Merge branch 'Dolibarr:15.0' into 15.0

This commit is contained in:
fboitel 2022-06-12 14:48:39 +02:00 committed by GitHub
commit 7cc9dbe5d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 119 additions and 20 deletions

View File

@ -540,7 +540,7 @@ if ($action == 'create') {
print '</td>';
print '</tr>';
// Date document creation
// Date document export
print '<tr>';
print '<td class="titlefield">'.$langs->trans("DateExport").'</td>';
print '<td>';
@ -548,7 +548,7 @@ if ($action == 'create') {
print '</td>';
print '</tr>';
// Date document creation
// Date document validation
print '<tr>';
print '<td class="titlefield">'.$langs->trans("DateValidation").'</td>';
print '<td>';
@ -607,6 +607,7 @@ if ($action == 'create') {
print '<br>';
$result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
@ -647,11 +648,14 @@ if ($action == 'create') {
print "</tr>\n";
// Empty line is the first line of $object->linesmvt
// So we must get the first line (the empty one) and put it at the end of the array
// in order to display it correctly to the user
$empty_line = array_shift($object->linesmvt);
$object->linesmvt[]= $empty_line;
// Add an empty line if there is not yet
if (!empty($object->linesmvt[0])) {
$tmpline = $object->linesmvt[0];
if (!empty($tmpline->numero_compte)) {
$line = new BookKeepingLine();
$object->linesmvt[] = $line;
}
}
foreach ($object->linesmvt as $line) {
print '<tr class="oddeven">';

View File

@ -597,9 +597,13 @@ class BookKeeping extends CommonObject
if (empty($this->credit)) {
$this->credit = 0;
}
if (empty($this->montant)) {
$this->montant = 0;
}
$this->debit = price2num($this->debit, 'MT');
$this->credit = price2num($this->credit, 'MT');
$this->montant = price2num($this->montant, 'MT');
$now = dol_now();
@ -1650,11 +1654,10 @@ class BookKeeping extends CommonObject
$this->doc_date = $this->db->jdate($obj->doc_date);
$this->doc_ref = $obj->doc_ref;
$this->doc_type = $obj->doc_type;
$this->date_creation = $obj->date_creation;
$this->date_modification = $obj->date_modification;
$this->date_export = $obj->date_export;
$this->date_validation = $obj->date_validated;
$this->date_validation = $obj->date_validation;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->date_export = $this->db->jdate($obj->date_export);
$this->date_validation = $this->db->jdate($obj->date_validation);
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__.$this->error, LOG_ERR);

View File

@ -99,7 +99,7 @@ $month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m");
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$pid = GETPOST("search_projectid", "int", 3) ?GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
$status = GETPOST("search_status", 'alpha') ?GETPOST("search_status", 'alpha') : GETPOST("status", 'alpha');
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
$type = GETPOST("search_type", 'alpha') ?GETPOST("search_type", 'alpha') : GETPOST("type", 'alpha');
$maxprint = ((GETPOST("maxprint", 'int') != '') ?GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -153,9 +153,10 @@ if ($end_d < $begin_d) {
$end_d = $begin_d + 1;
}
if ($status == '' && !GETPOSTISSET('status')) {
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
}
@ -512,7 +513,7 @@ print '<div class="liste_titre liste_titre_bydiv centpercent">';
if (empty($search_status)) {
$search_status = '';
}
print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print '</div>';

View File

@ -315,7 +315,7 @@ function dol_shutdown()
$depth = $db->transaction_opened;
$disconnectdone = $db->close();
}
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ?LOG_WARNING:LOG_INFO));
dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
}
/**

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

@ -135,7 +135,7 @@ class Productcustomerprice extends CommonObject
$this->price_base_type = trim($this->price_base_type);
}
if (isset($this->tva_tx)) {
$this->tva_tx = trim($this->tva_tx);
$this->tva_tx = (float) $this->tva_tx;
}
if (isset($this->recuperableonly)) {
$this->recuperableonly = trim($this->recuperableonly);
@ -621,7 +621,7 @@ class Productcustomerprice extends CommonObject
$this->price_base_type = trim($this->price_base_type);
}
if (isset($this->tva_tx)) {
$this->tva_tx = trim($this->tva_tx);
$this->tva_tx = (float) $this->tva_tx;
}
if (isset($this->recuperableonly)) {
$this->recuperableonly = trim($this->recuperableonly);

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

@ -915,8 +915,8 @@ class Societe extends CommonObject
$sql .= ", accountancy_code_sell";
}
$sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".((int) $this->entity).", '".$this->db->idate($now)."'";
$sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null");
$sql .= ", ".(!empty($user->id) ? ((int) $user->id) : "null");
$sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null");
$sql .= ", ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null");
$sql .= ", ".((int) $this->status);
$sql .= ", ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null");
@ -1078,7 +1078,7 @@ class Societe extends CommonObject
}
}
if (!empty($error)) {
if (empty($error)) {
dol_syslog(get_class($this)."::create_individual success");
$this->db->commit();
} else {