Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW_deposit_payment_terms

This commit is contained in:
Marc de Lima Lucio
2021-10-28 15:54:18 +02:00
858 changed files with 13581 additions and 21333 deletions

View File

@@ -1548,13 +1548,13 @@ if ($action == 'create' && $usercancreate) {
$deposit_percent = (!empty($objectsrc->deposit_percent) ? $objectsrc->deposit_percent : (!empty($soc->deposit_percent) ? $soc->deposit_percent : null));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0));
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0);
$shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0));
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
$demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : '';
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ? -1 : '';
$date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
if (empty($date_delivery)) {
@@ -1581,7 +1581,7 @@ if ($action == 'create' && $usercancreate) {
$deposit_percent = $soc->deposit_percent;
$mode_reglement_id = $soc->mode_reglement_id;
$fk_account = $soc->fk_account;
$availability_id = $soc->availability_id;
$availability_id = 0;
$shipping_method_id = $soc->shipping_method_id;
$warehouse_id = $soc->warehouse_id;
$demand_reason_id = $soc->demand_reason_id;
@@ -1701,13 +1701,19 @@ if ($action == 'create' && $usercancreate) {
print "</td>\n";
print '</tr>';
// Delivery delay
print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>';
print img_picto('', 'clock', 'class="pictofixedwidth"');
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
// Terms of the settlement
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'paiment');
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', $deposit_percent);
print '</td></tr>';
// Mode de reglement
// Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
print img_picto('', 'bank', 'class="pictofixedwidth"');
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
@@ -1720,12 +1726,6 @@ if ($action == 'create' && $usercancreate) {
print '</td></tr>';
}
// Delivery delay
print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>';
print img_picto('', 'clock', 'class="pictofixedwidth"');
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
// Shipping Method
if (!empty($conf->expedition->enabled)) {
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
@@ -1792,7 +1792,7 @@ if ($action == 'create' && $usercancreate) {
}
};
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
// Template to use by default
@@ -2307,7 +2307,7 @@ if ($action == 'create' && $usercancreate) {
print '</form>';
} else {
print $object->date ? dol_print_date($object->date, 'day') : '&nbsp;';
if ($object->hasDelay()) {
if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
@@ -2335,6 +2335,18 @@ if ($action == 'create' && $usercancreate) {
print '</td>';
print '</tr>';
// Delivery delay
print '<tr class="fielddeliverydelay"><td>';
$editenable = $usercancreate;
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
print '</td><td class="valuefield">';
if ($action == 'editavailability') {
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1);
} else {
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1);
}
print '</td></tr>';
// Shipping Method
if (!empty($conf->expedition->enabled)) {
print '<tr><td>';
@@ -2368,6 +2380,18 @@ if ($action == 'create' && $usercancreate) {
print '</tr>';
}
// Source reason (why we have an order)
print '<tr><td>';
$editenable = $usercancreate;
print $form->editfieldkey("Source", 'demandreason', '', $object, $editenable);
print '</td><td class="valuefield">';
if ($action == 'editdemandreason') {
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
} else {
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none');
}
print '</td></tr>';
// Terms of payment
print '<tr><td>';
$editenable = $usercancreate;
@@ -2433,30 +2457,6 @@ if ($action == 'create' && $usercancreate) {
}
}
// Delivery delay
print '<tr class="fielddeliverydelay"><td>';
$editenable = $usercancreate;
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
print '</td><td class="valuefield">';
if ($action == 'editavailability') {
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1);
} else {
$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1);
}
print '</td></tr>';
// Source reason (why we have an ordrer)
print '<tr><td>';
$editenable = $usercancreate;
print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable);
print '</td><td class="valuefield">';
if ($action == 'editdemandreason') {
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
} else {
$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none');
}
print '</td></tr>';
// TODO Order mode (how we receive order). Not yet implemented
/*
print '<tr><td>';
@@ -2526,7 +2526,6 @@ if ($action == 'create' && $usercancreate) {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
@@ -2583,7 +2582,6 @@ if ($action == 'create' && $usercancreate) {
}
print '</div>';
print '</div>';
print '</div>'; // Close fichecenter
@@ -2822,14 +2820,14 @@ if ($action == 'create' && $usercancreate) {
print showOnlinePaymentUrl('order', $object->ref).'<br>';
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'order', $socid, 1);
print '</div></div></div>';
print '</div></div>';
}
// Presend form