|
@@ -387,7 +387,7 @@ if (empty($reshook)) {
|
|
|
$date_end = $lines[$i]->date_end;
|
|
|
}
|
|
|
|
|
|
- // Reset fk_parent_line for no child products and special product
|
|
|
+ // Reset fk_parent_line for no child products and special product
|
|
|
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
|
|
|
$fk_parent_line = 0;
|
|
|
}
|
|
@@ -755,7 +755,7 @@ if (empty($reshook)) {
|
|
|
// Clean parameters
|
|
|
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
|
|
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
|
|
- $price_base_type = (GETPOST('price_base_type', 'alpha') ?GETPOST('price_base_type', 'alpha') : 'HT');
|
|
|
+ $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
|
|
|
|
|
|
$price_min = $price_min_ttc = 0;
|
|
|
|
|
@@ -1575,7 +1575,7 @@ if (empty($reshook)) {
|
|
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
|
|
|
|
|
// Actions to build doc
|
|
|
- $upload_dir = !empty($conf->commande->multidir_output[$object->entity])?$conf->commande->multidir_output[$object->entity]:$conf->commande->dir_output;
|
|
|
+ $upload_dir = !empty($conf->commande->multidir_output[$object->entity]) ? $conf->commande->multidir_output[$object->entity] : $conf->commande->dir_output;
|
|
|
$permissiontoadd = $usercancreate;
|
|
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
|
|
|
|
@@ -1763,7 +1763,7 @@ if ($action == 'create' && $usercancreate) {
|
|
|
$demand_reason_id = $soc->demand_reason_id;
|
|
|
//$remise_percent = $soc->remise_percent;
|
|
|
//$remise_absolue = 0;
|
|
|
- $dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ?-1 : '';
|
|
|
+ $dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : '';
|
|
|
|
|
|
if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) {
|
|
|
$currency_code = $soc->multicurrency_code;
|
|
@@ -1872,7 +1872,7 @@ if ($action == 'create' && $usercancreate) {
|
|
|
// Contacts (ask contact only if thirdparty already defined).
|
|
|
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
|
|
print img_picto('', 'contact', 'class="pictofixedwidth"');
|
|
|
- print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, !empty($srccontactslist)?$srccontactslist:"", '', 1, 'maxwidth200 widthcentpercentminusx');
|
|
|
+ print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, !empty($srccontactslist) ? $srccontactslist : "", '', 1, 'maxwidth200 widthcentpercentminusx');
|
|
|
print '</td></tr>';
|
|
|
|
|
|
// Ligne info remises tiers
|
|
@@ -1941,14 +1941,14 @@ if ($action == 'create' && $usercancreate) {
|
|
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
|
|
$formproduct = new FormProduct($db);
|
|
|
print '<tr><td>'.$langs->trans('Warehouse').'</td><td>';
|
|
|
- print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET('warehouse_id')?GETPOST('warehouse_id'):$warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx');
|
|
|
+ print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET('warehouse_id') ? GETPOST('warehouse_id') : $warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx');
|
|
|
print '</td></tr>';
|
|
|
}
|
|
|
|
|
|
// Source / Channel - What trigger creation
|
|
|
print '<tr><td>'.$langs->trans('Channel').'</td><td>';
|
|
|
print img_picto('', 'question', 'class="pictofixedwidth"');
|
|
|
- $form->selectInputReason((GETPOSTISSET('demand_reason_id')?GETPOST('demand_reason_id'):$demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
|
|
+ $form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOST('demand_reason_id') : $demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx');
|
|
|
print '</td></tr>';
|
|
|
|
|
|
// TODO How record was recorded OrderMode (llx_c_input_method)
|
|
@@ -1958,7 +1958,7 @@ if ($action == 'create' && $usercancreate) {
|
|
|
$langs->load("projects");
|
|
|
print '<tr>';
|
|
|
print '<td>'.$langs->trans("Project").'</td><td>';
|
|
|
- print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid')?GETPOST('projectid'):$projectid), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
|
|
+ print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid') ? GETPOST('projectid') : $projectid), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
|
|
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
|
|
print '</td>';
|
|
|
print '</tr>';
|
|
@@ -2018,7 +2018,7 @@ if ($action == 'create' && $usercancreate) {
|
|
|
print '<tr>';
|
|
|
print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
|
|
|
print '<td class="maxwidthonsmartphone">';
|
|
|
- print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany'))?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
|
|
|
+ print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany')) ? GETPOST('multicurrency_code') : $currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
|
|
|
print '</td></tr>';
|
|
|
}
|
|
|
|
|
@@ -2192,7 +2192,7 @@ if ($action == 'create' && $usercancreate) {
|
|
|
// 'text' => $langs->trans("ConfirmClone"),
|
|
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
|
|
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
|
|
- array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse', 'int') ?GETPOST('idwarehouse', 'int') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
|
|
+ array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse', 'int') ? GETPOST('idwarehouse', 'int') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -2200,14 +2200,16 @@ if ($action == 'create' && $usercancreate) {
|
|
|
$nbMandated = 0;
|
|
|
foreach ($object->lines as $line) {
|
|
|
$res = $line->fetch_product();
|
|
|
- if ($res > 0 ) {
|
|
|
- if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) {
|
|
|
+ if ($res > 0) {
|
|
|
+ if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) {
|
|
|
$nbMandated++;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
|
|
|
+ if ($nbMandated > 0) {
|
|
|
+ $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
|
|
|
+ }
|
|
|
|
|
|
if (getDolGlobalInt('SALE_ORDER_SUGGEST_DOWN_PAYMENT_INVOICE_CREATION')) {
|
|
|
// This is a hidden option:
|
|
@@ -2346,7 +2348,7 @@ if ($action == 'create' && $usercancreate) {
|
|
|
// 'text' => $langs->trans("ConfirmClone"),
|
|
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
|
|
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
|
|
- array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
|
|
+ array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -2385,7 +2387,7 @@ if ($action == 'create' && $usercancreate) {
|
|
|
// 'text' => $langs->trans("ConfirmClone"),
|
|
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
|
|
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
|
|
- array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
|
|
+ array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -2876,9 +2878,12 @@ if ($action == 'create' && $usercancreate) {
|
|
|
$parameters = array();
|
|
|
// Note that $action and $object may be modified by hook
|
|
|
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action);
|
|
|
- if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
- if (empty($reshook))
|
|
|
+ if ($reshook < 0) {
|
|
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
+ }
|
|
|
+ if (empty($reshook)) {
|
|
|
$object->formAddObjectLine(1, $mysoc, $soc);
|
|
|
+ }
|
|
|
} else {
|
|
|
$parameters = array();
|
|
|
$reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action);
|
|
@@ -2976,9 +2981,9 @@ if ($action == 'create' && $usercancreate) {
|
|
|
$arrayforbutaction[] = array('lang'=>'sendings', 'enabled'=>(isModEnabled("expedition") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), 'perm'=>$user->hasRight('expedition', 'creer'), 'label'=>'CreateShipment', 'url'=>'/expedition/shipment.php?id='.$object->id);
|
|
|
/*
|
|
|
if ($user->hasRight('expedition', 'creer')) {
|
|
|
- print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, '');
|
|
|
+ print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, '');
|
|
|
} else {
|
|
|
- print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
|
|
+ print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
|
|
}*/
|
|
|
} else {
|
|
|
$langs->load("errors");
|