Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 15.0

This commit is contained in:
Laurent Destailleur 2022-06-13 13:32:27 +02:00
commit d48477ab05
27 changed files with 118 additions and 6 deletions

View File

@ -612,6 +612,9 @@ class pdf_einstein extends ModelePDFCommandes
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -836,6 +836,9 @@ class pdf_eratosthene extends ModelePDFCommandes
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == $pageposafter) {

View File

@ -433,6 +433,9 @@ class pdf_strato extends ModelePDFContract
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {

View File

@ -575,6 +575,9 @@ class pdf_storm extends ModelePDFDeliveryOrder
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -499,6 +499,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -708,6 +708,9 @@ class pdf_espadon extends ModelePdfExpedition
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -614,6 +614,9 @@ class pdf_rouget extends ModelePdfExpedition
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -478,6 +478,9 @@ class pdf_standard extends ModeleExpenseReport
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -796,6 +796,9 @@ class pdf_crabe extends ModelePDFFactures
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -930,6 +930,9 @@ class pdf_sponge extends ModelePDFFactures
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {

View File

@ -419,6 +419,9 @@ class pdf_soleil extends ModelePDFFicheinter
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -706,6 +706,9 @@ class pdf_standard extends ModelePDFMovement
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -471,6 +471,9 @@ class pdf_baleine extends ModelePDFProjects
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -736,6 +736,9 @@ class pdf_beluga extends ModelePDFProjects
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
}

View File

@ -474,6 +474,9 @@ class pdf_timespent extends ModelePDFProjects
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -727,6 +727,9 @@ class pdf_azur extends ModelePDFPropales
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -851,6 +851,9 @@ class pdf_cyan extends ModelePDFPropales
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {

View File

@ -538,6 +538,9 @@ class pdf_squille extends ModelePdfReception
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -484,6 +484,9 @@ class pdf_standard extends ModelePDFStock
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -778,6 +778,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == $pageposafter) {

View File

@ -660,6 +660,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -447,6 +447,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -660,6 +660,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {

View File

@ -751,6 +751,9 @@ class pdf_standard_myobject extends ModelePDFMyObject
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {

View File

@ -620,6 +620,22 @@ if ($search_array_options) {
foreach ($search_array_options as $key => $val) {
$crit = $val;
$tmpkey = preg_replace('/search_options_/', '', $key);
if (is_array($val) && array_key_exists('start', $val) && array_key_exists('end', $val)) {
// date range from list filters is stored as array('start' => <timestamp>, 'end' => <timestamp>)
// start date
$param .= '&search_options_'.$tmpkey.'_startyear='.dol_print_date($val['start'], '%Y');
$param .= '&search_options_'.$tmpkey.'_startmonth='.dol_print_date($val['start'], '%m');
$param .= '&search_options_'.$tmpkey.'_startday='.dol_print_date($val['start'], '%d');
$param .= '&search_options_'.$tmpkey.'_starthour='.dol_print_date($val['start'], '%H');
$param .= '&search_options_'.$tmpkey.'_startmin='.dol_print_date($val['start'], '%M');
// end date
$param .= '&search_options_'.$tmpkey.'_endyear='.dol_print_date($val['end'], '%Y');
$param .= '&search_options_'.$tmpkey.'_endmonth='.dol_print_date($val['end'], '%m');
$param .= '&search_options_'.$tmpkey.'_endday='.dol_print_date($val['end'], '%d');
$param .= '&search_options_'.$tmpkey.'_endhour='.dol_print_date($val['end'], '%H');
$param .= '&search_options_'.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
$val = '';
}
if ($val != '') {
$param .= '&search_options_'.$tmpkey.'='.urlencode($val);
}

View File

@ -678,6 +678,9 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {

View File

@ -1139,6 +1139,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->country = $tmparray['label'];
}
$object->forme_juridique_code = GETPOST('forme_juridique_code');
// We set multicurrency_code if enabled
if (!empty($conf->multicurrency->enabled)) {
$object->multicurrency_code = GETPOST('multicurrency_code') ? GETPOST('multicurrency_code') : $conf->currency;
}
/* Show create form */
$linkback = "";
@ -1605,8 +1610,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Capital
print '<tr><td>'.$form->editfieldkey('Capital', 'capital', '', $object, 0).'</td>';
print '<td colspan="3"><input type="text" name="capital" id="capital" class="maxwidth100" value="'.$object->capital.'"> ';
print '<span class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
if (!empty($conf->multicurrency->enabled)) {
print '<span class="hideonsmartphone">'.$langs->trans("Currency".$object->multicurrency_code).'</span></td></tr>';
} else {
print '<span class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
@ -1656,7 +1664,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr>';
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1);
print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1);
print '</td></tr>';
}
@ -1854,6 +1862,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->country_code = $tmparray['code'];
$object->country = $tmparray['label'];
}
// We set multicurrency_code if enabled
if (!empty($conf->multicurrency->enabled)) {
$object->multicurrency_code = GETPOST('multicurrency_code') ? GETPOST('multicurrency_code') : $object->multicurrency_code;
}
}
if ($object->localtax1_assuj == 0) {
@ -2285,7 +2298,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$form->editfieldkey('Capital', 'capital', '', $object, 0).'</td>';
print '<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="';
print $object->capital != '' ? dol_escape_htmltag(price($object->capital)) : '';
print '"> <span class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
if (!empty($conf->multicurrency->enabled)) {
print '"> <span class="hideonsmartphone">'.$langs->trans("Currency".$object->multicurrency_code).'</span></td></tr>';
} else {
print '"> <span class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
}
// Default language
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -2340,7 +2357,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr>';
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1);
print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1);
print '</td></tr>';
}
@ -2763,7 +2780,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Capital
print '<tr><td>'.$langs->trans('Capital').'</td><td>';
if ($object->capital) {
print price($object->capital, '', $langs, 0, -1, -1, $conf->currency);
if (!empty($conf->multicurrency->enabled) && !empty($object->multicurrency_code)) {
print price($object->capital, '', $langs, 0, -1, -1, $object->multicurrency_code);
} else {
print price($object->capital, '', $langs, 0, -1, -1, $conf->currency);
}
} else {
print '&nbsp;';
}