Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0
This commit is contained in:
commit
deb110d556
@ -1309,6 +1309,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
dol_include_once('/multicurrency/class/multicurrency.class.php');
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
|
||||
$error = 0;
|
||||
@ -1384,6 +1385,29 @@ class Commande extends CommonOrder
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
if (!empty($object->multicurrency_code)) {
|
||||
$this->multicurrency_code = $object->multicurrency_code;
|
||||
}
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($object->multicurrency_tx)) {
|
||||
$this->multicurrency_tx = $object->multicurrency_tx;
|
||||
}
|
||||
|
||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) {
|
||||
$tmparray = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date_commande);
|
||||
$this->fk_multicurrency = $tmparray[0];
|
||||
$this->multicurrency_tx = $tmparray[1];
|
||||
} else {
|
||||
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||
}
|
||||
if (empty($this->fk_multicurrency)) {
|
||||
$this->multicurrency_code = $conf->currency;
|
||||
$this->fk_multicurrency = 0;
|
||||
$this->multicurrency_tx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// get extrafields from original line
|
||||
$object->fetch_optionals();
|
||||
|
||||
|
||||
@ -2986,8 +2986,8 @@ if ($action == 'create') {
|
||||
$remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$currency_code = (!empty($expesrc->currency_code) ? $expesrc->currency_code : (!empty($soc->currency_code) ? $soc->currency_code : $objectsrc->multicurrency_code));
|
||||
$currency_tx = (!empty($expesrc->currency_tx) ? $expesrc->currency_tx : (!empty($soc->currency_tx) ? $soc->currency_tx : $objectsrc->currency_tx));
|
||||
$currency_code = (!empty($expesrc->multicurrency_code) ? $expesrc->multicurrency_code : (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : $objectsrc->multicurrency_code));
|
||||
$currency_tx = (!empty($expesrc->multicurrency_tx) ? $expesrc->multicurrency_tx : (!empty($soc->multicurrency_tx) ? $soc->multicurrency_tx : $objectsrc->multicurrency_tx));
|
||||
}
|
||||
|
||||
//Replicate extrafields
|
||||
@ -4610,16 +4610,16 @@ if ($action == 'create') {
|
||||
if ($displayWarranty) {
|
||||
// Retained Warranty
|
||||
print '<tr class="retained-warranty-lines" ><td>';
|
||||
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print '<table id="retained-warranty-table" class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans('RetainedWarranty');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarranty' && $user->rights->facture->creer) {
|
||||
if ($action != 'editretainedwarranty' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarranty&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'</a></td>';
|
||||
}
|
||||
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editretainedwarranty') {
|
||||
if ($action == 'editretainedwarranty' && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarranty">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -4636,7 +4636,7 @@ if ($action == 'create') {
|
||||
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShortRetainedWarranty');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer) {
|
||||
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantypaymentterms&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'</a></td>';
|
||||
}
|
||||
|
||||
@ -4647,7 +4647,7 @@ if ($action == 'create') {
|
||||
$defaultDate = $object->date;
|
||||
}
|
||||
|
||||
if ($action == 'editretainedwarrantypaymentterms') {
|
||||
if ($action == 'editretainedwarrantypaymentterms' && $object->statut == Facture::STATUS_DRAFT) {
|
||||
//date('Y-m-d',$object->date_lim_reglement)
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
|
||||
@ -4671,7 +4671,7 @@ if ($action == 'create') {
|
||||
print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RetainedWarrantyDateLimit');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer) {
|
||||
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) {
|
||||
print '<td align="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editretainedwarrantydatelimit&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).'</a></td>';
|
||||
}
|
||||
|
||||
@ -4682,7 +4682,7 @@ if ($action == 'create') {
|
||||
$defaultDate = $object->date;
|
||||
}
|
||||
|
||||
if ($action == 'editretainedwarrantydatelimit') {
|
||||
if ($action == 'editretainedwarrantydatelimit' && $object->statut == Facture::STATUS_DRAFT) {
|
||||
//date('Y-m-d',$object->date_lim_reglement)
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarrantydatelimit">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user