diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5635df3c8e7..5f3def1d3ee 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1857,7 +1857,7 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a77e242379f..cb7e512bc36 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -121,7 +121,7 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights-> $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -$usercancreateintervention = $user->rights->ficheinter->creer; +$usercancreateintervention = empty($conf->ficheinter->enabled) ? 0 : $user->rights->ficheinter->creer; $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3ed5ede556c..3e5ec08a0f3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2525,7 +2525,7 @@ if ($action == 'create' && $usercancreate) { } // Create intervention - if ($conf->ficheinter->enabled) { + if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php index 2da54d84e7a..f4efce23797 100644 --- a/htdocs/core/boxes/box_graph_nb_tickets_type.php +++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php @@ -131,7 +131,7 @@ class box_graph_nb_tickets_type extends ModeleBoxes } foreach ($listofoppcode as $rowid => $code) { $dataseries[] = array( - 'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_category', 'code', 'label', $code), + 'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_type', 'code', 'label', $code), 'data' => (empty($data[$code]) ? 0 : $data[$code]) ); } diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index 13cd0c40c86..a7fa571b6c7 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -152,7 +152,7 @@ class box_graph_ticket_by_severity extends ModeleBoxes } foreach ($listofoppcode as $rowid => $code) { $dataseries[] = array( - 'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_category', 'code', 'label', $code), + 'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_severity', 'code', 'label', $code), 'data' => (empty($data[$code]) ? 0 : $data[$code]) ); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 02421ea9157..8df70054d11 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6760,7 +6760,7 @@ abstract class CommonObject $out .= ''; } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); - $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, $morecss, 0, '100%'); } elseif ($type == 'radio') { $out = ''; foreach ($param['options'] as $keyopt => $val) { @@ -7503,14 +7503,16 @@ abstract class CommonObject if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility $datenotinstring = $this->db->jdate($datenotinstring); } - $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(12, 0, 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring; + $datekey = $keyprefix.'options_'.$key.$keysuffix; + $value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; } if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) { $datenotinstring = $this->array_options['options_'.$key]; if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility $datenotinstring = $this->db->jdate($datenotinstring); } - $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."sec", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3), 'tzuserrel') : $datenotinstring; + $timekey = $keyprefix.'options_'.$key.$keysuffix; + $value = (GETPOSTISSET($timekey)) ? dol_mktime(GETPOST($timekey.'hour', 'int', 3), GETPOST($timekey.'min', 'int', 3), GETPOST($timekey.'sec', 'int', 3), GETPOST($timekey.'month', 'int', 3), GETPOST($timekey.'day', 'int', 3), GETPOST($timekey.'year', 'int', 3), 'tzuserrel') : $datenotinstring; } // Convert float submited string into real php numeric (value in memory must be a php numeric) if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double'))) { @@ -7518,7 +7520,7 @@ abstract class CommonObject } // HTML, text, select, integer and varchar: take into account default value in database if in create mode - if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int'))) { + if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int', 'boolean'))) { if ($action == 'create') { $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? $value : $extrafields->attributes[$this->table_element]['default'][$key]; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e891904e39e..19fa4cd5c63 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2154,7 +2154,7 @@ function dol_bc($var, $moreclass = '') */ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0, $extralangcode = '') { - global $conf, $langs; + global $conf, $langs, $hookmanager; $ret = ''; $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS @@ -2220,6 +2220,14 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $langs->load("dict"); $ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code))); } + if ($hookmanager) { + $parameters = array('withcountry' => $withcountry, 'sep' => $sep, 'outputlangs' => $outputlangs,'mode' => $mode, 'extralangcode' => $extralangcode); + $reshook = $hookmanager->executeHooks('formatAddress', $parameters, $object); + if ($reshook > 0) { + $ret = ''; + } + $ret .= $hookmanager->resPrint; + } return $ret; } diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index 3d4e88872ef..41679c19a1c 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -423,7 +423,7 @@ class modRecruitment extends DolibarrModules $sql = array(); // Document template - $moduledir = 'mymodule'; + $moduledir = 'recruitment'; $myTmpObjects = array(); $myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration'=>1, 'includedocgeneration'=>1); @@ -431,10 +431,10 @@ class modRecruitment extends DolibarrModules if ($myTmpObjectKey == 'MyObject') { continue; } - if ($myTmpObjectArray['includerefgeneration']) { - $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule'; - $dest = $dirodt.'/template_myobjects.odt'; + if ($myTmpObjectArray['includedocgeneration']) { + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_recruitmentjobposition.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; + $dest = $dirodt.'/template_recruitmentjobposition.odt'; if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -450,8 +450,6 @@ class modRecruitment extends DolibarrModules $sql = array_merge($sql, array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")", - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")" )); } } diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 38344a5f486..d81a01bea92 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -523,9 +523,9 @@ class pdf_squille extends ModelePdfReception while ($pagenb < $pageposafter) { $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object); } $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; @@ -534,9 +534,9 @@ class pdf_squille extends ModelePdfReception } if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object); } $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page @@ -550,10 +550,10 @@ class pdf_squille extends ModelePdfReception // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -719,9 +719,10 @@ class pdf_squille extends ModelePdfReception * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param Object|NULL $object Object reception to generate * @return void */ - protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $object = null) { global $conf; @@ -767,7 +768,18 @@ class pdf_squille extends ModelePdfReception $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqtytoship, $tab_top + 1); - $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToReceive"), '', 'C'); + $statusreceived = Reception::STATUS_CLOSED; + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) { + $statusreceived = Reception::STATUS_VALIDATED; + } + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { + $statusreceived = Reception::STATUS_CLOSED; + } + if ($object && $object->statut < $statusreceived) { + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyToReceive'), '', 'C'); + } else { + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyReceived'), '', 'C'); + } } if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) { diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 260bff00016..0dd1c4c2d4d 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -166,7 +166,7 @@ if ($action == 'add') { // on récupère les enregistrements $object->fetch($id); - + $res = $object->fetch_lines(); // on transfert les données de l'un vers l'autre if ($object->socid > 0) { $newinter->socid = $object->socid; @@ -178,6 +178,7 @@ if ($action == 'add') { $newinter->entity = $object->entity; $newinter->duree = $object->duree; + $newinter->datei = $object->date; $newinter->description = $object->description; $newinter->note_private = $object->note_private; @@ -194,7 +195,7 @@ if ($action == 'add') { if ($newfichinterid > 0) { // Now we add line of details foreach ($object->lines as $line) { - $newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, ''); + $newinter->addline($user, $newfichinterid, $line->desc, $line->datei, $line->duree, ''); } // on update le nombre d'inter crée à partir du modèle @@ -743,7 +744,7 @@ if ($action == 'create') { print '
'; print ''; - print $langs->trans("CreateFichInter").'
'; + print $langs->trans("AddIntervention").''; } if ($user->rights->ficheinter->supprimer) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 92b628b9aab..000b654bf72 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1347,7 +1347,6 @@ class Fichinter extends CommonObject $line->fetch_optionals(); $this->lines[$i] = $line; - $i++; } $this->db->free($resql); diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 4fe35c32a2c..ed43bae8377 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -349,7 +349,7 @@ class FichinterRec extends Fichinter { // phpcs:enable $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, '; - $sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, '; + $sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, l.date, '; $sql .= ' l.total_ht, l.total_tva, l.total_ttc,'; $sql .= ' l.rang, l.special_code,'; $sql .= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,'; @@ -366,7 +366,6 @@ class FichinterRec extends Fichinter while ($i < $num) { $objp = $this->db->fetch_object($result); $line = new FichinterLigne($this->db); - $line->id = $objp->rowid; $line->label = $objp->custom_label; // Label line $line->desc = $objp->description; // Description line @@ -386,8 +385,6 @@ class FichinterRec extends Fichinter $line->fk_product = $objp->fk_product; $line->date_start = $objp->date_start; $line->date_end = $objp->date_end; - $line->date_start = $objp->date_start; - $line->date_end = $objp->date_end; $line->info_bits = $objp->info_bits; $line->total_ht = $objp->total_ht; $line->total_tva = $objp->total_tva; diff --git a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php index 84bfd30401c..089aa720fa7 100644 --- a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php +++ b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php @@ -51,7 +51,7 @@ abstract class ModelePDFRecruitmentCandidature extends CommonDocGenerator // phpcs:enable global $conf; - $type = 'recruitmentjobposition'; + $type = 'recruitmentjobcandidature'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index ab2c2794e38..9c1a7c709b7 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1047,7 +1047,7 @@ if ($action == 'create' || $action == 'presend') { print ''; // Timing (Duration sum of linked fichinter) - if ($conf->ficheinter->enabled) { + if (!empty($conf->ficheinter->enabled)) { $object->fetchObjectLinked(); $num = count($object->linkedObjects); $timing = 0;