From abc3209f518af7e528c5b6cc253d2c9a2c66cb18 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 9 Dec 2022 16:31:43 +0100 Subject: [PATCH 001/572] NEW mode view for list of Societe --- htdocs/societe/class/societe.class.php | 29 ++ htdocs/societe/list.php | 696 +++++++++++++------------ 2 files changed, 388 insertions(+), 337 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1fb149ba250..3d918f423af 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5087,4 +5087,33 @@ class Societe extends CommonObject return 1; } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'code_client')) { + $return .= '
'.$this->code_client.''; + } + + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 6da7fcf3779..5f9abeb743b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -461,7 +461,6 @@ if ($resql) { } else { dol_print_error($db); } - $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.address, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,"; $sql .= " s.entity,"; $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; @@ -479,7 +478,7 @@ if ($search_sale && $search_sale != '-1') { $sql .= ", sc.fk_soc, sc.fk_user"; } // Add fields from extrafields -if (!empty($extrafields->attributes[$object->table_element]['label'])) { +if (empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } @@ -493,9 +492,10 @@ $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid"; -if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)"; +if (empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."extrafields as ef on (s.rowid = ef.fk_object)"; } + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)"; @@ -504,7 +504,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; // We'll need this table joined to the select in order to filter by sale if ($search_sale == -2) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; //elseif ($search_sale || (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } elseif (!empty($search_sale) && $search_sale != '-1' || (empty($user->rights->societe->client->voir) && !$socid)) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -783,6 +783,9 @@ $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -969,7 +972,10 @@ if ($contextpage != 'poslist') { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer); } elseif ($user->rights->societe->creer) { $url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place); $label = 'MenuNewCustomer'; @@ -986,6 +992,7 @@ print ''; print ''; //print ''; print ''; +print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1476,349 +1483,364 @@ while ($i < min($num, $limit)) { $companystatic->entity = $obj->entity; } - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } - // Action column (Show the massaction button only when this page is not opend from the Extended POS) - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; + // Output Kanban + print $companystatic->getKanbanView(''); + //print_r($obj->nb_rights); + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.rowid']['checked'])) { - print ''; - print $obj->rowid; - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.nom']['checked'])) { - print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">'; + } else { + print 'name); - } else { - print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.urlencode($place).'\'"'; } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - print dol_escape_htmltag($companystatic->name_alias); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Barcode - if (!empty($arrayfields['s.barcode']['checked'])) { - print ''.dol_escape_htmltag($companystatic->barcode).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Customer code - if (!empty($arrayfields['s.code_client']['checked'])) { - print ''.dol_escape_htmltag($companystatic->code_client).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Supplier code - if (!empty($arrayfields['s.code_fournisseur']['checked'])) { - print ''.dol_escape_htmltag($companystatic->code_fournisseur).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Account customer code - if (!empty($arrayfields['s.code_compta']['checked'])) { - print ''.dol_escape_htmltag($companystatic->code_compta_client).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Account supplier code - if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { - print ''.dol_escape_htmltag($companystatic->code_compta_fournisseur).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Address - if (!empty($arrayfields['s.address']['checked'])) { - print ''.dol_escape_htmltag($companystatic->address).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Zip - if (!empty($arrayfields['s.zip']['checked'])) { - print "".dol_escape_htmltag($companystatic->zip)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Town - if (!empty($arrayfields['s.town']['checked'])) { - print ''.dol_escape_htmltag($companystatic->town)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // State - if (!empty($arrayfields['state.nom']['checked'])) { - print "".dol_escape_htmltag($obj->state_name)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Region - if (!empty($arrayfields['region.nom']['checked'])) { - print "".dol_escape_htmltag($obj->region_name)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Country - if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; - $labelcountry = ($companystatic->country_code && ($langs->trans("Country".$companystatic->country_code) != "Country".$companystatic->country_code)) ? $langs->trans("Country".$companystatic->country_code) : $obj->country_label; - print $labelcountry; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type ent - if (!empty($arrayfields['typent.code']['checked'])) { - if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { - $typenArray = $formcompany->typent_array(1); - } - $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code]; + print '>'; - print ''; - print dol_escape_htmltag($labeltypeofcompany); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Multiprice level - if (!empty($arrayfields['s.price_level']['checked'])) { - print ''.$obj->price_level."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Staff - if (!empty($arrayfields['staff.code']['checked'])) { - print ''; - if (!is_array($staffArray) || count($staffArray) == 0) { - $staffArray = $formcompany->effectif_array(1); - } - print $staffArray[$obj->staff_code]; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.email']['checked'])) { - print ''.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.phone']['checked'])) { - print ''.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.fax']['checked'])) { - print ''.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.url']['checked'])) { - print "".dol_print_url($obj->url, '', '', 1)."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.siren']['checked'])) { - print "".$obj->idprof1."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.siret']['checked'])) { - print "".$obj->idprof2."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.ape']['checked'])) { - print "".$obj->idprof3."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.idprof4']['checked'])) { - print "".$obj->idprof4."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.idprof5']['checked'])) { - print "".$obj->idprof5."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.idprof6']['checked'])) { - print "".$obj->idprof6."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // VAT - if (!empty($arrayfields['s.tva_intra']['checked'])) { - print ''; - if ($companystatic->tva_intra && !isValidVATID($companystatic)) { - print img_warning("BadVATNumber", '', 'pictofixedwidth'); - } - print $companystatic->tva_intra; - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Type - if (!empty($arrayfields['customerorsupplier']['checked'])) { - print ''; - print $companystatic->getTypeUrl(1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { - // Prospect level - print ''; - print $companystatic->getLibProspLevel(); - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - - if (!empty($arrayfields['s.fk_stcomm']['checked'])) { - // Prospect status - print '
'; - print '
'; - print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); - print '
-
'; - foreach ($prospectstatic->cacheprospectstatus as $key => $val) { - $titlealt = 'default'; - if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) { - $titlealt = $val['label']; + // Action column (Show the massaction button only when this page is not opend from the Extended POS) + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - if ($obj->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print '
'; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Parent company - if (!empty($arrayfields['s2.nom']['checked'])) { - print ''; - if ($companystatic->fk_parent > 0) { - $companyparent->fetch($companystatic->fk_parent); - print $companyparent->getNomUrl(1); - } - print ""; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['s.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['s.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['s.status']['checked'])) { - print ''.$companystatic->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Import key - if (!empty($arrayfields['s.import_key']['checked'])) { - print ''; - print dol_escape_htmltag($obj->import_key); - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column (Show the massaction button only when this page is not opend from the Extended POS) - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + if (!empty($arrayfields['s.rowid']['checked'])) { + print ''; + print $obj->rowid; + print "\n"; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['s.nom']['checked'])) { + print 'global->MAIN_SOCIETE_SHOW_COMPLETE_NAME) ? ' class="tdoverflowmax200"' : '').' data-key="ref">'; + if ($contextpage == 'poslist') { + print dol_escape_htmltag($companystatic->name); + } else { + print $companystatic->getNomUrl(1, '', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } } - } + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + print dol_escape_htmltag($companystatic->name_alias); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Barcode + if (!empty($arrayfields['s.barcode']['checked'])) { + print ''.dol_escape_htmltag($companystatic->barcode).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Customer code + if (!empty($arrayfields['s.code_client']['checked'])) { + print ''.dol_escape_htmltag($companystatic->code_client).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Supplier code + if (!empty($arrayfields['s.code_fournisseur']['checked'])) { + print ''.dol_escape_htmltag($companystatic->code_fournisseur).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Account customer code + if (!empty($arrayfields['s.code_compta']['checked'])) { + print ''.dol_escape_htmltag($companystatic->code_compta_client).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Account supplier code + if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { + print ''.dol_escape_htmltag($companystatic->code_compta_fournisseur).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Address + if (!empty($arrayfields['s.address']['checked'])) { + print ''.dol_escape_htmltag($companystatic->address).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Zip + if (!empty($arrayfields['s.zip']['checked'])) { + print "".dol_escape_htmltag($companystatic->zip)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Town + if (!empty($arrayfields['s.town']['checked'])) { + print ''.dol_escape_htmltag($companystatic->town)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // State + if (!empty($arrayfields['state.nom']['checked'])) { + print "".dol_escape_htmltag($obj->state_name)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Region + if (!empty($arrayfields['region.nom']['checked'])) { + print "".dol_escape_htmltag($obj->region_name)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Country + if (!empty($arrayfields['country.code_iso']['checked'])) { + print ''; + $labelcountry = ($companystatic->country_code && ($langs->trans("Country".$companystatic->country_code) != "Country".$companystatic->country_code)) ? $langs->trans("Country".$companystatic->country_code) : $obj->country_label; + print $labelcountry; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type ent + if (!empty($arrayfields['typent.code']['checked'])) { + if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) { + $typenArray = $formcompany->typent_array(1); + } + $labeltypeofcompany= empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code]; - print ''."\n"; + print ''; + print dol_escape_htmltag($labeltypeofcompany); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Multiprice level + if (!empty($arrayfields['s.price_level']['checked'])) { + print ''.$obj->price_level."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Staff + if (!empty($arrayfields['staff.code']['checked'])) { + print ''; + if (!is_array($staffArray) || count($staffArray) == 0) { + $staffArray = $formcompany->effectif_array(1); + } + print $staffArray[$obj->staff_code]; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.email']['checked'])) { + print ''.dol_print_email($obj->email, $obj->rowid, $obj->rowid, 'AC_EMAIL', 0, 0, 1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.phone']['checked'])) { + print ''.dol_print_phone($obj->phone, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.fax']['checked'])) { + print ''.dol_print_phone($obj->fax, $companystatic->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'fax')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.url']['checked'])) { + print "".dol_print_url($obj->url, '', '', 1)."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.siren']['checked'])) { + print "".$obj->idprof1."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.siret']['checked'])) { + print "".$obj->idprof2."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.ape']['checked'])) { + print "".$obj->idprof3."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.idprof4']['checked'])) { + print "".$obj->idprof4."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.idprof5']['checked'])) { + print "".$obj->idprof5."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['s.idprof6']['checked'])) { + print "".$obj->idprof6."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // VAT + if (!empty($arrayfields['s.tva_intra']['checked'])) { + print ''; + if ($companystatic->tva_intra && !isValidVATID($companystatic)) { + print img_warning("BadVATNumber", '', 'pictofixedwidth'); + } + print $companystatic->tva_intra; + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Type + if (!empty($arrayfields['customerorsupplier']['checked'])) { + print ''; + print $companystatic->getTypeUrl(1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { + // Prospect level + print ''; + print $companystatic->getLibProspLevel(); + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + + if (!empty($arrayfields['s.fk_stcomm']['checked'])) { + // Prospect status + print '
'; + print '
'; + print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); + print '
-
'; + foreach ($prospectstatic->cacheprospectstatus as $key => $val) { + $titlealt = 'default'; + if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) { + $titlealt = $val['label']; + } + if ($obj->stcomm_id != $val['id']) { + print ''.img_action($titlealt, $val['code'], $val['picto']).''; + } + } + print '
'; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Parent company + if (!empty($arrayfields['s2.nom']['checked'])) { + print ''; + if ($companystatic->fk_parent > 0) { + $companyparent->fetch($companystatic->fk_parent); + print $companyparent->getNomUrl(1); + } + print ""; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['s.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['s.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['s.status']['checked'])) { + print ''.$companystatic->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Import key + if (!empty($arrayfields['s.import_key']['checked'])) { + print ''; + print dol_escape_htmltag($obj->import_key); + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column (Show the massaction button only when this page is not opend from the Extended POS) + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + print ''."\n"; + } $i++; } From 1c9a5547068a3826494300cc537efb1c1cec4035 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 21 Dec 2022 13:28:39 +0100 Subject: [PATCH 002/572] New mode view for projects --- htdocs/projet/class/project.class.php | 35 ++ htdocs/projet/list.php | 851 +++++++++++++------------- 2 files changed, 475 insertions(+), 411 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 9c8b4ebee26..33bedb3d56c 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2313,4 +2313,39 @@ class Project extends CommonObject $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode); } + + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs,$db,$user; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + //$return .= ''; // Can be image + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'date_start_event')) { + $return .= '
'.$langs->trans("DateStart").''; + $return .= ' : '.dol_print_date($db->jdate($this->date_start_event), 'day').''; + } + if (property_exists($this, 'user_author_id')) { + $return .= '
'.$langs->trans("Author").''; + $return .= ' : '.$user->getNomUrl(1).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b31666245d4..b208a64d08f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -55,6 +55,8 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projectlist'; +$mode = GETPOST('mode', 'alpha'); + $title = $langs->trans("Projects"); @@ -698,6 +700,9 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -881,6 +886,10 @@ if (!empty($socid)) { if ($search_usage_event_organization == 1) { $url .= '&usage_organize_event=1'; } + +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton = dolGetButtonTitle($langs->trans('NewProject'), '', 'fa fa-plus-circle', $url, '', $user->rights->projet->creer); print '
'; @@ -893,6 +902,8 @@ print ''; print ''; print ''; print ''; +print ''; + // Show description of content $texthelp = ''; @@ -1333,443 +1344,461 @@ while ($i < $imaxinloop) { $companystatic->town = $obj->town; $companystatic->country_code = $obj->country_code; - print ''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + $object->date_start_event = $obj->date_start; - // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->id, $arrayofselected)) { - $selected = 1; + $userstatic->id = $obj->fk_user_creat; + $object->user_author_id = $userstatic->id; + //var_dump($object->user_author_id);exit; + print $object->getKanbanView(''); + + if ($i == min($num, $limit)-1) { + print '
'; + print ''; + } + } else { + print ''; + + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Project url + if (!empty($arrayfields['p.ref']['checked'])) { + print ''; + print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':'')); + if ($object->hasDelay()) { + print img_warning($langs->trans('Late')); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Project url - if (!empty($arrayfields['p.ref']['checked'])) { - print ''; - print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':'')); - if ($object->hasDelay()) { - print img_warning($langs->trans('Late')); + // Title + if (!empty($arrayfields['p.title']['checked'])) { + print ''; + print $obj->title; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Company + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if ($obj->socid) { + print $companystatic->getNomUrl(1, '', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Title - if (!empty($arrayfields['p.title']['checked'])) { - print ''; - print $obj->title; - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Alias + if (!empty($arrayfields['s.name_alias']['checked'])) { + print ''; + if ($obj->socid) { + print $companystatic->name_alias; + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Company - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if ($obj->socid) { - print $companystatic->getNomUrl(1, '', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); - } else { - print ' '; + // Sales Representatives + if (!empty($arrayfields['commercial']['checked'])) { + print ''; + if ($obj->socid) { + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $userstatic = new User($db); + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + + // Date start project + if (!empty($arrayfields['p.dateo']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_start), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Alias - if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; - if ($obj->socid) { - print $companystatic->name_alias; - } else { - print ' '; + // Date end project + if (!empty($arrayfields['p.datee']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_end), 'day'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + + // Visibility + if (!empty($arrayfields['p.public']['checked'])) { + print ''; + if ($obj->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + //print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + //print $langs->trans('PrivateProject'); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Sales Representatives - if (!empty($arrayfields['commercial']['checked'])) { - print ''; - if ($obj->socid) { - $companystatic->id = $obj->socid; - $companystatic->name = $obj->name; - $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); - $nbofsalesrepresentative = count($listsalesrepresentatives); - if ($nbofsalesrepresentative > 6) { - // We print only number - print $nbofsalesrepresentative; - } elseif ($nbofsalesrepresentative > 0) { - $userstatic = new User($db); - $j = 0; - foreach ($listsalesrepresentatives as $val) { - $userstatic->id = $val['id']; - $userstatic->lastname = $val['lastname']; - $userstatic->firstname = $val['firstname']; - $userstatic->email = $val['email']; - $userstatic->statut = $val['statut']; - $userstatic->entity = $val['entity']; - $userstatic->photo = $val['photo']; - $userstatic->login = $val['login']; - $userstatic->office_phone = $val['office_phone']; - $userstatic->office_fax = $val['office_fax']; - $userstatic->user_mobile = $val['user_mobile']; - $userstatic->job = $val['job']; - $userstatic->gender = $val['gender']; - print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); - $j++; - if ($j < $nbofsalesrepresentative) { - print ' '; + // Contacts of project + if (!empty($arrayfields['c.assigned']['checked'])) { + print ''; + $ifisrt = 1; + foreach (array('internal', 'external') as $source) { + $tab = $object->liste_contact(-1, $source, 0, '', 1); + $numcontact = count($tab); + if (!empty($numcontact)) { + foreach ($tab as $contactproject) { + //var_dump($contacttask); + if ($source == 'internal') { + $c = new User($db); + } else { + $c = new Contact($db); + } + $c->fetch($contactproject['id']); + if (!empty($c->photo)) { + if (get_class($c) == 'User') { + print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst')); + } else { + print $c->getNomUrl(-2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst')); + } + } else { + if (get_class($c) == 'User') { + print $c->getNomUrl(2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst')); + } else { + print $c->getNomUrl(2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst')); + } + } + $ifisrt = 0; } } } - //else print $langs->trans("NoSalesRepresentativeAffected"); - } else { - print ' '; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Opp Status + if (!empty($arrayfields['p.fk_opp_status']['checked'])) { + print ''; + if ($obj->opp_status_code) { + print $langs->trans("OppStatus".$obj->opp_status_code); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } + // Opp Amount + if (!empty($arrayfields['p.opp_amount']['checked'])) { + print ''; + //if ($obj->opp_status_code) + if (strcmp($obj->opp_amount, '')) { + print ''.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').''; + $totalarray['val']['p.opp_amount'] += $obj->opp_amount; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount'; + } + } + // Opp percent + if (!empty($arrayfields['p.opp_percent']['checked'])) { + print ''; + if ($obj->opp_percent) { + print price($obj->opp_percent, 1, $langs, 1, 0).'%'; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Opp weighted amount + if (!empty($arrayfields['opp_weighted_amount']['checked'])) { + if (!isset($totalarray['val']['opp_weighted_amount'])) { + $totalarray['val']['opp_weighted_amount'] = 0; + } + print ''; + if ($obj->opp_weighted_amount) { + print ''.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').''; + $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount'; + } + } + // Budget + if (!empty($arrayfields['p.budget_amount']['checked'])) { + print ''; + if ($obj->budget_amount != '') { + print ''.price($obj->budget_amount, 1, $langs, 1, -1, -1).''; + $totalarray['val']['p.budget_amount'] += $obj->budget_amount; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount'; + } + } + // Usage opportunity + if (!empty($arrayfields['p.usage_opportunity']['checked'])) { + print ''; + if ($obj->usage_opportunity) { + print yn($obj->usage_opportunity); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Usage task + if (!empty($arrayfields['p.usage_task']['checked'])) { + print ''; + if ($obj->usage_task) { + print yn($obj->usage_task); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Bill time + if (!empty($arrayfields['p.usage_bill_time']['checked'])) { + print ''; + if ($obj->usage_bill_time) { + print yn($obj->usage_bill_time); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Event Organization + if (!empty($arrayfields['p.usage_organize_event']['checked'])) { + print ''; + if ($obj->usage_organize_event) { + print yn($obj->usage_organize_event); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Allow unknown people to suggest conferences + if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) { + print ''; + if ($obj->accept_conference_suggestions) { + print yn($obj->accept_conference_suggestions); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Allow unknown people to suggest booth + if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) { + print ''; + if ($obj->accept_booth_suggestions) { + print yn($obj->accept_booth_suggestions); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Price of registration + if (!empty($arrayfields['p.price_registration']['checked'])) { + print ''; + if ($obj->price_registration != '') { + print ''.price($obj->price_registration, 1, $langs, 1, -1, -1).''; + $totalarray['val']['p.price_registration'] += $obj->price_registration; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.price_registration'; + } + } + // Price of booth + if (!empty($arrayfields['p.price_booth']['checked'])) { + print ''; + if ($obj->price_booth != '') { + print ''.price($obj->price_booth, 1, $langs, 1, -1, -1).''; + $totalarray['val']['p.price_booth'] += $obj->price_booth; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth'; + } + } + // Author + $userstatic->id = $obj->fk_user_creat; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; - // Date start project - if (!empty($arrayfields['p.dateo']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_start), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); + } else { + print ' '; + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Date end project - if (!empty($arrayfields['p.datee']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_end), 'day'); - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['p.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - - // Visibility - if (!empty($arrayfields['p.public']['checked'])) { - print ''; - if ($obj->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - //print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - //print $langs->trans('PrivateProject'); + // Date modification + if (!empty($arrayfields['p.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Email MsgID + if (!empty($arrayfields['p.email_msgid']['checked'])) { + print ''; + print $obj->email_msgid; + print ''; + if (!$i) $totalarray['nbfield']++; } - } - // Contacts of project - if (!empty($arrayfields['c.assigned']['checked'])) { - print ''; - $ifisrt = 1; - foreach (array('internal', 'external') as $source) { - $tab = $object->liste_contact(-1, $source, 0, '', 1); - $numcontact = count($tab); - if (!empty($numcontact)) { - foreach ($tab as $contactproject) { - //var_dump($contacttask); - if ($source == 'internal') { - $c = new User($db); - } else { - $c = new Contact($db); - } - $c->fetch($contactproject['id']); - if (!empty($c->photo)) { - if (get_class($c) == 'User') { - print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst')); - } else { - print $c->getNomUrl(-2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst')); - } - } else { - if (get_class($c) == 'User') { - print $c->getNomUrl(2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst')); - } else { - print $c->getNomUrl(2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst')); - } - } - $ifisrt = 0; + // Import key + if (!empty($arrayfields['p.import_key']['checked'])) { + print ''.dol_escape_htmltag($obj->import_key).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Status + if (!empty($arrayfields['p.fk_statut']['checked'])) { + print ''.$object->getLibStatut(5).''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->id, $arrayofselected)) { + $selected = 1; } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Opp Status - if (!empty($arrayfields['p.fk_opp_status']['checked'])) { - print ''; - if ($obj->opp_status_code) { - print $langs->trans("OppStatus".$obj->opp_status_code); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Opp Amount - if (!empty($arrayfields['p.opp_amount']['checked'])) { - print ''; - //if ($obj->opp_status_code) - if (strcmp($obj->opp_amount, '')) { - print ''.price($obj->opp_amount, 1, $langs, 1, -1, -1, '').''; - $totalarray['val']['p.opp_amount'] += $obj->opp_amount; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.opp_amount'; - } - } - // Opp percent - if (!empty($arrayfields['p.opp_percent']['checked'])) { - print ''; - if ($obj->opp_percent) { - print price($obj->opp_percent, 1, $langs, 1, 0).'%'; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Opp weighted amount - if (!empty($arrayfields['opp_weighted_amount']['checked'])) { - if (!isset($totalarray['val']['opp_weighted_amount'])) { - $totalarray['val']['opp_weighted_amount'] = 0; - } - print ''; - if ($obj->opp_weighted_amount) { - print ''.price($obj->opp_weighted_amount, 1, $langs, 1, -1, -1, '').''; - $totalarray['val']['opp_weighted_amount'] += $obj->opp_weighted_amount; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount'; - } - } - // Budget - if (!empty($arrayfields['p.budget_amount']['checked'])) { - print ''; - if ($obj->budget_amount != '') { - print ''.price($obj->budget_amount, 1, $langs, 1, -1, -1).''; - $totalarray['val']['p.budget_amount'] += $obj->budget_amount; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount'; - } - } - // Usage opportunity - if (!empty($arrayfields['p.usage_opportunity']['checked'])) { - print ''; - if ($obj->usage_opportunity) { - print yn($obj->usage_opportunity); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Usage task - if (!empty($arrayfields['p.usage_task']['checked'])) { - print ''; - if ($obj->usage_task) { - print yn($obj->usage_task); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Bill time - if (!empty($arrayfields['p.usage_bill_time']['checked'])) { - print ''; - if ($obj->usage_bill_time) { - print yn($obj->usage_bill_time); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Event Organization - if (!empty($arrayfields['p.usage_organize_event']['checked'])) { - print ''; - if ($obj->usage_organize_event) { - print yn($obj->usage_organize_event); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Allow unknown people to suggest conferences - if (!empty($arrayfields['p.accept_conference_suggestions']['checked'])) { - print ''; - if ($obj->accept_conference_suggestions) { - print yn($obj->accept_conference_suggestions); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Allow unknown people to suggest booth - if (!empty($arrayfields['p.accept_booth_suggestions']['checked'])) { - print ''; - if ($obj->accept_booth_suggestions) { - print yn($obj->accept_booth_suggestions); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Price of registration - if (!empty($arrayfields['p.price_registration']['checked'])) { - print ''; - if ($obj->price_registration != '') { - print ''.price($obj->price_registration, 1, $langs, 1, -1, -1).''; - $totalarray['val']['p.price_registration'] += $obj->price_registration; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.price_registration'; - } - } - // Price of booth - if (!empty($arrayfields['p.price_booth']['checked'])) { - print ''; - if ($obj->price_booth != '') { - print ''.price($obj->price_booth, 1, $langs, 1, -1, -1).''; - $totalarray['val']['p.price_booth'] += $obj->price_booth; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth'; - } - } - // Author - $userstatic->id = $obj->fk_user_creat; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; - if (!empty($arrayfields['u.login']['checked'])) { - print ''; - if ($userstatic->id) { - print $userstatic->getNomUrl(-1); - } else { - print ' '; - } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; - } + print "\n"; } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['p.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date modification - if (!empty($arrayfields['p.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Email MsgID - if (!empty($arrayfields['p.email_msgid']['checked'])) { - print ''; - print $obj->email_msgid; - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Import key - if (!empty($arrayfields['p.import_key']['checked'])) { - print ''.dol_escape_htmltag($obj->import_key).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Status - if (!empty($arrayfields['p.fk_statut']['checked'])) { - print ''.$object->getLibStatut(5).''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - print "\n"; } $i++; From 411a769a59e45236a2e9fc2c721a14e3d66bb7e8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 22 Dec 2022 10:00:22 +0000 Subject: [PATCH 003/572] Fixing style errors. --- htdocs/societe/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 16f6d467e64..c3a8316dbbe 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -989,7 +989,6 @@ if ($contextpage != 'poslist') { $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer); } elseif ($user->rights->societe->creer) { - $url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place); $label = 'MenuNewCustomer'; $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url); From 3fdb445cf3a578383eb9d81656c6d6f54d10abfc Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 13 Jan 2023 14:20:19 +0100 Subject: [PATCH 004/572] modify style for checkbox --- htdocs/hrm/class/skill.class.php | 2 +- htdocs/theme/eldy/info-box.inc.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 5f58412b65a..592fd77ac45 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1130,7 +1130,7 @@ class Skill extends CommonObject $return .= ''; $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; - $return .= ''; + $return .= ''; if (property_exists($this, 'skill_type')) { $return .= '
'.$langs->trans("Type").''; $return .= ' : '.$this->fields['skill_type']['arrayofkeyval'][$this->skill_type].''; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index f35516ad58e..9c1f3b443ef 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -491,7 +491,10 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { min-width: 350px; max-width: 350px; } - +/**for make a checkbox in the right of the box in mode kanban */ +.fright { + float:right; +} @media only screen and (max-width: 1740px) { .info-box-module { min-width: 315px; From e4d2e1fec2221cafedc6e62d3abdf94fa463c4ae Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 16 Jan 2023 14:28:09 +0100 Subject: [PATCH 005/572] fix attribute class --- htdocs/hrm/class/skill.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 592fd77ac45..7e178204a3d 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1130,7 +1130,7 @@ class Skill extends CommonObject $return .= ''; $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; - $return .= ''; + $return .= ''; if (property_exists($this, 'skill_type')) { $return .= '
'.$langs->trans("Type").''; $return .= ' : '.$this->fields['skill_type']['arrayofkeyval'][$this->skill_type].''; From 5c3d35b415724cea6955bf8daea5a9e044d82670 Mon Sep 17 00:00:00 2001 From: lamrani abdelwadoud Date: Mon, 16 Jan 2023 15:48:29 +0100 Subject: [PATCH 006/572] Update list.php fix style --- htdocs/societe/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index c3a8316dbbe..9f808ec322e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -983,7 +983,6 @@ if ($contextpage != 'poslist') { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); From 340edf8b30da2f8510d0cce3679c3ddc7b6368b5 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 16 Jan 2023 16:41:49 +0100 Subject: [PATCH 007/572] fix error style --- htdocs/theme/eldy/info-box.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 9c1f3b443ef..99e8e5e2ca1 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -491,7 +491,6 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { min-width: 350px; max-width: 350px; } -/**for make a checkbox in the right of the box in mode kanban */ .fright { float:right; } From 06784bb02438ba6ff9f4b4af26fbd1524859d209 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 16 Jan 2023 16:45:02 +0100 Subject: [PATCH 008/572] fix error style --- htdocs/hrm/class/skill.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 7e178204a3d..6ef1cd621bd 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1130,7 +1130,7 @@ class Skill extends CommonObject $return .= ''; $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; - $return .= ''; + $return .= ''; if (property_exists($this, 'skill_type')) { $return .= '
'.$langs->trans("Type").''; $return .= ' : '.$this->fields['skill_type']['arrayofkeyval'][$this->skill_type].''; From 3d5682d0601043a70efa7c3efd143376d764a730 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 25 Jan 2023 12:02:25 +0100 Subject: [PATCH 009/572] fix error in sql request --- htdocs/societe/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5f9abeb743b..0f8ce9c55cc 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -478,7 +478,7 @@ if ($search_sale && $search_sale != '-1') { $sql .= ", sc.fk_soc, sc.fk_user"; } // Add fields from extrafields -if (empty($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } @@ -492,8 +492,8 @@ $sqlfields = $sql; // $sql fields to remove for count total $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid"; -if (empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."extrafields as ef on (s.rowid = ef.fk_object)"; +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (s.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; @@ -504,7 +504,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; // We'll need this table joined to the select in order to filter by sale if ($search_sale == -2) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; //elseif ($search_sale || (empty($user->rights->societe->client->voir) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->societe->client->readallthirdparties_advance)) && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } elseif (!empty($search_sale) && $search_sale != '-1' || (empty($user->rights->societe->client->voir) && !$socid)) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; From 2ec3f2165c0b11c8218591599458cb0bb9527289 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 25 Jan 2023 12:06:05 +0100 Subject: [PATCH 010/572] fix error in sql request --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index c7ca20724e6..d0a10d3fea5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -492,7 +492,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sqlfields = $sql; // $sql fields to remove for count total +$sqlfields = $sql; // $sql fields to remove for count totall $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s.parent = s2.rowid"; From f454cf513cc45368129e1c87d54078d7764c9a5e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 30 Jan 2023 10:17:12 +0100 Subject: [PATCH 011/572] add class to checkbox --- htdocs/hrm/class/skill.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 6ef1cd621bd..7e178204a3d 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -1130,7 +1130,7 @@ class Skill extends CommonObject $return .= ''; $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; - $return .= ''; + $return .= ''; if (property_exists($this, 'skill_type')) { $return .= '
'.$langs->trans("Type").''; $return .= ' : '.$this->fields['skill_type']['arrayofkeyval'][$this->skill_type].''; From 5b52dc9f0470d3ae64de8cc13ebb8ebdfb60350e Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 31 Jan 2023 10:43:58 +0100 Subject: [PATCH 012/572] Fix : stripe sepa payment process --- htdocs/core/class/commoninvoice.class.php | 137 +++------------------- htdocs/langs/en_US/bills.lang | 2 + htdocs/public/stripe/ipn.php | 101 +++++++++++++++- htdocs/stripe/class/stripe.class.php | 24 ++-- 4 files changed, 129 insertions(+), 135 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index d1eb324cc7f..0f38b39e0af 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -92,6 +92,10 @@ abstract class CommonInvoice extends CommonObject */ const STATUS_ABANDONED = 3; + /** + * Classified processing because payment requested + */ + const STATUS_PROCESSING = 4; public $totalpaid; // duplicate with sumpayed public $totaldeposits; // duplicate with sumdeposit @@ -610,6 +614,10 @@ abstract class CommonInvoice extends CommonObject $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially'); $statusType = 'status9'; + } elseif ($status == 4) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusRequestProcessing'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusRequestProcessing'); + $statusType = 'status3'; } elseif ($alreadypaid == 0) { $labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid'); @@ -900,9 +908,9 @@ abstract class CommonInvoice extends CommonObject $sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn"; $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; - $sql .= " AND fk_facture = ".((int) $this->fk_facture); // Add a protection to not pay another invoice than current one - $sql .= " AND traite = 0"; // Add a protection to not process twice $sql .= " WHERE rowid = ".((int) $did); + $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one + $sql .= " AND traite = 0"; // Add a protection to not process twice dol_syslog(get_class($this)."::makeStripeSepaRequest 1", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1186,126 +1194,11 @@ abstract class CommonInvoice extends CommonObject // Default description used for label of event. Will be overwrite by another value later. $description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; - - // @TODO LMR Save request to status pending instead of done. Done should be set with a webhook. - - - $db = $this->db; - - $ipaddress = getUserRemoteIP(); - - $TRANSACTIONID = $charge->id; - $currency = $conf->currency; - $paymentmethod = 'stripe'; - $emetteur_name = $charge->customer; - - // Same code than into paymentok.php... - - $paymentTypeId = 0; - if ($paymentmethod == 'paybox') { - $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS; - } - if ($paymentmethod == 'paypal') { - $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS; - } - if ($paymentmethod == 'stripe') { - $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; - } - if (empty($paymentTypeId)) { - //erics - if ($sepaMode) { - $paymentType = 'PRE'; - } else { - $paymentType = $_SESSION["paymentType"]; - if (empty($paymentType)) { - $paymentType = 'CB'; - } - } - $paymentTypeId = dol_getIdFromCode($this->db, $paymentType, 'c_paiement', 'code', 'id', 1); - } - - $currencyCodeType = $currency; - - $ispostactionok = 1; - - // Creation of payment line - // TODO LMR This must be move into the stripe server listening hooks public/stripe/ipn.php - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; - $paiement = new Paiement($this->db); - $paiement->datepaye = $now; - $paiement->date = $now; - if ($currencyCodeType == $conf->currency) { - $paiement->amounts = [$this->id => $amounttopay]; // Array with all payments dispatching with invoice id - } else { - $paiement->multicurrency_amounts = [$this->id => $amounttopay]; // Array with all payments dispatching - - $postactionmessages[] = 'Payment was done in a different currency than currency expected of company'; - $ispostactionok = -1; - // Not yet supported, so error + $result =$this->setStatut($this::STATUS_PROCESSING); + if ($result < 0) { $error++; $errorforinvoice++; - } - $paiement->paiementid = $paymentTypeId; - $paiement->num_paiement = ''; - $paiement->num_payment = ''; - // Add a comment with keyword 'SellYourSaas' in text. Used by trigger. - $paiement->note_public = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; - $paiement->note_private = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; - $paiement->ext_payment_id = $charge->id . ':' . $customer->id . '@' . $stripearrayofkeys['publishable_key']; - $paiement->ext_payment_site = 'stripe'; - - if (!$errorforinvoice) { - dol_syslog('* Record payment for invoice id ' . $this->id . '. It includes closing of invoice and regenerating document'); - - // This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document - $paiement_id = $paiement->create($user, 1); - if ($paiement_id < 0) { - $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); - $ispostactionok = -1; - $error++; - $errorforinvoice++; - } else { - $postactionmessages[] = 'Payment created'; - } - - dol_syslog("The payment has been created for invoice id " . $this->id); - } - - if (!$errorforinvoice && isModEnabled('banque')) { - dol_syslog('* Add payment to bank'); - - // The bank used is the one defined into Stripe setup - $bankaccountid = 0; - if ($paymentmethod == 'stripe') { - $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; - } - - if ($bankaccountid > 0) { - $label = '(CustomerInvoicePayment)'; - if ($this->type == Facture::TYPE_CREDIT_NOTE) { - $label = '(CustomerInvoicePaymentBack)'; - } // Refund of a credit note - $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $emetteur_name, ''); - if ($result < 0) { - $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); - $ispostactionok = -1; - $error++; - $errorforinvoice++; - } else { - $postactionmessages[] = 'Bank transaction of payment created (by makeStripeSepaRequest)'; - } - } else { - $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; - $ispostactionok = -1; - $error++; - $errorforinvoice++; - } - } - - if ($ispostactionok < 1) { - $description = 'Stripe payment OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') but post action KO from makeStripeSepaRequest: ' . $FULLTAG; - } else { - $description = 'Stripe payment+post action OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') from makeStripeSepaRequest: ' . $FULLTAG; + $this->errors[] = 'Error on invoice status change to processing'; } } @@ -1563,13 +1456,13 @@ abstract class CommonInvoice extends CommonObject $idtransferfile = 0; // Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon - $sql = "UPDATE".MAIN_DB_PREFIX."prelevement_demande SET"; + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET"; $sql .= " traite = 1,"; // TODO Remove this $sql .= " date_traite = '".$this->db->idate(dol_now())."'"; // TODO Remove this if ($idtransferfile > 0) { $sql .= " fk_prelevement_bons = ".((int) $idtransferfile); } - $sql .= "WHERE rowid = ".((int) $did); + $sql .= " WHERE rowid = ".((int) $did); dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 183620c72da..40adce33c66 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -148,6 +148,8 @@ BillShortStatusNotPaid=Not paid BillShortStatusNotRefunded=Not refunded BillShortStatusClosedUnpaid=Closed BillShortStatusClosedPaidPartially=Paid (partially) +BillStatusRequestProcessing=Payment request processing +BillShortStatusRequestProcessing=Processing PaymentStatusToValidShort=To validate ErrorVATIntraNotConfigured=Intra-Community VAT number not yet defined ErrorNoPaiementModeConfigured=No default payment type defined. Go to Invoice module setup to fix this. diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index dd5b1db148f..b41149a88f8 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -72,7 +72,9 @@ if (isset($_GET['connect'])) { $servicestatus = 1; } } - +$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; +$service = 'StripeTest'; +$servicestatus = 0; if (empty($conf->stripe->enabled)) { httponly_accessforbidden('Module Stripe not enabled'); } @@ -300,6 +302,103 @@ if ($event->type == 'payout.created') { } elseif ($event->type == 'payment_intent.succeeded') { // Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). // TODO: create fees // TODO: Redirect to paymentok.php + include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; + $object = $event->data->object; + $invoice_id = $object->metadata->dol_id; + $ipaddress = $object->metadata->ipaddress; + $invoice_amount = $object->amount / 100; + $TRANSACTIONID = $object->id; + $customer_id = $object->customer; + $errorforinvoice = 0; + $paymentmethod = 'stripe'; + $now = dol_now(); + $currencyCodeType = strtoupper($object->currency); + $paymentmethodstripeid = $object->payment_method; + + global $stripearrayofkeysbyenv; + $stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; + + dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard)); + + $s = new \Stripe\StripeClient($stripeacc); + + $paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid); + + //$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; + $paymentTypeId = $paymentmethodstripe->type; + if ($paymentTypeId == "sepa_debit") { + $paymentTypeId = "BANCON"; + } elseif ($paymentTypeId == "card") { + $paymentTypeId = "CB"; + } + + $paiement = new Paiement($db); + $paiement->datepaye = $now; + $paiement->date = $now; + if ($currencyCodeType == $conf->currency) { + $paiement->amounts = [$invoice_id => $invoice_amount]; // Array with all payments dispatching with invoice id + } else { + $paiement->multicurrency_amounts = [$invoice_id => $invoice_amount]; // Array with all payments dispatching + + $postactionmessages[] = 'Payment was done in a different currency than currency expected of company'; + $ispostactionok = -1; + // Not yet supported, so error + $error++; + $errorforinvoice++; + } + $paiement->paiementid = $paymentTypeId; + $paiement->num_paiement = ''; + $paiement->num_payment = ''; + // Add a comment with keyword 'SellYourSaas' in text. Used by trigger. + $paiement->note_public = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; + $paiement->note_private = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; + $paiement->ext_payment_id = $TRANSACTIONID . ':' . $customer_id . '@' . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']; + $paiement->ext_payment_site = 'stripe'; + + if (!$errorforinvoice) { + dol_syslog('* Record payment for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document'); + + // This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document + $paiement_id = $paiement->create($user, 1); + if ($paiement_id < 0) { + $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $postactionmessages[] = 'Payment created'; + } + + dol_syslog("The payment has been created for invoice id " . $invoice_id); + } + + if (!$errorforinvoice && isModEnabled('banque')) { + dol_syslog('* Add payment to bank'); + + // The bank used is the one defined into Stripe setup + $bankaccountid = 0; + if ($paymentmethod == 'stripe') { + $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; + } + + if ($bankaccountid > 0) { + $label = '(CustomerInvoicePayment)'; + $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, ''); + if ($result < 0) { + $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $postactionmessages[] = 'Bank transaction of payment created (by makeStripeSepaRequest)'; + } + } else { + $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } + } } elseif ($event->type == 'payment_intent.payment_failed') { // TODO: Redirect to paymentko.php } elseif ($event->type == 'checkout.session.completed') { // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index bc98a085d08..0684fb370b7 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -964,10 +964,9 @@ class Stripe extends CommonObject $dataforcard = array( 'type'=>'sepa_debit', "sepa_debit" => array('iban' => $iban), - 'currency' => strtolower($conf->currency), - 'usage' => 'reusable', - 'owner' => array( + 'billing_details' => array( 'name' => $soc->name, + 'email' => !empty($soc->email) ? $soc->email : "", ), "metadata" => array( 'dol_type'=>$object->element, @@ -979,19 +978,19 @@ class Stripe extends CommonObject ); // Complete owner name if (!empty($soc->town)) { - $dataforcard['owner']['address']['city']=$soc->town; + $dataforcard['billing_details']['address']['city']=$soc->town; } if (!empty($soc->country_code)) { - $dataforcard['owner']['address']['country']=$soc->country_code; + $dataforcard['billing_details']['address']['country']=$soc->country_code; } if (!empty($soc->address)) { - $dataforcard['owner']['address']['line1']=$soc->address; + $dataforcard['billing_details']['address']['line1']=$soc->address; } if (!empty($soc->zip)) { - $dataforcard['owner']['address']['postal_code']=$soc->zip; + $dataforcard['billing_details']['address']['postal_code']=$soc->zip; } if (!empty($soc->state)) { - $dataforcard['owner']['address']['state']=$soc->state; + $dataforcard['billing_details']['address']['state']=$soc->state; } //$a = \Stripe\Stripe::getApiKey(); @@ -1013,14 +1012,14 @@ class Stripe extends CommonObject $s = new \Stripe\StripeClient($stripeacc); - // TODO LMR Deprecated with the new Stripe API and SCA. - // TODO LMR Replace ->create() and ->createSource() and replace with ->getSetupIntent() to then, get the Payment mode with $payment_method = \Stripe\PaymentMethod::retrieve($setupintent->payment_method); ? - $sepa = $s->sources->create($dataforcard); + $sepa = $s->paymentMethods->create($dataforcard); if (!$sepa) { $this->error = 'Creation of sepa_debit on Stripe has failed'; } else { // link customer and src - $cs = $cu->createSource($cu->id, array('source' => $sepa->id)); + $cs = $s->setupIntents->create(['payment_method_types' => ['sepa_debit'], 'customer' => $cu->id]); + $cs = $s->setupIntents->update($cs->id, ['payment_method' => $sepa->id]); + $cs = $s->setupIntents->confirm($cs->id, ['mandate_data' => ['customer_acceptance' => ['type' => 'offline']]]); if (!$cs) { $this->error = 'Link SEPA <-> Customer failed'; } else { @@ -1040,6 +1039,7 @@ class Stripe extends CommonObject } } } catch (Exception $e) { + $sepa = null; $this->error = $e->getMessage(); dol_syslog($this->error, LOG_WARNING); } From 895957e89da1de1e296e3310acb93108d6939642 Mon Sep 17 00:00:00 2001 From: mgabriel Date: Thu, 2 Feb 2023 08:41:08 +0100 Subject: [PATCH 013/572] Modify margin rates in offers like VAT rates. --- htdocs/admin/propal.php | 13 ++++++++++ htdocs/comm/propal/card.php | 31 ++++++++++++++++++++++++ htdocs/core/tpl/objectline_title.tpl.php | 16 +++++++++--- htdocs/langs/en_US/margins.lang | 1 + htdocs/langs/fr_FR/margins.lang | 1 + 5 files changed, 59 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 10044e33b5b..289c514c703 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -615,6 +615,19 @@ print " \n"; print ""; +print ''; +print ''.$langs->trans("ModifyMarginRates").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PROPALE_MODIFY_MARGIN_RATES'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PROPALE_MODIFY_MARGIN_RATES", $arrval, $conf->global->PROPALE_MODIFY_MARGIN_RATES); +} +print "\n"; +print ''; +print "\n"; + print ""; print ''; print ""; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3f74c4a860f..c1912451cc8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -914,6 +914,37 @@ if (empty($reshook)) { foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } + } elseif (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines', 'none') !== '' && $usercancreate) { + // Define margin + $margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0); + foreach ($object->lines as &$line) { + $subprice = price2num($line->pa_ht * (1 + $margin_rate/100), 'MU'); + $prod = new Product($db); + $prod->fetch($line->fk_product); + if ($prod->price_min > $subprice) { + $price_subprice = price($subprice, 0, $outlangs, 1, -1, -1, 'auto'); + $price_price_min = price($prod->price_min, 0, $outlangs, 1, -1, -1, 'auto'); + setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings'); + } + // Manage $line->subprice and $line->multicurrency_subprice + $multicurrency_subprice = $subprice * $line->multicurrency_subprice / $line->subprice; + // Update DB + $result = $object->updateline($line->id, $subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_rate, $line->localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $multicurrency_subprice); + // Update $object with new margin info + $line->price = $subprice; + $line->marge_tx = $margin_rate; + $line->marque_tx = $margin_rate * $line->pa_ht / $subprice; + $line->total_ht = $line->qty * $subprice; + $line->total_tva = $line->tva_tx * $line->qty * $subprice; + $line->total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice; + // Manage $line->subprice and $line->multicurrency_subprice + $line->multicurrency_total_ht = $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; + $line->multicurrency_total_tva = $line->tva_tx * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; + $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; + // Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values + $line->subprice = $subprice; + $line->multicurrency_subprice = $multicurrency_subprice; + } } elseif ($action == 'addline' && $usercancreate) { // Add line // Set if we used free entry or predefined product $predef = ''; diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 4640d710705..991910865e4 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -140,9 +140,19 @@ if ($usemargins && isModEnabled('margin') && empty($user->socid)) { } } - if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { - print ''.$langs->trans('MarginRate').''; - } + if (!(empty($conf->global->DISPLAY_MARGIN_RATES) && empty($conf->global->PROPALE_MODIFY_MARGIN_RATES)) && $user->rights->margins->liretous) { + print ''.$langs->trans('MarginRate'); + if (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $user->hasRight("propal", "creer")) { + print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickmarginforalllines opacitymedium paddingleft cursorpointer"').''; + if (GETPOST('mode', 'aZ09') == 'marginforalllines') { + print '
'; + print ''; + print ''; + print '
'; + } + } + print ''; + } if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) { print ''.$langs->trans('MarkRate').''; } diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index a91b139ec7b..9101966eff2 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -6,6 +6,7 @@ TotalMargin=Total Margin MarginOnProducts=Margin / Products MarginOnServices=Margin / Services MarginRate=Margin rate +ModifyMarginRates=Modify margin rates MarkRate=Mark rate DisplayMarginRates=Display margin rates DisplayMarkRates=Display mark rates diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang index a8a68c6599f..742b8ce76c0 100644 --- a/htdocs/langs/fr_FR/margins.lang +++ b/htdocs/langs/fr_FR/margins.lang @@ -8,6 +8,7 @@ MarginOnServices=Marge / Services MarginRate=Taux de marge MarkRate=Taux de marque DisplayMarginRates=Afficher les taux de marge +ModifyMarginRates=Modifier les taux de marge DisplayMarkRates=Afficher les taux de marque InputPrice=Saisir un prix margin=Gestion des marges From 35ce7352e8ed9ec613ddaa8b4005ba0330c94405 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Feb 2023 08:09:57 +0000 Subject: [PATCH 014/572] Fixing style errors. --- htdocs/comm/propal/card.php | 62 ++++++++++++------------ htdocs/core/tpl/objectline_title.tpl.php | 26 +++++----- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c1912451cc8..88f3c1e44aa 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -914,37 +914,37 @@ if (empty($reshook)) { foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } - } elseif (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines', 'none') !== '' && $usercancreate) { - // Define margin - $margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0); - foreach ($object->lines as &$line) { - $subprice = price2num($line->pa_ht * (1 + $margin_rate/100), 'MU'); - $prod = new Product($db); - $prod->fetch($line->fk_product); - if ($prod->price_min > $subprice) { - $price_subprice = price($subprice, 0, $outlangs, 1, -1, -1, 'auto'); - $price_price_min = price($prod->price_min, 0, $outlangs, 1, -1, -1, 'auto'); - setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings'); - } - // Manage $line->subprice and $line->multicurrency_subprice - $multicurrency_subprice = $subprice * $line->multicurrency_subprice / $line->subprice; - // Update DB - $result = $object->updateline($line->id, $subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_rate, $line->localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $multicurrency_subprice); - // Update $object with new margin info - $line->price = $subprice; - $line->marge_tx = $margin_rate; - $line->marque_tx = $margin_rate * $line->pa_ht / $subprice; - $line->total_ht = $line->qty * $subprice; - $line->total_tva = $line->tva_tx * $line->qty * $subprice; - $line->total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice; - // Manage $line->subprice and $line->multicurrency_subprice - $line->multicurrency_total_ht = $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; - $line->multicurrency_total_tva = $line->tva_tx * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; - $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; - // Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values - $line->subprice = $subprice; - $line->multicurrency_subprice = $multicurrency_subprice; - } + } elseif (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines', 'none') !== '' && $usercancreate) { + // Define margin + $margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0); + foreach ($object->lines as &$line) { + $subprice = price2num($line->pa_ht * (1 + $margin_rate/100), 'MU'); + $prod = new Product($db); + $prod->fetch($line->fk_product); + if ($prod->price_min > $subprice) { + $price_subprice = price($subprice, 0, $outlangs, 1, -1, -1, 'auto'); + $price_price_min = price($prod->price_min, 0, $outlangs, 1, -1, -1, 'auto'); + setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings'); + } + // Manage $line->subprice and $line->multicurrency_subprice + $multicurrency_subprice = $subprice * $line->multicurrency_subprice / $line->subprice; + // Update DB + $result = $object->updateline($line->id, $subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_rate, $line->localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $multicurrency_subprice); + // Update $object with new margin info + $line->price = $subprice; + $line->marge_tx = $margin_rate; + $line->marque_tx = $margin_rate * $line->pa_ht / $subprice; + $line->total_ht = $line->qty * $subprice; + $line->total_tva = $line->tva_tx * $line->qty * $subprice; + $line->total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice; + // Manage $line->subprice and $line->multicurrency_subprice + $line->multicurrency_total_ht = $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; + $line->multicurrency_total_tva = $line->tva_tx * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; + $line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * $subprice * $line->multicurrency_subprice / $line->subprice; + // Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values + $line->subprice = $subprice; + $line->multicurrency_subprice = $multicurrency_subprice; + } } elseif ($action == 'addline' && $usercancreate) { // Add line // Set if we used free entry or predefined product $predef = ''; diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 991910865e4..e2882bcd43f 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -140,19 +140,19 @@ if ($usemargins && isModEnabled('margin') && empty($user->socid)) { } } - if (!(empty($conf->global->DISPLAY_MARGIN_RATES) && empty($conf->global->PROPALE_MODIFY_MARGIN_RATES)) && $user->rights->margins->liretous) { - print ''.$langs->trans('MarginRate'); - if (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $user->hasRight("propal", "creer")) { - print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickmarginforalllines opacitymedium paddingleft cursorpointer"').''; - if (GETPOST('mode', 'aZ09') == 'marginforalllines') { - print '
'; - print ''; - print ''; - print '
'; - } - } - print ''; - } + if (!(empty($conf->global->DISPLAY_MARGIN_RATES) && empty($conf->global->PROPALE_MODIFY_MARGIN_RATES)) && $user->rights->margins->liretous) { + print ''.$langs->trans('MarginRate'); + if (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $user->hasRight("propal", "creer")) { + print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickmarginforalllines opacitymedium paddingleft cursorpointer"').''; + if (GETPOST('mode', 'aZ09') == 'marginforalllines') { + print '
'; + print ''; + print ''; + print '
'; + } + } + print ''; + } if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) { print ''.$langs->trans('MarkRate').''; } From cd4064c0349138a86afd63f2432e3f0e8bb611c8 Mon Sep 17 00:00:00 2001 From: mgabriel Date: Thu, 2 Feb 2023 10:07:52 +0100 Subject: [PATCH 015/572] Dolibarr was using td here but is now using th so th was substituted for td. --- htdocs/core/tpl/objectline_title.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index e2882bcd43f..e00a34551a5 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -141,7 +141,7 @@ if ($usemargins && isModEnabled('margin') && empty($user->socid)) { } if (!(empty($conf->global->DISPLAY_MARGIN_RATES) && empty($conf->global->PROPALE_MODIFY_MARGIN_RATES)) && $user->rights->margins->liretous) { - print ''.$langs->trans('MarginRate'); + print ''.$langs->trans('MarginRate'); if (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $user->hasRight("propal", "creer")) { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickmarginforalllines opacitymedium paddingleft cursorpointer"').''; if (GETPOST('mode', 'aZ09') == 'marginforalllines') { @@ -151,7 +151,7 @@ if ($usemargins && isModEnabled('margin') && empty($user->socid)) { print '
'; } } - print ''; + print ''; } if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) { print ''.$langs->trans('MarkRate').''; From 99e5c894843a6084489228a26e9eb94c29a0979b Mon Sep 17 00:00:00 2001 From: mgabriel Date: Thu, 2 Feb 2023 10:20:02 +0100 Subject: [PATCH 016/572] In CodingPhpTest::testPHP, found a GETPOST that uses 'none' as a parameter which is not allowe. --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 88f3c1e44aa..d3310085f1f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -914,7 +914,7 @@ if (empty($reshook)) { foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } - } elseif (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines', 'none') !== '' && $usercancreate) { + } elseif (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines') !== '' && $usercancreate) { // Define margin $margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0); foreach ($object->lines as &$line) { From 463c87b393c9e5f96fd6e3c37caaf319a3bf77a2 Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 2 Feb 2023 13:30:32 +0100 Subject: [PATCH 017/572] first push flowjs-server.php --- htdocs/core/ajax/flowjs-server.php | 146 +++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 htdocs/core/ajax/flowjs-server.php diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php new file mode 100644 index 00000000000..6177b6fda35 --- /dev/null +++ b/htdocs/core/ajax/flowjs-server.php @@ -0,0 +1,146 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/ajax/bankconciliate.php + * \brief File to set data for bank concilation + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOREQUIRESOC')) { + define('NOREQUIRESOC', '1'); +} +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Required to know date format for dol_print_date + +// Load Dolibarr environment +require '../../main.inc.php'; + + +$action = GETPOST('action', 'aZ09'); +$module = GETPOST('module', 'aZ09'); +$flowFilename = GETPOST('flowFilename', 'alpha'); +$flowIdentifier = GETPOST('flowIdentifier', 'alpha'); +$flowChunkNumber = GETPOST('flowChunkNumber', 'alpha'); +$flowChunkSize = GETPOST('flowChunkSize', 'alpha'); +$flowTotalSize = GETPOST('flowTotalSize', 'alpha'); + +/* + * Action + */ + + +top_httphead(); +dol_syslog(join(',', $_GET)); + +if ($_SERVER['REQUEST_METHOD'] === 'GET' ) { + $temp_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'.$flowIdentifier; + $chunk_file = $temp_dir.'/'.$flowFilename.'.part'.$flowChunkNumber; + if (file_exists($chunk_file)) { + header("HTTP/1.0 200 Ok"); + } else { + header("HTTP/1.0 404 Not Found"); + } +} + + + +// loop through files and move the chunks to a temporarily created directory +if (!empty($_FILES)) foreach ($_FILES as $file) { + // check the error status + if ($file['error'] != 0) { + dol_syslog('error '.$file['error'].' in file '.$flowFilename); + continue; + } + + // init the destination file (format .part<#chunk> + // the file is stored in a temporary directory + $temp_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'.$flowIdentifier; + $dest_file = $temp_dir.'/'.$flowFilename.'.part'.$flowChunkNumber; + + // create the temporary directory + if (!dol_is_dir($temp_dir)) { + dol_mkdir($temp_dir, '', 0777); + } + + // move the temporary file + if (!move_uploaded_file($file['tmp_name'], $dest_file)) { + dol_syslog('Error saving (move_uploaded_file) chunk '.$flowChunkNumber.' for file '.$flowFilename); + } else { + // check if all the parts present, and create the final destination file + createFileFromChunks($temp_dir, $flowFilename, $flowChunkSize, $flowTotalSize); + } +} + + +/** + * Check if all the parts exist, and + * gather all the parts of the file together + * @param string $temp_dir - the temporary directory holding all the parts of the file + * @param string $fileName - the original file name + * @param string $chunkSize - each chunk size (in bytes) + * @param string $totalSize - original file size (in bytes) + * @return bool true if Ok false else + */ +function createFileFromChunks($temp_dir, $fileName, $chunkSize, $totalSize) +{ + + dol_syslog(__METHOD__, LOG_DEBUG); + // count all the parts of this file + $total_files = 0; + $files = dol_dir_list($temp_dir, 'files'); + foreach ($files as $file) { + if (stripos($file, $fileName) !== false) { + $total_files++; + } + } + + // check that all the parts are present + // the size of the last part is between chunkSize and 2*$chunkSize + if ($total_files * $chunkSize >= ($totalSize - $chunkSize + 1)) { + // create the final destination file + if (($fp = fopen($temp_dir.$fileName, 'w')) !== false) { + for ($i=1; $i<=$total_files; $i++) { + fwrite($fp, file_get_contents($temp_dir.'/'.$fileName.'.part'.$i)); + dol_syslog('writing chunk '.$i); + } + fclose($fp); + } else { + dol_syslog('cannot create the destination file'); + return false; + } + + /*// rename the temporary directory (to avoid access from other + // concurrent chunks uploads) and than delete it + if (rename($temp_dir, $temp_dir.'_UNUSED')) { + rrmdir($temp_dir.'_UNUSED'); + } else { + rrmdir($temp_dir); + }*/ + } + return true; +} From a254462bc9e360b047c2d3b44f510cdc207f64ac Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 2 Feb 2023 17:58:54 +0100 Subject: [PATCH 018/572] FIX : Sub-BOM's services prices were not good --- htdocs/bom/tpl/objectline_view.tpl.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index ac277f6e880..6208abcbf6d 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -172,7 +172,8 @@ print ''; $coldisplay++; if (!empty($line->fk_bom_child)) { echo ''.price($tmpbom->total_cost * $line->qty).''; -} else { +} +else { echo ''.price($line->total_cost).''; } print ''; @@ -301,6 +302,16 @@ if ($resql) { $sub_bom->calculateCosts(); print ''.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; + } elseif($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { + //Convert qty to hour + $unit = measuringUnitString($sub_bom_line->fk_unit, '', '', 1); + $qty = convertDurationtoHour($sub_bom_line->qty, $unit); + $workstation = new Workstation($this->db); + $res = $workstation->fetch($sub_bom_product->fk_default_workstation); + if ($res > 0) $sub_bom_line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); + + print ''.price(price2num($sub_bom_line->total_cost, 'MT')).''; + $this->total_cost += $line->total_cost; } elseif ($sub_bom_product->cost_price > 0) { print ''.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; From a07916858f7740dd6260ec2242fb15839bdf4ad7 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 2 Feb 2023 21:36:41 +0100 Subject: [PATCH 019/572] fix whitepage if modCategorie is not enabled --- htdocs/projet/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 32192114a4c..1113cf06b9e 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -152,7 +152,9 @@ $search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); $search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); $search_date_end_endday = GETPOST('search_date_end_endday', 'int'); $search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver -$search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array"); +if (isModEnabled('categorie')) { + $search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array"); +} if ($search_status == '') { $search_status = -1; // -1 or 1 From 2e7371eee649798adbab3d73dcbb54773ba73bde Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 6 Feb 2023 08:45:44 +0100 Subject: [PATCH 020/572] Fix #23795 --- htdocs/comm/propal/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index eb8ac018979..c702cf66434 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -132,7 +132,6 @@ $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown // Security check if (!empty($user->socid)) { $socid = $user->socid; - $object->id = $user->socid; } restrictedArea($user, 'propal', $object->id); From b8cd507287008ac7e9bdf4bda5969dff203b1930 Mon Sep 17 00:00:00 2001 From: mgabriel Date: Mon, 6 Feb 2023 10:06:23 +0100 Subject: [PATCH 021/572] As suggested by Dolibarr, removed PROPALE_MODIFY_MARGIN_RATES as not needed. --- htdocs/admin/propal.php | 13 ------------- htdocs/comm/propal/card.php | 2 +- htdocs/core/tpl/objectline_title.tpl.php | 4 ++-- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 289c514c703..10044e33b5b 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -615,19 +615,6 @@ print " \n"; print ""; -print ''; -print ''.$langs->trans("ModifyMarginRates").''; -print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('PROPALE_MODIFY_MARGIN_RATES'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("PROPALE_MODIFY_MARGIN_RATES", $arrval, $conf->global->PROPALE_MODIFY_MARGIN_RATES); -} -print "\n"; -print ''; -print "\n"; - print ""; print ''; print ""; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d3310085f1f..f1e191b323d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -914,7 +914,7 @@ if (empty($reshook)) { foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } - } elseif (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines') !== '' && $usercancreate) { + } elseif ($action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines') !== '' && $usercancreate) { // Define margin $margin_rate = (GETPOST('marginforalllines') ? GETPOST('marginforalllines') : 0); foreach ($object->lines as &$line) { diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index e00a34551a5..24231d3fe68 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -140,9 +140,9 @@ if ($usemargins && isModEnabled('margin') && empty($user->socid)) { } } - if (!(empty($conf->global->DISPLAY_MARGIN_RATES) && empty($conf->global->PROPALE_MODIFY_MARGIN_RATES)) && $user->rights->margins->liretous) { + if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { print ''.$langs->trans('MarginRate'); - if (!empty($conf->global->PROPALE_MODIFY_MARGIN_RATES) && $user->hasRight("propal", "creer")) { + if ($user->hasRight("propal", "creer")) { print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickmarginforalllines opacitymedium paddingleft cursorpointer"').''; if (GETPOST('mode', 'aZ09') == 'marginforalllines') { print '
'; From 72fc4c1d0b4fa78d5f0afe9129d0062b97a13e20 Mon Sep 17 00:00:00 2001 From: hystepik Date: Mon, 6 Feb 2023 12:24:19 +0100 Subject: [PATCH 022/572] add nologin --- htdocs/core/ajax/flowjs-server.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index 6177b6fda35..0f536a52acc 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -35,6 +35,10 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } +// If there is no need to load and show top and left menu +if (!defined("NOLOGIN")) { + define("NOLOGIN", '1'); +} //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Required to know date format for dol_print_date // Load Dolibarr environment From 1e53f87d518070479e71b0236d65e5d21320b7f9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 8 Feb 2023 12:18:46 +0100 Subject: [PATCH 023/572] FIX: various PHP8 compatibility fixes --- htdocs/admin/agenda.php | 2 +- htdocs/admin/agenda_extsites.php | 2 +- htdocs/admin/agenda_other.php | 4 +-- htdocs/admin/agenda_xcal.php | 33 ++++++++++++++----- htdocs/admin/dav.php | 6 +++- htdocs/admin/facture.php | 8 +++-- htdocs/admin/payment.php | 6 ++-- .../core/class/commondocgenerator.class.php | 10 ++++++ .../modules/facture/mod_facture_mercure.php | 23 ++++++------- .../core/modules/payment/mod_payment_ant.php | 6 ++-- .../doc/doc_generic_proposal_odt.modules.php | 19 ++++++----- ..._generic_supplier_proposal_odt.modules.php | 19 ++++++----- .../mod_supplier_proposal_saphir.php | 8 +++-- .../user/doc/doc_generic_user_odt.modules.php | 17 ++++++---- .../doc/doc_generic_usergroup_odt.modules.php | 17 ++++++---- htdocs/dav/dav.lib.php | 2 +- htdocs/includes/tcpdi/tcpdi_parser.php | 4 +-- htdocs/main.inc.php | 2 ++ 18 files changed, 117 insertions(+), 71 deletions(-) diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 730983ad090..bd1bae40d19 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -197,7 +197,7 @@ if (!empty($triggers)) { print ''.$trigger['label'].''; print ''; $key = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; - $value = $conf->global->$key; + $value = getDolGlobalInt($key); print ''; print ''."\n"; } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 5567e741272..d6cb112810a 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -202,7 +202,7 @@ print ''.$langs->trans("AgendaExtSitesDesc")."\n"; -$selectedvalue=$conf->global->AGENDA_DISABLE_EXT; +$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT'); if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; print ""; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 8e50380e2ae..7a49d2def53 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -325,7 +325,7 @@ print ''."\n"; print ''."\n"; // Manual or automatic @@ -387,7 +387,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltex print ' '."\n"; $tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); -print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); +print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW')); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; -$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); +$formactions->form_select_status_action('agenda', getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'), 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); print '
'; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index ce36d97d06a..fc75042146f 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -38,6 +38,23 @@ $langs->loadLangs(array("admin", "other", "agenda")); $def = array(); $actionsave = GETPOST('save', 'alpha'); +$MAIN_AGENDA_XCAL_EXPORTKEY = getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY'); +$MAIN_AGENDA_EXPORT_PAST_DELAY = getDolGlobalInt('MAIN_AGENDA_EXPORT_PAST_DELAY'); +$MAIN_AGENDA_EXPORT_CACHE = getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE'); +$AGENDA_EXPORT_FIX_TZ = getDolGlobalString('AGENDA_EXPORT_FIX_TZ'); + +if (GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) { + $MAIN_AGENDA_XCAL_EXPORTKEY = trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) { + $MAIN_AGENDA_EXPORT_PAST_DELAY = intval(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'int')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) { + $MAIN_AGENDA_EXPORT_CACHE = intval(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'int')); +} +if (GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) { + $AGENDA_EXPORT_FIX_TZ = trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')); +} // Sauvegardes parametres if ($actionsave) { @@ -45,10 +62,10 @@ if ($actionsave) { $db->begin(); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', $MAIN_AGENDA_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', $MAIN_AGENDA_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', $MAIN_AGENDA_EXPORT_CACHE, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', $AGENDA_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity); if ($i >= 4) { $db->commit(); @@ -97,7 +114,7 @@ print ""; print ''; print ''.$langs->trans("PasswordTogetVCalExport").""; -print ''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); } @@ -107,13 +124,13 @@ print ""; print ''; print "".$langs->trans("PastDelayVCalExport").""; -print "global->MAIN_AGENDA_EXPORT_PAST_DELAY)."\" size=\"10\"> ".$langs->trans("days").""; +print " ".$langs->trans("days").""; print " "; print ""; print ''; print "".$langs->trans("UseACacheDelay").""; -print "global->MAIN_AGENDA_EXPORT_CACHE)."\" size=\"10\">"; +print ""; print " "; print ""; @@ -130,7 +147,7 @@ print ""; print ''; print ''.$langs->trans("FixTZ").""; print ""; -print ''; +print ''; print '   '.$langs->trans("FillThisOnlyIfRequired"); print ""; print ""; diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index e12848e3de1..a19ffa17b49 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -42,7 +42,7 @@ $arrayofparameters = array( 'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), - 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) + 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>! empty($conf->ecm->enabled)) ); // To fix when dire does not exists @@ -123,6 +123,10 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $key => $val) { + if (isset($val['enabled']) && empty($val['enabled'])) { + continue; + } + print ''; $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); $label = $langs->trans($key); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index ae269492ddf..756484289aa 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -323,7 +323,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -661,12 +661,14 @@ if (!empty($conf->banque->enabled)) { } print ""; +$FACTURE_CHQ_NUMBER = getDolGlobalInt('FACTURE_CHQ_NUMBER'); + print ''; print "".$langs->trans("SuggestPaymentByChequeToAddress").""; print ""; print '', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -84,17 +84,17 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; @@ -136,23 +136,20 @@ class mod_facture_mercure extends ModeleNumRefFactures */ public function getNextValue($objsoc, $invoice, $mode = 'next') { - global $db, $conf; + global $db; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Get Mask value $mask = ''; if (is_object($invoice) && $invoice->type == 1) { - $mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT; - if (!$mask) { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; - } + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_REPLACEMENT', getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE')); } elseif (is_object($invoice) && $invoice->type == 2) { - $mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_CREDIT'); } elseif (is_object($invoice) && $invoice->type == 3) { - $mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_DEPOSIT'); } else { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE'); } if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 958074202fe..d59d7c47f6f 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -61,7 +61,7 @@ class mod_payment_ant extends ModeleNumRefPayments */ public function info() { - global $db, $conf, $langs; + global $db, $langs; $langs->load("bills"); @@ -82,7 +82,7 @@ class mod_payment_ant extends ModeleNumRefPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -128,7 +128,7 @@ class mod_payment_ant extends ModeleNumRefPayments require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->PAYMENT_ANT_MASK; + $mask = getDolGlobalString('PAYMENT_ANT_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 66e2f3c8312..ab03b04b86e 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -117,13 +117,16 @@ class doc_generic_proposal_odt extends ModelePDFPropales $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('PROPALE_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -133,7 +136,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROPALE_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -159,7 +162,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,7 +170,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Scan directories $nbofiles = count($listoffiles); - if (!empty($conf->global->PROPALE_ADDON_PDF_ODT_PATH)) { + if (!empty($odtPath)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -184,26 +187,26 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= '
'; // Set default template for different status of proposal - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFPropales::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 04f6ed49012..0cfcd91a350 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -118,13 +118,16 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -134,7 +137,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -160,7 +163,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFSupplierProposal::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelSupplierProposalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index e7db54062cb..99a05e12e4d 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -64,7 +64,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal */ public function info() { - global $conf, $langs, $db; + global $langs, $db; $langs->load("bills"); @@ -83,9 +83,11 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); $tooltip .= $langs->trans("GenericMaskCodes5"); + $mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); + // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -131,7 +133,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // On defini critere recherche compteur - $mask = $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; + $mask = empty($conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK) ? '' : $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 656eb88ecaa..aa068a162e2 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -115,13 +115,16 @@ class doc_generic_user_odt extends ModelePDFUser $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USER_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -131,7 +134,7 @@ class doc_generic_user_odt extends ModelePDFUser // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USER_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -157,7 +160,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,26 +170,26 @@ class doc_generic_user_odt extends ModelePDFUser if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { // Model for creation $list = ModelePDFUser::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USER_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USER_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USER_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USER_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USER_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USER_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index e1c83023df9..e1e5238cb89 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -118,13 +118,16 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USERGROUP_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -134,7 +137,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -160,7 +163,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -170,26 +173,26 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFUserGroup::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/dav/dav.lib.php b/htdocs/dav/dav.lib.php index 2861b8744bf..9babbabbe83 100644 --- a/htdocs/dav/dav.lib.php +++ b/htdocs/dav/dav.lib.php @@ -54,7 +54,7 @@ function dav_admin_prepare_head() $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/admin/dav.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/admin/dav.php'; $head[$h][1] = $langs->trans("WebDAV"); $head[$h][2] = 'webdav'; $h++; diff --git a/htdocs/includes/tcpdi/tcpdi_parser.php b/htdocs/includes/tcpdi/tcpdi_parser.php index 13e9839f2b4..174c496d4f4 100644 --- a/htdocs/includes/tcpdi/tcpdi_parser.php +++ b/htdocs/includes/tcpdi/tcpdi_parser.php @@ -1365,7 +1365,7 @@ class tcpdi_parser { $obj = $this->getObjectVal($obj); if (isset ($obj[1][1]['/Rotate'])) { $res = $this->getObjectVal($obj[1][1]['/Rotate']); - if ($res[0] == PDF_TYPE_OBJECT) + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) return $res[1]; return $res; } else { @@ -1373,7 +1373,7 @@ class tcpdi_parser { return false; } else { $res = $this->_getPageRotation($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) return $res[1]; return $res; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b97312859b9..d541f3abce5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -754,6 +754,8 @@ if (!defined('NOLOGIN')) { $login = ''; } + $dol_authmode = ''; + if ($login) { $dol_authmode = $conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_tz = $_POST["tz"]; From 38eee02272cbe06ada74cfb7b2d56f6cb7024db1 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 8 Feb 2023 17:34:50 +0100 Subject: [PATCH 024/572] FIX : Make bom_net_needs list standard --- htdocs/bom/bom_net_needs.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 60736d085da..f6644590a2e 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -218,6 +218,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''; print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; print ''; + + print ''; + print ''; if (!empty($TChildBom)) { if ($action == 'treeview') { foreach ($TChildBom as $fk_bom => $TProduct) { @@ -266,7 +269,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } } - print ''; + print ''; print ''; From cd289ca8ac2145b751f9b5236406c1d02f9dd1cd Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 8 Feb 2023 19:09:05 +0100 Subject: [PATCH 025/572] fix(qodana) fix function comment wrong return --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- htdocs/core/ajax/fileupload.php | 1 - htdocs/core/class/dolreceiptprinter.class.php | 2 +- htdocs/core/class/fileupload.class.php | 6 ++++-- htdocs/core/class/hookmanager.class.php | 2 +- .../core/modules/asset/doc/pdf_standard_asset.modules.php | 2 +- htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php | 2 +- htdocs/core/modules/cheque/doc/pdf_blochet.class.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/import/import_csv.modules.php | 2 +- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- htdocs/core/modules/mrp/doc/pdf_vinci.modules.php | 2 +- htdocs/core/modules/product/modules_product.class.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- .../core/modules/supplier_order/doc/pdf_cornas.modules.php | 2 +- .../modules/supplier_order/doc/pdf_muscadet.modules.php | 2 +- .../modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/projet/class/api_projects.class.php | 2 +- htdocs/user/class/api_users.class.php | 2 +- 21 files changed, 23 insertions(+), 22 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index bae53bce6a8..76275eadb16 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -778,7 +778,7 @@ class Invoices extends DolibarrApi * * @url POST {id}/contacts * - * @return array + * @return object * * @throws RestException 304 * @throws RestException 401 diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 67f95700976..b57e03972f1 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -48,7 +48,6 @@ $element = GETPOST('element', 'alpha'); $upload_handler = new FileUpload(null, $fk_element, $element); - /* * View */ diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 3b10f38d238..2bc26fa324c 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -935,7 +935,7 @@ class dolReceiptPrinter extends Printer * Function Init Printer * * @param int $printerid Printer id - * @return int 0 if OK; >0 if KO + * @return void|int 0 if OK; >0 if KO */ public function initPrinter($printerid) { diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 906933c9701..895cf6f8835 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -488,8 +488,9 @@ class FileUpload */ public function post() { + var_dump("here");exit; if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { - return $this->delete(); + echo $this->delete(); } $upload = isset($_FILES[$this->options['param_name']]) ? $_FILES[$this->options['param_name']] : null; @@ -556,6 +557,7 @@ class FileUpload } } header('Content-type: application/json'); - echo json_encode($success); + $response = json_encode($success); + return $response; } } diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index bcd5a506946..9c0441b3ced 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -77,7 +77,7 @@ class HookManager * Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed. * * @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... - * @return int Always 1 + * @return int|void Always 1 */ public function initHooks($arraycontext) { diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index 8ebd1051a06..b20f60fe084 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -916,7 +916,7 @@ class pdf_standard_asset extends ModelePDFAsset * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return void + * @return float */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index e296663f39a..ecf7a2a6ad9 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -478,7 +478,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param CompanyBankAccount $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object - * @return void + * @return float */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) { diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 3985cb6be90..43db9a615e6 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -401,7 +401,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text - * @return void + * @return mixed */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index f24517d0667..1e9339c55e2 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2057,7 +2057,7 @@ class pdf_sponge extends ModelePDFFactures * @param int $showaddress 0=no, 1=yes (usually set to 1 for first page, and 0 for next pages) * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return int top shift of linked object lines + * @return array top shift of linked object lines */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index a9a82e7cb00..1213cc4cf16 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -238,7 +238,7 @@ class ImportCsv extends ModeleImports /** * Return array of next record in input file. * - * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) + * @return array|boolean Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ public function import_read_record() { diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0854a0f56c5..c7f6df31d03 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -304,7 +304,7 @@ class ImportXlsx extends ModeleImports /** * Return array of next record in input file. * - * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) + * @return array|boolean Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ public function import_read_record() { diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index 8e3eeeafa33..492385a53a3 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -1067,7 +1067,7 @@ class pdf_vinci extends ModelePDFMo * @param CommandeFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 3a856763144..e5f5e7e09eb 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -191,7 +191,7 @@ abstract class ModeleProductCode * * @param DoliDB $dbs Database handler * @param integer $maxfilenamelength Max length of value to show - * @return array List of numbers + * @return array|int List of numbers */ public static function liste_modeles($dbs, $maxfilenamelength = 0) { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 5f637373507..9ea524f2977 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1484,7 +1484,7 @@ class pdf_azur extends ModelePDFPropales * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return void + * @return int|float */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 88b56eb8fa6..8a41e680fc5 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1547,7 +1547,7 @@ class pdf_cyan extends ModelePDFPropales * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 186ea465568..2343885cb4d 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1223,7 +1223,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders * @param CommandeFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 2fdf9828aff..1de4acd1550 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1130,7 +1130,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param CommandeFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index ff90b500969..2f264cfb928 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1232,7 +1232,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index bdf4f8aa457..21dae0e85b2 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -535,7 +535,7 @@ class PaiementFourn extends Paiement * Return list of supplier invoices the payment point to * * @param string $filter SQL filter. Warning: This value must not come from a user input. - * @return array Array of supplier invoice id + * @return array|int Array of supplier invoice id | <0 si ko */ public function getBillsArray($filter = '') { diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index fc10f49d38d..fa936969754 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -229,7 +229,7 @@ class Projects extends DolibarrApi * * @param int $id Id of project * @param int $includetimespent 0=Return only list of tasks. 1=Include a summary of time spent, 2=Include details of time spent lines - * @return int + * @return array * * @url GET {id}/tasks */ diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 2bbadd267cf..d91fcafffa6 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -593,7 +593,7 @@ class Users extends DolibarrApi * * @param int $group ID of group * @param int $load_members Load members list or not {@min 0} {@max 1} - * @return array Array of User objects + * @return object object of User objects * * @throws RestException 401 Not allowed * @throws RestException 404 User not found From 629f354800e591e549a3a227e19a794845d621ac Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 8 Feb 2023 19:20:55 +0100 Subject: [PATCH 026/572] fix(qodana) remove a var_dump --- htdocs/core/class/fileupload.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 895cf6f8835..84ff0a9ed33 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -488,7 +488,6 @@ class FileUpload */ public function post() { - var_dump("here");exit; if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { echo $this->delete(); } From e83559afb0ab7963a0187dbdcb4f8d5ea89f72fa Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 9 Feb 2023 15:20:07 +0100 Subject: [PATCH 027/572] FIX strato pdf --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 1875cfb833c..e9c53f4b354 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -230,7 +230,7 @@ class pdf_strato extends ModelePDFContract $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + $heightforfooter = $this->marge_basse + 9; // Height reserved to output the footer (value include bottom margin) if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) { $heightforfooter += 6; } @@ -383,7 +383,6 @@ class pdf_strato extends ModelePDFContract $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page $pdf->AddPage('', '', true); @@ -437,6 +436,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($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } @@ -459,6 +461,7 @@ class pdf_strato extends ModelePDFContract } } + // Show square if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); From 78e1fad6bdf26548511a671f0c9a1b7830817939 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 9 Feb 2023 14:27:50 +0000 Subject: [PATCH 028/572] Fixing style errors. --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index e9c53f4b354..05e409ac9ed 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -436,7 +436,7 @@ 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($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { $this->_pagehead($pdf, $object, 0, $outputlangs); } if (!empty($tplidx)) { From 69b690c45e01ec898a3402fed24d282b15f5929a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 15:29:07 +0100 Subject: [PATCH 029/572] Merge pull request #23817 from elcf/develop Added key name to unique constraint --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 7c38fb59b6d..bee0477665f 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -688,7 +688,7 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year')); DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year'); -ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label); +ALTER TABLE llx_takepos_floor_tables ADD UNIQUE uk_takepos_floor_tables (entity,label); ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255); ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128); From 8bd6f070aab2fd5efe01c4ce78fd274ee8002ac5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 9 Feb 2023 17:22:45 +0100 Subject: [PATCH 030/572] FIX: product ref fourn same size in supplier order/invoice as in product price fourn --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql | 2 +- htdocs/install/mysql/tables/llx_facture_fourn_det.sql | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 5621ca6fad8..bef7621d282 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -530,3 +530,6 @@ ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIG -- Idea is to update this column manually in v15 with value in currency of company for bank that are not into the main currency and the transfer -- into accounting will use it in priority if value is not null. The script repair.sql contains the sequence to fix datas in llx_bank. ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL; + +ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128); +ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql index f6092bc4c74..0dfed7152aa 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql @@ -25,7 +25,7 @@ create table llx_commande_fournisseurdet fk_commande integer NOT NULL, fk_parent_line integer NULL, fk_product integer, - ref varchar(50), -- supplier product ref + ref varchar(128), -- supplier product ref label varchar(255), -- product label description text, vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 30f57fa184b..8daf658fa68 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -24,7 +24,7 @@ create table llx_facture_fourn_det fk_facture_fourn integer NOT NULL, fk_parent_line integer NULL, fk_product integer NULL, - ref varchar(50), -- supplier product ref + ref varchar(128), -- supplier product ref label varchar(255), -- product label description text, pu_ht double(24,8), -- unit price excluding tax From da0daa49da8d0c64d05c832f07ae3d1cabd2d901 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:01:59 +0100 Subject: [PATCH 031/572] FIX: some more PHP8 comptability fixes --- htdocs/core/class/html.formfile.class.php | 8 ++++---- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4bcf742d461..1d6a2b10a04 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -496,6 +496,10 @@ class FormFile $titletoshow = ($title == 'none' ? '' : $title); } + $addcolumforpicto = ($delallowed || $printer || $morepicto); + $colspan = (4 + ($addcolumforpicto ? 1 : 0)); + $colspanmore = 0; + // Show table if ($genallowed) { $modellist = array(); @@ -747,10 +751,6 @@ class FormFile $out .= ''; - $addcolumforpicto = ($delallowed || $printer || $morepicto); - $colspan = (4 + ($addcolumforpicto ? 1 : 0)); - $colspanmore = 0; - $out .= ''; // Model diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d441d364f4b..ba9cdba1493 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -1059,7 +1059,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $ret = $actioncomm->create($user); // User creating action if ($ret > 0 && !empty($conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)) { - if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { + if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { foreach ($object->attachedfiles['paths'] as $key => $filespath) { $srcfile = $filespath; $destdir = $conf->agenda->dir_output.'/'.$ret; From e5de31a7dea24c89164a6e870a400d77dd758737 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 18:23:19 +0100 Subject: [PATCH 032/572] Fix size of ref --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 2a1a9ee2fd5..744c000294b 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -393,3 +393,6 @@ ALTER TABLE llx_opensurvey_user_studs ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_opensurvey_comments ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_c_tva ADD COLUMN use_default tinyint DEFAULT 0; + +ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128); +ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128); From e9ce09f9d1a987e812c29198033a0f369c37743b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 18:50:22 +0100 Subject: [PATCH 033/572] Doc --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3a51575ef57..9311adb11ef 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -411,6 +411,9 @@ function dol_shutdown() /** * Return true if we are in a context of submitting the parameter $paramname from a POST of a form. + * Warning: + * For action=add, use: $var = GETPOST('var'); // No GETPOSTISSET, so GETPOST always called and default value is retreived if not a form POST, and value of form is retreived if it is a form POST. + * For action=update, use: $var = GETPOSTISSET('var') ? GETPOST('var') : $object->var; * * @param string $paramname Name or parameter to test * @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty) From c28f0d9386e1693c51c9ea2059765bc4bef2313a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:24:16 +0100 Subject: [PATCH 034/572] FIX #23860 --- htdocs/compta/facture/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 80d3ed2b436..3aa43556e43 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3119,7 +3119,11 @@ if ($action == 'create') { } // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value - $fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account; + if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account + $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company + } else { // No company forced + $fk_account = GETPOST("fk_account", 'int'); + } if (!empty($soc->id)) { $absolute_discount = $soc->getAvailableDiscounts(); From 081ede08ec540694ad407edafb402bd068388d33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:24:42 +0100 Subject: [PATCH 035/572] Fix label --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 01a72c6c7f3..cbc0a3d5975 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -235,7 +235,7 @@ class Societe extends CommonObject 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>440), 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>445), - 'fk_account' =>array('type'=>'integer', 'label'=>'AccountingAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>450), + 'fk_account' =>array('type'=>'integer', 'label'=>'PaymentBankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>450), 'fk_warehouse' =>array('type'=>'integer', 'label'=>'Warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>455), 'logo' =>array('type'=>'varchar(255)', 'label'=>'Logo', 'enabled'=>1, 'visible'=>-1, 'position'=>400), 'logo_squarred' =>array('type'=>'varchar(255)', 'label'=>'Logo squarred', 'enabled'=>1, 'visible'=>-1, 'position'=>401), From 802ee770c3cac69d7efdb792d23b28d59b95ce70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:24:16 +0100 Subject: [PATCH 036/572] FIX #23860 --- htdocs/compta/facture/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 90f45018489..69155ecd8c7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2981,7 +2981,11 @@ if ($action == 'create') { } // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value - $fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account; + if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account + $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company + } else { // No company forced + $fk_account = GETPOST("fk_account", 'int'); + } if (!empty($soc->id)) { $absolute_discount = $soc->getAvailableDiscounts(); From 5ef4aa78e9f7a29d0a7bfbcbb01b067a094995f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:16:34 +0100 Subject: [PATCH 037/572] Fix filter using != --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9311adb11ef..bb69fd4966d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9768,7 +9768,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $value = preg_replace('/\*/', '%', $value); // Replace * with % } if ($mode == 1) { - $value = preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do + $value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do } $value = preg_replace('/\s*\|\s*/', '|', $value); @@ -9788,10 +9788,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) foreach ($fields as $field) { if ($mode == 1) { $operator = '='; - $newcrit = preg_replace('/([<>=]+)/', '', $crit); + $newcrit = preg_replace('/([!<>=]+)/', '', $crit); $reg = array(); - preg_match('/([<>=]+)/', $crit, $reg); + preg_match('/([!<>=]+)/', $crit, $reg); if (!empty($reg[1])) { $operator = $reg[1]; } From 65982c16753840aa88837ba2550e16e77f1b8ca7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:17:18 +0100 Subject: [PATCH 038/572] css --- htdocs/admin/emailcollector_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 10e7ea300f8..d140dd39ce2 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -723,7 +723,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Add operation print ''; print ''; - print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1); + print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'minwidth150 maxwidth300', 1); print ''; //print ''; $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); From 73b894dca3bee2895c4dd4ab5039dff2f202e029 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:19:58 +0100 Subject: [PATCH 039/572] Fix the qty in stock when product has no lot --- htdocs/product/reassortlot.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 690d3f3f261..6da51124919 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -214,7 +214,7 @@ $morecss = array(); $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.tms as datem,'; $sql .= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,'; -$sql .= ' ps.fk_entrepot,'; +$sql .= ' ps.fk_entrepot, ps.reel,'; $sql .= ' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,'; $sql .= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,'; $sql .= ' pl.rowid as lotid, pl.eatby, pl.sellby,'; @@ -313,7 +313,7 @@ foreach ($search as $key => $val) { $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; $sql .= " p.fk_product_type, p.tms,"; $sql .= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,"; -$sql .= " ps.fk_entrepot,"; +$sql .= " ps.fk_entrepot, ps.reel,"; $sql .= " e.ref, e.lieu, e.fk_parent,"; $sql .= " pb.batch, pb.eatby, pb.sellby,"; $sql .= " pl.rowid, pl.eatby, pl.sellby"; @@ -322,7 +322,7 @@ if ($toolowstock) { $sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet } if ($search_stock_physique != '') { - $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', '0', 'pb.qty') . ')', $search_stock_physique, 1, 1); + $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', $db->ifsql('ps.reel IS NULL', '0', 'ps.reel'), 'pb.qty') . ')', $search_stock_physique, 1, 1); $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters if (!empty($sql_having)) { $sql_having .= " AND"; @@ -689,7 +689,15 @@ while ($i < $imaxinloop) { print ''; //if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; - print $objp->stock_physique; + if (is_null($objp->stock_physique)) { + if (!empty($objp->reel)) { + print price2num($objp->reel, 'MS'); + } + } else { + if (!empty($objp->stock_physique)) { + print price2num($objp->stock_physique, 'MS'); + } + } print ''; print ''; From 616b006f2a053d2a589990adb0c0c3f15a353518 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 10:56:55 +0100 Subject: [PATCH 040/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 80 --- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 321741ea8a0..1e96c32129a 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; From 3e7879c88671c24d5733c742cefdd8b80b13dac3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 11:00:07 +0100 Subject: [PATCH 041/572] Debug v17 --- htdocs/projet/card.php | 3 ++- htdocs/projet/class/project.class.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 501cdcc5f4b..00b0c11deaf 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1060,7 +1060,8 @@ if ($action == 'create' && $user->rights->projet->creer) { if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) { $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; } - $text = $form->select_company($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), 0, 'minwidth300'); + $text = img_picto('', 'company', 'class="pictofixedwidth"'); + $text .= $form->select_company($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), 0, 'minwidth300'); if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) { $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c8d3be0163d..0d6df2ddc98 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -293,8 +293,8 @@ class Project extends CommonObject 'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'usage_organize_event' =>array('type'=>'integer', 'label'=>'UsageOrganizeEvent', 'enabled'=>1, 'visible'=>-1, 'position'=>145), // Properties for event organization - 'date_start_event' =>array('type'=>'date', 'label'=>'DateStartEvent', 'enabled'=>1, 'visible'=>1, 'position'=>200), - 'date_end_event' =>array('type'=>'date', 'label'=>'DateEndEvent', 'enabled'=>1, 'visible'=>1, 'position'=>201), + 'date_start_event' =>array('type'=>'date', 'label'=>'DateStartEvent', 'enabled'=>"isModEnabled('eventorganization')", 'visible'=>1, 'position'=>200), + 'date_end_event' =>array('type'=>'date', 'label'=>'DateEndEvent', 'enabled'=>"isModEnabled('eventorganization')", 'visible'=>1, 'position'=>201), 'location' =>array('type'=>'text', 'label'=>'Location', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>202), 'accept_conference_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestConf', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'accept_booth_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>211), From b52de45f73926958a7f7eecd978b7bed868c1b19 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:01:09 +0100 Subject: [PATCH 042/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 88 --- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 1e96c32129a..890d56e874b 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -85,7 +85,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note From f1c929abd0f28aaaeaf3d6d466e5f179832053bc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:03:31 +0100 Subject: [PATCH 043/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 93 --- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 890d56e874b..65594470c30 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -90,7 +90,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit From 4a826d47e93d30a0ec9e0308876169b410cbbbe5 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:17:02 +0100 Subject: [PATCH 044/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 98 --- htdocs/core/modules/facture/mod_facture_mercure.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 65594470c30..e624487c9cf 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -85,7 +85,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note From 2e0b7fe4e8da235d76bd64156a83a3029920cc9d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 10 Feb 2023 10:21:39 +0000 Subject: [PATCH 045/572] Fixing style errors. --- htdocs/core/modules/facture/mod_facture_mercure.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index e624487c9cf..4185a8a08b6 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -85,7 +85,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note From 5acefe2e72162f52d95fe2dfc309daa02e16f949 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:33:34 +0100 Subject: [PATCH 046/572] cleaning my previous --- htdocs/core/modules/facture/mod_facture_mercure.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index e624487c9cf..1f516fa08f6 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -85,17 +85,17 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; From fa856424a4f5a50486ffca16dcc7fcc7decca3aa Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:43:01 +0100 Subject: [PATCH 047/572] fix : Warning: Undefined property: Facture:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/doc/pdf_sponge.modules.php on line 1620 --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5edfc3f6157..1d106f6f024 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1617,7 +1617,7 @@ class pdf_sponge extends ModelePDFFactures // Get Total HT - $total_ht = (isModEnabled("multicurrency") && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); // Total remise $total_line_remise = 0; From 02475369e638333dfecad09b58e5f84ab7e314a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 12:58:49 +0100 Subject: [PATCH 048/572] Fix bad link --- htdocs/projet/agenda.php | 2 +- htdocs/projet/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index a3c120d0a23..071e9eb2e9a 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -180,7 +180,7 @@ if (!empty($object->id)) { $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); // Show link to change view in agenda - $messagingUrl = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; + $messagingUrl = DOL_URL_ROOT.'/projet/agenda.php?id='.$object->id; $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 00b0c11deaf..e954f429781 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1614,7 +1614,7 @@ if ($action == 'create' && $user->rights->projet->creer) { $MAXEVENT = 10; - $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/projet/info.php?id='.$object->id); + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id); // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; From d37c5ed6b1936f02179c3fd6bdee474179bedbc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 14:16:30 +0100 Subject: [PATCH 049/572] Debug v17 --- htdocs/admin/mails_templates.php | 31 +++++++++++++++---------------- htdocs/core/lib/functions.lib.php | 8 ++++---- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/btn.inc.php | 9 ++++++--- htdocs/theme/md/style.css.php | 5 +---- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index e462b7854ac..25a1ba101ad 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -675,17 +675,27 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu } -// Confirmation de la suppression de la ligne +// Confirm deletion of record if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&code='.urlencode($code).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } - - $fieldlist = explode(',', $tabfield[$id]); if ($action == 'create') { + // If data was already input, we define them in obj to populate input fields. + $obj = new stdClass(); + $obj->label = GETPOST('label'); + $obj->lang = GETPOST('lang'); + $obj->type_template = GETPOST('type_template'); + $obj->fk_user = GETPOST('fk_user', 'int'); + $obj->private = GETPOST('private', 'int'); + $obj->position = GETPOST('position'); + $obj->topic = GETPOST('topic'); + $obj->joinfiles = GETPOST('joinfiles'); + $obj->content = GETPOST('content', 'restricthtml'); + // Form to add a new line print ''; print ''; @@ -761,16 +771,6 @@ if ($action == 'create') { print ''; print ''; - $obj = new stdClass(); - // If data was already input, we define them in obj to populate input fields. - if (GETPOST('actionadd')) { - foreach ($fieldlist as $key => $val) { - if (GETPOST($val) != '') { - $obj->$val = GETPOST($val); - } - } - } - $tmpaction = 'create'; $parameters = array( 'fieldlist' => $fieldlist, @@ -828,7 +828,6 @@ if ($action == 'create') { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_4, '90%'); print $doleditor->Create(1); } @@ -848,7 +847,7 @@ if ($action == 'create') { print '
'; print ''; print '

'; -} // END IF not edit +} // List of available record in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bb69fd4966d..37949215357 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5371,10 +5371,10 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict $return .= '
'.$titre.'
'; $return .= ''; if (dol_strlen($morehtmlcenter)) { - $return .= ''.$morehtmlcenter.''; + $return .= ''.$morehtmlcenter.''; } if (dol_strlen($morehtmlright)) { - $return .= ''.$morehtmlright.''; + $return .= ''.$morehtmlright.''; } $return .= ''."\n"; @@ -5446,11 +5446,11 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', // Center if ($morehtmlcenter) { - print ''.$morehtmlcenter.''; + print ''.$morehtmlcenter.''; } // Right - print ''; + print ''; print ''; if ($sortfield) { $options .= "&sortfield=".urlencode($sortfield); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 10617a51d72..8f7d4b1ef1e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4879,7 +4879,7 @@ div.titre { color: var(--colortexttitlenotab2); } -table.table-fiche-title .col-title div.titre{ +table.table-fiche-title .col-title div.titre, .col-right .btnTitle-icon { line-height: 40px; } table.table-fiche-title { diff --git a/htdocs/theme/md/btn.inc.php b/htdocs/theme/md/btn.inc.php index 5ccd2e100dd..fdd9668c7d3 100644 --- a/htdocs/theme/md/btn.inc.php +++ b/htdocs/theme/md/btn.inc.php @@ -342,8 +342,8 @@ a.btnTitle.btnTitleSelected { position: relative; margin: 0 0 0 10px; text-align: center; - color: #ffffff; - background-color: rgb(); + color: #000; + background-color: #eee; font-size: 12px; text-decoration: none; box-shadow: none; @@ -373,7 +373,10 @@ div.pagination .btnTitle:hover .btnTitle-label{ } .paginationafterarrows a.btnTitlePlus, .titre_right a.btnTitlePlus { - border: 1px solid var(--colorbackbody); + border: 1px solid var(--btncolorborder); +} +.paginationafterarrows a.btnTitlePlus:hover, .titre_right a.btnTitlePlus:hover { + border-color: #ddd; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 780059e3a8f..47a35f8d0bf 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4168,9 +4168,6 @@ table.hidepaginationprevious .paginationprevious { table.hidepaginationnext .paginationnext { display: none; } -.paginationafterarrows a.btnTitlePlus { - border: 1px solid var(--btncolorborder); -} .paginationafterarrows a.btnTitlePlus:hover span:before { /* text-shadow: 0px 0px 5px #ccc; */ /* filter: invert(0.3); */ @@ -4906,7 +4903,7 @@ div.titre { table.centpercent.notopnoleftnoright.table-fiche-title { margin-bottom: 10px !important; } -table.table-fiche-title .col-title div.titre{ +table.table-fiche-title .col-title div.titre, .col-right .btnTitle-icon { line-height: 40px; } From c3a7cf57fcba3e4eafd3f6d1d51d47f93fcc9e14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 14:47:39 +0100 Subject: [PATCH 050/572] Debug v17 --- htdocs/theme/md/style.css.php | 32 ++++++++++++++---------------- htdocs/theme/md/theme_vars.inc.php | 4 ++-- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 47a35f8d0bf..6d56e452898 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1803,14 +1803,13 @@ tr.nobottom td { /* ============================================================================== */ /* Styles to hide objects */ /* ============================================================================== */ - .clearboth { clear:both; } .hideobject { display: none; } .minwidth25 { min-width: 25px; } .minwidth50 { min-width: 50px; } .minwidth75 { min-width: 75px; } /* rule for not too small screen only */ -@media only screen and (min-width: px) +@media only screen and (min-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3) ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) { .width20 { width: 20px; } .width25 { width: 25px; } @@ -3192,7 +3191,7 @@ a.aversion { .alogin, .alogin:hover { color: #888 !important; font-weight: normal !important; - font-size: px !important; + font-size: !important; } .alogin:hover, .atoplogin:hover { text-decoration:underline !important; @@ -3282,16 +3281,16 @@ div.vmenu, td.vmenu { .searchform .bordertransp { border: 0; } a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu, span.vsmenu { - white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; + white-space: nowrap; font-size:; font-family: ; text-align: ; font-weight: bold; } -span.vmenudisabled, font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; white-space: nowrap; } +span.vmenudisabled, font.vmenudisabled { font-size:; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; white-space: nowrap; } a.vmenu:link, a.vmenu:visited { color: var(--colortextbackvmenu); } -a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 8px; } +a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-size:; font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 8px; } span.vsmenudisabled:not(.spanlilevel0), font.vsmenudisabled:not(.spanlilevel0) { - font-size:px; + font-size:; } span.vsmenudisabled, font.vsmenudisabled { font-family: ; @@ -5002,7 +5001,7 @@ div#card-errors { .ui-dialog-titlebar { } .ui-dialog-content { - font-size: px !important; + font-size: !important; } .ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-draggable { z-index: 1002 !important; /* Default 101 with ui-jquery, top menu have a z-index of 1000 */ @@ -7466,13 +7465,12 @@ div.clipboardCPValue.hidewithsize { width: px; } -/* nboftopmenuentries = , fontsize= */ -/* disableimages = */ -/* rule to reduce top menu - 1st reduction */ -@media only screen and (max-width: px) +/* nboftopmenuentries = , fontsize= */ +/* rule to reduce top menu - 1st reduction: Reduce width of top menu icons */ +@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1) ? round($nbtopmenuentries * 90, 0) + 340 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1; ?>px) /* reduction 1 */ { div.tmenucenter { - max-width: px; /* size of viewport */ + max-width: 56px; /* size of viewport */ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -7496,16 +7494,16 @@ div.clipboardCPValue.hidewithsize { display: none; } } -/* rule to reduce top menu - 2nd reduction */ -@media only screen and (max-width: px) +/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */ +@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */ { li.tmenucompanylogo { display: none; } div.tmenucenter { - max-width: px; /* size of viewport */ - text-overflow: clip; + max-width: 24px; /* size of viewport */ + text-overflow: clip; } .mainmenuaspan { font-size: 10px; diff --git a/htdocs/theme/md/theme_vars.inc.php b/htdocs/theme/md/theme_vars.inc.php index 5f26d0d83bd..84a1065f781 100644 --- a/htdocs/theme/md/theme_vars.inc.php +++ b/htdocs/theme/md/theme_vars.inc.php @@ -64,8 +64,8 @@ $colortexttitle = '20,20,20'; $colortexttitlelink = '0,0,120'; $colortext = '0,0,0'; $colortextlink = '0,0,120'; -$fontsize = '14'; -$fontsizesmaller = '11'; +$fontsize = '0.94em'; +$fontsizesmaller = '0.75em'; $topMenuFontSize = '1.1em'; $toolTipBgColor = 'rgba(255, 255, 255, 0.96)'; $toolTipFontColor = '#333'; From 218d7cf148804d4dc0a3a86fb9007560a5819250 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 10 Feb 2023 13:47:46 +0000 Subject: [PATCH 051/572] Fixing style errors. --- htdocs/bom/tpl/objectline_view.tpl.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 6208abcbf6d..95bbed79784 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -172,8 +172,7 @@ print ''; $coldisplay++; if (!empty($line->fk_bom_child)) { echo ''.price($tmpbom->total_cost * $line->qty).''; -} -else { +} else { echo ''.price($line->total_cost).''; } print ''; @@ -302,7 +301,7 @@ if ($resql) { $sub_bom->calculateCosts(); print ''.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; - } elseif($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { + } elseif ($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { //Convert qty to hour $unit = measuringUnitString($sub_bom_line->fk_unit, '', '', 1); $qty = convertDurationtoHour($sub_bom_line->qty, $unit); From 49f093daefec960a3c4e632fcb557dd9a93441a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 14:57:27 +0100 Subject: [PATCH 052/572] css --- htdocs/theme/md/info-box.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index e2179b96162..9938225eebb 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -153,7 +153,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { margin-bottom: 15px; border: 1px solid #e9e9e9; } -.info-box.info-box-sm{ +.info-box.info-box-sm { min-height: 80px; margin-bottom: 10px; } @@ -213,6 +213,10 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { font-size: 25px; line-height: 92px; } +.info-box-module .info-box-icon { + padding-top: 4px; + padding-bottom: 4px; +} .opened-dash-board-wrap .info-box .info-box-icon { font-size: 2em; } From 1bc16f47c0633332e9a855bcc499b4b73d5ceb39 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 10 Feb 2023 15:00:27 +0100 Subject: [PATCH 053/572] FIX : Missing right to edit service note when module product is disabled --- htdocs/product/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/note.php b/htdocs/product/note.php index b758f414035..52d912933eb 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -49,7 +49,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); } -$permissionnote = $user->rights->produit->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = ($user->rights->produit->creer || $user->rights->service->creer); // Used by the include of actions_setnotes.inc.php if ($object->id > 0) { if ($object->type == $object::TYPE_PRODUCT) { From 0cc8b5d7f2e6acc146d9eb51dd2b05179260c1c0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:02:11 +0100 Subject: [PATCH 054/572] fix : Warning: Undefined variable in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/class/html.formfile.class.php on line 924 --- htdocs/core/class/html.formfile.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index bc06d1517dc..ca058603ce1 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -920,6 +920,9 @@ class FormFile } if (is_object($hookmanager)) { + $addcolumforpicto = ($delallowed || $printer || $morepicto); + $colspan = (4 + ($addcolumforpicto ? 1 : 0)); + $colspanmore = 0; $parameters = array('colspan'=>($colspan + $colspanmore), 'socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'modulepart'=>$modulepart, 'relativepath'=>$relativepath); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); if (empty($res)) { From 26ec131048fa28f3c690cdf48302279c1af04ee7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:24:46 +0100 Subject: [PATCH 055/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 122 --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index b2f3521111e..580b585c28f 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -119,7 +119,7 @@ $usercanreopen = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate))); $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); -$usercancreatemargin = $user->rights->margins->creer; +$usercancreatemargin = $user->hasRight("margins", "creer"); $usercanreadallmargin = $user->rights->margins->liretous; $usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; From 66015cb11d754a2404a9a426e44b6187d566e14a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:30:34 +0100 Subject: [PATCH 056/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 123 Warning: Attempt to read property liretous on null in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 123 --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 580b585c28f..39763375fd2 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -120,7 +120,7 @@ $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($ $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); $usercancreatemargin = $user->hasRight("margins", "creer"); -$usercanreadallmargin = $user->rights->margins->liretous; +$usercanreadallmargin = $user->hasRight("margins", "liretous"); $usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; $now = dol_now(); From b5ffe6204fe6df0d14215e32b6cb04f110c00873 Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 10 Feb 2023 15:30:36 +0100 Subject: [PATCH 057/572] push with ipn not working --- .../class/bonprelevement.class.php | 2 +- htdocs/core/class/commoninvoice.class.php | 67 ++++++++++--------- htdocs/langs/en_US/bills.lang | 2 - htdocs/public/stripe/ipn.php | 48 ++++++++++++- 4 files changed, 83 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index b9d1fd7c54a..bbfc694d414 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -106,7 +106,7 @@ class BonPrelevement extends CommonObject */ public function __construct($db) { - global $conf, $langs; + global $conf, $langs, $db; $this->db = $db; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 2063bb59bf9..41d76310779 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -92,10 +92,6 @@ abstract class CommonInvoice extends CommonObject */ const STATUS_ABANDONED = 3; - /** - * Classified processing because payment requested - */ - const STATUS_PROCESSING = 4; public $totalpaid; // duplicate with sumpayed public $totaldeposits; // duplicate with sumdeposit @@ -618,10 +614,6 @@ abstract class CommonInvoice extends CommonObject $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially'); $statusType = 'status9'; - } elseif ($status == 4) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusRequestProcessing'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusRequestProcessing'); - $statusType = 'status3'; } elseif ($alreadypaid == 0) { $labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid'); @@ -1197,13 +1189,6 @@ abstract class CommonInvoice extends CommonObject // Default description used for label of event. Will be overwrite by another value later. $description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; - - $result =$this->setStatut($this::STATUS_PROCESSING); - if ($result < 0) { - $error++; - $errorforinvoice++; - $this->errors[] = 'Error on invoice status change to processing'; - } } $object = $this; @@ -1457,24 +1442,42 @@ abstract class CommonInvoice extends CommonObject } // TODO Create a prelevement_bon and set its status to sent instead of this - $idtransferfile = 0; - - // Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon - $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET"; - $sql .= " traite = 1,"; // TODO Remove this - $sql .= " date_traite = '".$this->db->idate(dol_now())."'"; // TODO Remove this - if ($idtransferfile > 0) { - $sql .= " fk_prelevement_bons = ".((int) $idtransferfile); - } - $sql .= " WHERE rowid = ".((int) $did); - - - dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this).'::makeStripeSepaRequest Erreur'); + $bon = new BonPrelevement($db); + $nbinvoices = $bon->create(); + if ($nbinvoices <= 0) { $error++; + $errorforinvoice++; + dol_syslog("Error on BonPrelevement creation", LOG_ERR); + $this->errors[] = "Error on BonPrelevement creation"; + } + + $result = $bon->set_infotrans($user, $now, 'internet'); + if ($result < 0) { + $error++; + $errorforinvoice++; + dol_syslog("Error on BonPrelevement creation", LOG_ERR); + $this->errors[] = "Error on BonPrelevement creation"; + } + + if (!$errorforinvoice) { + $idtransferfile = $bon->id; + // Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET"; + $sql .= " traite = 1,"; // TODO Remove this + $sql .= " date_traite = '".$this->db->idate(dol_now())."',"; // TODO Remove this + if ($idtransferfile > 0) { + $sql .= " fk_prelevement_bons = ".((int) $idtransferfile); + } + $sql .= " WHERE rowid = ".((int) $did); + + + dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::makeStripeSepaRequest Erreur'); + $error++; + } } } else { $this->error = 'WithdrawRequestErrorNilAmount'; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 40adce33c66..183620c72da 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -148,8 +148,6 @@ BillShortStatusNotPaid=Not paid BillShortStatusNotRefunded=Not refunded BillShortStatusClosedUnpaid=Closed BillShortStatusClosedPaidPartially=Paid (partially) -BillStatusRequestProcessing=Payment request processing -BillShortStatusRequestProcessing=Processing PaymentStatusToValidShort=To validate ErrorVATIntraNotConfigured=Intra-Community VAT number not yet defined ErrorNoPaiementModeConfigured=No default payment type defined. Go to Invoice module setup to fix this. diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index b41149a88f8..de4ed61f802 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -43,9 +43,9 @@ require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; @@ -399,6 +399,52 @@ if ($event->type == 'payout.created') { $errorforinvoice++; } } + + if (!$errorforinvoice && isModEnabled('prelevement')) { //TEST IPN + $bon = new BonPrelevement($db); + $idbon = 0; + $sql = "SELECT dp.fk_prelevement_bons as idbon"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as dp"; + $sql .= " WHERE dp.fk_facture = '".$db->escape($invoice_id)."'"; + $sql .= " AND dp.sourcetype = 'facture'"; + $sql .= " AND dp.traite = 1"; + $result = $db->query($sql); + if ($result) { + if ($db->num_rows($result)) { + $obj = $db->fetch_object($result); + $idbon = $obj->idbon; + } + } else { + $postactionmessages[] = $db->lasterror(); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } + + if (!empty($idbon)) { + $bon->fetch($idbon); + $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons "; + $sql .= " SET fk_user_credit = ".$user->id; + $sql .= ", statut = ".$bon::STATUS_CREDITED; + $sql .= ", date_credit = '".$db->idate($now)."'"; + $sql .= ", credite = 1"; + $sql .= " WHERE rowid=".((int) $bon->id); + $sql .= " AND entity = ".((int) $bon->entity); + $sql .= " AND statut = ".$bon::STATUS_TRANSFERED; + + $db->begin(); + $result = $db->query($sql); + if (!$result) { + $db->rollback(); + $postactionmessages[] = $db->lasterror(); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $db->commit(); + } + } + } } elseif ($event->type == 'payment_intent.payment_failed') { // TODO: Redirect to paymentko.php } elseif ($event->type == 'checkout.session.completed') { // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). From 457e6883e249938eee7ac1d0f1a4164a337fb5ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 15:34:47 +0100 Subject: [PATCH 058/572] Fix excessive hooks log --- htdocs/core/ajax/selectsearchbox.php | 1 - htdocs/core/class/hookmanager.class.php | 6 +++++- htdocs/main.inc.php | 14 +++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 38c363654d3..d2379f46966 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -58,7 +58,6 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; -//global $hookmanager; $hookmanager->initHooks(array('searchform')); $search_boxvalue = GETPOST('q', 'restricthtml'); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 191887e1725..c9c559fce41 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -127,6 +127,7 @@ class HookManager } } } + // Log the init of hook but only for hooks thare are declared to be managed if (count($arraytolog) > 0) { dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG); } @@ -275,7 +276,10 @@ class HookManager $actionclassinstance->error = 0; $actionclassinstance->errors = array(); - dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG); + if (getDolGlobalInt('MAIN_DEBUG_SHOW_EACH_QUALIFIED_HOOK_CALL') >= 2) { + // This his too much verbose, enabled in develop only + dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG); + } // Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; // Note: The hook can use the $currentcontext in its code to avoid to be ran twice or be ran for one given context only diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 37d018a21ce..f476c9bafed 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2870,14 +2870,9 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ if (empty($conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { // Instantiate hooks for external modules - $hookmanager->initHooks(array('searchform', 'leftblock')); + $hookmanager->initHooks(array('leftblock')); print "\n".''."\n".'
'."\n"; - - if ($conf->browser->layout == 'phone') { - $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? - } - print "\n"; if (!is_object($form)) { @@ -2885,9 +2880,14 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ } $selected = -1; if (empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { + // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? + if ($conf->browser->layout == 'phone') { + $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; + } + $usedbyinclude = 1; $arrayresult = null; - include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult + include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This make initHooks('searchform') then set $arrayresult if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) { $searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, '', 1, 0, (empty($conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY) ? 1 : 0), 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1); From d183773ace1f036f1d128294e6c1ac3795031b05 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:34:56 +0100 Subject: [PATCH 059/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 124 --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 39763375fd2..96924f3bdd0 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -121,7 +121,7 @@ $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($ $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); $usercancreatemargin = $user->hasRight("margins", "creer"); $usercanreadallmargin = $user->hasRight("margins", "liretous"); -$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; +$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons","creer"); $now = dol_now(); From 1d9afa4808a64794970a9baaa52a06dc5ececc45 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 10 Feb 2023 14:45:03 +0000 Subject: [PATCH 060/572] Fixing style errors. --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 96924f3bdd0..06e9a762bca 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -121,7 +121,7 @@ $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($ $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); $usercancreatemargin = $user->hasRight("margins", "creer"); $usercanreadallmargin = $user->hasRight("margins", "liretous"); -$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons","creer"); +$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons", "creer"); $now = dol_now(); From fb4077ef95de43de60990235a979c1c2d9fc2f58 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 10 Feb 2023 16:07:55 +0100 Subject: [PATCH 061/572] Remove double code --- htdocs/core/photos_resize.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index efbb3ba9c19..9bb974d75b3 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -453,7 +453,6 @@ if ($action == 'confirm_crop') { if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); } - $result = $ecmfile->create($user); } if ($backtourl) { From 89f3ba1a322c4949ab741a5bbf5d8736482460ae Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 10 Feb 2023 16:12:24 +0100 Subject: [PATCH 062/572] fix ipn --- htdocs/public/stripe/ipn.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index de4ed61f802..ad51e37c310 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -400,7 +400,7 @@ if ($event->type == 'payout.created') { } } - if (!$errorforinvoice && isModEnabled('prelevement')) { //TEST IPN + if (!$errorforinvoice && isModEnabled('prelevement')) { $bon = new BonPrelevement($db); $idbon = 0; $sql = "SELECT dp.fk_prelevement_bons as idbon"; @@ -423,13 +423,12 @@ if ($event->type == 'payout.created') { if (!empty($idbon)) { $bon->fetch($idbon); - $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons "; + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $sql .= " SET fk_user_credit = ".$user->id; $sql .= ", statut = ".$bon::STATUS_CREDITED; $sql .= ", date_credit = '".$db->idate($now)."'"; $sql .= ", credite = 1"; $sql .= " WHERE rowid=".((int) $bon->id); - $sql .= " AND entity = ".((int) $bon->entity); $sql .= " AND statut = ".$bon::STATUS_TRANSFERED; $db->begin(); From 8299501800d27661caf468133979f14c91a27c8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:14:32 +0100 Subject: [PATCH 063/572] Fix subrequest inside a loop --- htdocs/core/class/commonobject.class.php | 7 ++-- htdocs/projet/list.php | 49 ++++++++++++++++-------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b5bcbe3ef8f..38202a0938a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1354,12 +1354,13 @@ abstract class CommonObject * * @param int $statusoflink Status of links to get (-1=all). Not used. * @param string $source Source of contact: 'external' or 'thirdparty' (llx_socpeople) or 'internal' (llx_user) - * @param int $list 0:Return array contains all properties, 1:Return array contains just id + * @param int $list 0:Returned array contains all properties, 1:Return array contains just id * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @param int $status Status of user or company + * @param array $arrayoftcids Array with ID of type of contacts. If we provide this, we can make a ec.fk_c_type_contact in ($arrayoftcids) to avoid link on tc table. TODO Not implemented. * @return array|int Array of contacts, -1 if error */ - public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1) + public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $typecontectids = array()) { // phpcs:enable global $langs; @@ -1401,7 +1402,7 @@ abstract class CommonObject $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople } } - $sql .= " AND tc.active=1"; + $sql .= " AND tc.active = 1"; if ($statusoflink >= 0) { $sql .= " AND ec.statut = ".((int) $statusoflink); } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 32192114a4c..6574cf8d09d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1331,6 +1331,7 @@ while ($i < $imaxinloop) { $userAccess = $object->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { + // Thirdparty $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->name_alias = $obj->alias; @@ -1343,6 +1344,21 @@ while ($i < $imaxinloop) { $companystatic->town = $obj->town; $companystatic->country_code = $obj->country_code; + // Author + $userstatic->id = $obj->fk_user_creat; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + print ''; // Action column @@ -1496,12 +1512,25 @@ while ($i < $imaxinloop) { if (!empty($numcontact)) { foreach ($tab as $contactproject) { //var_dump($contacttask); + $cid = $contactproject['id']; if ($source == 'internal') { - $c = new User($db); + if (empty($conf->cache['user'][$cid])) { + $c = new User($db); + $c->fetch($cid); + $conf->cache['user'][$cid] = $c; + } else { + $c = $conf->cache['user'][$cid]; + } } else { - $c = new Contact($db); + if (empty($conf->cache['contact'][$cid])) { + $c = new Contact($db); + $c->fetch($cid); + $conf->cache['contact'][$cid] = $c; + } else { + $c = $conf->cache['contact'][$cid]; + } } - $c->fetch($contactproject['id']); + if (!empty($c->photo)) { if (get_class($c) == 'User') { print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst')); @@ -1703,20 +1732,6 @@ while ($i < $imaxinloop) { $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth'; } } - // Author - $userstatic->id = $obj->fk_user_creat; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; if (!empty($arrayfields['u.login']['checked'])) { print ''; From 36b0b7f03cd4cb380683466a884067d4d3874afd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:15:05 +0100 Subject: [PATCH 064/572] Fix somes subrequests inside the loop --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 38202a0938a..9eb66fa0745 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1360,7 +1360,7 @@ abstract class CommonObject * @param array $arrayoftcids Array with ID of type of contacts. If we provide this, we can make a ec.fk_c_type_contact in ($arrayoftcids) to avoid link on tc table. TODO Not implemented. * @return array|int Array of contacts, -1 if error */ - public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $typecontectids = array()) + public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $arrayoftcids = array()) { // phpcs:enable global $langs; From bc0b0514bb4547885d1b27eb682f51d54b2a0a7d Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 10 Feb 2023 16:29:39 +0100 Subject: [PATCH 065/572] fix Ci --- htdocs/public/stripe/ipn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index ad51e37c310..2c93654829b 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -425,11 +425,11 @@ if ($event->type == 'payout.created') { $bon->fetch($idbon); $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $sql .= " SET fk_user_credit = ".$user->id; - $sql .= ", statut = ".$bon::STATUS_CREDITED; + $sql .= ", statut = '".$db->escape($bon::STATUS_CREDITED)."'"; $sql .= ", date_credit = '".$db->idate($now)."'"; $sql .= ", credite = 1"; $sql .= " WHERE rowid=".((int) $bon->id); - $sql .= " AND statut = ".$bon::STATUS_TRANSFERED; + $sql .= " AND statut = '".$db->escape($bon::STATUS_TRANSFERED)."'"; $db->begin(); $result = $db->query($sql); From a3d32fc7eb8bb0f7c590552aefb8ba43cb0bcfeb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:53:16 +0100 Subject: [PATCH 066/572] Trans --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 6f09e734406..f494dddb082 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1005,7 +1005,7 @@ if ($type == Categorie::TYPE_PROJECT) { print ''; print ''; print ''; print ''; From 0235e24e0e6d1f01e8d9b8097a35aacad4fa67e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 17:54:07 +0100 Subject: [PATCH 067/572] Fix css multiseclect --- htdocs/core/class/html.form.class.php | 9 +++++++-- htdocs/theme/eldy/global.inc.php | 8 ++++++++ htdocs/theme/md/style.css.php | 8 ++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6f0023548b9..1a15abe53bc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8408,8 +8408,13 @@ class Form } } - // Try also magic suggest - $out .= ''."\n"; if (is_array($array) && !empty($array)) { if ($value_as_key) { $array = array_combine($array, $array); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 8f7d4b1ef1e..12d068168d0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6514,6 +6514,14 @@ ul.select2-results__options li { font-size: 0.95em; } +select.multiselectononeline { + padding: 0; + vertical-align: middle; + height: 28px !important; + opacity: 0; + /* width: 1px !important; */ +} + @media only screen and (min-width: 767px) { /* CSS to have the dropdown boxes larger that the input search area */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6d56e452898..20349be0b4e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6421,6 +6421,14 @@ ul.select2-results__options li { font-size: 0.95em; } +select.multiselectononeline { + padding: 0; + vertical-align: middle; + height: 28px !important; + opacity: 0; + /* width: 1px !important; */ +} + @media only screen and (min-width: 767px) { /* CSS to have the dropdown boxes larger that the input search area */ From c21be771f87ea516ede1f2cd3cebccc8e614a295 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 18:05:05 +0100 Subject: [PATCH 068/572] CSS --- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 12d068168d0..23bb38e8d5a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6517,6 +6517,7 @@ ul.select2-results__options li { select.multiselectononeline { padding: 0; vertical-align: middle; + min-height: unset; height: 28px !important; opacity: 0; /* width: 1px !important; */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 20349be0b4e..8c2934fb227 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6424,6 +6424,7 @@ ul.select2-results__options li { select.multiselectononeline { padding: 0; vertical-align: middle; + min-height: unset; height: 28px !important; opacity: 0; /* width: 1px !important; */ From 211bda455d18e9e4d95d24097fe1b534202e026f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:00:44 +0100 Subject: [PATCH 069/572] Debug v17 --- htdocs/core/js/lib_notification.js.php | 35 ++++++++++++++++++-------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index d7e1932ca27..c33dbe2a3bd 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -66,6 +66,8 @@ print "jQuery(document).ready(function () {\n"; print ' var nowtime = Date.now();'; print ' var time_auto_update = '.max(1, getDolGlobalInt('MAIN_BROWSER_NOTIFICATION_FREQUENCY')).';'."\n"; // Always defined print ' var time_js_next_test;'."\n"; +print ' var dolnotif_nb_test_for_page = 0;'."\n"; +print ' var dolnotif_idinterval = null;'."\n"; ?> /* Check if Notification is supported */ @@ -82,7 +84,7 @@ if ("Notification" in window) { //var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds var time_first_execution = global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>; - setTimeout(first_execution, time_first_execution * 1000); + setTimeout(first_execution, time_first_execution * 1000); // Launch a first execution after a time_first_execution delay time_js_next_test = nowtime + time_first_execution; console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_check = "+time_js_next_test); } else { @@ -91,14 +93,16 @@ if ("Notification" in window) { function first_execution() { - console.log("Call first_execution then set repeat time to time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update); - check_events(); //one check before setting the new time for other checks - setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events + console.log("Call first_execution"); + result = check_events(); //one check before setting the new time for other checks + if (result > 0) { + console.log("Program a repeated run with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); + dolnotif_idinterval = setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events. time_auto_update=nb of seconds + } } function check_events() { - if (Notification.permission === "granted") - { + if (Notification.permission === "granted") { var currentToken = 'notrequired'; const allMeta = document.getElementsByTagName("meta"); for (let i = 0; i < allMeta.length; i++) { @@ -108,7 +112,9 @@ function check_events() { } } time_js_next_test += time_auto_update; - console.log("Call ajax to check events with time_js_next_test = "+time_js_next_test); + dolnotif_nb_test_for_page += 1; + + console.log("Call ajax to check events with time_js_next_test = "+time_js_next_test+" dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page); $.ajax("", { type: "post", // Usually post or get @@ -188,10 +194,17 @@ function check_events() { } } }); - } - else - { - console.log("Cancel check_events. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + + if (dolnotif_nb_test_for_page > 10) { + console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); + clearInterval(dolnotif_idinterval); + } + + return 1; + } else { + console.log("Cancel check_events and timer. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + + return 0; } } Date: Fri, 10 Feb 2023 19:08:03 +0100 Subject: [PATCH 070/572] Log --- htdocs/core/js/lib_notification.js.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index c33dbe2a3bd..2659b812bc6 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -93,7 +93,7 @@ if ("Notification" in window) { function first_execution() { - console.log("Call first_execution"); + console.log("Call first_execution of check_events()"); result = check_events(); //one check before setting the new time for other checks if (result > 0) { console.log("Program a repeated run with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); @@ -190,12 +190,12 @@ function check_events() { data: { time_js_next_test: time_js_next_test, token: currentToken } }); } else { - console.log("No reminder to do found, next search at "+time_js_next_test); + console.log("No remind to do found, next search at "+time_js_next_test); } } }); - if (dolnotif_nb_test_for_page > 10) { + if (dolnotif_nb_test_for_page > 5) { console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); clearInterval(dolnotif_idinterval); } From 582cb35ae4fed24edf935950788ee7537174f252 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:15:14 +0100 Subject: [PATCH 071/572] Fix allow time to answer notification permission --- htdocs/core/js/lib_notification.js.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 2659b812bc6..9724dc8c447 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -96,7 +96,7 @@ function first_execution() { console.log("Call first_execution of check_events()"); result = check_events(); //one check before setting the new time for other checks if (result > 0) { - console.log("Program a repeated run with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); + console.log("check_events() is scheduled as a repeated task with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); dolnotif_idinterval = setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events. time_auto_update=nb of seconds } } @@ -204,7 +204,7 @@ function check_events() { } else { console.log("Cancel check_events and timer. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); - return 0; + return 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } } Date: Fri, 10 Feb 2023 19:15:54 +0100 Subject: [PATCH 072/572] Log --- htdocs/core/js/lib_notification.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 9724dc8c447..67423200405 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -202,7 +202,7 @@ function check_events() { return 1; } else { - console.log("Cancel check_events and timer. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + console.log("Cancel check_events. Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); return 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } From 78201454e8e1fe8cc14a52b771e1e44d832d3b2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:19:11 +0100 Subject: [PATCH 073/572] Fix stop of timer is done also when checks fail --- htdocs/core/js/lib_notification.js.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 67423200405..102f760122a 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -102,6 +102,9 @@ function first_execution() { } function check_events() { + var result = 0; + dolnotif_nb_test_for_page += 1; + if (Notification.permission === "granted") { var currentToken = 'notrequired'; const allMeta = document.getElementsByTagName("meta"); @@ -112,7 +115,6 @@ function check_events() { } } time_js_next_test += time_auto_update; - dolnotif_nb_test_for_page += 1; console.log("Call ajax to check events with time_js_next_test = "+time_js_next_test+" dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page); @@ -195,17 +197,19 @@ function check_events() { } }); - if (dolnotif_nb_test_for_page > 5) { - console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); - clearInterval(dolnotif_idinterval); - } - - return 1; + result = 1; } else { - console.log("Cancel check_events. Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + console.log("Cancel check_events() with dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page+". Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); - return 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) + result = 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } + + if (dolnotif_nb_test_for_page > 5) { + console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); + clearInterval(dolnotif_idinterval); + } + + return result; } Date: Fri, 10 Feb 2023 19:24:50 +0100 Subject: [PATCH 074/572] Fix end of loop --- htdocs/core/js/lib_notification.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 102f760122a..c2f7096432f 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -204,7 +204,7 @@ function check_events() { result = 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } - if (dolnotif_nb_test_for_page > 5) { + if (dolnotif_nb_test_for_page >= 5) { console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); clearInterval(dolnotif_idinterval); } From 23b4e999fbeabad0eba22b782cf497e6a2aacbfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:44:34 +0100 Subject: [PATCH 075/572] Better sql for unique index --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index bee0477665f..f4b7689d6df 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -688,7 +688,7 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year')); DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year'); -ALTER TABLE llx_takepos_floor_tables ADD UNIQUE uk_takepos_floor_tables (entity,label); +ALTER TABLE llx_takepos_floor_tables ADD UNIQUE INDEX uk_takepos_floor_tables (entity,label); ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255); ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128); From ba1d3c9d8c6d56c691d4f36054aa446a12184bc5 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Fri, 10 Feb 2023 19:49:51 +0100 Subject: [PATCH 076/572] Update llx_accounting_account_fr.sql If you import this by hand, a key violation occurs. the 3352 account is named 3552, which collides which the 3552 below. I propose to fix that easily ;) --- htdocs/install/mysql/data/llx_accounting_account_fr.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_fr.sql b/htdocs/install/mysql/data/llx_accounting_account_fr.sql index 4520969f82b..4c24d63e5b1 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_fr.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_fr.sql @@ -824,7 +824,7 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5317,'PCG14-DEV','STOCK','3312',5315,'Produits en cours P 2','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5318,'PCG14-DEV','STOCK','335',5314,'Travaux en cours','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5319,'PCG14-DEV','STOCK','3351',5318,'Travaux en cours T 1','1'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5320,'PCG14-DEV','STOCK','3552',5318,'Travaux en cours T 2','1'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5320,'PCG14-DEV','STOCK','3352',5318,'Travaux en cours T 2','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5321,'PCG14-DEV','STOCK','34',5969,'En-cours de production de services','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5322,'PCG14-DEV','STOCK','341',5321,'Etudes en cours','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5323,'PCG14-DEV','STOCK','3411',5322,'Etudes en cours E 1','1'); From 9c706061bea8a5011dd273edee6bd815c3fe49aa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 11 Feb 2023 08:48:09 +0100 Subject: [PATCH 077/572] FIX Object of class LDAP\Connection could not be converted to string --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 7b3c6c4ac2c..847a1bf32e3 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1058,7 +1058,7 @@ class Ldap if (is_array($attributeArray)) { // Return list with required fields $attributeArray = array_values($attributeArray); // This is to force to have index reordered from 0 (not make ldap_search fails) - dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")"); + dol_syslog(get_class($this)."::getRecords connection=".get_resource_type($this->connection)." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")"); //var_dump($attributeArray); $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray); } else { From 8a091de9d79e0c12608626a1099e4a45a571abc7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 11 Feb 2023 10:06:18 +0100 Subject: [PATCH 078/572] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/class/facture.class.php on line 1264 --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9b93721ca6a..161087a3bf9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1261,7 +1261,7 @@ class Facture extends CommonInvoice $object->ref_client = ''; $object->close_code = ''; $object->close_note = ''; - if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING == 1) { + if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) { $object->note_private = ''; $object->note_public = ''; } From 8d531d92df2db14f1340563ff595015e81a740a3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 11 Feb 2023 10:20:30 +0100 Subject: [PATCH 079/572] fix : typo and translation --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3aa43556e43..a9d9e040ec8 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4327,7 +4327,7 @@ if ($action == 'create') { array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)), array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now()) ); - // Ask confirmatio to clone + // Request confirmation to clone $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250); } From 4a8223ae297b54292f3eab5a3085c4268ea35d99 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 11 Feb 2023 11:59:48 +0100 Subject: [PATCH 080/572] FIX look and feel --- htdocs/core/class/html.form.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1a15abe53bc..a672709cc48 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5115,10 +5115,12 @@ class Form $i = 0; foreach ($input['values'] as $selkey => $selval) { $more .= '
'; - if ($i == 0) { - $more .= '
'.$input['label'].'
'; - } else { - $more .= '
 
'; + if (isset($input['label'])) { + if ($i == 0) { + $more .= '
'.$input['label'].'
'; + } else { + $more .= '
 
'; + } } $more .= '
Date: Sat, 11 Feb 2023 12:28:23 +0100 Subject: [PATCH 081/572] Debug v17 --- htdocs/core/lib/functions.lib.php | 10 ++++--- htdocs/core/menus/standard/eldy.lib.php | 2 +- .../modules/mailings/contacts1.modules.php | 2 +- htdocs/fourn/facture/card.php | 14 ++++----- htdocs/hrm/admin/job_extrafields.php | 2 +- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/compare.php | 2 +- htdocs/hrm/evaluation_agenda.php | 2 +- htdocs/hrm/evaluation_card.php | 2 +- htdocs/hrm/evaluation_contact.php | 2 +- htdocs/hrm/evaluation_document.php | 2 +- htdocs/hrm/evaluation_note.php | 2 +- htdocs/hrm/job_list.php | 2 +- htdocs/hrm/lib/hrm_job.lib.php | 2 +- htdocs/hrm/position_agenda.php | 2 +- htdocs/hrm/position_card.php | 2 +- htdocs/hrm/position_document.php | 2 +- htdocs/hrm/position_note.php | 2 +- htdocs/langs/en_US/hrm.lang | 6 ++-- htdocs/user/list.php | 30 +++++++++++++++++-- 21 files changed, 60 insertions(+), 34 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 37949215357..0f42862b724 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4098,7 +4098,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'gears', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', - 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', + 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'jobprofile', + 'knowledgemanagement', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'off', 'on', 'order', @@ -4113,7 +4114,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'technic', 'ticket', 'error', 'warning', 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'replacement', 'resource', 'recurring','rss', - 'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', + 'shapes', 'skill', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', 'uncheck', 'url', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'world', 'private', 'conferenceorbooth', 'eventorganization', @@ -4145,7 +4146,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'email'=>'at', 'establishment'=>'building', 'edit'=>'pencil-alt', 'entity'=>'globe', 'graph'=>'chart-line', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle', 'generic'=>'file', 'holiday'=>'umbrella-beach', - 'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'line'=>'bars', 'loan'=>'money-bill-alt', + 'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'jobprofile'=>'cogs', + 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'line'=>'bars', 'loan'=>'money-bill-alt', 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', @@ -4161,7 +4163,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'region'=>'map-marked', 'replacement'=>'exchange-alt', 'resource'=>'laptop-house', 'recurring'=>'history', 'service'=>'concierge-bell', - 'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', + 'skill'=>'shapes', 'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', 'supplier'=>'building', 'technic'=>'cogs', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d04cf9edc1a..b534a998107 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2270,7 +2270,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read')); // Job (Description of work to do and skills required) - $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsProfiles"), 1, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->hasRight('hrm', 'all', 'write')); //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read')); diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 36be5bf40b3..71cbe6e6199 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -463,7 +463,7 @@ class mailing_contacts1 extends MailingTargets 'other' => ($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'. ($langs->transnoentities("UserTitle").'='.($obj->civility_id ? $langs->transnoentities("Civility".$obj->civility_id) : '')).';'. - ($langs->transnoentities("JobPosition").'='.$obj->jobposition), + ($langs->transnoentities("PostOrFunction").'='.$obj->jobposition), 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, 'source_type' => 'contact' diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 7eedcc29403..246f65c19f9 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2199,7 +2199,7 @@ if ($action == 'create') { // Standard invoice print '
'; $tmp = ' '; - $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($tmp.'', $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; @@ -2377,7 +2377,7 @@ if ($action == 'create') { }); }); '; - $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk").' '; + $text = $tmp.' '; // $text.=''; $text .= '
'; - // Payment term print ''; + // Due date + print ''; + // Payment mode print '
'; - print $langs->trans("AddProjectIntoCategory").'  '; + print $langs->trans("AddObjectIntoCategory").'  '; $form->selectProjects('', 'elemid'); print '
'.$langs->trans('DateMaxPayment').''; - print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); - print '
'.$langs->trans('PaymentConditionsShort').''; print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ?GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print '
'.$langs->trans('DateMaxPayment').''; + print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); + print '
'.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); diff --git a/htdocs/hrm/admin/job_extrafields.php b/htdocs/hrm/admin/job_extrafields.php index 6ac0773c00f..8b30b1c7051 100644 --- a/htdocs/hrm/admin/job_extrafields.php +++ b/htdocs/hrm/admin/job_extrafields.php @@ -67,7 +67,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject = $langs->transnoentitiesnoconv("JobPosition"); +$textobject = $langs->transnoentitiesnoconv("JobProfile"); $help_url = ''; $page_name = "HrmSetup"; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 51f8c8bc985..039888258b8 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -119,7 +119,7 @@ class Evaluation extends CommonObject 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'default'=>0, 'visible'=>5, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '6' => 'Closed'),), 'date_eval' => array('type'=>'date', 'label'=>'DateEval', 'enabled'=>'1', 'position'=>502, 'notnull'=>1, 'visible'=>1,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php:0', 'label'=>'User', 'enabled'=>'1', 'position'=>504, 'notnull'=>1, 'visible'=>1,), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobProfile', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), ); public $rowid; public $ref; diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index b685147a9b9..27c7643abe5 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -110,7 +110,7 @@ class Position extends CommonObject 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobProfile', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), 'abort_comment' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'getDolGlobalInt("HRM_JOB_POSITON_ENDING_COMMENT")', 'position'=>502, 'notnull'=>0, 'visible'=>1,), diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index beee61ca6fa..a9fbb3a1903 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -155,7 +155,7 @@ $fk_usergroup1 = GETPOST('fk_usergroup1'); $TJobs[$j->id] = $j->label; } - print $form->selectarray('fk_job', $TJobs, $fk_job, 1); + print img_picto('', 'jobprofile', 'class="pictofixedwidth"').$form->selectarray('fk_job', $TJobs, $fk_job, 1); ?>
diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index cc314bd9bce..31607e01b28 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -158,7 +158,7 @@ if ($object->id > 0) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 101873a69e4..8f513d654f3 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -410,7 +410,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index 4ea2e8e81be..c96f562afc7 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -145,7 +145,7 @@ if ($object->id) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 84bc6023291..7935ea7602c 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -138,7 +138,7 @@ if ($object->id) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 3f0d41e946a..1164a9642b1 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -113,7 +113,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 6cb1a4bf62c..0261c968d4c 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -207,7 +207,7 @@ $now = dol_now(); //$help_url="EN:Module_Job|FR:Module_Job_FR|ES:Módulo_Job"; $help_url = ''; -$title = $langs->trans("JobsPosition"); +$title = $langs->trans("JobsProfiles"); $morejs = array(); $morecss = array(); diff --git a/htdocs/hrm/lib/hrm_job.lib.php b/htdocs/hrm/lib/hrm_job.lib.php index 6a948b00439..cff07ef5e67 100644 --- a/htdocs/hrm/lib/hrm_job.lib.php +++ b/htdocs/hrm/lib/hrm_job.lib.php @@ -40,7 +40,7 @@ function jobPrepareHead($object) $head = array(); $head[$h][0] = DOL_URL_ROOT."/hrm/job_card.php?id=".$object->id; - $head[$h][1] = $langs->trans("JobPosition"); + $head[$h][1] = $langs->trans("JobProfile"); $head[$h][2] = 'job_card'; $h++; diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index af60ddea1b8..210f8974b68 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -158,7 +158,7 @@ if ($object->id > 0) { $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index fae9efd76ba..9004e8d2b13 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -288,7 +288,7 @@ function displayPositionCard(&$object) $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref); diff --git a/htdocs/hrm/position_document.php b/htdocs/hrm/position_document.php index 521d6b0ec24..60c0e87c788 100644 --- a/htdocs/hrm/position_document.php +++ b/htdocs/hrm/position_document.php @@ -136,7 +136,7 @@ if ($object->id) { $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/position_note.php b/htdocs/hrm/position_note.php index a09b0e99699..fba8cd2067c 100644 --- a/htdocs/hrm/position_note.php +++ b/htdocs/hrm/position_note.php @@ -111,7 +111,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 592009b8697..475e11131f4 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -26,8 +26,8 @@ HRM_DEFAULT_SKILL_DESCRIPTION=Default description of ranks when skill is created deplacement=Shift DateEval=Evaluation date JobCard=Job card -JobPosition=Job profile -JobsPosition=Job profiles +JobProfile=Job profile +JobsProfiles=Job profiles NewSkill=New Skill SkillType=Skill type Skilldets=List of ranks for this skill @@ -53,7 +53,7 @@ EmployeePositions=Employee positions EmployeesInThisPosition=Employees in this position group1ToCompare=Usergroup to analyze group2ToCompare=Second usergroup for comparison -OrJobToCompare=Compare to job skills requirements +OrJobToCompare=Compare to skill requirements of a job profile difference=Difference CompetenceAcquiredByOneOrMore=Competence acquired by one or more users but not requested by the second comparator MaxlevelGreaterThan=Max level greater than the one requested diff --git a/htdocs/user/list.php b/htdocs/user/list.php index d3139b438e2..a269a93fb7b 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -131,6 +131,7 @@ $arrayfields = array( 'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35), 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(!empty($conf->api->enabled) && $user->admin)), 'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), + 'u.job'=>array('label'=>"PostOrFunction", 'checked'=>-1, 'position'=>50), 'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>(!empty($conf->salaries->enabled) && $user->hasRight("salaries", "readall"))), 'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100), 'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110), @@ -159,6 +160,7 @@ $search_email = GETPOST('search_email', 'alpha'); $search_api_key = GETPOST('search_api_key', 'alphanohtml'); $search_statut = GETPOST('search_statut', 'intcomma'); $search_thirdparty = GETPOST('search_thirdparty', 'alpha'); +$search_job = GETPOST('search_job', 'alpha'); $search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_supervisor = GETPOST('search_supervisor', 'intcomma'); $search_categ = GETPOST("search_categ", 'int'); @@ -250,6 +252,7 @@ if (empty($reshook)) { $search_email = ""; $search_statut = ""; $search_thirdparty = ""; + $search_job = ""; $search_warehouse = ""; $search_supervisor = ""; $search_api_key = ""; @@ -357,7 +360,7 @@ $morehtmlright = ""; // Build and execute select // -------------------------------------------------------------------- $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.office_phone, u.user_mobile, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,"; -$sql .= " u.salary, u.datelastlogin, u.datepreviouslogin,"; +$sql .= " u.job, u.salary, u.datelastlogin, u.datepreviouslogin,"; $sql .= " u.ldap_sid, u.statut as status, u.entity,"; $sql .= " u.tms as date_update, u.datec as date_creation,"; $sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.office_phone as ofice_phone2, u2.user_mobile as user_mobile2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as status2,"; @@ -433,6 +436,9 @@ if ($search_email != '') { if ($search_api_key != '') { $sql .= natural_search("u.api_key", $search_api_key); } +if ($search_job != '') { + $sql .= natural_search(array('u.job'), $search_job); +} if ($search_statut != '' && $search_statut >= 0) { $sql .= " AND u.statut IN (".$db->sanitize($search_statut).")"; } @@ -772,6 +778,9 @@ if (!empty($arrayfields['u.fk_soc']['checked'])) { if (!empty($arrayfields['u.entity']['checked'])) { print ''; } +if (!empty($arrayfields['u.job']['checked'])) { + print ''; +} if (!empty($arrayfields['u.salary']['checked'])) { print ''; } @@ -823,7 +832,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { $totalarray['nbfield']++; } if (!empty($arrayfields['u.login']['checked'])) { - print_liste_field_titre("Login", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['u.lastname']['checked'])) { @@ -871,7 +880,11 @@ if (!empty($arrayfields['u.fk_soc']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['u.entity']['checked'])) { - print_liste_field_titre("Entity", $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['u.entity']['label'], $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['u.job']['checked'])) { + print_liste_field_titre($arrayfields['u.job']['label'], $_SERVER['PHP_SELF'], "u.job", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['u.salary']['checked'])) { @@ -948,6 +961,7 @@ while ($i < $imaxinloop) { $object->status = $obj->status; $object->office_phone = $obj->office_phone; $object->user_mobile = $obj->user_mobile; + $object->job = $obj->job; $object->email = $obj->email; $object->gender = $obj->gender; $object->socid = $obj->fk_soc; @@ -1160,6 +1174,16 @@ while ($i < $imaxinloop) { } } + // Job position + if (!empty($arrayfields['u.job']['checked'])) { + print ''; + print dol_escape_htmltag($obj->job); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Salary if (!empty($arrayfields['u.salary']['checked'])) { print ''; From 1b3b7c93297118d84f23dd86b99401f8daf43c42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 12:34:21 +0100 Subject: [PATCH 082/572] Fix default values --- htdocs/admin/defaultvalues.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 6903571d394..4baddd8b29b 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -147,12 +147,12 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac $object->value=$defaultvalue; $object->entity=$conf->entity; $result=$object->create($user); - if ($result<0) { + if ($result < 0) { $action = ''; setEventMessages($object->error, $object->errors, 'errors'); } else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - $action = ""; + $action = ''; $defaulturl = ''; $defaultkey = ''; $defaultvalue = ''; @@ -324,16 +324,16 @@ print "\n"; print ''; // Page print ''; -print ''; +print ''; print ''."\n"; // Field print ''; -print ''; +print ''; print ''; // Value if ($mode != 'focus' && $mode != 'mandatory') { print ''; - print ''; + print ''; print ''; } // Limit to superadmin From c02113de6a36601ee26af2bc9390da006bd018db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:04:23 +0100 Subject: [PATCH 083/572] Debug v17 --- htdocs/hrm/evaluation_agenda.php | 28 +++++++++------ htdocs/hrm/evaluation_card.php | 2 +- htdocs/hrm/evaluation_contact.php | 2 +- htdocs/hrm/evaluation_document.php | 2 +- htdocs/hrm/evaluation_note.php | 2 +- htdocs/langs/en_US/hrm.lang | 2 +- .../template/myobject_agenda.php | 15 +++++--- htdocs/societe/agenda.php | 35 +++++++++++-------- 8 files changed, 52 insertions(+), 36 deletions(-) diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index 31607e01b28..28f4e33e4d4 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -96,8 +96,10 @@ $permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft); +if (!isModEnabled('hrm')) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); @@ -155,7 +157,7 @@ if ($object->id > 0) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); @@ -196,21 +198,25 @@ if ($object->id > 0) { //$out.="
"; } + $morehtmlright = ''; - print '
'; + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } } - print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { - $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : ''); + print '
'; + + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -218,8 +224,8 @@ if ($object->id > 0) { $param .= '&limit='.urlencode($limit); } - - //print load_fiche_titre($langs->trans("ActionsOnEvaluation"), '', ''); + //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); + print_barre_liste($langs->trans("Actions"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 8f513d654f3..e59ba7db462 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -407,7 +407,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index c96f562afc7..ff41c152080 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -142,7 +142,7 @@ if ($object->id) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 7935ea7602c..a707913c3c3 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -135,7 +135,7 @@ if ($object->id) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 1164a9642b1..ba0ec02d616 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -110,7 +110,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 475e11131f4..b31df5ee605 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -46,7 +46,7 @@ NewEval=New evaluation ValidateEvaluation=Validate evaluation ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with reference %s? EvaluationCard=Evaluation card -RequiredRank=Required rank for this job +RequiredRank=Required rank for the job profile EmployeeRank=Employee rank for this skill EmployeePosition=Employee position EmployeePositions=Employee positions diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index d7b84707b95..5cdcc27eade 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -276,20 +276,25 @@ if ($object->id > 0) { //$out.=""; } + $morehtmlright = ''; - print '
'; + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } } - print '
'; if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + print '
'; + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); @@ -298,8 +303,8 @@ if ($object->id > 0) { $param .= '&limit='.urlencode($limit); } - //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); + print_barre_liste($langs->trans("ActionsOnMyObject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 9e6c10a0ccd..b5d01422782 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -32,6 +32,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Load translation files required by the page $langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); @@ -48,13 +50,6 @@ if (GETPOST('actioncode', 'array')) { $search_agenda_label = GETPOST('search_agenda_label'); -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'societe', $socid, '&societe'); - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -72,9 +67,19 @@ if (!$sortorder) { $sortorder = 'DESC,DESC'; } +// Initialize technical objects +$object = new Societe($db); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendathirdparty')); +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'societe', $socid, '&societe'); + /* * Actions @@ -109,28 +114,28 @@ if (empty($reshook)) { $form = new Form($db); if ($socid > 0) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - - $object = new Societe($db); $result = $object->fetch($socid); $title = $langs->trans("Agenda"); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->name." - ".$title; } - llxHeader('', $title); + $help_url = ''; + llxHeader('', $title, $help_url); if (isModEnabled('notification')) { $langs->load("mails"); } $head = societe_prepare_head($object); - print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company'); + + print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + $morehtmlref = ''; + + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref); print '
'; @@ -202,7 +207,7 @@ if ($socid > 0) { $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module); } } From 216c4f02b6378b64bd5e9f3753ac65d002d08c2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:53:56 +0100 Subject: [PATCH 084/572] Fix bad test --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f476c9bafed..de331c7c3d4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -177,7 +177,7 @@ function testSqlAndScriptInject($val, $type) // We refuse html into html because some hacks try to obfuscate evil strings by inserting HTML into HTML. Example: error=alert(1) to bypass test on onerror $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers - $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like + $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $tmpval); // onmousexxx can be set on img or any html tag like $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval); From d0858d8eaaa434a708d538ddef71299907b65e0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 14:55:46 +0100 Subject: [PATCH 085/572] Debug v17 --- htdocs/core/lib/website2.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 05727a1e539..aa6d4fbec21 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -730,6 +730,7 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) if (!$error) { $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT); $allowimportsite = true; + include DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) { $allowimportsite = false; } From 9e79e00f10c18b75d27dac4739041ac30e5ab1dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 15:19:49 +0100 Subject: [PATCH 086/572] Debug v17 --- htdocs/core/lib/website2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index aa6d4fbec21..e03f711c9c0 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -730,7 +730,7 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) if (!$error) { $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT); $allowimportsite = true; - include DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) { $allowimportsite = false; } From 9bf878a635dab70742f2b7e8332b46c9b10f5d86 Mon Sep 17 00:00:00 2001 From: FLIO Date: Sat, 11 Feb 2023 19:23:32 +0100 Subject: [PATCH 087/572] fix (qodana) delete the edit of the fuction post in the fileupload and edit the comment --- htdocs/core/class/fileupload.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 84ff0a9ed33..75662d57f94 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -484,12 +484,12 @@ class FileUpload /** * Output data * - * @return void + * @return string|void */ public function post() { if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { - echo $this->delete(); + return $this->delete(); } $upload = isset($_FILES[$this->options['param_name']]) ? $_FILES[$this->options['param_name']] : null; @@ -556,7 +556,6 @@ class FileUpload } } header('Content-type: application/json'); - $response = json_encode($success); - return $response; + echo json_encode($success); } } From 67d8c74a609a61aaa58916b8e65c8a206e633f71 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 11 Feb 2023 21:23:40 +0100 Subject: [PATCH 088/572] fix : Warning: Undefined array key price_min_ttc in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card.php on line 2157 --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a9d9e040ec8..7af0f7046f9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2154,7 +2154,7 @@ if (empty($reshook)) { $pu_ht = $datapriceofproduct['pu_ht']; $pu_ttc = $datapriceofproduct['pu_ttc']; $price_min = $datapriceofproduct['price_min']; - $price_min_ttc = $datapriceofproduct['price_min_ttc']; + $price_min_ttc = (isset($datapriceofproduct['price_min_ttc'])) ? $datapriceofproduct['price_min_ttc'] : null; $price_base_type = $datapriceofproduct['price_base_type']; $tva_tx = $datapriceofproduct['tva_tx']; From 92c4eed7c68eb6322e5ce294688b0f3f6340f718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 21:34:21 +0100 Subject: [PATCH 089/572] add ajax tooltip on knowledge record --- htdocs/core/ajax/ajaxtooltip.php | 4 ++ .../class/knowledgerecord.class.php | 59 +++++++++++++++---- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 60220a221ff..3933f03533b 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -163,6 +163,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'opensurvey/class'; $module = 'opensurvey'; $myobject = 'opensurveysondage'; +} elseif ($objecttype == 'knowledgerecord') { + $classpath = 'knowledgemanagement/class'; + $module = 'knowledgemanagement'; + $myobject = 'knowledgerecord'; } // Generic case for $classfile and $classname diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 3f9f1b40223..d5cd5a82a51 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -129,7 +129,15 @@ class KnowledgeRecord extends CommonObject public $fk_user_valid; public $import_key; public $model_pdf; + + /** + * @var string question asked + */ public $question; + + /** + * @var string answer to question + */ public $answer; public $url; public $status; @@ -265,8 +273,8 @@ class KnowledgeRecord extends CommonObject if (property_exists($object, 'ref')) { $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; } - if (property_exists($object, 'label')) { - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; + if (property_exists($object, 'question')) { + $object->question = empty($this->fields['question']['default']) ? $langs->trans("CopyOf")." ".$object->question : $this->fields['question']['default']; } if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; @@ -706,6 +714,32 @@ class KnowledgeRecord extends CommonObject return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'KNOWLEDGERECORD_REOPEN'); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->loadLangs(['knowledgemanagement', 'languages']); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; + if (isset($this->statut)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref; + $datas['question'] = '
'.$langs->trans('Question').': '.$this->question; + $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : ''); + $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -726,12 +760,17 @@ class KnowledgeRecord extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); } - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?id='.$this->id; @@ -752,8 +791,8 @@ class KnowledgeRecord extends CommonObject $label = $langs->trans("ShowKnowledgeRecord"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -774,7 +813,7 @@ class KnowledgeRecord extends CommonObject if (empty($this->showphoto_on_popup)) { if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } } else { if ($withpicto) { From 00898291ed9f23fd3d0fa7fe6bc29f7d0abc0fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 21:49:06 +0100 Subject: [PATCH 090/572] add ajax tooltip on knowledge record --- .../knowledgemanagement/class/knowledgerecord.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index d5cd5a82a51..0d233f37af6 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -735,7 +735,13 @@ class KnowledgeRecord extends CommonObject $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref; $datas['question'] = '
'.$langs->trans('Question').': '.$this->question; $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : ''); - $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; + $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; + // show categories for this record + if (isModEnabled('categorie')) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); + } return $datas; } From f50a43c8822ee1c28da21a12ab88ef3c9bfd7ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 21:58:57 +0100 Subject: [PATCH 091/572] add ajax tooltip on knowledge record --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 0d233f37af6..77493590d9d 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -728,6 +728,7 @@ class KnowledgeRecord extends CommonObject $langs->loadLangs(['knowledgemanagement', 'languages']); $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); @@ -736,8 +737,8 @@ class KnowledgeRecord extends CommonObject $datas['question'] = '
'.$langs->trans('Question').': '.$this->question; $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : ''); $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; - // show categories for this record - if (isModEnabled('categorie')) { + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $form = new Form($this->db); $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); @@ -769,6 +770,8 @@ class KnowledgeRecord extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From beba616f3c90574aa959cd05f87b9d23d993acf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 22:13:15 +0100 Subject: [PATCH 092/572] clean code --- htdocs/api/class/api_documents.class.php | 2 +- htdocs/categories/class/api_categories.class.php | 2 +- .../modules/modKnowledgeManagement.class.php | 4 ++-- .../class/api_knowledgemanagement.class.php | 10 +++++----- .../class/knowledgerecord.class.php | 4 ++-- .../knowledgerecord_agenda.php | 2 +- .../knowledgemanagement/knowledgerecord_card.php | 16 ++++++++-------- .../knowledgerecord_contact.php | 2 +- .../knowledgerecord_document.php | 6 +++--- .../knowledgemanagement/knowledgerecord_list.php | 8 ++++---- .../knowledgemanagement/knowledgerecord_note.php | 4 ++-- htdocs/ticket/index.php | 2 +- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index d4f252bfd43..8dae305a989 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -461,7 +461,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'knowledgemanagement') { require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read') && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index e59ff070aec..2de1f43d071 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -323,7 +323,7 @@ class Categories extends DolibarrApi throw new RestException(401); } elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); - } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index b331c56a917..68754f530b3 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -271,7 +271,7 @@ class modKnowledgeManagement extends DolibarrModules 'langs'=>'knowledgemanagement', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000 + $r, 'enabled'=>'$conf->knowledgemanagement->enabled', // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. - 'perms'=>'1', // Use 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read' if you want your menu with a permission rules + 'perms'=>'1', // Use 'perms'=>'$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')' if you want your menu with a permission rules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); @@ -334,7 +334,7 @@ class modKnowledgeManagement extends DolibarrModules // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->write', + 'perms'=>'$user->hasRight("knowledgemanagement", "knowledgerecord", "write")', 'target'=>'', // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 8232287b23b..0806514b968 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -70,7 +70,7 @@ class KnowledgeManagement extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } @@ -144,7 +144,7 @@ class KnowledgeManagement extends DolibarrApi $obj_ret = array(); $tmpobject = new KnowledgeRecord($this->db); - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } @@ -249,7 +249,7 @@ class KnowledgeManagement extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->write) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { throw new RestException(401); } @@ -282,7 +282,7 @@ class KnowledgeManagement extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->write) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { throw new RestException(401); } @@ -324,7 +324,7 @@ class KnowledgeManagement extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->delete) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete')) { throw new RestException(401); } $result = $this->knowledgerecord->fetch($id); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 77493590d9d..f85b2f8e9cf 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -200,7 +200,7 @@ class KnowledgeRecord extends CommonObject } // Example to show how to set values of fields definition dynamically - /*if ($user->rights->knowledgemanagement->knowledgerecord->read) { + /*if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { $this->fields['myfield']['visible'] = 1; $this->fields['myfield']['noteditable'] = 0; }*/ @@ -538,7 +538,7 @@ class KnowledgeRecord extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->knowledgemanagement->knowledgerecord->write)) + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->knowledgemanagement->knowledgerecord->knowledgerecord_advance->validate)))) { $this->error='NotEnoughPermissions'; diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index e24e23b14e7..6cf8428d06b 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -90,7 +90,7 @@ if ($id > 0 || !empty($ref)) { $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php /* diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 52143048f72..495b095fb4d 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -74,12 +74,12 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read; -$permissiontovalidate = $user->rights->knowledgemanagement->knowledgerecord->write; -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_dellink.inc.php +$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'); +$permissiontovalidate = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissionnote = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->knowledgemanagement->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check - Protection if external user @@ -538,8 +538,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->knowledgemanagement->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->knowledgemanagement->knowledgerecord->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->knowledgemanagement->knowledgerecord->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'); // If you can read, you can build the PDF to read content + $delallowed = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('knowledgemanagement:KnowledgeRecord', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php index 4e557a3e1ae..751cdff5c9e 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_contact.php +++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php @@ -56,7 +56,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); -$permission = $user->rights->knowledgemanagement->knowledgerecord->write; +$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); /* diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index 7430de8a495..8d8fe6ac769 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -81,7 +81,7 @@ if ($id > 0 || !empty($ref)) { $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php @@ -183,9 +183,9 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'knowledgemanagement'; - //$permission = $user->rights->knowledgemanagement->knowledgerecord->write; + //$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); $permission = 1; - //$permtoedit = $user->rights->knowledgemanagement->knowledgerecord->write; + //$permtoedit = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); $permtoedit = 1; $param = '&id='.$object->id; diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 7cd5a24c764..3a916cb96ef 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -140,9 +140,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read; -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; -$permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete; +$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'); +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); +$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete'); // Security check if (empty($conf->knowledgemanagement->enabled)) { @@ -428,7 +428,7 @@ if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (isModEnabled('category') && $user->rights->knowledgemanagement->knowledgerecord->write) { +if (isModEnabled('category') && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index 28a2bcaa9d0..ea1052ccc98 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->knowledgemanagement->multidir_output[$object->entity]."/".$object->id; } -$permissionnote = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_setnotes.inc.php -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 243084ec89f..f75a93f7082 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -65,7 +65,7 @@ $object = new Ticket($db); // Security check //$result = restrictedArea($user, 'ticket|knowledgemanagement', 0, '', '', '', ''); -if (empty($user->rights->ticket->read) && empty($user->rights->knowledgemanagement->knowledgerecord->read)) { +if (empty($user->rights->ticket->read) && !$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { accessforbidden('Not enought permissions'); } From 6144b6e99d973c2c1bb289258c79856470a8eaec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 09:54:57 +0100 Subject: [PATCH 093/572] add two widgets --- .../core/boxes/box_last_knowledgerecord.php | 187 ++++++++++++++++++ .../box_last_modified_knowledgerecord.php | 187 ++++++++++++++++++ .../modules/modKnowledgeManagement.class.php | 14 +- htdocs/langs/en_US/knowledgemanagement.lang | 8 +- 4 files changed, 389 insertions(+), 7 deletions(-) create mode 100644 htdocs/core/boxes/box_last_knowledgerecord.php create mode 100644 htdocs/core/boxes/box_last_modified_knowledgerecord.php diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php new file mode 100644 index 00000000000..20510a5b3b0 --- /dev/null +++ b/htdocs/core/boxes/box_last_knowledgerecord.php @@ -0,0 +1,187 @@ + + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018-2023 Frédéric France + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_last_knowledgerecord.php + * \ingroup knowledgerecord + * \brief This box shows latest created knowledgerecords + */ +require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; + +/** + * Class to manage the box + */ +class box_last_knowledgerecord extends ModeleBoxes +{ + + public $boxcode = "box_last_knowledgerecord"; + public $boximg = "knowledgemanagement"; + public $boxlabel; + public $depends = array("knowledgemanagement"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + public $info_box_head = array(); + public $info_box_contents = array(); + + /** + * Constructor + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param = '') + { + global $langs; + $langs->load("boxes", "languages"); + $this->db = $db; + + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastKnowledgerecord"); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $conf, $user, $langs; + + $this->max = $max; + + require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php"; + + $text = $langs->trans("BoxLastKnowledgerecordDescription", $max); + $this->info_box_head = array( + 'text' => $text, + 'limit' => dol_strlen($text), + ); + + $this->info_box_contents[0][0] = array( + 'td' => 'class="left"', + 'text' => $langs->trans("BoxLastKnowledgerecordContent"), + ); + + if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { + $sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status'; + $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k"; + $sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")"; + + if ($user->socid) { + $sql .= " AND k.fk_soc= ".((int) $user->socid); + } + + $sql.= " AND k.status > 0"; + + $sql .= " ORDER BY k.date_creation DESC, k.rowid DESC "; + $sql .= $this->db->plimit($max, 0); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + $i = 0; + + while ($i < $num) { + $objp = $this->db->fetch_object($resql); + + $datec = $this->db->jdate($objp->date_creation); + + $knowledgerecord = new KnowledgeRecord($this->db); + $knowledgerecord->id = $objp->id; + $knowledgerecord->date_creation = $objp->date_creation; + $knowledgerecord->ref = $objp->ref; + $knowledgerecord->status = $objp->status; + $knowledgerecord->question = $objp->question; + + $r = 0; + + // Ticket + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="nowraponall"', + 'text' => $knowledgerecord->getNomUrl(1), + 'asis' => 1 + ); + $r++; + + // Question + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax200"', + 'text' => ''.dol_escape_htmltag($objp->question).'', + 'url' => DOL_URL_ROOT."/knowledgemanagement/knowledgerecord_card.php?id=".urlencode($objp->id), + ); + $r++; + + // Language + $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : ''); + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax100"', + 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang, + 'asis' => 1, + ); + $r++; + + // Date creation + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', + 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + ); + $r++; + + // Statut + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="right nowraponall"', + 'text' => $knowledgerecord->getLibStatut(3), + ); + $r++; + + $i++; + } + + if ($num == 0) { + $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + } + } else { + dol_print_error($this->db); + } + } else { + $this->info_box_contents[0][0] = array('td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php new file mode 100644 index 00000000000..5e23ee54602 --- /dev/null +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -0,0 +1,187 @@ + + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018-2023 Frédéric France + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_last_modified_knowledgerecord.php + * \ingroup knowledgerecord + * \brief This box shows latest created knowledgerecords + */ +require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; + +/** + * Class to manage the box + */ +class box_last_modified_knowledgerecord extends ModeleBoxes +{ + + public $boxcode = "box_last_modified_knowledgerecord"; + public $boximg = "knowledgemanagement"; + public $boxlabel; + public $depends = array("knowledgemanagement"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + public $info_box_head = array(); + public $info_box_contents = array(); + + /** + * Constructor + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param = '') + { + global $langs; + $langs->load("boxes", "knowledgemanagement", "languages"); + $this->db = $db; + + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedKnowledgerecord"); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $conf, $user, $langs; + + $this->max = $max; + + require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php"; + + $text = $langs->trans("BoxLastModifiedKnowledgerecordDescription", $max); + $this->info_box_head = array( + 'text' => $text, + 'limit' => dol_strlen($text), + ); + + $this->info_box_contents[0][0] = array( + 'td' => 'class="left"', + 'text' => $langs->trans("BoxLastKnowledgerecordContent"), + ); + + if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { + $sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status'; + $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k"; + $sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")"; + + if ($user->socid) { + $sql .= " AND k.fk_soc= ".((int) $user->socid); + } + + $sql.= " AND k.status > 0"; + + $sql .= " ORDER BY k.tms DESC, k.rowid DESC "; + $sql .= $this->db->plimit($max, 0); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + $i = 0; + + while ($i < $num) { + $objp = $this->db->fetch_object($resql); + + $datec = $this->db->jdate($objp->date_creation); + + $knowledgerecord = new KnowledgeRecord($this->db); + $knowledgerecord->id = $objp->id; + $knowledgerecord->date_creation = $objp->date_creation; + $knowledgerecord->ref = $objp->ref; + $knowledgerecord->status = $objp->status; + $knowledgerecord->question = $objp->question; + + $r = 0; + + // Ticket + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="nowraponall"', + 'text' => $knowledgerecord->getNomUrl(1), + 'asis' => 1 + ); + $r++; + + // Question + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax200"', + 'text' => ''.dol_escape_htmltag($objp->question).'', + 'url' => DOL_URL_ROOT."/knowledgemanagement/knowledgerecord_card.php?id=".urlencode($objp->id), + ); + $r++; + + // Language + $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : ''); + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax100"', + 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang, + 'asis' => 1, + ); + $r++; + + // Date creation + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', + 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + ); + $r++; + + // Statut + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="right nowraponall"', + 'text' => $knowledgerecord->getLibStatut(3), + ); + $r++; + + $i++; + } + + if ($num == 0) { + $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + } + } else { + dol_print_error($this->db); + } + } else { + $this->info_box_contents[0][0] = array('td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index 68754f530b3..c372f611c60 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -201,12 +201,14 @@ class modKnowledgeManagement extends DolibarrModules // Boxes/Widgets // Add here list of php file(s) stored in knowledgemanagement/core/boxes that contains a class to show a widget. $this->boxes = array( - // 0 => array( - // 'file' => 'knowledgemanagementwidget1.php@knowledgemanagement', - // 'note' => 'Widget provided by KnowledgeManagement', - // 'enabledbydefaulton' => 'Home', - // ), - // ... + 0 => array( + 'file' => 'box_last_knowledgerecord.php', + 'enabledbydefaulton' => 'ticketindex', + ), + 1 => array( + 'file' => 'box_last_modified_knowledgerecord.php', + 'enabledbydefaulton' => 'ticketindex', + ), ); // Cronjobs (List of cron jobs entries to add when module is enabled) diff --git a/htdocs/langs/en_US/knowledgemanagement.lang b/htdocs/langs/en_US/knowledgemanagement.lang index 38c1624afad..050ecbcc03a 100644 --- a/htdocs/langs/en_US/knowledgemanagement.lang +++ b/htdocs/langs/en_US/knowledgemanagement.lang @@ -51,4 +51,10 @@ SuggestedForTicketsInGroup=Suggested on ticket creation SetObsolete=Set as obsolete ConfirmCloseKM=Do you confirm the closing of this article as obsolete ? -ConfirmReopenKM=Do you want to restore this article to status "Validated" ? \ No newline at end of file +ConfirmReopenKM=Do you want to restore this article to status "Validated" ? +BoxLastKnowledgerecordDescription=Last %s articles +BoxLastKnowledgerecord=Last articles +BoxLastKnowledgerecordContent=Last articles +BoxLastKnowledgerecordModifiedContent=Last modified articles +BoxLastModifiedKnowledgerecordDescription=Last %s modified articles +BoxLastModifiedKnowledgerecord=Last modified articles From daba310395ed40c88b32e38f3858187215bdac2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 11:39:10 +0100 Subject: [PATCH 094/572] clean code --- .../core/boxes/box_last_knowledgerecord.php | 40 ++++++++++++++++--- .../box_last_modified_knowledgerecord.php | 40 ++++++++++++++++--- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php index 20510a5b3b0..13635481341 100644 --- a/htdocs/core/boxes/box_last_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_knowledgerecord.php @@ -30,10 +30,24 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; */ class box_last_knowledgerecord extends ModeleBoxes { - + /** + * @var string boxcode + */ public $boxcode = "box_last_knowledgerecord"; + + /** + * @var string box img + */ public $boximg = "knowledgemanagement"; + + /** + * @var string boc label + */ public $boxlabel; + + /** + * @var array box dependancies + */ public $depends = array("knowledgemanagement"); /** @@ -41,8 +55,19 @@ class box_last_knowledgerecord extends ModeleBoxes */ public $db; + /** + * @var string param + */ public $param; + + /** + * @var array box info heads + */ public $info_box_head = array(); + + /** + * @var array box info content + */ public $info_box_contents = array(); /** @@ -67,7 +92,7 @@ class box_last_knowledgerecord extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs; + global $user, $langs; $this->max = $max; @@ -161,14 +186,19 @@ class box_last_knowledgerecord extends ModeleBoxes } if ($num == 0) { - $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + $this->info_box_contents[$i][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").'', + ); } } else { dol_print_error($this->db); } } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + $this->info_box_contents[0][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'', + ); } } diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php index 5e23ee54602..01ee0771ee1 100644 --- a/htdocs/core/boxes/box_last_modified_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -30,10 +30,24 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; */ class box_last_modified_knowledgerecord extends ModeleBoxes { - + /** + * @var string boxcode + */ public $boxcode = "box_last_modified_knowledgerecord"; + + /** + * @var string box img + */ public $boximg = "knowledgemanagement"; + + /** + * @var string boc label + */ public $boxlabel; + + /** + * @var array box dependancies + */ public $depends = array("knowledgemanagement"); /** @@ -41,8 +55,19 @@ class box_last_modified_knowledgerecord extends ModeleBoxes */ public $db; + /** + * @var string param + */ public $param; + + /** + * @var array box info heads + */ public $info_box_head = array(); + + /** + * @var array box info content + */ public $info_box_contents = array(); /** @@ -67,7 +92,7 @@ class box_last_modified_knowledgerecord extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs; + global $user, $langs; $this->max = $max; @@ -161,14 +186,19 @@ class box_last_modified_knowledgerecord extends ModeleBoxes } if ($num == 0) { - $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + $this->info_box_contents[$i][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").'', + ); } } else { dol_print_error($this->db); } } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + $this->info_box_contents[0][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'', + ); } } From a7c5140fd6c7e366971e8e3ee324c7dcfa9b9dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 12:05:14 +0100 Subject: [PATCH 095/572] clean code --- htdocs/core/boxes/box_last_knowledgerecord.php | 2 +- htdocs/core/boxes/box_last_modified_knowledgerecord.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php index 13635481341..2cb4818d6ac 100644 --- a/htdocs/core/boxes/box_last_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_knowledgerecord.php @@ -171,7 +171,7 @@ class box_last_knowledgerecord extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', - 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'), ); $r++; diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php index 01ee0771ee1..2c5319151fa 100644 --- a/htdocs/core/boxes/box_last_modified_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -171,7 +171,7 @@ class box_last_modified_knowledgerecord extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', - 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'), ); $r++; From 509dfacbf72a1e0562360d0756807f2d1dcb7afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 18:02:58 +0100 Subject: [PATCH 096/572] missing translations --- htdocs/langs/en_US/mrp.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 82cf7c38012..6c8af64f69a 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -119,3 +119,5 @@ BomCantAddChildBom=The nomenclature %s is already present in the tree leading to BOMNetNeeds = BOM Net Needs BOMProductsList=BOM's products BOMServicesList=BOM's services +Manufacturing=Manufacturing +Disassemble=Disassemble From 3a6b8ebfe7142b9960c6c8092b006cb4e2a57cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 18:31:35 +0100 Subject: [PATCH 097/572] clean code --- htdocs/mrp/class/mo.class.php | 51 ++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index ddfd8a7f57b..afdac2d16a8 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -93,7 +93,6 @@ class Mo extends CommonObject * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ - // BEGIN MODULEBUILDER PROPERTIES /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ @@ -126,6 +125,10 @@ class Mo extends CommonObject public $rowid; public $entity; public $ref; + + /** + * @var int mrptype + */ public $mrptype; public $label; public $qty; @@ -154,8 +157,17 @@ class Mo extends CommonObject public $fk_user_modif; public $import_key; public $status; + + /** + * @var int ID of product + */ public $fk_product; + /** + * @var Product product object + */ + public $product; + /** * @var integer|string date_start_planned */ @@ -167,10 +179,20 @@ class Mo extends CommonObject public $date_end_planned; + /** + * @var int ID bom + */ public $fk_bom; - public $fk_project; - // END MODULEBUILDER PROPERTIES + /** + * @var Bom bom + */ + public $bom; + + /** + * @var int ID project + */ + public $fk_project; // If this object has a subtable with lines @@ -204,12 +226,24 @@ class Mo extends CommonObject */ public $lines = array(); + /** + * @var MoLine MO line + */ + public $line = array(); + /** * @var integer Mo parent line * */ + /** + * @var int ID of parent line + */ public $fk_parent_line; + /** + * @var array tpl + */ + public $tpl = array(); /** * Constructor @@ -1100,6 +1134,9 @@ class Mo extends CommonObject if (isset($this->label)) { $datas['label'] = '
'.$langs->trans('Label').': '.$this->label; } + if (isset($this->mrptype)) { + $datas['type'] = '
'.$langs->trans('Type').': '.$this->fields['mrptype']['arrayofkeyval'][$this->mrptype]; + } return $datas; } @@ -1458,7 +1495,7 @@ class Mo extends CommonObject * If lines are into a template, title must also be into a template * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * - * @param CommonObjectLine $line Line + * @param MoLine $line Line * @param string $var Var * @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not) * @param string $defaulttpldir Directory where to find the template @@ -1519,7 +1556,7 @@ class Mo extends CommonObject /** * Function used to return childs of Mo * - * @return array|int array if OK, -1 if KO + * @return Mo[]|int array if OK, -1 if KO */ public function getMoChilds() { @@ -1557,7 +1594,7 @@ class Mo extends CommonObject /** * Function used to return childs of Mo * - * @return Object|int MO object if OK, -1 if KO, 0 if not exist + * @return Mo|int MO object if OK, -1 if KO, 0 if not exist */ public function getMoParent() { @@ -1680,6 +1717,7 @@ class MoLine extends CommonObjectLine public $qty; public $qty_frozen; public $disable_stock_change; + public $efficiency; public $batch; public $role; public $fk_mrp_production; @@ -1689,6 +1727,7 @@ class MoLine extends CommonObjectLine public $fk_user_creat; public $fk_user_modif; public $import_key; + public $fk_parent_line; /** * Constructor From c3425919c2e10a70d7d243f753f2a0324c2a96c0 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:18:39 +0100 Subject: [PATCH 098/572] Update hookmanager.class.php --- htdocs/core/class/hookmanager.class.php | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index bcd5a506946..0e679493ae8 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -166,32 +166,32 @@ class HookManager // TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks. if (in_array($method, array( 'createFrom', - 'dashboardMembers', - 'dashboardEmailings', - 'dashboardPropals', - 'dashboardPropals', - 'dashboardCommercials', - 'dashboardOrders', - 'dashboardSpecialBills', 'dashboardAccountancy', + 'dashboardActivities', + 'dashboardCommercials', 'dashboardContracts', 'dashboardDonation', - 'dashboardWarehouseSendings', + 'dashboardEmailings', 'dashboardExpenseReport', - 'dashboardInterventions', - 'dashboardOrdersSuppliers', 'dashboardHRM', + 'dashboardInterventions', 'dashboardMRP', + 'dashboardMembers', 'dashboardOpensurvey', - 'dashboardWarehouse', + 'dashboardOrders', + 'dashboardOrdersSuppliers', 'dashboardProductServices', - 'dashboardActivities', 'dashboardProjects', - 'dashboardWarehouseReceptions', - 'dashboardThirdparties', + 'dashboardPropals', + 'dashboardPropals', + 'dashboardSpecialBills', 'dashboardSupplierProposal', + 'dashboardThirdparties', 'dashboardTickets', 'dashboardUsersGroups', + 'dashboardWarehouse', + 'dashboardWarehouseReceptions', + 'dashboardWarehouseSendings', 'insertExtraHeader', 'insertExtraFooter', 'printLeftBlock', From 6e3966abaeda0628503250c231c265fbb883ccc1 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:21:11 +0100 Subject: [PATCH 099/572] Update hookmanager.class.php saw now 'dashboardPropals' was twice --- htdocs/core/class/hookmanager.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 0e679493ae8..f973bffba93 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -183,7 +183,6 @@ class HookManager 'dashboardProductServices', 'dashboardProjects', 'dashboardPropals', - 'dashboardPropals', 'dashboardSpecialBills', 'dashboardSupplierProposal', 'dashboardThirdparties', From ffa4e58addc09215dcbe79d540b41bd912acf2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:26:40 +0100 Subject: [PATCH 100/572] fix warning listUsersForGroup with mode = 1 return array of user id --- htdocs/holiday/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 42c64613933..05568e08992 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2020 Laurent Destailleur * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -620,7 +620,7 @@ if ($resql) { $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); $valideurarray = array(); foreach ($valideurobjects as $val) { - $valideurarray[$val->id] = $val->id; + $valideurarray[$val] = $val; } print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); print ''; From 814075d36b943413bc244bfeffa7619a703203e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:28:39 +0100 Subject: [PATCH 101/572] Update view_log.php --- htdocs/holiday/view_log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 4235b7261eb..d0ba35add68 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -336,7 +336,7 @@ if (!empty($arrayfields['cpl.fk_user_action']['checked'])) { $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); $valideurarray = array(); foreach ($valideurobjects as $val) { - $valideurarray[$val->id] = $val->id; + $valideurarray[$val] = $val; } print ''; From af1b9d319474ce70fb1a3f100d4d2aa3c400e91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:48:19 +0100 Subject: [PATCH 102/572] fix warnings --- htdocs/comm/mailing/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 32207425d2a..26e8e6ec63a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -736,9 +736,9 @@ if ($action == 'create') { print ''.$langs->trans("MailTitle").''; - print ''.$langs->trans("MailFrom").''; + print ''.$langs->trans("MailFrom").''; - print ''.$langs->trans("MailErrorsTo").''; + print ''.$langs->trans("MailErrorsTo").''; // Other attributes $parameters = array(); From 4e00810ca63ab843495eb178a5341d8ce88ddcbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:54:28 +0100 Subject: [PATCH 103/572] fix warnings --- htdocs/hrm/evaluation_list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index 999d6d0d44e..adf642597f2 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -134,13 +134,13 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->hrm->evaluation->read; -$permissiontoreadall = $user->rights->hrm->evaluation->readall; -$permissiontoadd = $user->rights->hrm->evaluation->write; -$permissiontodelete = $user->rights->hrm->evaluation->delete; +$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); +$permissiontoreadall = $user->hasRight('hrm', 'evaluation', 'readall'); +$permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'evaluation', 'delete'); // Security check -if (empty($conf->hrm->enabled)) { +if (!isModEnabled('hrm')) { accessforbidden('Module not enabled'); } From 85a594aa6130c3f97ac4018e7086e9d9274cd53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 21:01:02 +0100 Subject: [PATCH 104/572] clean code --- htdocs/opensurvey/class/opensurveysondage.class.php | 5 +++++ htdocs/ticket/class/ticket.class.php | 4 ++-- htdocs/ticket/contact.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index e928c2f3cd6..b141da8d392 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -115,6 +115,11 @@ class Opensurveysondage extends CommonObject */ public $allow_spy; + /** + * @var array fields + */ + public $fields = array(); + /** * Draft status (not used) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 932ed171cea..6884d2e830d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1440,10 +1440,10 @@ class Ticket extends CommonObject $datas['track_id'] = '
'.$langs->trans('TicketTrackId').': '.$this->track_id; $datas['subject'] = '
'.$langs->trans('Subject').': '.$this->subject; if ($this->date_creation) { - $datas['date_creation'] = '
'.$langs->trans('DateCreation').': '.$this->date_creation; + $datas['date_creation'] = '
'.$langs->trans('DateCreation').': '.dol_print_date($this->date_creation, 'dayhour'); } if ($this->date_modification) { - $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.$this->date_modification; + $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.dol_print_date($this->date_modification, 'dayhour'); } return $datas; diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index b5453ed638b..d858a4d7334 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -252,7 +252,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $linkback = ''.$langs->trans("BackToList").' '; - dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, ''); + dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1, ''); print dol_get_fiche_end(); From f043345706eb469d7277adf2233f811e330e2f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 21:06:39 +0100 Subject: [PATCH 105/572] clean code --- htdocs/societe/class/societe.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bc0e8cff3bd..10c13d0313f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2612,6 +2612,7 @@ class Societe extends CommonObject $datas = []; $option = $params['option'] ?? ''; + $nofetch = empty($params['nofetch']) ? false : true; $name = $this->name; if (!empty($this->name_alias) && empty($noaliasinname)) { @@ -2724,6 +2725,12 @@ class Societe extends CommonObject if (isModEnabled('accounting') && $this->fournisseur) { $datas['accountancysuppliercode'] = '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur; } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1); + } $datas['divclose'] = '
'; @@ -2789,6 +2796,7 @@ class Societe extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From 0f4adbedab3466eacbe41296fd9a1ae9b69bec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 21:15:16 +0100 Subject: [PATCH 106/572] clean code --- htdocs/product/class/product.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9db4565ca49..c8b3104aed0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5012,6 +5012,7 @@ class Product extends CommonObject $langs->load('products'); $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("ShowProduct")]; @@ -5103,6 +5104,12 @@ class Product extends CommonObject $datas['accountancybuy'] = $buylabel; } } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); + } return $datas; } @@ -5135,6 +5142,7 @@ class Product extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From c17463d2f4ec4a1c8f419c511b04b7db9e2e41f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 22:03:39 +0100 Subject: [PATCH 107/572] clean code --- htdocs/societe/class/societe.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 10c13d0313f..ea99b9c9eef 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2729,7 +2729,12 @@ class Societe extends CommonObject if (isModEnabled('categorie') && !$nofetch) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $form = new Form($this->db); - $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1); + if ($this->client) { + $datas['categories_customer'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1); + } + if ($this->fournisseur) { + $datas['categories_supplier'] = '
' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1); + } } $datas['divclose'] = '
'; From 43ac67c3d825dac14addf51a876ec0e7d67758ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 23:13:45 +0100 Subject: [PATCH 108/572] clean code --- htdocs/ticket/class/ticket.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6884d2e830d..bc50c0e31f8 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1433,6 +1433,7 @@ class Ticket extends CommonObject $langs->load('ticket'); + $nofetch = empty($params['nofetch']) ? false : true; $datas = []; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Ticket").''; $datas['picto'] .= ' '.$this->getLibStatut(4); @@ -1445,6 +1446,12 @@ class Ticket extends CommonObject if ($this->date_modification) { $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.dol_print_date($this->date_modification, 'dayhour'); } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_TICKET, 1); + } return $datas; } @@ -1474,6 +1481,8 @@ class Ticket extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From e1ca6ef019f19a7dc3c5f9b80470e4ce37676c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 23:19:03 +0100 Subject: [PATCH 109/572] clean code --- htdocs/adherents/class/adherent.class.php | 8 ++++++++ htdocs/comm/action/class/actioncomm.class.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b0ca0986ffb..6e77fd3fa95 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2288,6 +2288,7 @@ class Adherent extends CommonObject $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); return ['optimize' => $langs->trans("ShowUser")]; @@ -2318,6 +2319,12 @@ class Adherent extends CommonObject $datas['email'] = '
'.$langs->trans("EMail").': '.$this->email; } $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1); + } $datas['divclose'] = '
'; return $datas; @@ -2353,6 +2360,7 @@ class Adherent extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fd5b55e70fe..11cb4f98dbd 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1580,6 +1580,7 @@ class ActionComm extends CommonObject $langs->load('agenda'); $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; // Set label of type $labeltype = ''; if ($this->type_code) { @@ -1631,6 +1632,12 @@ class ActionComm extends CommonObject $datas['note'] .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '
', $texttoshow)); $datas['note'] .= ''; } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1); + } return $datas; } @@ -1734,6 +1741,7 @@ class ActionComm extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); From b0a1d8058fb0c8a49323028ea945330cd558b79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 23:28:14 +0100 Subject: [PATCH 110/572] clean code --- htdocs/compta/bank/class/account.class.php | 43 ++++++++-------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 7032f9c40e2..4ccdf93cb58 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1417,6 +1417,7 @@ class Account extends CommonObject $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; $pictos = img_picto('', $this->picto).' '.$langs->trans("BankAccount").''; if (isset($this->status)) { $pictos .= ' '.$this->getLibStatut(5); @@ -1434,6 +1435,12 @@ class Account extends CommonObject $datas['accountaccounting'] = '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); $datas['accountancyjournal'] = '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_ACCOUNT, 1); + } return $datas; } @@ -1454,38 +1461,20 @@ class Account extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("BankAccount").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= '
'.$langs->trans('Label').': '.$this->label; - $label .= '
'.$langs->trans('AccountNumber').': '.$this->number; - $label .= '
'.$langs->trans('IBAN').': '.getIbanHumanReadable($this); - $label .= '
'.$langs->trans('BIC').': '.$this->bic; - $label .= '
'.$langs->trans("AccountCurrency").': '.$this->currency_code; - - if (empty($user->rights->banque->lire) || !empty($user->socid)) { - $option = 'nolink'; - } - - if (isModEnabled('accounting')) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - $langs->load("accountancy"); - $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); - $label .= '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; - } $classfortooltip = 'classfortooltip'; $dataparams = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, + ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); + $linkclose = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">'; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id; @@ -1871,7 +1860,7 @@ class Account extends CommonObject /** * Class to manage bank transaction lines */ -class AccountLine extends CommonObject +class AccountLine extends CommonObjectLine { /** * @var string Error code (or message) From 30b81e2ac94fe4714af2a2574b5aebab81316e54 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Feb 2023 06:03:42 +0000 Subject: [PATCH 111/572] Bump JetBrains/qodana-action from 2022.3.2 to 2022.3.3 Bumps [JetBrains/qodana-action](https://github.com/JetBrains/qodana-action) from 2022.3.2 to 2022.3.3. - [Release notes](https://github.com/JetBrains/qodana-action/releases) - [Commits](https://github.com/JetBrains/qodana-action/compare/v2022.3.2...v2022.3.3) --- updated-dependencies: - dependency-name: JetBrains/qodana-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/code_quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index e5351acaf78..9b4fd68efe7 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 1 #php-version: '7.1' - name: 'Qodana Scan' - uses: JetBrains/qodana-action@v2022.3.2 + uses: JetBrains/qodana-action@v2022.3.3 #with: # php-version: '7.1' env: From c90e5094455511e5282ec3429741e8517ef1884b Mon Sep 17 00:00:00 2001 From: priojk Date: Mon, 13 Feb 2023 10:09:48 +0100 Subject: [PATCH 112/572] NEW: Possibility to link to German pages in help --- htdocs/main.inc.php | 17 ++++++++++++----- htdocs/mrp/mo_movements.php | 2 +- htdocs/mrp/mo_production.php | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1ea68780746..dc9d9d90c02 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -15,6 +15,7 @@ * Copyright (C) 2020 Charlene Benke * Copyright (C) 2021 Frédéric France * Copyright (C) 2021 Alexandre Spangaro + * Copyright (C) 2023 Joachim Küter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1397,7 +1398,7 @@ if (!function_exists("llxHeader")) { * @param string $head Optionnal head lines * @param string $title HTML title * @param string $help_url Url links to help page - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @param string $target Target to use on links * @param int $disablejs More content into html header @@ -1958,7 +1959,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr * @param array $arrayofcss Array of css files to add in header * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $helppagename Name of wiki page for help ('' by default). - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @return void */ @@ -2091,7 +2092,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $helppresent = ''; if (empty($helppagename)) { - $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; + $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios|DE:Benutzerdokumentation'; } else { $helppresent = 'helppresent'; } @@ -2888,7 +2889,7 @@ function top_menu_search() * * @param array $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprectaed and must be provided to ''. * @param string $helppagename Name of wiki page for help ('' by default). - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now. * @param array $menu_array_after Table of menu entries to show after entries of menu handler @@ -3176,7 +3177,7 @@ function main_area($title = '') /** * Return helpbaseurl, helppage and mode * - * @param string $helppagename Page name ('EN:xxx,ES:eee,FR:fff...' or 'http://localpage') + * @param string $helppagename Page name ('EN:xxx,ES:eee,FR:fff,DE:ddd...' or 'http://localpage') * @param Translate $langs Language * @return array Array of help urls */ @@ -3206,6 +3207,12 @@ function getHelpParamFor($helppagename, $langs) $helppage = $reg[1]; } } + if (preg_match('/^de/i', $langs->defaultlang)) { + $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; + if (preg_match('/DE:([^|]+)/i', $helppagename, $reg)) { + $helppage = $reg[1]; + } + } if (empty($helppage)) { // If help page not already found $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) { diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index c0357aa5e4b..a82f36c913e 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -257,7 +257,7 @@ $productlot = new ProductLot($db); $warehousestatic = new Entrepot($db); $userstatic = new User($db); -$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication'; +$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag'; llxHeader('', $langs->trans('Mo'), $help_url); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index b274f4b89df..4e149201ba3 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -431,7 +431,7 @@ $tmpwarehouse = new Entrepot($db); $tmpbatch = new Productlot($db); $tmpstockmovement = new MouvementStock($db); -$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication'; +$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag'; llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php')); $newToken = newToken(); From a34703532f3f6a476e9d1fc36a23f53b8324b7b7 Mon Sep 17 00:00:00 2001 From: jyhere Date: Mon, 13 Feb 2023 10:37:36 +0100 Subject: [PATCH 113/572] [FIX] extrafield with visibility '5' update bug When using a visibility = 5 (not editable extrafield, but visible on card and list), updating the object will result in an empty value in database for this extrafield. --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 71d5dfdb06d..be34ccd1a8b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2114,7 +2114,7 @@ class ExtraFields ) { continue; } - if (empty($visibility)) { + if (empty($visibility) || $visibility == 5) { continue; } if (empty($perms)) { From d034acb3ecdf5c4e3a69337ca2d93b7271e13c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina=20JOUM?= Date: Mon, 13 Feb 2023 12:13:02 +0100 Subject: [PATCH 114/572] add supplier --- htdocs/accountancy/class/accountancyexport.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 232df48761a..900da6890cf 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1913,14 +1913,16 @@ class AccountancyExport //Calcul de la longueur des numéros de comptes $taille_numero = strlen(length_accountg($line->numero_compte)); - //Création du numéro de client générique + //Création du numéro de client et fournisseur générique $numero_cpt_client = '411'; + $numero_cpt_fourn = '401'; for ($i = 1; $i <= ($taille_numero - 3); $i++) { $numero_cpt_client .= '0'; + $numero_cpt_fourn .= '0'; } - //Création des comptes auxiliaire des clients - if (length_accountg($line->numero_compte) == $numero_cpt_client) { + //Création des comptes auxiliaire des clients et fournisseur + if (length_accountg($line->numero_compte) == $numero_cpt_client || length_accountg($line->numero_compte) == $numero_cpt_fourn) { $tab[] = rtrim(length_accounta($line->subledger_account), "0"); } else { $tab[] = length_accountg($line->numero_compte); From 779a134022e4ccf80fa4cf03dae6880572ffaf7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 12:27:23 +0100 Subject: [PATCH 115/572] Fix call of antivirus must be done using utils->executeCLI --- htdocs/core/class/antivir.class.php | 54 ++++++++--------------------- 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index dc38d38185e..cb195b58f5d 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -81,63 +81,37 @@ class AntiVir } $fullcommand = $this->getCliCommand($file); + //$fullcommand="/usr/bin/clamdscan --fdpass '/tmp/phpuxoAEo'" //$fullcommand='"c:\Program Files (x86)\ClamWin\bin\clamscan.exe" --database="C:\Program Files (x86)\ClamWin\lib" "c:\temp\aaa.txt"'; - $fullcommand .= ' 2>&1'; // This is to get error output - $output = array(); $return_var = 0; $safemode = ini_get("safe_mode"); // Create a clean fullcommand dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand." with safe_mode ".($safemode ? "on" : "off")); - // Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL% - $lastline = exec($fullcommand, $output, $return_var); + // Run CLI command. + include_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; + $utils = new Utils($this->db); + $outputfile = $conf->user->dir_temp.'/antivir.tmp'; + $result = $utils->executeCLI($fullcommand, $outputfile); + + $return_var = $result['result']; + $output = $result['output']; + $errorstring = $result['error']; if (is_null($output)) { $output = array(); } - //print "x".$lastline." - ".join(',',$output)." - ".$return_var."y";exit; - - /* - $outputfile=$conf->admin->dir_temp.'/dol_avscan_file.out.'.session_id(); - $handle = fopen($outputfile, 'w'); - if ($handle) - { - $handlein = popen($fullcommand, 'r'); - while (!feof($handlein)) - { - $read = fgets($handlein); - fwrite($handle,$read); - } - pclose($handlein); - - $errormsg = fgets($handle,2048); - $this->output=$errormsg; - - fclose($handle); - - if (!empty($conf->global->MAIN_UMASK)) - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); - } - else - { - $langs->load("errors"); - dol_syslog("Failed to open file ".$outputfile,LOG_ERR); - $this->error="ErrorFailedToWriteInDir"; - $return=-1; - } - */ - - dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".join(',', $output)); + dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".$output); $returncodevirus = 1; if ($return_var == $returncodevirus) { // Virus found - $this->errors = $output; + $this->errors = array($errorstring, $output); return -99; } if ($return_var > 0) { // If other error - $this->errors = $output; + $this->errors = array($errorstring, $output); return -98; } @@ -178,7 +152,7 @@ class AntiVir } if (preg_match("/\s/", $command)) { - $command = escapeshellarg($command); // Use quotes on command. Using escapeshellcmd fails. + $command = escapeshellarg($command); // Force use of quotes on command. Using escapeshellcmd fails. } $ret = $command.' '.$param; From 183ae35ab7c2f9eaeb9a619895c1ca8f0b3139fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 12:27:23 +0100 Subject: [PATCH 116/572] Fix #huntr10e423cd-7051-43fd-b736-4e18650d0172 --- htdocs/admin/system/security.php | 3 ++ htdocs/core/class/antivir.class.php | 61 +++++++++-------------------- htdocs/core/lib/functions.lib.php | 4 +- 3 files changed, 24 insertions(+), 44 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 99b0ec96b08..e1b47b5beaa 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -577,6 +577,9 @@ print '
'; print 'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; print '
'; +print 'MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED = '.getDolGlobalString('MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; +print '
'; + print 'MAIN_SECURITY_FORCECSP = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; img-src *;\")
"; print '
'; diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index dc38d38185e..f8391c7a512 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -81,63 +81,38 @@ class AntiVir } $fullcommand = $this->getCliCommand($file); + //$fullcommand="/usr/bin/clamdscan --fdpass '/tmp/phpuxoAEo'" //$fullcommand='"c:\Program Files (x86)\ClamWin\bin\clamscan.exe" --database="C:\Program Files (x86)\ClamWin\lib" "c:\temp\aaa.txt"'; - $fullcommand .= ' 2>&1'; // This is to get error output + //var_dump($fullcommand); - $output = array(); - $return_var = 0; $safemode = ini_get("safe_mode"); // Create a clean fullcommand dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand." with safe_mode ".($safemode ? "on" : "off")); - // Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL% - $lastline = exec($fullcommand, $output, $return_var); + // Run CLI command. + include_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; + $utils = new Utils($this->db); + $outputfile = $conf->user->dir_temp.'/antivir.tmp'; + + $result = $utils->executeCLI($fullcommand, $outputfile); + + $return_var = $result['result']; + $output = $result['output']; + $errorstring = $result['error']; if (is_null($output)) { $output = array(); } - //print "x".$lastline." - ".join(',',$output)." - ".$return_var."y";exit; - - /* - $outputfile=$conf->admin->dir_temp.'/dol_avscan_file.out.'.session_id(); - $handle = fopen($outputfile, 'w'); - if ($handle) - { - $handlein = popen($fullcommand, 'r'); - while (!feof($handlein)) - { - $read = fgets($handlein); - fwrite($handle,$read); - } - pclose($handlein); - - $errormsg = fgets($handle,2048); - $this->output=$errormsg; - - fclose($handle); - - if (!empty($conf->global->MAIN_UMASK)) - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); - } - else - { - $langs->load("errors"); - dol_syslog("Failed to open file ".$outputfile,LOG_ERR); - $this->error="ErrorFailedToWriteInDir"; - $return=-1; - } - */ - - dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".join(',', $output)); + dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".$output); $returncodevirus = 1; if ($return_var == $returncodevirus) { // Virus found - $this->errors = $output; + $this->errors = array($errorstring, $output); return -99; } if ($return_var > 0) { // If other error - $this->errors = $output; + $this->errors = array($errorstring, $output); return -98; } @@ -178,10 +153,12 @@ class AntiVir } if (preg_match("/\s/", $command)) { - $command = escapeshellarg($command); // Use quotes on command. Using escapeshellcmd fails. + $command = escapeshellarg($command); // Force use of quotes on command. Using escapeshellcmd fails. } - $ret = $command.' '.$param; + $forbidden_chars_to_replace = array("*", "?", "\"", "<", ">", "|", "[", "]", ";", '°', '$'); + $ret = dol_sanitizePathName($command).' '.dol_string_nospecial($param, '_', $forbidden_chars_to_replace); + //$ret=$command.' '.$param.' 2>&1'; //print "xx".$ret."xx";exit; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1913e7dc235..a73bf3e096f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1385,7 +1385,7 @@ function dol_string_unaccent($str) /** * Clean a string from all punctuation characters to use it as a ref or login. - * This is a more complete function than dol_sanitizeFileName. + * This is a more complete function than dol_sanitizeFileName(). * * @param string $str String to clean * @param string $newstr String to replace forbidden chars with @@ -1397,7 +1397,7 @@ function dol_string_unaccent($str) */ function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '', $badcharstoremove = '') { - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°', '$', ';'); // more complete than dol_sanitizeFileName $forbidden_chars_to_remove = array(); //$forbidden_chars_to_remove=array("(",")"); From 08838d4debdc817d0143a7511046ba42845aa54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 13:16:27 +0100 Subject: [PATCH 117/572] clean code --- htdocs/core/boxes/box_members_subscriptions_by_year.php | 2 +- htdocs/langs/en_US/members.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 716b8ed0482..228ba016ceb 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -191,7 +191,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes if ($num == 0) { $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', + 'td' => 'class="left" colspan="4"', 'text' => $langs->trans("NoRecordedMembers"), ); } else { diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 5876a019d25..b0237c5578b 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -233,3 +233,4 @@ CreateDolibarrThirdPartyDesc=A thirdparty is the legal entity that will be used MemberFirstname=Member firstname MemberLastname=Member lastname MemberCodeDesc=Member Code, unique for all members +NoRecordedMembers=No registered member From cccd7494dfdfcce5017dcecb97166f3bf27bc4da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 13:29:30 +0100 Subject: [PATCH 118/572] Fix #huntr88841fe0-e332-49ce-a46b-36d4f091fd89 --- htdocs/core/lib/website.lib.php | 2 +- htdocs/core/lib/website2.lib.php | 1 + htdocs/website/index.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index de5779a3f51..61a894b2c96 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -69,7 +69,7 @@ function dolStripPhpCode($str, $replacewith = '') * * @param string $str String to clean * @return string Result string with php code only - * @see dolStripPhpCode() + * @see dolStripPhpCode(), checkPHPCode() */ function dolKeepOnlyPhpCode($str) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 768f735fe39..6d93d4391b2 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -680,6 +680,7 @@ function showWebsiteTemplates(Website $website) * @param string $phpfullcodestringold PHP old string. For exemple "" * @param string $phpfullcodestring PHP new string. For exemple "" * @return int Error or not + * @see dolKeepOnlyPhpCode() */ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b4262757bff..e585dd07bb2 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -806,6 +806,16 @@ if ($action == 'addcontainer' && $usercanedit) { // Remove comments $tmp['content'] = removeHtmlComment($tmp['content']); + // Check there is no PHP content into the imported file (must be only HTML + JS) + $phpcontent = dolKeepOnlyPhpCode('', $tmp['content']); + if ($phpcontent) { + $error++; + setEventMessages('Error getting '.$urltograb.': file that include PHP content is not allowed', null, 'errors'); + $action = 'createcontainer'; + } + } + + if (!$error) { $regs = array(); preg_match('/(.*)<\/head>/ims', $tmp['content'], $regs); From 4a49ca86c9fe7fbfa3f2cf5cc9ece6c4018fe756 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 13:29:30 +0100 Subject: [PATCH 119/572] Fix #huntr88841fe0-e332-49ce-a46b-36d4f091fd89 --- htdocs/core/lib/website.lib.php | 2 +- htdocs/core/lib/website2.lib.php | 1 + htdocs/website/index.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index c258e3198ce..d900b7718cf 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -69,7 +69,7 @@ function dolStripPhpCode($str, $replacewith = '') * * @param string $str String to clean * @return string Result string with php code only - * @see dolStripPhpCode() + * @see dolStripPhpCode(), checkPHPCode() */ function dolKeepOnlyPhpCode($str) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index e03f711c9c0..e619ab17a76 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -678,6 +678,7 @@ function showWebsiteTemplates(Website $website) * @param string $phpfullcodestringold PHP old string * @param string $phpfullcodestring PHP new string * @return int Error or not + * @see dolKeepOnlyPhpCode() */ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3a625818ba4..22e692ad824 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -806,6 +806,16 @@ if ($action == 'addcontainer' && $usercanedit) { // Remove comments $tmp['content'] = removeHtmlComment($tmp['content']); + // Check there is no PHP content into the imported file (must be only HTML + JS) + $phpcontent = dolKeepOnlyPhpCode('', $tmp['content']); + if ($phpcontent) { + $error++; + setEventMessages('Error getting '.$urltograb.': file that include PHP content is not allowed', null, 'errors'); + $action = 'createcontainer'; + } + } + + if (!$error) { $regs = array(); preg_match('/(.*)<\/head>/ims', $tmp['content'], $regs); From c1ee02c51059644dfcb0072e6280374897d509a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 13:33:48 +0100 Subject: [PATCH 120/572] Fix bad param --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 22e692ad824..271c139b667 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -807,7 +807,7 @@ if ($action == 'addcontainer' && $usercanedit) { $tmp['content'] = removeHtmlComment($tmp['content']); // Check there is no PHP content into the imported file (must be only HTML + JS) - $phpcontent = dolKeepOnlyPhpCode('', $tmp['content']); + $phpcontent = dolKeepOnlyPhpCode($tmp['content']); if ($phpcontent) { $error++; setEventMessages('Error getting '.$urltograb.': file that include PHP content is not allowed', null, 'errors'); From f569048eb2bd823525bce4ef52316e7a83e3345c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:50:40 +0100 Subject: [PATCH 121/572] Fix #hunter7a048bb7-bfdd-4299-931e-9bc283e92bc8 --- htdocs/main.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 98de8c12e5c..44ee262b700 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -167,16 +167,20 @@ function testSqlAndScriptInject($val, $type) $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $val); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $val); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $val); + // More not into the previous list + $inj += preg_match('/on(repeat|begin|finish|beforeinput)\s*=/i', $val); // We refuse html into html because some hacks try to obfuscate evil strings by inserting HTML into HTML. Example: error=alert(1) to bypass test on onerror $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers - $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like + $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $tmpval); // onmousexxx can be set on img or any html tag like $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $tmpval); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $tmpval); + // More not into the previous list + $inj += preg_match('/on(repeat|begin|finish|beforeinput)\s*=/i', $tmpval); //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val); // To lock event handlers onAbort(), ... $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' From a8daf57f715b35fff40ea1365e2bfc4167cc239b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 14:03:34 +0100 Subject: [PATCH 122/572] doc --- htdocs/asset/class/asset.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index c01f4b967c4..5cf9e748d00 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -157,6 +157,11 @@ class Asset extends CommonObject public $status; public $user_cloture_id; + /** + * @var Asset object oldcopy + */ + public $oldcopy; + // /** // * @var string Field with ID of parent key if this object has a parent // */ From e9c5f515ced36ccdfd5312049d76d7dc3c1e68d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 14:35:02 +0100 Subject: [PATCH 123/572] Fix #huntrb1412070-740e-4119-8e4b-61bdc3af42aa --- htdocs/accountancy/admin/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 02b95cfd043..535463822db 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel', 'alpha'); -$account_number = GETPOST('account_number', 'string'); +$account_number = GETPOST('account_number', 'alphanohtml'); $label = GETPOST('label', 'alpha'); // Security check From c3fc14a45af041919c1098c06781a2727b430b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 13 Feb 2023 16:05:12 +0100 Subject: [PATCH 124/572] FIX bad check on if in get_all_ways --- htdocs/categories/class/categorie.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 27a301776b8..23495e9c5c1 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2023 Benjamin Falière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1463,7 +1464,7 @@ class Categorie extends CommonObject $ways = array(); $parents = $this->get_meres(); - if (!empty($parents)) { + if (is_array($parents)) { foreach ($parents as $parent) { $allways = $parent->get_all_ways(); foreach ($allways as $way) { From 2dec660763e526b280e9379c0a7da499e8d86bbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 16:12:38 +0100 Subject: [PATCH 125/572] Fix backto link --- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/line.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 6c961e85af9..a678c176ca7 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -175,7 +175,7 @@ $arrayfields = array( 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>120), 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>130), 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>140), - 'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeReceipt"), 'checked'=>0, 'position'=>150), + 'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeNumber"), 'checked'=>0, 'position'=>150), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 7c775b6e95c..fd75c9ceaee 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -327,7 +327,7 @@ if ($result) { print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($bankline, 'rowid', $linkback); From cac9a00bac0a522c2d54e7557c8c0a2912b66566 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 13 Feb 2023 16:19:00 +0100 Subject: [PATCH 126/572] fix loi de finance 525 --- htdocs/blockedlog/README-fr.md | 2 +- htdocs/blockedlog/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/blockedlog/README-fr.md b/htdocs/blockedlog/README-fr.md index e92bd5a09fe..a5d709ca7a7 100644 --- a/htdocs/blockedlog/README-fr.md +++ b/htdocs/blockedlog/README-fr.md @@ -4,7 +4,7 @@ LOG INALTERABLE ## Fonctionnalité Ce module trace, en temps réel, certains évènements métiers dans une log inaltérable (que vous ne pouvez pas modifier une fois enregistrés) de type blockchain. -Ce module est requis pour la compatibilité avec les exigences légales de certains pays (comme la France avec la loi Fincance 2016 - Norme NF535). +Ce module est requis pour la compatibilité avec les exigences légales de certains pays (comme la France avec la loi Finance 2016 - Norme NF525). **Les évènements tracés de manière inaltérables sont:** diff --git a/htdocs/blockedlog/README.md b/htdocs/blockedlog/README.md index ec3174fb847..7bd9b10787e 100644 --- a/htdocs/blockedlog/README.md +++ b/htdocs/blockedlog/README.md @@ -4,7 +4,7 @@ BLOCKED LOG ## Feature This module tracks, in real time, some events into a non reversible log (that you can't modify once recorded) into a block chain. -This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535). +This module provides compatibility with requirements of laws of some countries (like France with the law Finance 2016 - Norme NF525). **The tracked events are:** From 83727d08bad9db0572c31732f5cbcea5830e3385 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 19:34:36 +0100 Subject: [PATCH 127/572] Enhance the virtual business card feature --- htdocs/admin/tools/dolibarr_export.php | 51 ++++++++++------- htdocs/langs/en_US/main.lang | 3 +- htdocs/public/users/view.php | 2 +- htdocs/theme/eldy/global.inc.php | 27 +++++++++ htdocs/theme/md/style.css.php | 27 +++++++++ htdocs/user/virtualcard.php | 76 ++++++++++++++++++++------ 6 files changed, 147 insertions(+), 39 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index d01efa0ea5b..8afd1f7e03c 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -202,45 +202,53 @@ print ''; print ''; print ''; -print ''; +print '
'; +print img_picto('', 'setup', 'class="pictofixedwidth"').''.$langs->trans("ShowAdvancedOptions").'...'; +print '
'; print ''; + print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 177855c9302..f3047dacf3e 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -463,7 +463,7 @@ if ($result < 0) { print '
'; // do not use class="center" here, it will have no effect for the js graph inside. print $show2; print '
'; - print '
'; + print '
'; } diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index dfc8564b34c..a95512a286f 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -671,7 +671,7 @@ if (empty($action) || $action == "view" || $action == "close") { print "\n"; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 1bf7706bf87..4cb75c526ef 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -321,7 +321,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index e1f68a5f79a..5c23057b10b 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -421,7 +421,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index cd94f4ebbac..1584fdbe41c 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1500,7 +1500,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index a6a24e056b9..6584d59400c 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -135,7 +135,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh $object = null; $reshook = $hookmanager->executeHooks('searchAgendaFrom', $parameters, $object, $action); // Note that $action and $object may have been - print '
'; + print '
'; } diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 866cd25eef1..3ca8c0aeab6 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -295,7 +295,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index 3e8cba9def2..9213e2ca849 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -310,7 +310,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index e9fdd03a2be..04ce5d5d648 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -311,7 +311,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 59c3ba83ee1..cec740fdd9c 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -319,7 +319,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 19335656f51..c6bee17d20b 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -868,7 +868,7 @@ if ($object->id > 0) { } print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index cfb3f73f7cd..63b40cccb0e 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -188,7 +188,7 @@ $fk_usergroup1 = GETPOST('fk_usergroup1'); -
+
diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index 403c4b28eae..a5b17803f65 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -274,7 +274,7 @@ if ($id > 0 && $action != 'edit') { print "\n"; print "\n"; - print '
'; + print '
'; print dol_get_fiche_end(); } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 323af1af532..5d247b4bc27 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2390,7 +2390,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
'.$logoutLink.'
-
+
diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 107189e5181..1bda53b5c5d 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -133,7 +133,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 00188256619..3202dcb93ce 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -163,7 +163,7 @@ if ($socid > 0) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/opensurvey/wizard/index.php b/htdocs/opensurvey/wizard/index.php index b8ccd0d8588..4542ecfa3bd 100644 --- a/htdocs/opensurvey/wizard/index.php +++ b/htdocs/opensurvey/wizard/index.php @@ -61,7 +61,7 @@ print '
'; print '
'; print ''; print '
'; -print '
'; +print '
'; print ''; print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 610bd41b1c1..197626d69f3 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2722,7 +2722,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); } diff --git a/htdocs/product/document.php b/htdocs/product/document.php index c24082ae6e6..af75cbc71ce 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -259,7 +259,7 @@ if ($object->id) { print ''; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index c1b61913d9f..d82fa8b1c41 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -460,7 +460,7 @@ if ($id > 0 || $ref) { print ''; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 788857dfd47..08757602907 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1312,7 +1312,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print "\n"; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index 66e673567a6..0ccc249b94f 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -121,7 +121,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 5559eaf8413..1df4f70c063 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -131,7 +131,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 6ae1d7881ef..4d5972529cd 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -131,7 +131,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index bcf9c8c0737..a53c71085fd 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -120,7 +120,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 3ff0b00d56a..c0a4d36793c 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -147,7 +147,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 20bb56a3c19..8e89a05273f 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -132,7 +132,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index 9b982407825..b09e572763a 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -148,7 +148,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index b401b40bc9e..561557e62fe 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -131,7 +131,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index b70d2e08161..e1b46677c65 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -133,7 +133,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 50b17b0ac06..a182aa61eb6 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -132,7 +132,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index b0771bc39d9..80a5f969a84 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -903,7 +903,7 @@ if ($id > 0 || $ref) { print ''; print ''; - print '
'; + print '
'; } print dol_get_fiche_end(); diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index be6c7f640a4..38c5b0503d8 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -197,7 +197,7 @@ if ($object->id) { print ''; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index e8f8463493f..22be071ffc5 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -205,7 +205,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stock/stats/expedition.php b/htdocs/product/stock/stats/expedition.php index b18bee897e4..19e2640d0bd 100644 --- a/htdocs/product/stock/stats/expedition.php +++ b/htdocs/product/stock/stats/expedition.php @@ -205,7 +205,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stock/stats/mo.php b/htdocs/product/stock/stats/mo.php index 06fcad417c7..f0be40d1a1d 100644 --- a/htdocs/product/stock/stats/mo.php +++ b/htdocs/product/stock/stats/mo.php @@ -152,7 +152,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index ec54553ed07..bf944056ccb 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -205,7 +205,7 @@ if ($id > 0 || !empty($ref)) { print ""; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 32498121045..a0b076197b8 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -329,7 +329,7 @@ print $stringtoshow; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index 07b0199d480..ee0bae2dc45 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -224,7 +224,7 @@ print $stringtoshow; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 84652017b37..239d9f71d59 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -89,7 +89,7 @@ print ''; print ''; diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index df11e2a9cd5..f951beca058 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -302,7 +302,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index ba5d254f22b..c18f59a754a 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -279,7 +279,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 02d0b042aab..30c23781757 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3185,7 +3185,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 95d290d680a..2a8ee74be33 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1386,7 +1386,7 @@ if ($action == 'create' || $action == 'presend') { } print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index f75a93f7082..35e11b9f1f5 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -446,7 +446,7 @@ print ''; print ''; -print '
'; +print '
'; $parameters = array('user' => $user); $reshook = $hookmanager->executeHooks('dashboardTickets', $parameters, $object); // Note that $action and $object may have been modified by hook diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 7e94af1a431..acbf03b5ba9 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -316,7 +316,7 @@ print ''; print ''; -print '
'; +print '
'; print dol_get_fiche_end(); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 4c26ec27021..fc7efd23749 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -757,7 +757,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index b3d83ddb239..04086a90304 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1892,7 +1892,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index e5043dcd7fa..4c2b77ce766 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -463,7 +463,7 @@ if (!empty($id) || !empty($ref)) { print "\n"; print ''; - print '
'; + print '
'; print dol_get_fiche_end(); From a81510ccd65714bbf08d784c573568532c749fe7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Feb 2023 14:15:39 +0100 Subject: [PATCH 243/572] Better exemple for RCP security string --- htdocs/admin/system/security.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index c23bdb3051f..d7f8884a38a 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -574,13 +574,13 @@ print '
'; print 'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."
"; print '
'; -print 'MAIN_SECURITY_FORCECSP = '.(empty($conf->global->MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; img-src *;\")
"; +print 'MAIN_SECURITY_FORCECSP = '.(empty($conf->global->MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src *; img-src *; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';\")
"; print '
'; print 'MAIN_SECURITY_FORCERP = '.(empty($conf->global->MAIN_SECURITY_FORCERP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCERP).'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"same-origin\" so browser doesn't send any referrer when going into another web site domain)
"; print '
'; -print 'WEBSITE_MAIN_SECURITY_FORCECSP = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->WEBSITE_MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src *;\")
"; +print 'WEBSITE_MAIN_SECURITY_FORCECSP = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->WEBSITE_MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com https://fonts.googleapis.com; script-src https://cdn.transifex.com https://www.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src *;\")
"; print '
'; print 'WEBSITE_MAIN_SECURITY_FORCERP = '.(empty($conf->global->WEBSITE_MAIN_SECURITY_FORCERP) ? ''.$langs->trans("Undefined").'' : $conf->global->WEBSITE_MAIN_SECURITY_FORCERP).'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")
"; From fdcce8d26361e0266825157f0cffdfe3594acdb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Feb 2023 15:10:05 +0100 Subject: [PATCH 244/572] Add nonce on javascript tags --- htdocs/core/ajax/ajaxdirpreview.php | 2 +- htdocs/core/ajax/ajaxdirtree.php | 4 +- htdocs/core/boxes/box_actions.php | 4 +- .../boxes/box_graph_invoices_permonth.php | 2 +- .../core/boxes/box_graph_invoices_peryear.php | 2 +- .../box_graph_invoices_supplier_permonth.php | 2 +- .../boxes/box_graph_nb_ticket_last_x_days.php | 2 +- .../core/boxes/box_graph_orders_permonth.php | 2 +- .../box_graph_orders_supplier_permonth.php | 2 +- .../boxes/box_graph_product_distribution.php | 2 +- .../boxes/box_graph_propales_permonth.php | 2 +- htdocs/core/boxes/box_task.php | 4 +- htdocs/core/class/commonobject.class.php | 4 +- .../core/class/commonsocialnetworks.class.php | 2 +- htdocs/core/class/doleditor.class.php | 6 +-- htdocs/core/class/dolgraph.class.php | 4 +- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/class/html.form.class.php | 36 +++++++------- .../core/class/html.formaccounting.class.php | 2 +- htdocs/core/class/html.formactions.class.php | 3 +- htdocs/core/class/html.formbarcode.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/class/html.formmail.class.php | 4 +- htdocs/core/class/html.formmargin.class.php | 10 ++-- htdocs/core/class/html.formother.class.php | 12 ++--- htdocs/core/class/html.formsms.class.php | 2 +- htdocs/core/class/html.formticket.class.php | 16 +++---- htdocs/core/class/openid.class.php | 2 +- htdocs/core/customreports.php | 2 +- htdocs/core/datepicker.php | 4 +- htdocs/core/get_menudiv.php | 2 +- htdocs/core/lib/functions.lib.php | 39 ++++++++++----- htdocs/core/lib/project.lib.php | 18 ------- htdocs/core/lib/security2.lib.php | 3 +- htdocs/core/lib/treeview.lib.php | 2 +- htdocs/core/lib/website.lib.php | 14 +++--- htdocs/core/lib/website2.lib.php | 2 +- htdocs/core/photos_resize.php | 2 +- htdocs/core/tpl/login.tpl.php | 2 +- htdocs/core/tpl/passwordforgotten.tpl.php | 2 +- htdocs/core/tpl/passwordreset.tpl.php | 3 +- htdocs/main.inc.php | 47 ++++++++++--------- 43 files changed, 143 insertions(+), 140 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 76531832776..2f763c4e576 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -448,7 +448,7 @@ if ($useajax || $action == 'deletefile') { if ($useajax) { print ''."\n"; - print ''; // This ajax service is called only when a directory $selecteddir is opened but not when closed. - //print ''; } diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index ac0df03184a..a47f5d4f744 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -256,7 +256,7 @@ class box_actions extends ModeleBoxes } $out .= ''; if ($actioncejour) { - $out .= ''; } else { - $out .= ''; } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 03b0e1d087b..34dc015a1db 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -227,7 +227,7 @@ class box_graph_invoices_permonth extends ModeleBoxes if (!$mesg) { $stringtoshow = ''; - $stringtoshow .= ''; // set cookie by js - $boxcontent .= ''; + $boxcontent .= ''; } $this->info_box_contents[0][] = array( 'tr' => 'class="nohover showiffilter'.$this->boxcode.' hideobject"', diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b8a986a0663..1376155e0e7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7443,7 +7443,7 @@ abstract class CommonObject if (!empty($conf->use_javascript_ajax)) { $out .= ' - '; + $result .= ''; } return $result; @@ -833,7 +833,7 @@ class Form if (!empty($conf->use_javascript_ajax)) { $ret .= ' - '; + print ''; + print 'console.log("hide the margin info"); $("#margintable").hide();'; } + print '});'; } print '
'; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 7e14474bc96..21e5b608a41 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -104,7 +104,7 @@ class FormOther $out .= '
'; $out .= '
'; - $out .= ''; - $out .= ''; + $out .= ''; - $out .= ''; + $out .= ''; } - $stringtoprint .=''; } else { // Default Header Redirect diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index fefdc5880c8..d61a07f59bc 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -443,7 +443,7 @@ if (empty($conf->use_javascript_ajax)) { print ''; } else { print ' - '."\n"; + print ''."\n"; } else { print ''.$langs->trans("Calendar").''; } @@ -93,7 +93,7 @@ $tradTemp = array( $langs->trans("November"), $langs->trans("December") ); -print ' + "; + gtag(\'config\', \''.trim($tmptag).'\'); + '; print "\n"; } } @@ -9772,7 +9772,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=') function dol_set_focus($selector) { print "\n".''."\n"; - print ''."\n"; + print ''."\n"; } @@ -10074,7 +10074,7 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param function ajax_autoselect($htmlname, $addlink = '', $textonlink = 'Link') { global $langs; - $out = '';*/ - print ''; // Note @@ -1656,15 +1647,6 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr //$tableCell.=' '; print $tableCell; - // Comment for avoid unnecessary multiple calculation - /*$modeinput = 'hours'; - - print '';*/ - print ''; // Note diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index e0bf4a683f0..c68bb49d93b 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -570,7 +570,8 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token global $conf; if (!empty($conf->use_javascript_ajax)) { - print "\n".''."\n"; } elseif ($type == 'qa') { $ret = ''."\n"; - $ret .= ''; + $out .= ''; $out .= '
'."\n"; // Reddit @@ -931,7 +931,7 @@ function getSocialNetworkSharingLinks() // Facebook $out .= ''; } -if ($moreforfilter) { +if (!empty($moreforfilter)) { print '
'; print $moreforfilter; $parameters = array('type'=>$type); @@ -1084,18 +1097,14 @@ if ($massactionbutton && $contextpage != 'poslist') { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } -if (empty($arrayfields['customerorsupplier']['checked'])) { - print ''; -} - print '
'; -print ''."\n"; +print '
'."\n"; // Fields title search print ''; +// Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - // Action column - print ''; @@ -1331,112 +1340,151 @@ if (!empty($arrayfields['s.import_key']['checked'])) { } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { // Action column - print ''; } -print "\n"; +print ''."\n"; + +$totalarray = array(); +$totalarray['nbfield'] = 0; + +// Fields title label +// -------------------------------------------------------------------- print ''; -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.rowid']['checked'])) { print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder, 'actioncolumn '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder, 'actioncolumn '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.name_alias']['checked'])) { print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], "s.name_alias", "", $param, "", $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.barcode']['checked'])) { print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode", $param, '', '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.code_client']['checked'])) { print_liste_field_titre($arrayfields['s.code_client']['label'], $_SERVER["PHP_SELF"], "s.code_client", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.code_fournisseur']['checked'])) { print_liste_field_titre($arrayfields['s.code_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_fournisseur", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.code_compta']['checked'])) { print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.address']['checked'])) { print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.zip']['checked'])) { print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['state.nom']['checked'])) { print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['region.nom']['checked'])) { print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['country.code_iso']['checked'])) { print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['typent.code']['checked'])) { print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, "", $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['staff.code']['checked'])) { print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.price_level']['checked'])) { print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.email']['checked'])) { print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.phone']['checked'])) { print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.fax']['checked'])) { print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.url']['checked'])) { print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.siren']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.siret']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.ape']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.idprof4']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.idprof5']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[5], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.idprof6']['checked'])) { print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[6], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.tva_intra']['checked'])) { print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['customerorsupplier']['checked'])) { print_liste_field_titre($arrayfields['customerorsupplier']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); // type of customer + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.fk_stcomm']['checked'])) { print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s2.nom']['checked'])) { print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1446,27 +1494,39 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $objec print $hookmanager->resPrint; if (!empty($arrayfields['s.datec']['checked'])) { print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.tms']['checked'])) { print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.status']['checked'])) { print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.import_key']['checked'])) { print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + $totalarray['nbfield']++; // For the column action } -print "\n"; +print ''."\n"; $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } + $parameters = array('staticdata' => $obj); // Note that $action and $object may have been modified by hook // do companystatic fetch in hook if wanted or anything else @@ -1500,13 +1560,11 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { - print ''; From 992fe1286d5b17f83e2248e98f4df80eb430de18 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Feb 2023 16:08:19 +0100 Subject: [PATCH 247/572] FIX request new password with "mc" and "twofactor" authentication --- htdocs/user/class/user.class.php | 3 +++ htdocs/user/passwordforgotten.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9a495a04a91..9ee9bcae43e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2425,6 +2425,9 @@ class User extends CommonObject //print $password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id; $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword'; $url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id)); + if (!empty($conf->multicompany->enabled)) { + $url .= '&entity='.(!empty($user->entity) ? $user->entity : 1); + } $msgishtml = 1; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index dabac0727dc..c529dcc0e19 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -87,7 +87,7 @@ if (empty($reshook)) { // Validate new password if ($action == 'validatenewpassword' && $username && $passworduidhash) { $edituser = new User($db); - $result = $edituser->fetch('', $username); + $result = $edituser->fetch('', $username, '', 0, $conf->entity); if ($result < 0) { $message = '
'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'
'; } else { @@ -122,9 +122,9 @@ if (empty($reshook)) { $isanemail = preg_match('/@/', $username); $edituser = new User($db); - $result = $edituser->fetch('', $username, '', 1); + $result = $edituser->fetch('', $username, '', 1, $conf->entity); if ($result == 0 && $isanemail) { - $result = $edituser->fetch('', '', '', 1, -1, $username); + $result = $edituser->fetch('', '', '', 1, $conf->entity, $username); } if ($result <= 0 && $edituser->error == 'USERNOTFOUND') { From 5b81880b9721f4ddb26725887c3b98e5d12354e3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Feb 2023 16:24:56 +0100 Subject: [PATCH 248/572] FIX object $user is not defined --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 9ee9bcae43e..f5566cc30e7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2426,7 +2426,7 @@ class User extends CommonObject $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword'; $url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id)); if (!empty($conf->multicompany->enabled)) { - $url .= '&entity='.(!empty($user->entity) ? $user->entity : 1); + $url .= '&entity='.(!empty($this->entity) ? $this->entity : 1); } $msgishtml = 1; From 50721f8df3eb8399930d4f7b7dd2c5e3e1012a39 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 18 Feb 2023 16:31:59 +0100 Subject: [PATCH 249/572] TODO object $user parameter is not use in send_password() ! --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f5566cc30e7..752cbf15c34 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2359,7 +2359,7 @@ class User extends CommonObject /** * Send new password by email * - * @param User $user Object user that send the email (not the user we send too) + * @param User $user Object user that send the email (not the user we send too) @todo object $user is not used ! * @param string $password New password * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @todo Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok From fd3dffc892102b60920334aaaba5487a6dae8a1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Feb 2023 19:20:54 +0100 Subject: [PATCH 250/572] Add kanban view for partnership object --- htdocs/hrm/class/position.class.php | 3 +- .../modulebuilder/template/myobject_list.php | 2 +- .../partnership/class/partnership.class.php | 30 +++++++ htdocs/partnership/partnership_list.php | 79 +++++++++++++------ htdocs/product/class/product.class.php | 3 +- htdocs/societe/class/societe.class.php | 3 +- 6 files changed, 91 insertions(+), 29 deletions(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 479479d4b9d..4cb0eb670f8 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -1123,9 +1123,10 @@ class Position extends CommonObject * Return clicable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ - public function getKanbanView($option = '') + public function getKanbanView($option = '', $arraydata = null) { global $selected, $langs; $return = '
'; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 7465f2ce161..338ad79affb 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -671,7 +671,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if ($val && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index a6df07655ed..1833fc97d52 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -1320,6 +1320,36 @@ class Partnership extends CommonObject return $error; } + + /** + * Return a thumb for kanban views + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array $arraydata Array of data + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '', $arraydata = null) + { + global $conf, $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if (property_exists($this, 'label')) { + $return .= '
'.$this->label.'
'; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + + return $return; + } } diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 7144f201022..a13fb6f8182 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; // Load translation files required by the page $langs->loadLangs(array("partnership", "members", "other")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation @@ -48,7 +48,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected i $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'aZ'); +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOST('id', 'int'); $socid = GETPOST('socid', 'int'); @@ -311,9 +311,12 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; @@ -420,7 +423,8 @@ $sql=preg_replace('/,\s*$/','', $sql); $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); $resql = $db->query($sqlforcount); if ($resql) { $objforcount = $db->fetch_object($resql); @@ -429,7 +433,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -576,6 +580,9 @@ if ($managedfor == "member") { $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -589,12 +596,16 @@ if ($memberid) { $param .= '&rowid='.urlencode($memberid); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); } } + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } @@ -640,15 +651,22 @@ print ''; print ''; print ''; print ''; +print ''; print ''; if ($socid) { print ''; } elseif ($memberid) { print ''; } + + $newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/partnership/partnership_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) @@ -674,7 +692,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; print $moreforfilter; + $parameters = array('type'=>$type); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } @@ -704,7 +725,7 @@ if ($managedfor == 'member') { // -------------------------------------------------------------------- print '
'; // Action column -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; // For the column action } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -790,7 +812,7 @@ foreach ($object->fields as $key => $val) { } $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; $totalarray['nbfield']++; } } @@ -804,13 +826,13 @@ if ($managedfor == 'member') { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; // For the column action } -$totalarray['nbfield']++; print ''."\n"; @@ -857,7 +879,7 @@ while ($i < $imaxinloop) { $j = 0; print ''; // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -888,7 +913,7 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print 'executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print ''."\n"; @@ -970,7 +995,9 @@ while ($i < $imaxinloop) { $i++; } -if ($managedfor != 'member') $totalarray['nbfield']++; // End of subscription date +if ($managedfor != 'member') { + $totalarray['nbfield']++; // End of subscription date +} // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; @@ -983,7 +1010,9 @@ if ($num == 0) { $colspan++; } } - if ($managedfor != 'member') $colspan++; // End of subscription date + if ($managedfor != 'member') { + $colspan++; // End of subscription date + } print ''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a18a7796541..321c6722018 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -6363,9 +6363,10 @@ class Product extends CommonObject * Return clicable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ - public function getKanbanView($option = '') + public function getKanbanView($option = '', $arraydata = null) { global $langs,$conf; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8aa886e7bd6..02200651a13 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5201,9 +5201,10 @@ class Societe extends CommonObject * Return clicable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array $arraydata Array of data * @return string HTML Code for Kanban thumb. */ - public function getKanbanView($option = '') + public function getKanbanView($option = '', $arraydata = null) { $return = '
'; From b35d768d053f6bbee62845b13abd7ffcddb53a46 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Feb 2023 20:47:19 +0100 Subject: [PATCH 251/572] Debug v17 --- htdocs/core/class/commonobject.class.php | 8 ++++---- htdocs/core/lib/images.lib.php | 8 ++++++-- htdocs/theme/md/style.css.php | 2 +- htdocs/theme/md/theme_vars.inc.php | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0ac16532246..e4e767b3cee 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8711,9 +8711,9 @@ abstract class CommonObject if ($usesharelink) { if ($val['share']) { - if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { + if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { $return .= ''; - $return .= ''; + $return .= ''; } else { $return .= ''; $return .= ''; @@ -8723,9 +8723,9 @@ abstract class CommonObject $return .= ''; } } else { - if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { + if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { $return .= ''; - $return .= ''; + $return .= ''; } else { $return .= ''; $return .= ''; diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 37cc70760eb..9ca4684ef51 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -130,8 +130,12 @@ function dol_getImageSize($file, $url = false) if ($filetoread) { $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image - $ret['width'] = $infoImg[0]; // Largeur de l'image - $ret['height'] = $infoImg[1]; // Hauteur de l'image + if ($infoImg) { + $ret['width'] = $infoImg[0]; // Largeur de l'image + $ret['height'] = $infoImg[1]; // Hauteur de l'image + } else { + $ret['width'] = $ret['height'] = ''; + } } return $ret; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 945befdae08..6179c64db8c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4900,7 +4900,7 @@ div.titre { color: var(--colortexttitlenotab); } .tertiary { - color: var(--colortexttitlenotab); + color: var(--colortexttitlenotab2); } table.centpercent.notopnoleftnoright.table-fiche-title { diff --git a/htdocs/theme/md/theme_vars.inc.php b/htdocs/theme/md/theme_vars.inc.php index 84a1065f781..be799259b32 100644 --- a/htdocs/theme/md/theme_vars.inc.php +++ b/htdocs/theme/md/theme_vars.inc.php @@ -60,6 +60,7 @@ $colorbacklinepairchecked = '230,237,244'; // line checked $colorbacklinebreak = '250,246,251'; $colorbackbody = '248,248,248'; $colortexttitlenotab = '80,71,5'; +$colortexttitlenotab2 = '100,0,100'; $colortexttitle = '20,20,20'; $colortexttitlelink = '0,0,120'; $colortext = '0,0,0'; From 6b12020e7a53e87a794c1e5a6d2b11d60eab1543 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Feb 2023 20:49:38 +0100 Subject: [PATCH 252/572] Look and feel v18 --- htdocs/projet/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 044728227cf..ab1a6800338 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -119,10 +119,11 @@ $morehtml = ''; $morehtml .= ''; $morehtml .= ''; $morehtml .= ''; -$morehtml .= ''; $morehtml .= ''; $morehtml .= ''; $morehtml .= ''; +$morehtml .= ajax_combobox("search_project_user", array(), 0, 0, 'resolve', '-1', 'small'); $morehtml .= ''; $morehtml .= ''; @@ -188,9 +189,8 @@ if ($resql) { print '
'; -/* - * Statistics - */ + +// Statistics include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; From 45a6d12d65c93310dfb630b918c024e6f9022574 Mon Sep 17 00:00:00 2001 From: priojk Date: Sat, 18 Feb 2023 22:33:42 +0100 Subject: [PATCH 253/572] Fix: Original translation change misleading in many places --- htdocs/langs/de_DE/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/de_DE/main.lang b/htdocs/langs/de_DE/main.lang index 4aa75a20c80..56e9c337bfe 100644 --- a/htdocs/langs/de_DE/main.lang +++ b/htdocs/langs/de_DE/main.lang @@ -464,7 +464,7 @@ OtherStatistics=Weitere Statistiken Status=Status Favorite=Favorit ShortInfo=Info. -Ref=Artikelnummer +Ref=Ref.Nr. ExternalRef=Externe-ID RefSupplier=Lieferanten-Zeichen RefPayment=Zahlungsref.-Nr. From 833505b5e2382ea168b2cb896826530baeab512a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 00:17:58 +0100 Subject: [PATCH 254/572] Fix responsive --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3c9e0766a45..3d4a094c30b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2327,7 +2327,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $profilLink = ' '.$langs->trans("Card").''; $urltovirtualcard = '/user/virtualcard.php?id='.((int) $user->id); $virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->trans("PublicVirtualCardUrl").(is_object($user) ? ' - '.$user->getFullName($langs) : ''), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v'); - $logoutLink = ' '.$langs->trans("Logout").''; + $logoutLink = ''.$langs->trans("Logout").''; $profilName = $user->getFullName($langs).' ('.$user->login.')'; if (!empty($user->admin)) { From e2c558f9cc61ed040f85d0610b146a76ea2c8bf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 01:34:45 +0100 Subject: [PATCH 255/572] Debug v17 --- htdocs/compta/facture/card.php | 51 +++++++++++---------------- htdocs/core/class/html.form.class.php | 16 +++++---- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ccfedf5ad4a..4ea4306a465 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3188,7 +3188,7 @@ if ($action == 'create') { $arrayoutstandingbills = $soc->getOutstandingBills(); $outstandingBills = $arrayoutstandingbills['opened']; print ' - '.$langs->trans('CurrentOutstandingBill').': '; - print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); + print ''.price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency).''; if ($soc->outstanding_limit != '') { if ($outstandingBills > $soc->outstanding_limit) { print img_warning($langs->trans("OutstandingBillReached")); @@ -3307,7 +3307,7 @@ if ($action == 'create') { print '
'; $tmp = ' '; $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3, 'standardonsmartphone'); print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; + print '
'; print '
'; } - // Output Kanban print $companystatic->getKanbanView(''); - //print_r($obj->nb_rights); if ($i == ($imaxinloop - 1)) { print '
'; print '
'; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; @@ -723,9 +744,9 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { @@ -757,10 +778,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; @@ -774,8 +795,9 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print '
'; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -867,6 +889,9 @@ while ($i < $imaxinloop) { print ''; } print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -960,9 +985,9 @@ while ($i < $imaxinloop) { print ''; } print '
'.$langs->trans("NoRecordFound").'
'; print ''; - print ''; + print ''; $datem = $db->jdate($obj->dv); print ''; } else { $tmpaction = 'view'; From 10fff593579172295452ebbc52cf8a2b237f2c83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2023 23:19:37 +0100 Subject: [PATCH 572/572] Trans --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/langs/en_US/bills.lang | 2 +- htdocs/langs/en_US/boxes.lang | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e0599f0fcf0..174648dfa8c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1233,7 +1233,7 @@ class pdf_crabe extends ModelePDFFactures $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $object->thirdparty->id); $iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic; - $lib_mode_reg .= $outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1)); + $lib_mode_reg .= ' '.$outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1)); } $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 57d7b75d12a..312115bb0c1 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1326,7 +1326,7 @@ class pdf_sponge extends ModelePDFFactures $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $object->thirdparty->id); $iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic; - $lib_mode_reg .= $outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1)); + $lib_mode_reg .= ' '.$outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1)); } $pdf->MultiCell($posxend - $posxval, 5, $lib_mode_reg, 0, 'L'); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 183620c72da..7ad897ab0e2 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -450,7 +450,7 @@ ErrorPaymentConditionsNotEligibleToDepositCreation=The chose payment conditions PaymentTypeVIR=Bank transfer PaymentTypeShortVIR=Bank transfer PaymentTypePRE=Direct debit payment order -PaymentTypePREdetails=(on account *-%s) +PaymentTypePREdetails=(on account %s...) PaymentTypeShortPRE=Debit payment order PaymentTypeLIQ=Cash PaymentTypeShortLIQ=Cash diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index e74539132f6..03840b9fab8 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -130,8 +130,8 @@ sendingindex=Home shippings receptionindex=Home receivings activityindex=Home activity proposalindex=Home proposal -ordersindex=Home orders -orderssuppliersindex=Home orders suppliers +ordersindex=Home sale orders +orderssuppliersindex=Home purchase orders contractindex=Home contracts interventionindex=Home interventions suppliersproposalsindex=Home suppliers proposals
'; print $desc; @@ -3346,7 +3346,7 @@ if ($action == 'create') { jQuery("#radio_deposit").prop("checked", true); setRadioForTypeOfIncoice(); }); - jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_template").change(function() { + jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_creditnote, #radio_template").change(function() { setRadioForTypeOfIncoice(); }); function setRadioForTypeOfIncoice() { @@ -3362,10 +3362,10 @@ if ($action == 'create') { }); '; - $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); print ''; print ''; if (($origin == 'propal') || ($origin == 'commande')) { @@ -3404,7 +3404,7 @@ if ($action == 'create') { print '
'; $tmp = ' '; $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); print $desc; print '
'; @@ -3417,7 +3417,7 @@ if ($action == 'create') { $tmp .= ' disabled'; } $tmp .= '> '; - $text = ' '; + $text = $tmp.' '; $text .= 'id > 0) { $text .= ' disabled'; @@ -3486,26 +3486,18 @@ if ($action == 'create') { if (!empty($conf->global->INVOICE_USE_SITUATION)) { print '
'; $tmp = ' '; - $text = ' '; + $text = $tmp.' '; $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); - print $desc; - print '
'; - - print '
'; - $tmp = ' '; - $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); print $desc; print '
'; } print '
'; $tmp = ' '; - $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + $text = $tmp.' '; + //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'replacementonsmartphone'); print $desc; print '
'; } @@ -3565,7 +3557,6 @@ if ($action == 'create') { }); '; $text = ' '; - // $text.=''; $text .= ' 0 ? 'checked' : '').' /> "; print '
    0 ? 'checked' : '').' /> "; print ''; @@ -3595,9 +3586,9 @@ if ($action == 'create') { } else { $tmp = ' '; } - $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + $text = $tmp.' '; + //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'creditnoteonsmartphone'); print $desc; print ''."\n"; } @@ -3606,9 +3597,8 @@ if ($action == 'create') { // Template invoice print '
'; $tmp = ' '; - $text = ' '; - //$text.= '('.$langs->trans("YouMustCreateStandardInvoiceFirst").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3); + $text = $tmp.' '; + $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3, 'templateonsmartphone'); print $desc; print '
'; @@ -3629,7 +3619,8 @@ if ($action == 'create') { $(document).ready(function() { var listType = {'.$jsListType.'}; $("[name=\'type\'").change(function() { - if($( this ).prop("checked")) + console.log("change name=type"); + if ($( this ).prop("checked")) { if(($( this ).val() in listType)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6fef01d3f7e..5ee6efac42f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -724,7 +724,7 @@ class Form * @param string $extracss Add a CSS style to td, div or span tag * @param int $noencodehtmltext Do not encode into html entity the htmltext * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable') + * @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable') * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) * @return string HTML code of text, picto, tooltip */ @@ -732,11 +732,6 @@ class Form { global $conf, $langs; - $alt = ''; - if ($tooltiptrigger) { - $alt = $langs->transnoentitiesnoconv("ClickToShowHelp"); - } - //For backwards compatibility if ($type == '0') { $type = 'info'; @@ -744,6 +739,15 @@ class Form $type = 'help'; } + if (preg_match('/onsmartphone$/', $tooltiptrigger) && empty($conf->dol_no_mouse_hover)) { + $tooltiptrigger = preg_replace('/^.*onsmartphone$/', '', $tooltiptrigger); + } + + $alt = ''; + if ($tooltiptrigger) { + $alt = $langs->transnoentitiesnoconv("ClickToShowHelp"); + } + // If info or help with no javascript, show only text if (empty($conf->use_javascript_ajax)) { if ($type == 'info' || $type == 'infoclickable' || $type == 'help' || $type == 'helpclickable') { From 4ce5d0f42d5d7a147f8e712f71aed43eae2ef04b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 01:34:45 +0100 Subject: [PATCH 256/572] Debug v17 --- htdocs/compta/facture/card.php | 51 +++++++++++---------------- htdocs/core/class/html.form.class.php | 16 +++++---- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c2469655df6..eaebb294cac 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3189,7 +3189,7 @@ if ($action == 'create') { $arrayoutstandingbills = $soc->getOutstandingBills(); $outstandingBills = $arrayoutstandingbills['opened']; print ' - '.$langs->trans('CurrentOutstandingBill').': '; - print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); + print ''.price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency).''; if ($soc->outstanding_limit != '') { if ($outstandingBills > $soc->outstanding_limit) { print img_warning($langs->trans("OutstandingBillReached")); @@ -3308,7 +3308,7 @@ if ($action == 'create') { print '
'; $tmp = ' '; $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3, 'standardonsmartphone'); print '
'; + $tmp = $tmp.''; + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3, 'depositonsmartphone'); print $desc; print '
'; print '
'; print $desc; @@ -3347,7 +3347,7 @@ if ($action == 'create') { jQuery("#radio_deposit").prop("checked", true); setRadioForTypeOfIncoice(); }); - jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_template").change(function() { + jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_creditnote, #radio_template").change(function() { setRadioForTypeOfIncoice(); }); function setRadioForTypeOfIncoice() { @@ -3363,10 +3363,10 @@ if ($action == 'create') { }); '; - $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); print ''; print ''; if (($origin == 'propal') || ($origin == 'commande')) { @@ -3405,7 +3405,7 @@ if ($action == 'create') { print '
'; $tmp = ' '; $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); print $desc; print '
'; @@ -3418,7 +3418,7 @@ if ($action == 'create') { $tmp .= ' disabled'; } $tmp .= '> '; - $text = ' '; + $text = $tmp.' '; $text .= 'id > 0) { $text .= ' disabled'; @@ -3487,26 +3487,18 @@ if ($action == 'create') { if (!empty($conf->global->INVOICE_USE_SITUATION)) { print '
'; $tmp = ' '; - $text = ' '; + $text = $tmp.' '; $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); - print $desc; - print '
'; - - print '
'; - $tmp = ' '; - $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); print $desc; print '
'; } print '
'; $tmp = ' '; - $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + $text = $tmp.' '; + //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'replacementonsmartphone'); print $desc; print '
'; } @@ -3566,7 +3558,6 @@ if ($action == 'create') { }); '; $text = ' '; - // $text.=''; $text .= ' 0 ? 'checked' : '').' /> "; print '
    0 ? 'checked' : '').' /> "; print ''; @@ -3596,9 +3587,9 @@ if ($action == 'create') { } else { $tmp = ' '; } - $text = ' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + $text = $tmp.' '; + //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'creditnoteonsmartphone'); print $desc; print ''."\n"; } @@ -3607,9 +3598,8 @@ if ($action == 'create') { // Template invoice print '
'; $tmp = ' '; - $text = ' '; - //$text.= '('.$langs->trans("YouMustCreateStandardInvoiceFirst").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3); + $text = $tmp.' '; + $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3, 'templateonsmartphone'); print $desc; print '
'; @@ -3630,7 +3620,8 @@ if ($action == 'create') { $(document).ready(function() { var listType = {'.$jsListType.'}; $("[name=\'type\'").change(function() { - if($( this ).prop("checked")) + console.log("change name=type"); + if ($( this ).prop("checked")) { if(($( this ).val() in listType)) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a672709cc48..62fee2bc8ec 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -709,7 +709,7 @@ class Form * @param string $extracss Add a CSS style to td, div or span tag * @param int $noencodehtmltext Do not encode into html entity the htmltext * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable') + * @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable') * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) * @return string HTML code of text, picto, tooltip */ @@ -717,11 +717,6 @@ class Form { global $conf, $langs; - $alt = ''; - if ($tooltiptrigger) { - $alt = $langs->transnoentitiesnoconv("ClickToShowHelp"); - } - //For backwards compatibility if ($type == '0') { $type = 'info'; @@ -729,6 +724,15 @@ class Form $type = 'help'; } + if (preg_match('/onsmartphone$/', $tooltiptrigger) && empty($conf->dol_no_mouse_hover)) { + $tooltiptrigger = preg_replace('/^.*onsmartphone$/', '', $tooltiptrigger); + } + + $alt = ''; + if ($tooltiptrigger) { + $alt = $langs->transnoentitiesnoconv("ClickToShowHelp"); + } + // If info or help with no javascript, show only text if (empty($conf->use_javascript_ajax)) { if ($type == 'info' || $type == 'infoclickable' || $type == 'help' || $type == 'helpclickable') { From 438c7b93f2a73670e21ca1683418b984088e96f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:18:46 +0100 Subject: [PATCH 257/572] Debug v18 --- htdocs/contrat/list.php | 112 ++++++++++++++---- .../modulebuilder/template/myobject_list.php | 8 +- htdocs/user/list.php | 8 +- 3 files changed, 94 insertions(+), 34 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 38c37c1389e..ea072abddf2 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -51,6 +51,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractlist'; // To manage different context of search +$optioncss = GETPOST('optioncss', 'alpha'); $mode = GETPOST('mode', 'alpha'); $search_name = GETPOST('search_name', 'alpha'); @@ -88,15 +89,15 @@ if (GETPOSTISSET('formfilteraction')) { } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); -$optioncss = GETPOST('optioncss', 'alpha'); - +// Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -175,6 +176,7 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); $permissiontoread = $user->rights->contrat->lire; +$permissiontoadd = $user->rights->contrat->creer; $permissiontodelete = $user->rights->contrat->supprimer; @@ -183,7 +185,8 @@ $permissiontodelete = $user->rights->contrat->supprimer; */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -243,13 +246,15 @@ if (empty($reshook)) { * View */ -$now = dol_now(); $form = new Form($db); $formfile = new FormFile($db); $formother = new FormOther($db); $socstatic = new Societe($db); $formcompany = new FormCompany($db); $contracttmp = new Contrat($db); + +$now = dol_now(); + $title = ""; $sql = 'SELECT'; @@ -272,7 +277,8 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total @@ -452,6 +458,7 @@ if (empty($reshook)) { } $sql .= $hookmanager->resPrint; +// Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { //$result = $db->query($sql); @@ -485,8 +492,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $page = 0; $offset = 0; } + $db->free($resql); } +// Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); if ($limit) { $sql .= $db->plimit($limit + 1, $offset); @@ -631,7 +640,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars i $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer); -print '
'; +print ''."\n"; if ($optioncss != '') { print ''; } @@ -725,10 +734,12 @@ if ($massactionbutton) { print '
'; print '
'; + $tmp = $tmp.''; + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3, 'depositonsmartphone'); print $desc; print '
'."\n"; +// Fields title search +// -------------------------------------------------------------------- print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -837,81 +848,114 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print $searchpicto; print ''; } -print "\n"; +print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; + +// Fields title label +// -------------------------------------------------------------------- print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['c.ref']['checked'])) { print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['c.ref_customer']['checked'])) { print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['c.ref_supplier']['checked'])) { print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.email']['checked'])) { print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['s.zip']['checked'])) { print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['state.nom']['checked'])) { print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['country.code_iso']['checked'])) { print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['typent.code']['checked'])) { print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['sale_representative']['checked'])) { print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['c.date_contrat']['checked'])) { print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['c.datec']['checked'])) { print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['c.tms']['checked'])) { print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['lower_planned_end_date']['checked'])) { print_liste_field_titre($arrayfields['lower_planned_end_date']['label'], $_SERVER["PHP_SELF"], "lower_planned_end_date", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; // For the column action } if (!empty($arrayfields['status']['checked'])) { print_liste_field_titre($staticcontratligne->LibStatut(0, 3, -1, 'class="nochangebackground"'), '', '', '', '', 'width="16"'); + $totalarray['nbfield']++; // For the column action print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 0, 'class="nochangebackground"'), '', '', '', '', 'width="16"'); + $totalarray['nbfield']++; // For the column action print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 1, 'class="nochangebackground"'), '', '', '', '', 'width="16"'); + $totalarray['nbfield']++; // For the column action print_liste_field_titre($staticcontratligne->LibStatut(5, 3, -1, 'class="nochangebackground"'), '', '', '', '', 'width="16"'); + $totalarray['nbfield']++; // For the column action } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + $totalarray['nbfield']++; // For the column action } print "\n"; +// Loop on record +// -------------------------------------------------------------------- +$i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; $typenArray = array(); $cacheCountryIDCode = array(); - -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } $contracttmp->ref = $obj->ref; $contracttmp->id = $obj->rowid; @@ -938,10 +982,10 @@ while ($i < min($num, $limit)) { $socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code']; $socstatic->country = $cacheCountryIDCode[$obj->country_id]['label']; } - //mode kanban + if ($mode == 'kanban') { if ($i == 0) { - print ''; } } else { - print ''; + // Show here line of result + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Ref if (!empty($arrayfields['c.ref']['checked'])) { @@ -987,11 +1035,17 @@ while ($i < min($num, $limit)) { print ''; print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Ref thirdparty if (!empty($arrayfields['c.ref_customer']['checked'])) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['c.ref_supplier']['checked'])) { print ''; @@ -1140,6 +1194,12 @@ while ($i < min($num, $limit)) { print ''; print ''; print ''; + if (!$i) { + $totalarray['nbfield']++; + $totalarray['nbfield']++; + $totalarray['nbfield']++; + $totalarray['nbfield']++; + } } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -1152,12 +1212,12 @@ while ($i < min($num, $limit)) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } - print "\n"; + print ''."\n"; } $i++; } @@ -1179,10 +1239,10 @@ $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print '
'; + print '
'; print '
'; } @@ -949,12 +993,13 @@ while ($i < min($num, $limit)) { $contracttmp->societe = $socstatic->getNomUrl(); $contracttmp->date_contrat = $obj->date_contrat; print $contracttmp->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print '
'; @@ -966,6 +1011,9 @@ while ($i < min($num, $limit)) { print ''; } print ''.$contracttmp->getFormatedCustomerRef($obj->ref_customer).''.dol_escape_htmltag($obj->ref_supplier).''.($obj->nb_running > 0 ? $obj->nb_running : '').''.($obj->nb_expired > 0 ? $obj->nb_expired : '').''.($obj->nb_closed > 0 ? $obj->nb_closed : '').'
'; -print ''; +print '
'."\n"; +print ''."\n"; -print ''; +print ''."\n"; $hidegeneratedfilelistifempty = 1; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { @@ -1194,8 +1254,8 @@ $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortor $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; -$genallowed = $user->rights->contrat->lire; -$delallowed = $user->rights->contrat->lire; +$genallowed = $permissiontoread; +$delallowed = $permissiontoadd; print $formfile->showdocuments('massfilesarea_contract', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 338ad79affb..ef4753c7199 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -343,7 +343,7 @@ if ($search_all) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; /* If a group by is required @@ -560,10 +560,10 @@ print ''; +print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -615,7 +615,7 @@ print $hookmanager->resPrint; }*/ // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 82a56264f1c..e298da2d14c 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -729,10 +729,10 @@ print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; +print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -820,8 +820,8 @@ if (!empty($arrayfields['u.tms']['checked'])) { } if (!empty($arrayfields['u.statut']['checked'])) { // Status - print ''; } // Action column From 07ef94debfeb7e3c9ddfcb8ec9c476a49a94a7a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:29:48 +0100 Subject: [PATCH 258/572] Fix filter on contract list --- htdocs/projet/list.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index dea5848b469..de44d4a0bfc 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -789,8 +789,10 @@ if ($search_date_end_end) { if ($socid) { $param .= '&socid='.urlencode($socid); } -if (!empty($search_categ)) { - $param .= '&search_categ='.urlencode($search_categ); +if (!empty($search_category_array)) { + foreach ($search_category_array as $tmpval) { + $param .= '&search_categegory_project_list[]='.urlencode($tmpval); + } } if ($search_ref != '') { $param .= '&search_ref='.urlencode($search_ref); @@ -819,8 +821,8 @@ if ($search_public != '') { if ($search_project_user > 0) { $param .= '&search_project_user='.urlencode($search_project_user); } -if ($search_project_contact != '') { - $param .= '&search_project_user='.urlencode($search_project_contact); +if ($search_project_contact > 0) { + $param .= '&search_project_contact='.urlencode($search_project_contact); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); From 7d445ff1bd4fd40032633b7202e5263e1a83199f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:29:56 +0100 Subject: [PATCH 259/572] css --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c35b0c3515f..0007bc334b9 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2840,7 +2840,7 @@ class Contrat extends CommonObject $return .= '
'.$this->societe.''; } if (property_exists($this, 'date_contrat')) { - $return .= '
'.$langs->trans("DateContract").' : '.dol_print_date($this->date_contrat).''; + $return .= '
'.$langs->trans("DateContract").' : '.dol_print_date($this->date_contrat, 'day').''; } if (method_exists($this, 'getLibStatut')) { $return .= '
'.$this->getLibStatut(5).'
'; From eaa0e5eb3e83bef4ca87ac2157777dcc3a32f79a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:39:39 +0100 Subject: [PATCH 260/572] CSS --- htdocs/adherents/list.php | 2 +- htdocs/adherents/subscription/list.php | 2 +- htdocs/adherents/type.php | 2 +- htdocs/admin/emailcollector_list.php | 2 +- htdocs/admin/modules.php | 2 +- htdocs/bom/bom_list.php | 2 +- htdocs/bookcal/availabilities_list.php | 2 +- htdocs/bookcal/booking_list.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/bank/list.php | 2 +- htdocs/compta/bank/various_payment/list.php | 2 +- htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/compta/localtax/list.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/prelevement/list.php | 2 +- htdocs/compta/prelevement/orders_list.php | 2 +- htdocs/compta/sociales/list.php | 2 +- htdocs/compta/tva/list.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/don/list.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/expensereport/payment/list.php | 2 +- htdocs/fichinter/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/hrm/evaluation_list.php | 2 +- htdocs/hrm/job_list.php | 2 +- htdocs/hrm/position_list.php | 2 +- htdocs/hrm/skill_list.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- htdocs/loan/list.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- htdocs/mrp/mo_list.php | 2 +- htdocs/partnership/partnership_list.php | 2 +- htdocs/product/list.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/recruitment/recruitmentcandidature_list.php | 2 +- htdocs/recruitment/recruitmentjobposition_list.php | 2 +- htdocs/salaries/list.php | 2 +- htdocs/salaries/payments.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- htdocs/ticket/list.php | 2 +- htdocs/user/group/list.php | 2 +- htdocs/user/list.php | 2 +- htdocs/webhook/target_list.php | 2 +- htdocs/workstation/workstation_list.php | 2 +- 54 files changed, 54 insertions(+), 54 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7684b175ccb..006c43ba1a1 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1051,7 +1051,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print ''; + print ''; $datem = $db->jdate($obj->dp); print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; - print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75imp maxwidth125 onrightofpage'); + print ''; + print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print '
'; - print '
'; + print '
'; } $membertypestatic->id = $obj->type_id; $membertypestatic->label = $obj->type; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index ef47c347cdf..45fbc99b816 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -532,7 +532,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } //fetch informations needs on this mode diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index f7f4394a80f..ce9afa976d6 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -336,7 +336,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } //output kanban $membertype->label = $objp->label; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index de18b57b297..3913d10df56 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -552,7 +552,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1833df59fd2..9dc1b6e0811 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -759,7 +759,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { print load_fiche_titre($familytext, '', '', 0, '', 'modulefamilygroup'); if ($mode == 'commonkanban') { - print '
'; + print '
'; } else { print '
'; print ''."\n"; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index c5e5491dff8..7e2098bb119 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -685,7 +685,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print ''."\n"; // Line text diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4f64cf4c0aa..9b651fb0049 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4110,7 +4110,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'github', 'google', 'jabber', 'microsoft', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', - 'partnership', 'payment', 'payment_vat', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'region', + 'partnership', 'payment', 'payment_vat', 'pencil-ruler', 'pictoconfirm', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'region', 'salary', 'shipment', 'state', 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced', 'technic', 'ticket', 'error', 'warning', @@ -4159,8 +4159,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'proposal'=>'file-signature', - 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'puce'=>'angle-right', - 'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', + 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'pictoconfirm'=>'check-square', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'puce'=>'angle-right', + 'recent' => 'check-square', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'region'=>'map-marked', 'replacement'=>'exchange-alt', 'resource'=>'laptop-house', 'recurring'=>'history', 'service'=>'concierge-bell', diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index e84db5c99dd..ee9eabfa289 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -74,12 +74,12 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { $formquestion = array(); if (!empty($categ_types)) { foreach ($categ_types as $categ_type) { - $cate_arbo = $form->select_all_categories($categ_type['code'], null, 'parent', null, null, 1); + $categ_arbo_tmp = $form->select_all_categories($categ_type['code'], null, 'parent', null, null, 2); $formquestion[] = array( 'type' => 'other', 'name' => 'affecttag_'.$categ_type['code'], 'label' => '', - 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $cate_arbo, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->trans("SelectTheTagsToAssign")) + 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->trans("SelectTheTagsToAssign")) ); } $formquestion[] = array( From 760135a0bbc682423b40afea2294a6797c06759c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 12:10:59 +0100 Subject: [PATCH 267/572] Look and feel v18 --- htdocs/core/tpl/massactions_pre.tpl.php | 20 ++++++++++++-------- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 5124a1dce35..67a2e1ebd01 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -63,15 +63,19 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { if (!empty($categ_types)) { foreach ($categ_types as $categ_type) { $cate_arbo = $form->select_all_categories($categ_type['code'], null, 'parent', null, null, 1); - $formquestion[] = array('type' => 'other', - 'name' => 'affecttag_'.$categ_type['code'], - 'label' => $langs->trans("Tag").' '.$categ_type['label'], - 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $cate_arbo, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, null, null, '60%')); - } - $formquestion[] = array('type' => 'other', - 'name' => 'affecttag_type', + $formquestion[] = array( + 'type' => 'other', + 'name' => 'affecttag_'.$categ_type['code'], 'label' => '', - 'value' => ''); + 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $cate_arbo, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->trans("SelectTheTagsToAssign")) + ); + } + $formquestion[] = array( + 'type' => 'other', + 'name' => 'affecttag_type', + 'label' => '', + 'value' => '' + ); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAffectTag"), $langs->trans("ConfirmAffectTagQuestion", count($toselect)), "affecttag", $formquestion, 1, 0, 200, 500, 1); } else { setEventMessage('CategTypeNotFound'); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a79a5083b69..992eb91b050 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -513,6 +513,7 @@ NotYetAvailable=Not yet available NotAvailable=Not available Categories=Tags/categories Category=Tag/category +SelectTheTagsToAssign=Select the tags/categories to assign By=By From=From FromDate=From From 30c0b5e60e09b32caad6885134c4a618197e4c3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 12:39:00 +0100 Subject: [PATCH 268/572] Debug Look and feel v17 --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/core/tpl/massactions_pre.tpl.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 62fee2bc8ec..e04c0bddf11 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5354,7 +5354,7 @@ class Form // Line title $formconfirm .= ''."\n"; // Line text diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 79e3c3e05c7..7ca4b30e0a0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4109,7 +4109,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'github', 'google', 'jabber', 'microsoft', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', - 'partnership', 'payment', 'payment_vat', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'region', + 'partnership', 'payment', 'payment_vat', 'pencil-ruler', 'pictoconfirm', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'region', 'salary', 'shipment', 'state', 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced', 'technic', 'ticket', 'error', 'warning', @@ -4158,8 +4158,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'proposal'=>'file-signature', - 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'puce'=>'angle-right', - 'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', + 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'pictoconfirm'=>'check-square', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'puce'=>'angle-right', + 'recent' => 'check-square', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'region'=>'map-marked', 'replacement'=>'exchange-alt', 'resource'=>'laptop-house', 'recurring'=>'history', 'service'=>'concierge-bell', diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 67a2e1ebd01..24ec6665d03 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -62,12 +62,12 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { $formquestion = array(); if (!empty($categ_types)) { foreach ($categ_types as $categ_type) { - $cate_arbo = $form->select_all_categories($categ_type['code'], null, 'parent', null, null, 1); + $categ_arbo_tmp = $form->select_all_categories($categ_type['code'], null, 'parent', null, null, 2); $formquestion[] = array( 'type' => 'other', 'name' => 'affecttag_'.$categ_type['code'], 'label' => '', - 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $cate_arbo, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->trans("SelectTheTagsToAssign")) + 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->trans("SelectTheTagsToAssign")) ); } $formquestion[] = array( From b5ec68a1c3182f02f302e003fe84d2cf9735e98a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 13:05:35 +0100 Subject: [PATCH 269/572] Fix look and feel v17 --- htdocs/comm/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 5d71683a311..8f94f29f7ca 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -868,7 +868,7 @@ if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TOD print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -971,7 +971,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { print '
'; - print '
'; + print '
'; } // Output kanban print $object->getKanbanView(''); diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php index 414faf2dc5a..f111b8df8bf 100644 --- a/htdocs/bookcal/availabilities_list.php +++ b/htdocs/bookcal/availabilities_list.php @@ -639,7 +639,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index 3c78ffea120..2c5355c2824 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -639,7 +639,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index cc507041ac6..323b9627c34 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1718,7 +1718,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $userstatic->fetch($obj->fk_user_author); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 9c06f86e8c3..584926cd87e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1998,7 +1998,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } print $generic_commande->getKanbanView(''); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 2a0995af009..668ada03fdb 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -596,7 +596,7 @@ foreach ($accounts as $key => $type) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $objecttmp->getKanbanView(''); diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index edb770bb4e6..204ea92041f 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -605,7 +605,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 0ae54456735..4b3c9b31322 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -575,7 +575,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $object->posmodule = $obj->posmodule; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 54510bd3fae..23c7d87f87a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1921,7 +1921,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $facturestatic->socid = $companystatic->getNomUrl(1, 'company', 15); diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 42f4d326811..23fd1186e0e 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -96,7 +96,7 @@ if ($result) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $localtax_static->getKanbanView(''); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 38db4fca14b..794db8df39b 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -243,7 +243,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $checkdepositstatic->getKanbanView(''); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 8d9489bbec7..ad8570d9268 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -282,7 +282,7 @@ if ($result) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index bead580ab31..c2e8c5e4194 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -236,7 +236,7 @@ if ($result) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index a132a3650dc..498a28a54f5 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -614,7 +614,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 0497c05d204..80f73c6fe44 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -489,7 +489,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index e6dd6baa1db..4bb325f30ae 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1234,7 +1234,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $contactstatic->photo = $obj->photo; if ($obj->socid > 0) { diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index ea072abddf2..560b83175fb 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -986,7 +986,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 819e0ea7931..a895db4f3a6 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -298,7 +298,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $donationstatic->amount = $objp->amount; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 3bbbe328080..3ad6e2702c0 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -885,7 +885,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 26cafe14b5d..b13db1c159b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -903,7 +903,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $object->socid = $companystatic->getNomUrl(1); $object->date_delivery = $obj->delivery_date; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 918c916a52c..c093bbfd721 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -750,7 +750,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $usertmp->fetch($obj->id_user); $expensereportstatic->fk_user_author = $usertmp->getNomUrl(1); diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index 4c838a73b1e..c236e72d514 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -500,7 +500,7 @@ while ($i < min($num, $limit)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $paymentexpensereportstatic->getKanbanView(''); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 2f704384305..d2b326a6ba4 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -703,7 +703,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 394660f3866..b6e94712e0b 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1674,7 +1674,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $thirdpartytmp->id = $obj->socid; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 9b790050571..1aab2dd6a45 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1415,7 +1415,7 @@ if ($num > 0) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $facturestatic->socid = $thirdparty->getNomUrl(1, 'supplier', 3); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 05568e08992..421da582e0d 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -832,7 +832,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index adf642597f2..f39030cf3d5 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -579,7 +579,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $object->date_eval = $obj->date_eval; diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index c980cec9abf..b347c32848c 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -606,7 +606,7 @@ while ($i < $imaxinloop) { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index 4518d28bf65..f5740834da7 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -615,7 +615,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // get info needed $object->date_start = $obj->date_start; diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index 03302a812ff..e9d3564c1a4 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -556,7 +556,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 3a916cb96ef..f7e49f0f88c 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -643,7 +643,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index b864c9f09ab..d3eace18a88 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -285,7 +285,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $loan_static->datestart= $obj->datestart; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ef4753c7199..7fa1b718dd9 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -697,7 +697,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index c3ae9247c9d..36dbe6c120a 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -609,7 +609,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $object->id = $obj->type_id; $bom->id = $obj->fk_bom; diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index a13fb6f8182..4fc78fdbdde 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -866,7 +866,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 9bd1a202245..15f8e93dd6b 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1417,7 +1417,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $product_static->price = $obj->price; // Output Kanban diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 9ab992d537b..56f83c26f03 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -634,7 +634,7 @@ while ($i < min($num, $limit)) { if ($mode =='kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $warehouse->getKanbanView(''); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index bc4c8770f0f..00449a30a17 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -1127,7 +1127,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $object->fk_statut = $projectstatic->getLibStatut(1); diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 95b6ac6203d..8fcd62fc078 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -733,7 +733,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } $recuitment = new RecruitmentJobPosition($db); $recuitment->fetch($obj->fk_recruitmentjobposition); diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 670eca08040..8a0d3f06540 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -591,7 +591,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if ($massactionbutton || $massaction) { diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 24b416295d1..35e82e96da1 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -570,7 +570,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $salstatic->getKanbanView(''); diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 7bf61f3021f..807ae82f9af 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -575,7 +575,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 4ddb23379a9..12de0af0f29 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1561,7 +1561,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $companystatic->getKanbanView(''); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 8683d6db205..7162bc7dd2a 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -984,7 +984,7 @@ if ($resql) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban $userstatic->fetch($obj->fk_user_author); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index f3e2c82d703..a3caccbef6d 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -1008,7 +1008,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // get infos needed from object $userstatic = new User($db); diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 5f017da01c9..05adcf15059 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -386,7 +386,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index e298da2d14c..981c3744028 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -1009,7 +1009,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index 1db73639103..a5f01c306f8 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -631,7 +631,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 8639adf866d..91818e2b344 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -629,7 +629,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { print '
'; - print '
'; + print '
'; } // Output Kanban print $object->getKanbanView(''); From 35d496de3876859952774cdb1a280b0ca22519ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:41:53 +0100 Subject: [PATCH 261/572] Update user.class.php --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 752cbf15c34..3329e4fe71e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2359,7 +2359,7 @@ class User extends CommonObject /** * Send new password by email * - * @param User $user Object user that send the email (not the user we send too) @todo object $user is not used ! + * @param User $user Object user that send the email (not the user we send to) @todo object $user is not used ! * @param string $password New password * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @todo Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok From 4ba1309a17d0e3b3012db3857a72ab765fb3c033 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:55:11 +0100 Subject: [PATCH 262/572] Update param_ihm.php --- htdocs/user/param_ihm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index fba8cb0611e..43fb3159df4 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -230,7 +230,7 @@ if (!empty($conf->global->MAIN_USE_BOOKMARKS_FOR_LANDING_PAGES)) { $i = 0; while ($i < $object->db->num_rows($resql)) { $obj = $db->fetch_object($resql); - $landing_url = str_replace(DOL_URL_ROOT,'',$obj->url); + $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url); $tmparray[$landing_url] = $obj->title; $i++; } From b3e54b5ed2767a47be828d1d83244d196e34ebca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 02:58:48 +0100 Subject: [PATCH 263/572] Update param_ihm.php --- htdocs/user/param_ihm.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 43fb3159df4..70eb215cda1 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -219,16 +219,16 @@ if (!empty($conf->global->MAIN_USE_BOOKMARKS_FOR_LANDING_PAGES)) { $sql = "SELECT b.rowid, b.fk_user, b.url, b.title,"; $sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b"; - $sql .= " WHERE 1=1"; - $sql .= " AND b.entity IN (".getEntity('bookmark').")"; + $sql .= " WHERE b.entity IN (".getEntity('bookmark').")"; $sql .= " AND b.url NOT LIKE 'http%'"; if (!$object->admin) { $sql .= " AND (b.fk_user = ".((int) $object->id)." OR b.fk_user is NULL OR b.fk_user = 0)"; } - $resql = $object->db->query($sql); + $resql = $db->query($sql); if ($resql) { $i = 0; - while ($i < $object->db->num_rows($resql)) { + $num_rows = $db->num_rows($resql); + while ($i < $num_rows) { $obj = $db->fetch_object($resql); $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url); $tmparray[$landing_url] = $obj->title; From 7454e6cbf1aa7c1a7350146d3a1a126f49264bbe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 03:00:02 +0100 Subject: [PATCH 264/572] Update param_ihm.php --- htdocs/user/param_ihm.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 70eb215cda1..9d42e210ada 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -215,9 +215,8 @@ if (isModEnabled('ticket')) { $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets'; } // add bookmarks to available landing pages -if (!empty($conf->global->MAIN_USE_BOOKMARKS_FOR_LANDING_PAGES)) { - $sql = "SELECT b.rowid, b.fk_user, b.url, b.title,"; - +if (empty($conf->global->MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES)) { + $sql = "SELECT b.rowid, b.fk_user, b.url, b.title"; $sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b"; $sql .= " WHERE b.entity IN (".getEntity('bookmark').")"; $sql .= " AND b.url NOT LIKE 'http%'"; From 09b84f08379778c1cc87a0d2d61551227352c21c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 12:10:59 +0100 Subject: [PATCH 265/572] Look and feel v18 --- htdocs/core/tpl/massactions_pre.tpl.php | 20 ++++++++++++-------- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 66b681cb3ca..e84db5c99dd 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -75,15 +75,19 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { if (!empty($categ_types)) { foreach ($categ_types as $categ_type) { $cate_arbo = $form->select_all_categories($categ_type['code'], null, 'parent', null, null, 1); - $formquestion[] = array('type' => 'other', - 'name' => 'affecttag_'.$categ_type['code'], - 'label' => $langs->trans("Tag").' '.$categ_type['label'], - 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $cate_arbo, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, null, null, '60%')); - } - $formquestion[] = array('type' => 'other', - 'name' => 'affecttag_type', + $formquestion[] = array( + 'type' => 'other', + 'name' => 'affecttag_'.$categ_type['code'], 'label' => '', - 'value' => ''); + 'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $cate_arbo, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->trans("SelectTheTagsToAssign")) + ); + } + $formquestion[] = array( + 'type' => 'other', + 'name' => 'affecttag_type', + 'label' => '', + 'value' => '' + ); print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAffectTag"), $langs->trans("ConfirmAffectTagQuestion", count($toselect)), "affecttag", $formquestion, 1, 0, 200, 500, 1); } else { setEventMessage('CategTypeNotFound'); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 22f04a3ad44..6734168621c 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -514,6 +514,7 @@ NotYetAvailable=Not yet available NotAvailable=Not available Categories=Tags/categories Category=Tag/category +SelectTheTagsToAssign=Select the tags/categories to assign By=By From=From FromDate=From From 17b22673974367b5b3aa3230d6c84f454dcf2658 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 12:39:00 +0100 Subject: [PATCH 266/572] Debug Look and feel v17 --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/core/tpl/massactions_pre.tpl.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5ee6efac42f..c47add93207 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5369,7 +5369,7 @@ class Form // Line title $formconfirm .= '
'; - $formconfirm .= img_picto('', 'recent').' '.$title; + $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; $formconfirm .= '
'; - $formconfirm .= img_picto('', 'recent').' '.$title; + $formconfirm .= img_picto('', 'pictoconfirm').' '.$title; $formconfirm .= '
'.$staticcontrat->getNomUrl(1).''.$companystatic->getNomUrl(1, 'customer', 44).''.$companystatic->getNomUrl(1, 'customer').''.$staticcontrat->LibStatut($obj->statut, 3).'
'; print '
'.$companystatic->getNomUrl(1, 'customer', 44).''.$companystatic->getNomUrl(1, 'customer').''; print dol_print_date($datem, 'day', 'tzserver'); @@ -1091,7 +1091,7 @@ if (isModEnabled('commande') && $user->rights->commande->lire) { print '
'; print '
'.$companystatic->getNomUrl(1, 'customer', 44).''.$companystatic->getNomUrl(1, 'customer').''; print dol_print_date($datem, 'day', 'tzserver'); From 836191648b8595a581b12a420e0cb4d474e5ea3a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 19 Feb 2023 13:35:16 +0100 Subject: [PATCH 270/572] fix php error --- htdocs/adherents/type.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ce9afa976d6..207acc53e6f 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -42,6 +42,7 @@ $langs->load("members"); $rowid = GETPOST('rowid', 'int'); $action = GETPOST('action', 'aZ09'); +$massaction = GETPOST('massaction', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); From 56add74e71895008b86bd0130a0a04bb0e0e7f20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 13:58:57 +0100 Subject: [PATCH 271/572] Debug v17 --- htdocs/comm/index.php | 2 +- htdocs/core/lib/project.lib.php | 41 +++++++++++++++++++----- htdocs/fourn/facture/list.php | 56 +++++++++++++++++---------------- htdocs/projet/card.php | 2 +- htdocs/projet/index.php | 3 +- 5 files changed, 65 insertions(+), 39 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 8f94f29f7ca..415728cb3e9 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -163,7 +163,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { $obj = $db->fetch_object($resql); if ($i >= $max) { - $othernb += 1; + $othernb++; $i++; $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); continue; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f144b97e922..cdffc5c1961 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2192,13 +2192,16 @@ function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole) * @param int $status -1=No filter on statut, 0 or 1 = Filter on status * @param array $listofoppstatus List of opportunity status * @param array $hiddenfields List of info to not show ('projectlabel', 'declaredprogress', '...', ) + * @param int $max Max nb of record to show in HTML list * @return void */ -function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array()) +function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array(), $max = 0) { global $langs, $conf, $user; global $theme_datacolor; + $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $listofstatus = array_keys($listofoppstatus); @@ -2229,8 +2232,6 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]); } - $arrayidtypeofcontact = array(); - print ''; print '
'; print ''; @@ -2309,11 +2310,15 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $resql = $db->query($sql2); if ($resql) { + $othernb = 0; $total_task = 0; $total_opp_amount = 0; $ponderated_opp_amount = 0; + $total_plannedworkload = 0; + $total_declaredprogressworkload = 0; $num = $db->num_rows($resql); + $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); $i = 0; print ''; @@ -2340,11 +2345,23 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } print "\n"; - $total_plannedworkload = 0; - $total_declaredprogressworkload = 0; - while ($i < $num) { + while ($i < $nbofloop) { $objp = $db->fetch_object($resql); + if ($max && $i >= $max) { + $othernb++; + $i++; + $total_task += $objp->nb; + $total_opp_amount += $objp->opp_amount; + $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100; + $ponderated_opp_amount += price2num($opp_weighted_amount); + $plannedworkload = $objp->planned_workload; + $total_plannedworkload += $plannedworkload; + $declaredprogressworkload = $objp->declared_progess_workload; + $total_declaredprogressworkload += $declaredprogressworkload; + continue; + } + $projectstatic->id = $objp->projectid; $projectstatic->user_author_id = $objp->fk_user_creat; $projectstatic->public = $objp->public; @@ -2451,13 +2468,21 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print "\n"; - $total_task = $total_task + $objp->nb; - $total_opp_amount = $total_opp_amount + $objp->opp_amount; + $total_task += $objp->nb; + $total_opp_amount += $objp->opp_amount; } $i++; } + if ($othernb) { + print ''; + print ''; + print "\n"; + } + print ''; print '"; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index be215e891eb..ad03c48258b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1028,17 +1028,17 @@ if (!empty($arrayfields['f.ref_supplier']['checked'])) { if (!empty($arrayfields['f.type']['checked'])) { print ''; @@ -1065,11 +1065,11 @@ if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { print ''; if (!$i) { $totalarray['nbfield']++; @@ -1543,7 +1543,7 @@ if ($num > 0) { // Alias if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; if (!$i) { $totalarray['nbfield']++; @@ -1551,8 +1551,8 @@ if ($num > 0) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -1560,7 +1560,7 @@ if ($num > 0) { } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; if (!$i) { @@ -1569,7 +1569,9 @@ if ($num > 0) { } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } @@ -1620,14 +1622,14 @@ if ($num > 0) { // Amount HT if (!empty($arrayfields['f.total_ht']['checked'])) { - print '\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; } - $totalarray['val']['f.total_ht'] += $obj->total_ht; + $totalarray['val']['f.total_ht'] += $obj->total_ht; } // Amount VAT if (!empty($arrayfields['f.total_vat']['checked'])) { @@ -1726,7 +1728,7 @@ if ($num > 0) { // Currency if (!empty($arrayfields['f.multicurrency_code']['checked'])) { - print '\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } @@ -1734,16 +1736,16 @@ if ($num > 0) { // Currency rate if (!empty($arrayfields['f.multicurrency_tx']['checked'])) { - print '\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } } // Amount HT if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) { - print '\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e954f429781..4f743cc58f7 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1102,7 +1102,7 @@ if ($action == 'create' && $user->rights->projet->creer) { print ''; print ''; } if (!empty($arrayfields['p.fk_statut']['checked'])) { From c3da1554a7edb6cf59d83ee69b52141b08a1d7ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 16:28:04 +0100 Subject: [PATCH 273/572] Debug v17 --- htdocs/core/actions_massactions.inc.php | 9 ++- htdocs/projet/class/project.class.php | 76 +++++++++++++------------ htdocs/projet/list.php | 1 + 3 files changed, 49 insertions(+), 37 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index d5731f014af..3338acd1be4 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -958,7 +958,14 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { foreach ($toselect as $toselectid) { $result = $objecttmp->fetch($toselectid); if ($result > 0) { - $result = $objecttmp->validate($user); + if (method_exists($objecttmp, 'validate')) { + $result = $objecttmp->validate($user); + } elseif (method_exists($objecttmp, 'setValid')) { + $result = $objecttmp->setValid($user); + } else { + $objecttmp->error = 'No method validate or setValid on this object'; + $result = -1; + } if ($result == 0) { $langs->load("errors"); setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 0d6df2ddc98..5375a418ca2 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1098,7 +1098,7 @@ class Project extends CommonObject * * @param User $user User that validate * @param int $notrigger 1=Disable triggers - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, 0=Nothing done, >0 if KO */ public function setValid($user, $notrigger = 0) { @@ -1106,47 +1106,51 @@ class Project extends CommonObject $error = 0; - if ($this->statut != 1) { - // Check parameters - if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->title)) { - $this->error = $langs->trans("ErrorFieldFormat", $langs->transnoentities("Label")).'. '.$langs->trans('RemoveString', $langs->transnoentitiesnoconv("CopyOf")); - return -1; + // Protection + if ($this->status == self::STATUS_VALIDATED) { + dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING); + return 0; + } + + // Check parameters + if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->title)) { + $this->error = $langs->trans("ErrorFieldFormat", $langs->transnoentities("Label")).'. '.$langs->trans('RemoveString', $langs->transnoentitiesnoconv("CopyOf")); + return -1; + } + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."projet"; + $sql .= " SET fk_statut = ".self::STATUS_VALIDATED; + $sql .= " WHERE rowid = ".((int) $this->id); + $sql .= " AND entity = ".((int) $conf->entity); + + dol_syslog(get_class($this)."::setValid", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + // Call trigger + if (empty($notrigger)) { + $result = $this->call_trigger('PROJECT_VALIDATE', $user); + if ($result < 0) { + $error++; + } + // End call triggers } - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."projet"; - $sql .= " SET fk_statut = 1"; - $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".((int) $conf->entity); - - dol_syslog(get_class($this)."::setValid", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - // Call trigger - if (empty($notrigger)) { - $result = $this->call_trigger('PROJECT_VALIDATE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - if (!$error) { - $this->statut = 1; - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - $this->error = join(',', $this->errors); - dol_syslog(get_class($this)."::setValid ".$this->error, LOG_ERR); - return -1; - } + if (!$error) { + $this->statut = 1; + $this->db->commit(); + return 1; } else { $this->db->rollback(); - $this->error = $this->db->lasterror(); + $this->error = join(',', $this->errors); + dol_syslog(get_class($this)."::setValid ".$this->error, LOG_ERR); return -1; } + } else { + $this->db->rollback(); + $this->error = $this->db->lasterror(); + return -1; } } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c50350c91cc..15fc35f9e84 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -888,6 +888,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( + 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), From 2cafd2cbc49268b1995f772ac416aab02a3a38aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 16:42:01 +0100 Subject: [PATCH 274/572] Debug v17 --- .../compta/paiement/cheque/class/remisecheque.class.php | 2 +- htdocs/core/actions_massactions.inc.php | 9 +++++++-- htdocs/don/class/don.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 3fb82f05cb9..9895e583601 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -261,7 +261,7 @@ class RemiseCheque extends CommonObject $this->errno = $this->db->lasterrno(); } - if (!$this->errno && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS)) { + if (!$this->errno && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_CHEQUE'))) { $res = $this->validate($user); //if ($res < 0) $error++; } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 3338acd1be4..9afd82b7eaf 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -984,8 +984,13 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $objecttmp->thirdparty->default_lang; + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && property_exists($objecttmp, 'thirdparty')) { + if ((property_exists($objecttmp, 'socid') || property_exists($objecttmp, 'fk_soc')) && empty($objecttmp->thirdparty)) { + $objecttmp->fetch_thirparty(); + } + if (!empty($objecttmp->thirdparty)) { + $newlang = $objecttmp->thirdparty->default_lang; + } } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index ceb5b95c1f3..35c5c5ff40a 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -438,7 +438,7 @@ class Don extends CommonObject } } - if (!$error && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS)) { + if (!$error && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_DONATION'))) { //$res = $this->setValid($user); //if ($res < 0) $error++; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 5375a418ca2..d6b0515eb1a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -498,7 +498,7 @@ class Project extends CommonObject } } - if (!$error && !empty($conf->global->MAIN_DISABLEDRAFTSTATUS)) { + if (!$error && (getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') || getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_PROJECT'))) { $res = $this->setValid($user); if ($res < 0) { $error++; From 6224414b0d36d1c8fe7e0bbad83848ab78eeab88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 16:55:36 +0100 Subject: [PATCH 275/572] Debug v17 --- htdocs/projet/card.php | 44 +++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 4f743cc58f7..bbecfacdae4 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -99,6 +99,8 @@ if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $acti accessforbidden(); } +$permissiontoadd = $user->rights->projet->creer; +$permissiontodelete = $user->rights->projet->supprimer; $permissiondellink = $user->rights->projet->creer; // Used by the include of actions_dellink.inc.php @@ -152,7 +154,20 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once - if ($action == 'add' && $user->rights->projet->creer) { + // Action setdraft object + if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) { + $result = $object->setStatut($object::STATUS_DRAFT, null, '', 'PROJECT_MODIFY'); + if ($result >= 0) { + // Nothing else done + } else { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + $action = ''; + } + + // Action add + if ($action == 'add' && $permissiontoadd) { $error = 0; if (!GETPOST('ref')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors'); @@ -260,7 +275,7 @@ if (empty($reshook)) { } } - if ($action == 'update' && empty(GETPOST('cancel')) && $user->rights->projet->creer) { + if ($action == 'update' && empty(GETPOST('cancel')) && $permissiontoadd) { $error = 0; if (empty($ref)) { @@ -376,7 +391,7 @@ if (empty($reshook)) { } // Build doc - if ($action == 'builddoc' && $user->rights->projet->creer) { + if ($action == 'builddoc' && $permissiontoadd) { // Save last template used to generate document if (GETPOST('model')) { $object->setDocModel($user, GETPOST('model', 'alpha')); @@ -395,7 +410,7 @@ if (empty($reshook)) { } // Delete file in doc form - if ($action == 'remove_file' && $user->rights->projet->creer) { + if ($action == 'remove_file' && $permissiontoadd) { if ($object->id > 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -413,28 +428,28 @@ if (empty($reshook)) { } - if ($action == 'confirm_validate' && $confirm == 'yes') { + if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { $result = $object->setValid($user); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - if ($action == 'confirm_close' && $confirm == 'yes') { + if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) { $result = $object->setClose($user); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - if ($action == 'confirm_reopen' && $confirm == 'yes') { + if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) { $result = $object->setValid($user); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->projet->supprimer) { + if ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontodelete) { $object->fetch($id); $result = $object->delete($user); if ($result > 0) { @@ -447,7 +462,7 @@ if (empty($reshook)) { } } - if ($action == 'confirm_clone' && $user->rights->projet->creer && $confirm == 'yes') { + if ($action == 'confirm_clone' && $permissiontoadd && $confirm == 'yes') { $clone_contacts = GETPOST('clone_contacts') ? 1 : 0; $clone_tasks = GETPOST('clone_tasks') ? 1 : 0; $clone_project_files = GETPOST('clone_project_files') ? 1 : 0; @@ -1483,6 +1498,17 @@ if ($action == 'create' && $user->rights->projet->creer) { } */ + // Back to draft + if (!getDolGlobalString('MAIN_DISABLEDRAFTSTATUS') && !getDolGlobalString('MAIN_DISABLEDRAFTSTATUS_PROJECT')) { + if ($object->statut != Project::STATUS_DRAFT && $user->rights->projet->creer) { + if ($userWrite > 0) { + print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_setdraft&confirm=yes&token='.newToken().'&id='.$object->id, ''); + } else { + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('SetToDraft'), 'default', $_SERVER['PHP_SELF']. '#', '', false); + } + } + } + // Modify if ($object->statut != Project::STATUS_CLOSED && $user->rights->projet->creer) { if ($userWrite > 0) { From 2b8b389bcfae99bfd31046d9e1de63bbd258545a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 17:00:40 +0100 Subject: [PATCH 276/572] Fix regression --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 9afd82b7eaf..6fe7ab2ac5d 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -986,7 +986,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && property_exists($objecttmp, 'thirdparty')) { if ((property_exists($objecttmp, 'socid') || property_exists($objecttmp, 'fk_soc')) && empty($objecttmp->thirdparty)) { - $objecttmp->fetch_thirparty(); + $objecttmp->fetch_thirdparty(); } if (!empty($objecttmp->thirdparty)) { $newlang = $objecttmp->thirdparty->default_lang; From 8a283f4de4b5b066e51e79db95dedff49a66bb4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 17:12:13 +0100 Subject: [PATCH 277/572] Fix missing extraparams column --- .../install/mysql/migration/16.0.0-17.0.0.sql | 4 ++ htdocs/install/mysql/tables/llx_commande.sql | 2 +- htdocs/install/mysql/tables/llx_projet.sql | 69 ++++++++++--------- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 744c000294b..9d0a5a776d6 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -396,3 +396,7 @@ ALTER TABLE llx_c_tva ADD COLUMN use_default tinyint DEFAULT 0; ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128); ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128); + +ALTER TABLE llx_projet ADD COLUMN extraparams varchar(255); + + diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 67712178bd3..e64ce7ff14f 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -77,7 +77,7 @@ create table llx_commande fk_incoterms integer, -- for incoterms location_incoterms varchar(255), -- for incoterms import_key varchar(14), - extraparams varchar(255), -- for stock other parameters with json format + extraparams varchar(255), -- to save other parameters with json format fk_multicurrency integer, multicurrency_code varchar(3), diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index 3b8bf1be05b..531f0992f2c 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -19,45 +19,46 @@ create table llx_projet ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_soc integer, - datec datetime, -- date creation project - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - dateo date, -- date start project - datee date, -- date end project - ref varchar(50), - entity integer DEFAULT 1 NOT NULL, -- multi company id - title varchar(255) NOT NULL, - description text, - fk_user_creat integer NOT NULL, -- createur du projet - fk_user_modif integer, - public integer, -- project is public or not - fk_statut integer DEFAULT 0 NOT NULL, -- open or close - fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities - opp_percent double(5,2), - fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose) - date_close datetime DEFAULT NULL, - fk_user_close integer DEFAULT NULL, - note_private text, - note_public text, - email_msgid varchar(175), -- if project or lead is created by email collector, we store here MSG ID. Do not use a too large value, it generates trouble with unique index - --budget_days real, -- budget in days is sum of field planned_workload of tasks - opp_amount double(24,8), - budget_amount double(24,8), + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_soc integer, + datec datetime, -- date creation project + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + dateo date, -- date start project + datee date, -- date end project + ref varchar(50), + entity integer DEFAULT 1 NOT NULL, -- multi company id + title varchar(255) NOT NULL, + description text, + fk_user_creat integer NOT NULL, -- createur du projet + fk_user_modif integer, + public integer, -- project is public or not + fk_statut integer DEFAULT 0 NOT NULL, -- open or close + fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities + opp_percent double(5,2), + fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose) + date_close datetime DEFAULT NULL, + fk_user_close integer DEFAULT NULL, + note_private text, + note_public text, + email_msgid varchar(175), -- if project or lead is created by email collector, we store here MSG ID. Do not use a too large value, it generates trouble with unique index + --budget_days real, -- budget in days is sum of field planned_workload of tasks + opp_amount double(24,8), + budget_amount double(24,8), usage_opportunity integer DEFAULT 0, -- Set to 1 if project is used to follow an opportunity usage_task integer DEFAULT 1, -- Set to 1 if project is used to manage tasks and/or record timesheet usage_bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event or receive attendees registration - date_start_event datetime, -- date start event - date_end_event datetime, -- date end event - location varchar(255), -- location + date_start_event datetime, -- date start event + date_end_event datetime, -- date end event + location varchar(255), -- location accept_conference_suggestions integer DEFAULT 0, -- Set to 1 if you want to allow unknown people to suggest conferences - accept_booth_suggestions integer DEFAULT 0, -- Set to 1 if you want to Allow unknown people to suggest booth + accept_booth_suggestions integer DEFAULT 0, -- Set to 1 if you want to Allow unknown people to suggest booth max_attendees integer DEFAULT 0, price_registration double(24,8), - price_booth double(24,8), - model_pdf varchar(255), - ip varchar(250), --ip used to create record (for public submission page) - last_main_doc varchar(255), -- relative filepath+filename of last main generated document - import_key varchar(14) -- Import key + price_booth double(24,8), + model_pdf varchar(255), + ip varchar(250), -- ip used to create record (for public submission page) + last_main_doc varchar(255), -- relative filepath+filename of last main generated document + import_key varchar(14), -- Import key + extraparams varchar(255) -- to save other parameters with json format )ENGINE=innodb; From 9966d605a2c7505dab8e0b3016fb966536be5f94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 17:20:51 +0100 Subject: [PATCH 278/572] Debug v17 --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index d6b0515eb1a..c4303a73950 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1123,7 +1123,7 @@ class Project extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."projet"; $sql .= " SET fk_statut = ".self::STATUS_VALIDATED; $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".((int) $conf->entity); + //$sql .= " AND entity = ".((int) $conf->entity); // Disabled, when we use the ID for the where, we must not add any other search condition dol_syslog(get_class($this)."::setValid", LOG_DEBUG); $resql = $this->db->query($sql); From 230c3d2752c7190325b99bcfdad882a1b3e9702c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 18:11:41 +0100 Subject: [PATCH 279/572] Debug v17 --- htdocs/bookmarks/bookmarks.lib.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 88cae3e4293..4141aa671a0 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -102,6 +102,7 @@ function printDropdownBookmarksList() $listbtn .= img_picto('', 'edit', 'class="paddingright opacitymedium"').$langs->trans('EditBookmarks').''; $bookmarkList = ''; + $bookmarkNb = 0; // Menu with list of bookmarks $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; $sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)"; @@ -116,6 +117,7 @@ function printDropdownBookmarksList() $bookmarkList .= dol_escape_htmltag($obj->title); $bookmarkList .= ''; $i++; + $bookmarkNb++; } $bookmarkList .= ''; @@ -141,6 +143,7 @@ function printDropdownBookmarksList() $searchForm .= dol_escape_htmltag($obj->title); $searchForm .= ''; $i++; + $bookmarkNb++; } $searchForm .= ''; } @@ -200,13 +203,15 @@ function printDropdownBookmarksList() '; - $html .= ' - - - '; + if ($bookmarkNb) { + $html .= ' + + + '; + } $html .= ' '; -print '
'; + print ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; + print '
'.$langs->trans("Total")."'; $listtype = array( - FactureFournisseur::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), - FactureFournisseur::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), - FactureFournisseur::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), - FactureFournisseur::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), + FactureFournisseur::TYPE_STANDARD=>$langs->trans("InvoiceStandard"), + FactureFournisseur::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"), + FactureFournisseur::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), + FactureFournisseur::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), ); /* - if (!empty($conf->global->INVOICE_USE_SITUATION)) - { - $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); - } - */ + if (!empty($conf->global->INVOICE_USE_SITUATION)) + { + $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); + } + */ //$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order. print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100'); print ''; print '
'; /* - print $langs->trans('From').' '; - print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1); - print '
'; - print '
'; - print $langs->trans('to').' ';*/ + print $langs->trans('From').' '; + print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to').' ';*/ print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before")); print '
'.$langs->trans("Alert"); print '
'; @@ -1487,7 +1487,7 @@ if ($num > 0) { // Label if (!empty($arrayfields['f.label']['checked'])) { print '
'; - print $obj->label; + print dol_escape_htmltag($obj->label); print ''; - print $thirdparty->name_alias; + print dol_escape_htmltag($thirdparty->name_alias); print ''; - print $obj->town; + print ''; + print dol_escape_htmltag($obj->town); print ''; + print ''; print dol_escape_htmltag($obj->zip); print '".$obj->state_name."'; + print dol_escape_htmltag($obj->state_name); + print "'.price($obj->total_ht)."'.price($obj->total_ht)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."'; - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); - print "'; + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code); + print "'.price($obj->multicurrency_total_ht)."'.price($obj->multicurrency_total_ht)."
'.$langs->trans("OpportunityStatus").''; print '
'; - print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'inline-block valignmiddle', 1, 1); + print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'minwidth150 inline-block valignmiddle', 1, 1); // Opportunity probability print ' %'; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 2698a4b1a21..27885de31b9 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -193,9 +193,8 @@ print '
'; */ include DOL_DOCUMENT_ROOT.'/projet/graph_opportunities.inc.php'; - // List of draft projects -print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress', 'prospectionstatus', 'projectstatus')); +print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 0, $listofoppstatus, array('projectlabel', 'plannedworkload', 'declaredprogress', 'prospectionstatus', 'projectstatus'), $max); print '
'; From 93927cceff72b02fab0ed468346e45b901601cd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Feb 2023 16:12:28 +0100 Subject: [PATCH 272/572] Debug v17 --- htdocs/core/lib/functions.lib.php | 86 +++++++++++++++++++++---------- htdocs/projet/list.php | 71 ++++++++++++++++--------- 2 files changed, 106 insertions(+), 51 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7ca4b30e0a0..0664bae3f58 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -784,6 +784,12 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } } } else { + // If field name is 'search_xxx' then we force the add of space after each < and > (when following char is numeric) because it means + // we use the < or > to make a search on a numeric value to do higher or lower so we can add a space to break html tags + if (strpos($paramname, 'search_') === 0) { + $out = preg_replace('/([<>])([-+]?\d)/', '\1 \2', $out); + } + $out = sanitizeVal($out, $check, $filter, $options); } @@ -9751,7 +9757,7 @@ function dol_getmypid() * If param $mode is 0, can contains several keywords separated with a space or | * like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2 * or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2 - * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000" + * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < -1000" * If param $mode is 2, can contains a list of int id separated by comma like "1,3,4" * If param $mode is 3, can contains a list of string separated by comma like "a,b,c" * @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4') @@ -9789,23 +9795,35 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $newres = ''; foreach ($fields as $field) { if ($mode == 1) { - $operator = '='; - $newcrit = preg_replace('/([!<>=]+)/', '', $crit); - - $reg = array(); - preg_match('/([!<>=]+)/', $crit, $reg); - if (!empty($reg[1])) { - $operator = $reg[1]; - } - if ($newcrit != '') { - $numnewcrit = price2num($newcrit); - if (is_numeric($numnewcrit)) { - $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.((float) $numnewcrit); // should be a numeric - } else { - $newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false + $tmpcrits = explode('|', $crit); + $i3 = 0; // count the nb of valid criteria added for this field + foreach ($tmpcrits as $tmpcrit) { + if ($tmpcrit !== '0' && empty($tmpcrit)) { + continue; + } + $tmpcrit = trim($tmpcrit); + + $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); + + $operator = '='; + $newcrit = preg_replace('/([!<>=]+)/', '', $tmpcrit); + + $reg = array(); + preg_match('/([!<>=]+)/', $tmpcrit, $reg); + if (!empty($reg[1])) { + $operator = $reg[1]; + } + if ($newcrit != '') { + $numnewcrit = price2num($newcrit); + if (is_numeric($numnewcrit)) { + $newres .= $field.' '.$operator.' '.((float) $numnewcrit); // should be a numeric + } else { + $newres .= '1 = 2'; // force false, we received a corrupted data + } + $i3++; // a criteria was added to string } - $i2++; // a criteria was added to string } + $i2++; } elseif ($mode == 2 || $mode == -2) { $crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer $newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : ''); @@ -9847,28 +9865,36 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) } } } - } else // $mode=0 - { + } else { // $mode=0 $tmpcrits = explode('|', $crit); - $i3 = 0; + $i3 = 0; // count the nb of valid criteria added for this field foreach ($tmpcrits as $tmpcrit) { if ($tmpcrit !== '0' && empty($tmpcrit)) { continue; } + $tmpcrit = trim($tmpcrit); - $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); + if ($tmpcrit == '^$') { // If we search empty, we must combined different fields with AND + $newres .= (($i2 > 0 || $i3 > 0) ? ' AND ' : ''); + } else { + $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); + } if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field - $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? ((float) trim($tmpcrit)) : '0'); + $newres .= $field." = ".(is_numeric($tmpcrit) ? ((float) $tmpcrit) : '0'); } else { - $tmpcrit = trim($tmpcrit); $tmpcrit2 = $tmpcrit; $tmpbefore = '%'; $tmpafter = '%'; + $tmps = ''; + if (preg_match('/^!/', $tmpcrit)) { - $newres .= $field." NOT LIKE '"; // ! as exclude character + $tmps .= $field." NOT LIKE "; // ! as exclude character $tmpcrit2 = preg_replace('/^!/', '', $tmpcrit2); - } else $newres .= $field." LIKE '"; + } else { + $tmps .= $field." LIKE "; + } + $tmps .= "'"; if (preg_match('/^[\^\$]/', $tmpcrit)) { $tmpbefore = ''; @@ -9878,12 +9904,17 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $tmpafter = ''; $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2); } + + if ($tmpcrit2 == '' || preg_match('/^!/', $tmpcrit)) { + $tmps = "(".$tmps; + } + $newres .= $tmps; $newres .= $tmpbefore; $newres .= $db->escape($tmpcrit2); $newres .= $tmpafter; $newres .= "'"; - if ($tmpcrit2 == '') { - $newres .= " OR ".$field." IS NULL"; + if ($tmpcrit2 == '' || preg_match('/^!/', $tmpcrit)) { + $newres .= " OR ".$field." IS NULL)"; } } @@ -9893,13 +9924,14 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) } $i++; } + if ($newres) { $res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : ''); } $j++; } $res = ($nofirstand ? "" : " AND ")."(".$res.")"; - //print 'xx'.$res.'yy'; + return $res; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index dea5848b469..c50350c91cc 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -54,6 +54,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projectlist'; $title = $langs->trans("Projects"); @@ -113,6 +114,7 @@ $search_accept_booth_suggestions = GETPOST('search_accept_booth_suggestions', 'i $search_price_registration = GETPOST("search_price_registration", 'alpha'); $search_price_booth = GETPOST("search_price_booth", 'alpha'); $search_login = GETPOST('search_login', 'alpha'); +$search_import_key = GETPOST('search_import_key', 'alpha'); $searchCategoryCustomerOperator = 0; if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = GETPOST('search_category_customer_operator', 'int'); @@ -120,7 +122,7 @@ if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); -$optioncss = GETPOST('optioncss', 'alpha'); + $mine = ((GETPOST('mode') == 'mine') ? 1 : 0); if ($mine) { @@ -134,7 +136,6 @@ $search_eday = GETPOST('search_eday', 'int'); $search_emonth = GETPOST('search_emonth', 'int'); $search_eyear = GETPOST('search_eyear', 'int'); - $search_date_start_startmonth = GETPOST('search_date_start_startmonth', 'int'); $search_date_start_startyear = GETPOST('search_date_start_startyear', 'int'); $search_date_start_startday = GETPOST('search_date_start_startday', 'int'); @@ -152,6 +153,7 @@ $search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); $search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); $search_date_end_endday = GETPOST('search_date_end_endday', 'int'); $search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver + if (isModEnabled('categorie')) { $search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array"); } @@ -301,6 +303,7 @@ if (empty($reshook)) { $search_price_registration = ''; $search_price_booth = ''; $search_login = ''; + $search_import_key = ''; $toselect = array(); $search_array_options = array(); $search_category_array = array(); @@ -368,6 +371,8 @@ if (empty($reshook)) { $form = new Form($db); $formcompany = new FormCompany($db); +$now = dol_now(); + $companystatic = new Societe($db); $taskstatic = new Task($db); $formother = new FormOther($db); @@ -415,7 +420,7 @@ if (count($listofprojectcontacttypeexternal) == 0) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. +$distinct = 'DISTINCT'; // We add distinct until we have added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,"; $sql .= " p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount,"; $sql .= " p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,"; @@ -436,6 +441,9 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as p"; if (!empty($extrafields->attributes[$object->table_element]['label']) &&is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; @@ -546,9 +554,11 @@ if ($search_sale > 0) { // No check is done on company permission because readability is managed by public status of project and assignement. //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id).") OR (s.rowid IS NULL))"; if ($search_project_user > 0) { + // TODO Replace this with a EXISTS and remove the link to table + DISTINCT $sql .= " AND ecp.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttype))).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".((int) $search_project_user); } if ($search_project_contact > 0) { + // TODO Replace this with a EXISTS and remove the link to table + DISTINCT $sql .= " AND ecp_contact.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttypeexternal))).") AND ecp_contact.element_id = p.rowid AND ecp_contact.fk_socpeople = ".((int) $search_project_contact); } if ($search_opp_amount != '') { @@ -584,6 +594,9 @@ if ($search_price_booth != '') { if ($search_login) { $sql .= natural_search(array('u.login', 'u.firstname', 'u.lastname'), $search_login); } +if ($search_import_key) { + $sql .= natural_search(array('p.import_key'), $search_import_key); +} // Search for tag/category ($searchCategoryProjectList is an array of ID) $searchCategoryProjectList = $search_category_array; $searchCategoryProjectOperator = 0; @@ -664,37 +677,45 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= $db->order($sortfield, $sortorder); +//print $sql; // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if (!empty($limit)) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$obj->id); exit; @@ -704,8 +725,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ // Output page // -------------------------------------------------------------------- -dol_syslog("list allowed project", LOG_DEBUG); - llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); @@ -855,6 +874,9 @@ if ($search_price_booth != '') { if ($search_login) { $param .= '&search_login='.urlencode($search_login); } +if ($search_import_key) { + $param .= '&search_import_key='.urlencode($search_import_key); +} if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } @@ -1186,6 +1208,7 @@ if (!empty($arrayfields['p.email_msgid']['checked'])) { if (!empty($arrayfields['p.import_key']['checked'])) { // Import key print '
'; + print ''; print '
'."\n"; - // Type -/* -if (empty($conf->global->PARTNERSHIP_NEWFORM_FORCETYPE)) { - $listoftype = $partnershipt->liste_array(); - $tmp = array_keys($listoftype); - $defaulttype = ''; - $isempty = 1; - if (count($listoftype) == 1) { - $defaulttype = $tmp[0]; - $isempty = 0; - } - print ''."\n"; -} else { - $partnershipt->fetch($conf->global->PARTNERSHIP_NEWFORM_FORCETYPE); - print ''; -} -*/ - $partnershiptype = new PartnershipType($db); $listofpartnershipobj = $partnershiptype->fetchAll('', '', 1000, 0, array('active'=>1)); $listofpartnership = array(); @@ -608,15 +587,17 @@ foreach ($listofpartnershipobj as $partnershipobj) { $listofpartnership[$partnershipobj->id] = $partnershipobj->label; } -if (empty($conf->global->PARTNERSHIP_NEWFORM_FORCETYPE)) { - print ''."\n"; -} else { +if (getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { print $listofpartnership[$conf->global->PARTNERSHIP_NEWFORM_FORCETYPE]; print ''; } +print '
'.$langs->trans("Type").' *'; - print $form->selectarray("typeid", $partnershipt->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); - print '
'.$langs->trans('PartnershipType').' *'."\n"; - print $form->selectarray("partnershiptype", $listofpartnership, GETPOSTISSET('partnershiptype') ? GETPOST('partnershiptype', 'int') : 'ifone', 1); - print '
'."\n"; +if (!getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { + print ''."\n"; +} // Company print ''."\n"; // Other attributes -$tpl_context = 'public'; // define template context to public +$parameters['tdclass']='titlefield'; +$parameters['tpl_context']='public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Comments print ''; diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index d4d6b4b68b5..50759aeede9 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -537,7 +537,7 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { } // Other attributes -$tpl_context = 'public'; // define template context to public +$parameters['tpl_context']='public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Comments print ''; From 8f33945a0b5ef6825dc5bd748df9b24503647707 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 10:37:15 +0100 Subject: [PATCH 330/572] CSS --- htdocs/public/partnership/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 2884c7099c3..c06843a64a8 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -651,7 +651,7 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { // Logo //print ''."\n"; // Other attributes -$parameters['tdclass']='titlefield'; +$parameters['tdclass']='titlefieldauto'; $parameters['tpl_context']='public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Comments From 6f869be8c039a309b764e576213d9a02269be7b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 10:41:47 +0100 Subject: [PATCH 331/572] Fix lang --- htdocs/langs/en_US/partnership.lang | 2 +- htdocs/langs/fr_FR/partnership.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 89a1bfa742d..f4ea73a1a8f 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -29,7 +29,7 @@ PartnershipCheckBacklink=Partnership: Check referring backlink # Menu # NewPartnership=New Partnership -NewPartnershipbyWeb= Your partnership was added successfully. +NewPartnershipbyWeb=Your partnership request has been added successfully. We may contact you soon... ListOfPartnerships=List of partnership # diff --git a/htdocs/langs/fr_FR/partnership.lang b/htdocs/langs/fr_FR/partnership.lang index 20c3fc0d801..b12f139abc9 100644 --- a/htdocs/langs/fr_FR/partnership.lang +++ b/htdocs/langs/fr_FR/partnership.lang @@ -29,7 +29,7 @@ PartnershipCheckBacklink=Partenariat : Vérifiez le backlink référent # Menu # NewPartnership=Nouveau partenariat -NewPartnershipbyWeb= Votre partenariat a été ajouté avec succès. +NewPartnershipbyWeb=Votre demande de partenariat a été ajouté avec succès. Nous vous recontacterons surement d'ici peu... ListOfPartnerships=Listes des partenariats # From 5477ec9800ee53f6597c32de27d883a37ced7de7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 10:50:29 +0100 Subject: [PATCH 332/572] Style --- htdocs/public/members/new.php | 2 +- htdocs/public/partnership/new.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index e03ecfb0fda..2c6b7b4c9c5 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -497,7 +497,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio llxHeaderVierge($langs->trans("NewSubscription")); - +print '
'; print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center'); diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index c06843a64a8..dea912e0653 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -537,7 +537,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio llxHeaderVierge($langs->trans("NewPartnershipRequest")); - +print '
'; print load_fiche_titre($langs->trans("NewPartnershipRequest"), '', '', 0, 0, 'center'); From 3a561d78b9d6e8606917e7100cbd7cc690438217 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 10:59:04 +0100 Subject: [PATCH 333/572] css --- htdocs/partnership/class/partnership.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 3e16b4bf4e8..fab8b1ce32a 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -104,7 +104,8 @@ class Partnership extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>15, 'notnull'=>1, 'visible'=>-2, 'default'=>'1', 'index'=>1,), - 'fk_type' => array('type'=>'integer:PartnershipType:partnership/class/partnership_type.class.php:0:active=1', 'label'=>'Type', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1,), + 'fk_type' => array('type'=>'integer:PartnershipType:partnership/class/partnership_type.class.php:0:active=1', 'label'=>'Type', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflowmax100'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax125',), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -121,7 +122,6 @@ class Partnership extends CommonObject 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,), 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>73, 'notnull'=>0, 'visible'=>-2,), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150',), 'ip' => array('type'=>'varchar(250)', 'label'=>'Ip', 'enabled'=>'1', 'position'=>74, 'notnull'=>0, 'visible'=>-2,), ); public $rowid; From a64c41c4ba54dbfddb680e4f5e466410e5a22905 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 12:14:34 +0100 Subject: [PATCH 334/572] Fix due date for supplier invoice not correctly set on clone --- htdocs/core/class/commoninvoice.class.php | 5 ++++- htdocs/fourn/class/fournisseur.facture.class.php | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 7818ab2fb11..a3b0810efc6 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -663,7 +663,7 @@ abstract class CommonInvoice extends CommonObject * conditions and billing date. * * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. - * @return integer Date limite de reglement si ok, <0 si ko + * @return integer Date limit of payment if OK, <0 if KO */ public function calculate_date_lim_reglement($cond_reglement = 0) { @@ -674,6 +674,9 @@ abstract class CommonInvoice extends CommonObject if (!$cond_reglement) { $cond_reglement = $this->cond_reglement_id; } + if (!$cond_reglement) { + return $this->date; + } $cdr_nbjour = 0; $cdr_type = 0; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 2e766fb5cdc..bc0c7b9e232 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3069,16 +3069,17 @@ class FactureFournisseur extends CommonInvoice $object->fk_facture_source = 0; $object->date_creation = ''; $object->date_validation = ''; - $object->date = (empty($this->date) ? '' : $this->date); - $object->date_echeance = ''; + $object->date = (empty($this->date) ? dol_now() : $this->date); $object->ref_client = ''; $object->close_code = ''; $object->close_note = ''; - if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING == 1) { + if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) { $object->note_private = ''; $object->note_public = ''; } + $object->date_echeance = $object->calculate_date_lim_reglement(); + // Loop on each line of new invoice foreach ($object->lines as $i => $line) { if (isset($object->lines[$i]->info_bits) && ($object->lines[$i]->info_bits & 0x02) == 0x02) { // We do not clone line of discounts From ba70262f0459b244bbb3ab35fdeb27d8520ee665 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 12:37:03 +0100 Subject: [PATCH 335/572] Fix qodana warnings --- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- htdocs/modulebuilder/index.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 0611e6fe003..2aed109ce26 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1006,7 +1006,7 @@ if (empty($reshook)) { $newcardbutton .= ''.$langs->trans("ClickToHideAlreadyExportedLines").''; $newcardbutton .= ''; } else { - $newcardbutton .= ''.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').''; + $newcardbutton .= ''.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"'); $newcardbutton .= ''.$langs->trans("DocsAlreadyExportedAreExcluded").''; $newcardbutton .= ''; } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index ee9eabfa289..ce36d2bb899 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -49,7 +49,7 @@ if ($massaction == 'preclonetasks') { $formquestion = array( array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects('', 'projectid', '', '', '', '', '', '', '', 1, 1)), ); - print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected . '', $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590); + print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected, $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590); } if ($massaction == 'preaffecttag' && isModEnabled('category')) { diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d2fc01ddead..582fddd83df 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1852,7 +1852,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { \$r++; "; - $deleteright = dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($objectname).'*/' => '', $rights => '', "/*END ".strtoupper($objectname).'*/'."\n\t\t" => ''."\n\t\t")); + $deleteright = dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($objectname).'*/' => '', $rights => '', "/*END ".strtoupper($objectname).'*/'."\n\t\t" => "\n\t\t")); if ($deleteright > 0) { if (isModEnabled(strtolower($module))) { $result = unActivateModule(strtolower($module)); @@ -2218,7 +2218,7 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - $check = dolReplaceInFile($moduledescriptorfile, array($rightTodelete => ''."\n\t\t")); + $check = dolReplaceInFile($moduledescriptorfile, array($rightTodelete => "\n\t\t")); if ($check > 0) { //check if all permissions of object was deleted $permsForObj = array(); From d2d6f3974d67b57d6014f9d5f17228db66527673 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 12:38:23 +0100 Subject: [PATCH 336/572] Fix qodana warnings --- htdocs/adherents/list.php | 2 +- htdocs/core/lib/project.lib.php | 4 ++-- htdocs/mrp/class/mo.class.php | 4 ---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 006c43ba1a1..b44abce662d 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -325,7 +325,7 @@ $membertypestatic = new AdherentType($db); $memberstatic = new Adherent($db); // Page Header -$title = $langs->trans("Members")." - ".$langs->trans("List");; +$title = $langs->trans("Members")." - ".$langs->trans("List"); $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; llxHeader('', $title, $help_url); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 48ed501e125..8aa8b6d93b7 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2874,13 +2874,13 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide // good $out .= '
'; if (!empty($task->progress)) { - $out .= '
'; + $out .= '
'; } $out .= '
'; } else { // bad $out .= '
'; - $out .= '
'; + $out .= '
'; $out .= '
'; } $out .= ' '; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 452a87b6ab8..64156ca9b37 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -231,10 +231,6 @@ class Mo extends CommonObject */ public $line = array(); - /** - * @var integer Mo parent line - * */ - /** * @var int ID of parent line */ From 44da230012a059395dca02cde614e0f9c3307717 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 12:57:36 +0100 Subject: [PATCH 337/572] Clean code --- htdocs/admin/system/perf.php | 6 +++--- htdocs/admin/system/security.php | 6 +++--- htdocs/admin/tools/purge.php | 6 +++--- htdocs/core/class/conf.class.php | 10 +++++++--- htdocs/core/class/utils.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/install/inc.php | 6 ++++++ htdocs/support/inc.php | 4 +++- 8 files changed, 27 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index cc9ab7658db..fd586e24c95 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -82,14 +82,14 @@ print '
'; // Module log print '
'; print ''.$langs->trans("Syslog").': '; -$test = empty($conf->syslog->enabled); +$test = !isModEnabled('syslog'); if ($test) { print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' '.$langs->trans("NotSlowedDownByThis").''; } else { - if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) { + if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) { print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog")); } else { - print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL); + print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL')); } //print ' '.$langs->trans("MoreInformation").' XDebug admin page'; } diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 4515e4b7c2a..5775ea5404e 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -453,14 +453,14 @@ print load_fiche_titre($langs->trans("Modules"), '', 'folder'); // Module log print ''.$langs->trans("Syslog").': '; -$test = empty($conf->syslog->enabled); +$test = !isModEnabled('syslog'); if ($test) { print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); } else { - if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) { + if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) { print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog")); } else { - print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL); + print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL')); } //print ' '.$langs->trans("MoreInformation").' XDebug admin page'; } diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index ee95fd7b44e..6c771abbd32 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -38,8 +38,8 @@ $nbsecondsold = GETPOSTINT('nbsecondsold'); // Define filelog to discard it from purge $filelog = ''; -if (!empty($conf->syslog->enabled)) { - $filelog = $conf->global->SYSLOG_FILE; +if (isModEnabled('syslog')) { + $filelog = getDolGlobalString('SYSLOG_FILE'); $filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog); } @@ -96,7 +96,7 @@ print '
'.$langs->trans('PartnershipType').' *'."\n"; + print $form->selectarray("partnershiptype", $listofpartnership, GETPOSTISSET('partnershiptype') ? GETPOST('partnershiptype', 'int') : 'ifone', 1); + print '
'.$langs->trans("Company").' *'; print img_picto('', 'company', 'class="pictofixedwidth"'); @@ -670,7 +651,8 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { // Logo //print '
'.$langs->trans("URLPhoto").'
'.$langs->trans("URLPhoto").'
'; print '\n"; print '';*/ - if (!$conf->expedition_bon->enabled && isModEnabled('stock')) { + if (!isModEnabled('expedition_bon') && isModEnabled('stock')) { // Entrepot $entrepot = new Entrepot($db); $entrepot->fetch($object->entrepot_id); @@ -647,7 +647,7 @@ if ($action == 'create') { } if ($user->rights->expedition->delivery->supprimer) { - if ($conf->expedition_bon->enabled) { + if (isModEnabled('expedition_bon')) { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), ''); } else { print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index bb0d8ac162d..9a11302e5bd 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -201,7 +201,7 @@ class Delivery extends CommonObject dol_syslog("Delivery::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - if (!$conf->expedition_bon->enabled) { + if (!isModEnabled('expedition_bon')) { $commande = new Commande($this->db); $commande->id = $this->commande_id; $commande->fetch_lines(); @@ -229,7 +229,7 @@ class Delivery extends CommonObject $error++; } - if (!$conf->expedition_bon->enabled) { + if (!isModEnabled('expedition_bon')) { // TODO standardize status uniformiser les statuts $ret = $this->setStatut(2, $this->origin_id, $this->origin); if (!$ret) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 30c23781757..1649a161034 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -617,7 +617,7 @@ if (empty($reshook)) { $result = $object->create($user); - if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email) && $object->no_email == 1) { + if (empty($error) && isModEnabled('mailing') && !empty($object->email) && $object->no_email == 1) { // Add mass emailing flag into table mailing_unsubscribe $result = $object->setNoEmail($object->no_email); if ($result < 0) { @@ -1633,7 +1633,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Unsubscribe - if (!empty($conf->mailing->enabled)) { + if (isModEnabled('mailing')) { if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { print "\n".''."\n"; } + // Subject + if ($this->withtitletopic) { + print ''; + } + // MESSAGE $msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ''; print ''; // print ''; if (!empty($arrayfields['t.ref']['checked'])) { - print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); + print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], 't.ref', '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.label']['checked'])) { - print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); + print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.description']['checked'])) { print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.dateo']['checked'])) { - print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.datee']['checked'])) { - print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.planned_workload']['checked'])) { - print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.duration_effective']['checked'])) { - print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress_calculated']['checked'])) { print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress']['checked'])) { - print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress_summary']['checked'])) { print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '', 1); } if ($object->usage_bill_time) { if (!empty($arrayfields['t.tobill']['checked'])) { - print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "t.tobill", '', $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['t.billed']['checked'])) { - print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "t.billed", '', $param, '', $sortfield, $sortorder, 'right '); } } // Contacts of task, disabled because available by default jsut after @@ -1043,7 +1043,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third */ if (!empty($arrayfields['t.budget_amount']['checked'])) { - print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['c.assigned']['checked'])) { From af4228064d95a44e62ac9b4342e0d6955d4f87a4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Feb 2023 07:33:16 +0000 Subject: [PATCH 407/572] Fixing style errors. --- htdocs/projet/class/task.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3c58a147d39..fea80f6d13a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -953,7 +953,7 @@ class Task extends CommonObjectLine } } - if($sortfield && $sortorder) { + if ($sortfield && $sortorder) { $sql .= $this->db->order($sortfield, $sortorder); } else { $sql .= " ORDER BY p.ref, t.rang, t.dateo"; From 30c76623e12de38b67f8518a44701011cf7fa8a2 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 23 Feb 2023 10:46:20 +0100 Subject: [PATCH 408/572] FIX : missing w option in dol_print_date --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d503026a868..053bbfe98ca 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2696,8 +2696,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($time); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', '%w', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', 'w', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( @@ -2722,8 +2722,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($timetouse); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', '%w', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', 'w', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( From 763001625bdf7ad32b09bf8dcd9ec68bfc4f1e07 Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 23 Feb 2023 11:20:19 +0100 Subject: [PATCH 409/572] New : test of big upload on test_forms --- htdocs/core/ajax/flowjs-server.php | 7 +++- htdocs/public/test/test_forms.php | 64 ++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index e1f5feaaf10..480dba39195 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -35,6 +35,9 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } +if (!defined('NOCSRFCHECK')) { + define('NOCSRFCHECK', '1'); +} // If there is no need to load and show top and left menu if (!defined("NOLOGIN")) { define("NOLOGIN", '1'); @@ -68,7 +71,7 @@ if (!empty($upload_dir)) { $temp_dir = $upload_dir.'/'.$flowIdentifier; } else { $temp_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'.$flowIdentifier; - $upload_dir = $temp_dir; + $upload_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'; } if ($_SERVER['REQUEST_METHOD'] === 'GET') { @@ -133,7 +136,7 @@ function createFileFromChunks($temp_dir, $upload_dir, $fileName, $chunkSize, $to $total_files = 0; $files = dol_dir_list($temp_dir, 'files'); foreach ($files as $file) { - if (stripos($file, $fileName) !== false) { + if (stripos($file["name"], $fileName) !== false) { $total_files++; } } diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index acc9151798f..e041e1d98fa 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -105,6 +105,70 @@ $array = array(1=>'Value 1', 2=>'Value 2', 3=>'Value 3'); $arrayselected = array(1, 3); print $form->multiselectarray('testmulti', $array, $arrayselected, '', 0, 'minwidth100'); +print '

'."\n"; + +// Test6a: Upload of big files +print "Test 6a: Upload of big files
\n"; +print "The file will be uploaded in the directory: documents/test_form/temp/
\n"; + +if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { + print ''; + print ' No file selected.'; + print '
'; + print '
'; + print ''; + print ''; +} else { + print "If this message displays, please add flow.js file which can be found here :https://github.com/flowjs/flow.js and place the js lib in htdocs/includes/flowjs/
\n"; +} + print ''; // End of page From 5d5634cc505a7b2ce990d645e785ca5faee77281 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 23 Feb 2023 11:41:46 +0100 Subject: [PATCH 410/572] fix : Warning: Undefined property: Conf:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/contrat/card.php on line 1652 --- htdocs/contrat/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 6b3937df76a..b41d913a92e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1649,9 +1649,9 @@ if ($action == 'create') { if ($objp->subprice >= 0) { $colspan = 6; - if ($conf->margin->enabled && getDolGlobalString('PRODUCT_USE_UNITS')) { + if (isModEnabled('margin') && getDolGlobalString('PRODUCT_USE_UNITS')) { $colspan = 8; - } elseif ($conf->margin->enabled || getDolGlobalString('PRODUCT_USE_UNITS')) { + } elseif (isModEnabled('margin') || getDolGlobalString('PRODUCT_USE_UNITS')) { $colspan = 7; } From d86ab00950d9c7592ba8ab8c55f5ed7dc681e038 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 12:08:43 +0100 Subject: [PATCH 411/572] Look and feel v18 --- htdocs/comm/mailing/card.php | 10 +++++++++- htdocs/comm/mailing/cibles.php | 10 ++++++++-- htdocs/comm/mailing/info.php | 8 +++++++- htdocs/core/class/html.form.class.php | 8 ++++++-- htdocs/theme/eldy/global.inc.php | 7 +++++-- htdocs/theme/md/style.css.php | 8 ++++++++ 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 634047cdad6..a0d8ec640d0 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -899,6 +899,12 @@ if ($action == 'create') { $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1); + $morehtmlref .= '
'; + $morehtmlright = ''; $nbtry = $nbok = 0; if ($object->statut == 2 || $object->statut == 3) { @@ -912,7 +918,7 @@ if ($action == 'create') { $morehtmlright .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; print '
'; @@ -920,11 +926,13 @@ if ($action == 'create') { print '
'; -if (!empty($conf->syslog->enabled)) { +if (isModEnabled('syslog')) { print 'syslog = new stdClass(); $this->multicompany = new stdClass(); $this->expedition_bon = new stdClass(); $this->delivery_note = new stdClass(); @@ -212,7 +217,6 @@ class Conf // First level object // TODO Remove this part. - $this->syslog = new stdClass(); $this->expedition_bon = new stdClass(); $this->delivery_note = new stdClass(); $this->fournisseur = new stdClass(); @@ -1018,7 +1022,7 @@ class Conf } } - if (!empty($this->syslog->enabled)) { + if (isModEnabled('syslog')) { // We init log handlers if (!empty($this->global->SYSLOG_HANDLERS)) { $handlers = json_decode($this->global->SYSLOG_HANDLERS); diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index be91b49765b..f67702ca7c9 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -121,7 +121,7 @@ class Utils $filesarray = dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*(\.gz)?$', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1); } - if (!empty($conf->syslog->enabled)) { + if (isModEnabled('syslog')) { $filelog = $conf->global->SYSLOG_FILE; $filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c6abf0e5b87..4345c936432 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1641,7 +1641,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = global $conf, $user, $debugbar; // If syslog module enabled - if (empty($conf->syslog->enabled)) { + if (!isModEnabled('syslog')) { return; } diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 970fd40261b..9dc12b18277 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -232,6 +232,9 @@ if ($islocked) { // Pages are locked // Force usage of log file for install and upgrades +if (!isset($conf->syslog) || !is_object($conf->syslog)) { + $conf->syslog = new stdClass(); +} $conf->syslog->enabled = 1; $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); if (!defined('SYSLOG_HANDLERS')) { @@ -341,6 +344,9 @@ function conf($dolibarr_main_document_root) $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; // Force usage of log file for install and upgrades + if (!isset($conf->syslog) || !is_object($conf->syslog)) { + $conf->syslog = new stdClass(); + } $conf->syslog->enabled = 1; $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); if (!defined('SYSLOG_HANDLERS')) { diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 3f372e97c1e..1c8c4c5d7f8 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -39,7 +39,9 @@ $conf = new stdClass(); // instantiate $conf explicitely $conf->global = new stdClass(); $conf->file = new stdClass(); $conf->db = new stdClass(); -$conf->syslog = new stdClass(); +if (!isset($conf->syslog) || !is_object($conf->syslog)) { + $conf->syslog = new stdClass(); +} // Force $_REQUEST["logtohtml"] $_REQUEST["logtohtml"] = 1; From ce7c54c570778cd7b048ed5b65fe5ea24e15b83e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 21 Feb 2023 13:10:13 +0100 Subject: [PATCH 338/572] fix incoherence on permissions --- htdocs/modulebuilder/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d2fc01ddead..89dfc8694e3 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1262,6 +1262,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { \$this->rights[\$r][5] = 'delete'; \$r++; "; + $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectname).'*/'.$rightToadd."/*END ".strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */')); } } @@ -2036,7 +2037,7 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { // if not found permission for the object if (!in_array($objectForPerms, array_unique($allObject))) { $firstRight++; - $existRight = 0; + $existRight++; } if (!$error) { if (isModEnabled(strtolower($module))) { @@ -2058,11 +2059,10 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { "; $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; if (!$existRight) { - //var_dump(1);exit; dolReplaceInFile($moduledescriptorfile, array('/*END '.strtoupper($objectForPerms).'*/' => $rightToAdd.'/*END '.strtoupper($objectForPerms).'*/')); setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); } - if ($firstRight) { + if ($firstRight>0) { dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectForPerms).'*/'.$rightToAdd."/*END ".strtoupper($objectForPerms).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */')); setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null); } @@ -4720,8 +4720,8 @@ if ($module == 'initmodule') { print '
'; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; From b0cf8cd72dfc09578b542671bc2126a76bf9e173 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 13:19:57 +0100 Subject: [PATCH 339/572] Clean code --- htdocs/core/class/conf.class.php | 38 ++++++++++++---------- htdocs/core/lib/propal.lib.php | 4 +-- htdocs/core/lib/sendings.lib.php | 2 +- htdocs/core/menus/init_menu_auguria.sql | 6 ++-- htdocs/delivery/card.php | 6 ++-- htdocs/delivery/class/delivery.class.php | 4 +-- htdocs/societe/card.php | 8 ++--- scripts/emailings/mailing-send.php | 5 +++ scripts/emailings/reset-invalid-emails.php | 5 +++ 9 files changed, 46 insertions(+), 32 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 66e0fc07014..12457a41339 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -51,6 +51,12 @@ class Conf public $mycompany; public $admin; public $medias; + //! To store properties of multi-company + public $multicompany; + + //! To store module status of special module names + public $expedition_bon; + public $delivery_note; //! To store if javascript/ajax is enabked @@ -84,8 +90,6 @@ class Conf */ public $loghandlers = array(); - //! To store properties of multi-company - public $multicompany; //! Used to store running instance for multi-company (default 1) public $entity = 1; //! Used to store list of entities to use for each element @@ -148,8 +152,6 @@ class Conf // First level object that are modules. // TODO Remove this part. $this->multicompany = new stdClass(); - $this->expedition_bon = new stdClass(); - $this->delivery_note = new stdClass(); $this->fournisseur = new stdClass(); $this->product = new stdClass(); $this->service = new stdClass(); @@ -164,7 +166,6 @@ class Conf $this->adherent = new stdClass(); $this->bank = new stdClass(); $this->notification = new stdClass(); - $this->mailing = new stdClass(); $this->expensereport = new stdClass(); $this->productbatch = new stdClass(); } @@ -217,8 +218,6 @@ class Conf // First level object // TODO Remove this part. - $this->expedition_bon = new stdClass(); - $this->delivery_note = new stdClass(); $this->fournisseur = new stdClass(); $this->product = new stdClass(); $this->service = new stdClass(); @@ -233,7 +232,6 @@ class Conf $this->adherent = new stdClass(); $this->bank = new stdClass(); $this->notification = new stdClass(); - $this->mailing = new stdClass(); $this->expensereport = new stdClass(); $this->productbatch = new stdClass(); @@ -503,8 +501,10 @@ class Conf // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. // Sous module bons d'expedition + $this->expedition_bon = new stdClass(); $this->expedition_bon->enabled = (empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? 0 : $this->global->MAIN_SUBMODULE_EXPEDITION); // Sub module delivery note Sous module bons de livraison + $this->delivery_note = new stdClass(); $this->delivery_note->enabled = (empty($this->global->MAIN_SUBMODULE_DELIVERY) ? 0 : $this->global->MAIN_SUBMODULE_DELIVERY); // Module fournisseur @@ -705,22 +705,26 @@ class Conf $this->theme = $this->global->MAIN_THEME; $this->css = "/theme/".$this->theme."/style.css.php"; - // conf->email_from = email pour envoi par dolibarr des mails automatiques + // conf->email_from = email by default to send Dolibarr automatic emails $this->email_from = "robot@example.com"; if (!empty($this->global->MAIN_MAIL_EMAIL_FROM)) { $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM; } - // conf->notification->email_from = email pour envoi par Dolibarr des notifications - $this->notification->email_from = $this->email_from; - if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) { - $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM; + // conf->notification->email_from = email by default to send Dolibarr notifications + if (isModEnabled('notification')) { + $this->notification->email_from = $this->email_from; + if (!empty($this->global->NOTIFICATION_EMAIL_FROM)) { + $this->notification->email_from = $this->global->NOTIFICATION_EMAIL_FROM; + } } - // conf->mailing->email_from = email pour envoi par Dolibarr des mailings - $this->mailing->email_from = $this->email_from; - if (!empty($this->global->MAILING_EMAIL_FROM)) { - $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; + // conf->mailing->email_from = email by default to send Dolibarr emailings + if (isModEnabled('mailing')) { + $this->mailing->email_from = $this->email_from; + if (!empty($this->global->MAILING_EMAIL_FROM)) { + $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; + } } if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 3d380a3904a..b5e459c8637 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -47,10 +47,10 @@ function propal_prepare_head($object) $langs->load("sendings"); $text = ''; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; - if ($conf->expedition_bon->enabled) { + if (isModEnabled('expedition_bon')) { $text = $langs->trans("Shipment"); } - if ($conf->delivery_note->enabled) { + if (isModEnabled('delivery_note')) { $text .= '/'.$langs->trans("Receivings"); } $head[$h][1] = $text; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index a2fbaeef92e..4013c6d41e9 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -133,7 +133,7 @@ function delivery_prepare_head($object) $h = 0; $head = array(); - if ($conf->expedition_bon->enabled && $user->rights->expedition->lire) { + if (isModEnabled('expedition_bon') && $user->rights->expedition->lire) { $head[$h][0] = DOL_URL_ROOT."/expedition/card.php?id=".$object->origin_id; $head[$h][1] = $langs->trans("SendingCard"); $head[$h][2] = 'shipping'; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 5c819488971..417744bc49d 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -437,9 +437,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Tools insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($user->socid)', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'email_templates', 8__+MAX_llx_menu__, '/admin/mails_templates.php?mainmenu=tools&leftmenu=email_templates', 'EMailTemplates', 0, '', '', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?mainmenu=tools&leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?mainmenu=tools&leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("mailing")', __HANDLER__, 'left', 3910__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?mainmenu=tools&leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("mailing")', __HANDLER__, 'left', 3911__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/card.php?mainmenu=tools&leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("mailing")', __HANDLER__, 'left', 3912__+MAX_llx_menu__, 'tools', '', 3910__+MAX_llx_menu__, '/comm/mailing/list.php?mainmenu=tools&leftmenu=mailing', 'List', 1, 'mails', '$user->rights->mailing->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4100__+MAX_llx_menu__, 'tools', 'export', 8__+MAX_llx_menu__, '/exports/index.php?mainmenu=tools&leftmenu=export', 'FormatedExport', 0, 'exports', '$user->rights->export->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->export->enabled', __HANDLER__, 'left', 4101__+MAX_llx_menu__, 'tools', '', 4100__+MAX_llx_menu__, '/exports/export.php?mainmenu=tools&leftmenu=export', 'NewExport', 1, 'exports', '$user->rights->export->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->import->enabled', __HANDLER__, 'left', 4130__+MAX_llx_menu__, 'tools', 'import', 8__+MAX_llx_menu__, '/imports/index.php?mainmenu=tools&leftmenu=import', 'FormatedImport', 0, 'exports', '$user->rights->import->run', '', 2, 2, __ENTITY__); diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index c1b27af2ce0..ea345efadcb 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -104,7 +104,7 @@ if ($action == 'add') { $object->commande_id = GETPOST("commande_id", 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - if (!$conf->expedition_bon->enabled && isModEnabled('stock')) { + if (!isModEnabled('expedition_bon') && isModEnabled('stock')) { $expedition->entrepot_id = GETPOST('entrepot_id', 'int'); } @@ -479,7 +479,7 @@ if ($action == 'create') { print '
'.$object->getLibStatut(4)."
'.img_picto('', 'globe', 'class="pictofixedwidth"').'
'; + // Answer to a ticket : display of the thread title in readonly + if ($this->withtopicreadonly) { + print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; + } else { + if (isset($this->withreadid) && $this->withreadid > 0) { + $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.''; + } else { + $subject = GETPOST('subject', 'alpha'); + } + print 'withemail)?' autofocus':'').' />'; + } + print '
'; @@ -846,6 +851,8 @@ class FormTicket print ' selected="selected"'; } elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) { print ' selected="selected"'; + } elseif (count($ticketstat->cache_category_tickets) == 1) { + print ' selected="selected"'; } print '>'; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 089629234d6..99b8210644c 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -274,7 +274,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin = $langs->transnoentities($body, $object->track_id).'
'; $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; $message_admin .= '
  • '.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'
  • '; - $message_admin .= '
  • '.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
  • '; + $message_admin .= '
  • '.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
  • '; $message_admin .= '
  • '.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'
  • '; $message_admin .= '
  • '.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'
  • '; // Extrafields @@ -343,7 +343,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer = $langs->transnoentities($body, $object->track_id).'
    '; $message_customer .= '
    • '.$langs->trans('Title').' : '.$object->subject.'
    • '; $message_customer .= '
    • '.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'
    • '; - $message_customer .= '
    • '.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
    • '; + $message_customer .= '
    • '.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
    • '; $message_customer .= '
    • '.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'
    • '; // Extrafields diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ea560012afc..7cb36b3bd0c 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -183,7 +183,7 @@ CreatedBy=Created by NewTicket=New Ticket SubjectAnswerToTicket=Ticket answer TicketTypeRequest=Request type -TicketCategory=Ticket categorization +TicketCategory=Ticket group SeeTicket=See ticket TicketMarkedAsRead=Ticket has been marked as read TicketReadOn=Read on diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index aca2828da3b..5c99c56c1d0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5215,7 +5215,7 @@ div.visible { display: block; } -div.hidden, header.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { +div.hidden, header.hidden, tr.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { display: none; } .unvisible { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 7a0f9749be8..93b501885fe 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5211,7 +5211,7 @@ div.visible { display: block; } -div.hidden, header.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { +div.hidden, header.hidden, tr.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { display: none; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 7cbb23c75c4..d46a787f983 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -726,7 +726,7 @@ if ($action == 'create' || $action == 'presend') { print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); - $formticket->trackid = ''; // TODO Use a unique key to avoid conflict in upload file feature + $formticket->trackid = ''; // TODO Use a unique key 'tic' to avoid conflict in upload file feature $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; @@ -737,7 +737,6 @@ if ($action == 'create' || $action == 'presend') { $formticket->withfile = 2; $formticket->withextrafields = 1; $formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid')); - $formticket->trackid = 'tic'.$object->id; $formticket->withcancel = 1; From 5713ca8a4329907f9b8a35d2673a4a28bacb81c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 16:01:48 +0100 Subject: [PATCH 384/572] Regression --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 386ed4fc134..f361c0d7028 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -854,7 +854,7 @@ if ($resql) { } $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; - llxHeader('', $langs->trans('ListOfProposals'), $help_url); + llxHeader('', $title, $help_url); $param = '&search_status='.urlencode($search_status); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { From 04a6a0a0435e8273baf2195fb086007c6dc9fd2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 16:27:10 +0100 Subject: [PATCH 385/572] Fix qodana --- .../canvas/actions_contactcard_common.class.php | 6 ++++-- htdocs/core/class/validate.class.php | 16 ++++++++-------- .../societe/canvas/actions_card_common.class.php | 2 ++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 4a3fc28c9de..7e73d264480 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -74,8 +74,10 @@ abstract class ActionsContactCardCommon if (!empty($id)) { $object->fetch($id); } - $this->object = $object; - //} + + $this->object = $object; + + return $object; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/class/validate.class.php b/htdocs/core/class/validate.class.php index 31cf6300aff..37bb37aec4f 100644 --- a/htdocs/core/class/validate.class.php +++ b/htdocs/core/class/validate.class.php @@ -27,7 +27,6 @@ */ class Validate { - /** * @var DoliDb Database handler (result of a new DoliDB) */ @@ -62,7 +61,7 @@ class Validate } if (!is_object($this->outputLang) || !method_exists($this->outputLang, 'load')) { - return false; + return; } $this->outputLang->loadLangs(array('validate', 'errors')); @@ -72,7 +71,8 @@ class Validate /** * Use to clear errors msg or other ghost vars - * @return null + * + * @return void */ protected function clear() { @@ -82,8 +82,8 @@ class Validate /** * Use to clear errors msg or other ghost vars * - * @param string $errMsg your error message - * @return null + * @param string $errMsg your error message + * @return void */ protected function setError($errMsg) { @@ -93,9 +93,9 @@ class Validate /** * Check for e-mail validity * - * @param string $email e-mail address to validate - * @param int $maxLength string max length - * @return boolean Validity is ok or not + * @param string $email e-mail address to validate + * @param int $maxLength string max length + * @return boolean Validity is ok or not */ public function isEmail($email, $maxLength = false) { diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index fc8794aa1a8..a2b320e50db 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -70,6 +70,8 @@ abstract class ActionsCardCommon $object->fetch($id, $ref); } $this->object = $object; + + return $object; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 837f89c19fc0872e66ce7d1e685bc20cdc263c72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 17:17:34 +0100 Subject: [PATCH 386/572] Fix warning --- htdocs/core/class/smtps.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 135d9d9e8de..46193e1efea 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1862,6 +1862,7 @@ class SMTPs } elseif ($type == 'alternative') { return $this->_smtpsAlternativeBoundary; } + return ''; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 53014290cfe115b872d3fd9eaa1f3fd98d8b3ea4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 17:18:42 +0100 Subject: [PATCH 387/572] Fix unbind --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 3dc45c753bc..68464524621 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -401,7 +401,7 @@ class Ldap public function unbind() { $this->result = true; - if ($this->connection) { + if (is_resource($this->connection) || is_object($this->connection)) { $this->result = @ldap_unbind($this->connection); } if ($this->result) { From f6f420d19aebe61c78ae8cc2dfbae10b882c530d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 17:26:22 +0100 Subject: [PATCH 388/572] Doc --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 68464524621..b3d5766daff 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -339,7 +339,7 @@ class Ldap * This method seems a duplicate/alias of unbind(). * * @return boolean true or false - * @deprecated ldap_close is an alias of ldap_unbind + * @deprecated ldap_close is an alias of ldap_unbind, so use unbind() instead. * @see unbind() */ public function close() From d9fda122ff0d22d7748b2409027c11f6c1242944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 18:14:44 +0100 Subject: [PATCH 389/572] utf8_decode is deprecated --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4345c936432..61324e4ce9e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Cédric GROSS * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2019-2022 Thibault Foucart * Copyright (C) 2020 Open-Dsi * Copyright (C) 2021 Gauthier VERDOL @@ -8890,7 +8890,7 @@ function dol_osencode($str) } if ($tmp == 'iso-8859-1') { - return utf8_decode($str); + return mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1'); } return $str; } From ed046e16d2536ab77cec3dd1ac6c48834d4780a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 18:21:00 +0100 Subject: [PATCH 390/572] Update functions2.lib.php --- htdocs/core/lib/functions2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 6b51cf76150..188b30116d7 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -178,9 +178,9 @@ function dol_print_file($langs, $filename, $searchalt = 0) $content = file_get_contents($formfilealt); $isutf8 = utf8_check($content); if (!$isutf8 && $conf->file->character_set_client == 'UTF-8') { - print utf8_encode($content); + print mb_convert_encoding($content, 'UTF-8', 'ISO-8859-1'); } elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') { - print utf8_decode($content); + print mb_convert_encoding($content, 'ISO-8859-1', 'UTF-8'); } else { print $content; } From ee95ac237c57142ca5a135c1efcc4caef5455c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 18:21:58 +0100 Subject: [PATCH 391/572] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 61324e4ce9e..e6ac7f2d9f2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8890,7 +8890,7 @@ function dol_osencode($str) } if ($tmp == 'iso-8859-1') { - return mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1'); + return mb_convert_encoding($str, 'ISO-8859-1', 'UTF-8'); } return $str; } From f7348d21d366ebf579bc52f533aa0113abb39b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:20:04 +0100 Subject: [PATCH 392/572] doc --- htdocs/core/menus/standard/eldy_menu.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 596e1e4cc3f..de33b209383 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -36,6 +36,11 @@ class MenuManager public $atarget = ""; // To store default target to use onto links public $name = "eldy"; + /** + * @var Menu + */ + public $menu; + public $menu_array; public $menu_array_after; From 873a0266eef558b32e8018d50fd576aeead936f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:20:53 +0100 Subject: [PATCH 393/572] Update auguria_menu.php --- htdocs/core/menus/standard/auguria_menu.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index ae40ec170fc..168effd964d 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -37,6 +37,11 @@ class MenuManager public $atarget = ""; // To store default target to use onto links public $name = "auguria"; + /** + * @var Menu + */ + public $menu; + public $menu_array; public $menu_array_after; From 53d89bb068a40d25e32b78fdf350dbfb3b05d282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:24:40 +0100 Subject: [PATCH 394/572] Update menubase.class.php --- htdocs/core/class/menubase.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 9544e11e075..3630d137136 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -152,6 +152,10 @@ class Menubase */ public $tms; + /** + * @var Menu menu + */ + public $newmenu; /** * Constructor From fc8ae34dd34f34286b84d3dfe06996f7f4b52d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:32:13 +0100 Subject: [PATCH 395/572] Update conf.class.php --- htdocs/core/class/conf.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 12457a41339..2b3ddba9881 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -79,6 +79,10 @@ class Conf // An array to store cache results ->cache['nameofcache']=... public $cache; + /** + * @var int To tell header was output + */ + public $headerdone; /** * @var string[] From a20c511ee934d5996f603016e36d850933e58c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:58:55 +0100 Subject: [PATCH 396/572] doc --- htdocs/datapolicy/class/datapolicycron.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index fb76767bf1e..7383d303a7c 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,11 @@ */ class DataPolicyCron { + /** + * @var DoliDB Database handler. + */ + public $db; + /** * Constructor * From f1bcaf60850c006c51ad9dbb43482d13357c9aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:16:16 +0100 Subject: [PATCH 397/572] doc --- htdocs/don/class/paymentdonation.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 657a1d32d1a..1aceca10c16 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -92,6 +92,10 @@ class PaymentDonation extends CommonObject public $type_code; public $type_label; + public $chid; + public $datepaid; + public $bank_account; + public $bank_line; /** * @var string Id of external payment mode From 66a56a36e40c1ae827109af227462edcb7c54831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:19:55 +0100 Subject: [PATCH 398/572] Update commonsocialnetworks.class.php --- htdocs/core/class/commonsocialnetworks.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonsocialnetworks.class.php b/htdocs/core/class/commonsocialnetworks.class.php index 04dc17e26f0..19928eb1dbb 100644 --- a/htdocs/core/class/commonsocialnetworks.class.php +++ b/htdocs/core/class/commonsocialnetworks.class.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/core/class/commonincoterm.class.php + * \file htdocs/core/class/commonsocialnetworks.class.php * \ingroup core - * \brief File of the superclass of object classes that support incoterm (customer and supplier) + * \brief File of the superclass of object classes that support socialnetworks */ From 3306565ba8a2f510364bf3cabd829d7a2703eb02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:26:59 +0100 Subject: [PATCH 399/572] doc --- htdocs/core/class/doleditor.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index dad1f572406..bb63c1dd927 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -43,6 +43,7 @@ class DolEditor public $cols; public $height; public $width; + public $uselocalbrowser; public $readonly; public $posx; public $posy; From f8b75f33126d851ad4f9bfe2b70260234d3aa880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:29:07 +0100 Subject: [PATCH 400/572] Update cstate.class.php --- htdocs/core/class/cstate.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index e098de93bd4..46e60b2f7fd 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -49,6 +49,11 @@ class Cstate // extends CommonObject */ public $id; + /** + * @var int ID + */ + public $rowid; + public $code_departement; public $code; From e9e8934a84df49171764075810cef4f93b323208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:35:18 +0100 Subject: [PATCH 401/572] doc --- htdocs/core/class/commonstickergenerator.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index e388159f978..3a83d015f65 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -61,6 +61,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; */ abstract class CommonStickerGenerator { + /** + * @var DoliDB Database handler. + */ + public $db; + public $code; // Code of format /** From 1ce9da8026a7234d96869bf32acf83512748cb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:38:26 +0100 Subject: [PATCH 402/572] doc --- htdocs/core/class/CMailFile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 9e8593e6d1b..c54b527eff2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -128,6 +128,7 @@ class CMailFile // Image public $html; + public $msgishtml; public $image_boundary; public $atleastoneimage = 0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). public $html_images = array(); From 2ae87e95e6b78a8238c822a4d7d6fda303258150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:56:09 +0100 Subject: [PATCH 403/572] doc --- htdocs/core/class/cgenericdic.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/cgenericdic.class.php b/htdocs/core/class/cgenericdic.class.php index 250fb3ec569..60ac9f7984e 100644 --- a/htdocs/core/class/cgenericdic.class.php +++ b/htdocs/core/class/cgenericdic.class.php @@ -30,6 +30,11 @@ */ class CGenericDic { + /** + * @var DoliDB Database handler. + */ + public $db; + /** * @var string Id to identify managed objects */ From c520c3d39037480dcca80818ff7de2c1e0ab2726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 22:17:39 +0100 Subject: [PATCH 404/572] Update translate.class.php --- htdocs/core/class/translate.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 2315428b37a..7379877753b 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -41,6 +41,9 @@ class Translate public $cache_labels = array(); // Cache for labels return by getLabelFromKey method public $cache_currencies = array(); // Cache to store currency symbols private $cache_currencies_all_loaded = false; + public $origlang; + public $error; + public $errors = array(); /** @@ -416,7 +419,7 @@ class Translate * * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache * - * @param Database $db Database handler + * @param DoliDB $db Database handler * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK */ public function loadFromDatabase($db) From b74e7e8de4b0ab12650164bb7796268666a51206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 22:47:19 +0100 Subject: [PATCH 405/572] translation --- htdocs/contrat/class/contrat.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0007bc334b9..48a3e4053a4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1992,6 +1992,8 @@ class Contrat extends CommonObject { global $conf, $langs, $user; + $langs->load('contracts'); + $datas = []; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { From d326e59beba5e5d997384f323f6f22c57c55a17e Mon Sep 17 00:00:00 2001 From: pratushraj Date: Thu, 23 Feb 2023 13:00:31 +0530 Subject: [PATCH 406/572] issue #24014 --- htdocs/projet/class/task.class.php | 9 ++++++--- htdocs/projet/tasks.php | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 87ab0afdc47..3c58a147d39 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -813,7 +813,7 @@ class Task extends CommonObjectLine * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') { global $conf, $hookmanager; @@ -953,8 +953,11 @@ class Task extends CommonObjectLine } } - - $sql .= " ORDER BY p.ref, t.rang, t.dateo"; + if($sortfield && $sortorder) { + $sql .= $this->db->order($sortfield, $sortorder); + } else { + $sql .= " ORDER BY p.ref, t.rang, t.dateo"; + } //print $sql;exit; dol_syslog(get_class($this)."::getTasksArray", LOG_DEBUG); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ffba37abb7d..22258bd3b18 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -124,12 +124,12 @@ $search_array_options = $extrafields->getOptionalsFromPost($taskstatic->table_el // Default sort order (if not yet defined by previous GETPOST) -if (!$sortfield) { +/* if (!$sortfield) { reset($object->fields); $sortfield="t.".key($object->fields); } // Set here default search field. By default 1st field in definition. Reset is required to avoid key() to return null. if (!$sortorder) { $sortorder = "ASC"; -} +} */ // Security check @@ -848,7 +848,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). $filteronthirdpartyid = $socid; - $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options); + $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options, 0, 1, $sortfield, $sortorder); // We load also tasks limited to a particular user $tmpuser = new User($db); @@ -998,41 +998,41 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print '
'.$langs->trans("Project").'
'; // Description + /* print ''; + */ // From print ''; } diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 23fd1186e0e..dbd3bdafdbf 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -28,15 +28,19 @@ require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php'; // Load translation files required by the page $langs->load("compta"); +$limit = GETPOST('limit', 'int'); + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) { $socid = $user->socid; } + $result = restrictedArea($user, 'tax', '', '', 'charges'); $ltt = GETPOST("localTaxType", 'int'); $mode = GETPOST('mode', 'alpha'); + /* * View */ @@ -80,8 +84,9 @@ if ($result) { print ''; print ""; print "\n"; - $var = 1; - while ($i < $num) { + + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($result); $localtax_static->label = $obj->label; @@ -100,7 +105,7 @@ if ($result) { } // Output Kanban print $localtax_static->getKanbanView(''); - if ($i == ($num - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 794db8df39b..3c617a2db0c 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -226,7 +226,8 @@ if ($resql) { print "\n"; if ($num > 0) { - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $checkdepositstatic->id = $objp->rowid; @@ -247,7 +248,7 @@ if ($resql) { } // Output Kanban print $checkdepositstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index ad8570d9268..307a7239fe8 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -265,7 +265,8 @@ if ($result) { print "\n"; if ($num) { - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($result); $bon->id = $obj->rowid; @@ -285,9 +286,8 @@ if ($result) { print '
'; } // Output Kanban - print $bon->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index c2e8c5e4194..8dd056ed796 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -239,7 +239,6 @@ if ($result) { print '
'; } // Output Kanban - print $directdebitorder->getKanbanView(''); if ($i == (min($num, $limit) - 1)) { print '
'; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 498a28a54f5..297dc3f7de5 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -594,7 +594,8 @@ $i = 0; $totalarray = $TLoadedUsers = array(); $totalarray['nbfield'] = 0; $totalarray['val']['totalttcfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $chargesociale_static->id = $obj->rowid; @@ -617,10 +618,9 @@ while ($i < min($num, $limit)) { print '
'; } // Output Kanban - $chargesociale_static->fk_project = $projectstatic->getNomUrl(); print $chargesociale_static->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 80f73c6fe44..44aa49361f9 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -475,7 +475,8 @@ $totalarray = array(); $totalarray['nbfield'] = 0; $total = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $tva_static->id = $obj->rowid; @@ -492,9 +493,8 @@ while ($i < min($num, $limit)) { print '
'; } // Output Kanban - print $tva_static->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print ''; } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 03e65e18988..b55e09bd252 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -990,7 +990,6 @@ while ($i < $imaxinloop) { print '\n"; - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $donationstatic->setVarsFromFetchObj($objp); $company = new Societe($db); @@ -314,7 +315,7 @@ if ($resql) { } print $donationstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index c093bbfd721..1edf6c0edca 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -732,6 +732,8 @@ if ($resql) { $totalarray['val']['d.total_tva'] = 0; $totalarray['val']['d.total_ttc'] = 0; $totalarray['totalizable'] = array(); + + $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -756,14 +758,12 @@ if ($resql) { $expensereportstatic->fk_user_author = $usertmp->getNomUrl(1); // Output Kanban - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($massactionbutton || $massaction) { - $selected = 0; + if ($massactionbutton || $massaction) { + $selected = 0; - print $expensereportstatic->getKanbanView(''); - } + print $expensereportstatic->getKanbanView(''); } - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index c236e72d514..18420e7ac20 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -477,7 +477,8 @@ $i = 0; $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $paymentexpensereportstatic->id = $objp->rowid; @@ -504,7 +505,7 @@ while ($i < min($num, $limit)) { } // Output Kanban print $paymentexpensereportstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f3e88404f6d..86554408a23 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -714,9 +714,8 @@ while ($i < $imaxinloop) { $objectstatic->duration = $obj->duree; $objectstatic->socid = $companystatic->getNomUrl(1, '', 44); - print $objectstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b6e94712e0b..6f326a75250 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1686,7 +1686,7 @@ if ($resql) { $objectstatic->socid = $thirdpartytmp->getNomUrl('supplier', 0, 0, -1); // Output Kanban print $objectstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 043a92b0648..a5363fd6c19 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1359,7 +1359,8 @@ if ($num > 0) { $totalarray['val']['f.total_localtax1']=0; $totalarray['val']['f.total_ttc']=0; - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $datelimit = $db->jdate($obj->datelimite); @@ -1423,7 +1424,7 @@ if ($num > 0) { $facturestatic->total_ht = $obj->total_ht; $facturestatic->date = $obj->datef; print $facturestatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 421da582e0d..3f8f9d69131 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -790,7 +790,8 @@ if ($resql) { $totalarray = array(); $totalarray['nbfield'] = 0; $totalduration = 0; - while ($i < min($num, $limit)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); // Leave request @@ -852,7 +853,7 @@ if ($resql) { $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); print $holidaystatic->getKanbanView('', $arraydata); } - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index f39030cf3d5..b4c0ebe9f02 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -567,7 +567,8 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index e9d3564c1a4..796c1abd57d 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -544,7 +544,8 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxiloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -570,7 +571,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } print $object->getKanbanView(''); } - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index d3eace18a88..57e5ef97d97 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -270,7 +270,8 @@ if ($resql) { // -------------------------------------------------------------------- $i = 0; $totalarray = array(); - while ($i < ($limit ? min($num, $limit) : $num)) { + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -294,7 +295,7 @@ if ($resql) { $loan_static->totalpaid = $obj->paid; print $loan_static->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 36dbe6c120a..30b9d288562 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -596,7 +596,8 @@ $bom = new Bom($db); $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -619,7 +620,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Output Kanban print $object->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 56f83c26f03..b6291958144 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -619,7 +619,8 @@ $i = 0; $warehouse = new Entrepot($db); -while ($i < min($num, $limit)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 8fcd62fc078..05524716cad 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -66,7 +66,7 @@ $pagenext = $page + 1; $object = new RecruitmentCandidature($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->recruitment->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('recruitmentcandidaturelist')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -102,6 +102,13 @@ foreach ($object->fields as $key => $val) { $fieldstosearchall['t.'.$key] = $val['label']; } } +/*$parameters = array('fieldstosearchall'=>$fieldstosearchall); +$reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook > 0) { + $fieldstosearchall = $hookmanager->resArray['fieldstosearchall']; +} elseif ($reshook == 0) { + $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray['fieldstosearchall']); +}*/ // Definition of array of fields for columns $arrayfields = array(); @@ -226,6 +233,9 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; @@ -279,7 +289,7 @@ if (!empty($id)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; /* If a group by is required @@ -304,7 +314,8 @@ $sql = preg_replace('/,\s*$/', '', $sql); $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ - $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); $resql = $db->query($sqlforcount); if ($resql) { $objforcount = $db->fetch_object($resql); @@ -313,7 +324,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -500,7 +511,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); @@ -581,7 +592,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; +print ''; // Action column -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; @@ -621,13 +632,13 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; @@ -669,8 +680,9 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -680,12 +692,12 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; $totalarray['nbfield']++; } } @@ -693,13 +705,13 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } -$totalarray['nbfield']++; print ''."\n"; @@ -707,7 +719,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if ($val && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } @@ -739,14 +751,11 @@ while ($i < $imaxinloop) { $recuitment->fetch($obj->fk_recruitmentjobposition); $object->fk_recruitmentjobposition = $recuitment->getNomUrl(); $object->phone = $obj->phone; - // Output Kanban - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($massactionbutton || $massaction) { - $selected = 0; - } - // Output Kanban - print $object->getKanbanView(''); + if ($massactionbutton || $massaction) { + $selected = 0; } + // Output Kanban + print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -756,7 +765,7 @@ while ($i < $imaxinloop) { $j = 0; print ''; // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -787,7 +799,7 @@ while ($i < $imaxinloop) { //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print '$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print ''."\n"; diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 8a0d3f06540..4cb2d845828 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -593,13 +593,11 @@ while ($i < $imaxinloop) { print ''; diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 35e82e96da1..7ef8db376b7 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -537,7 +537,8 @@ $totalarray = array(); $totalarray['nbfield'] = 0; $totalarray['val'] = array(); $totalarray['val']['totalttcfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -574,7 +575,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Output Kanban print $salstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 807ae82f9af..15b50c6dfc3 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -534,7 +534,7 @@ $i = 0; $total = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; @@ -544,8 +544,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - - $userstatic->id = $obj->uid; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; @@ -570,18 +568,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $paymentsalstatic->fk_bank = $accountlinestatic->getNomUrl(1); $paymentsalstatic->fk_user_author = $userstatic->getNomUrl(1); - - if ($mode == 'kanban') { if ($i == 0) { print ''; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index b3f1888f505..226ddb55206 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -965,7 +965,9 @@ if ($resql) { $totalarray['val']['sp.total_ht'] = 0; $totalarray['val']['sp.total_tva'] = 0; $totalarray['val']['sp.total_ttc'] = 0; - while ($i < min($num, $limit)) { + + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); $objectstatic->id = $obj->rowid; @@ -992,7 +994,7 @@ if ($resql) { $objectstatic->user_author_id = $userstatic->getNomUrl(1); $objectstatic->delivery_date = $obj->dp; print $objectstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } From 767ad3e366d1cc7fc5cce75070b37bc87417a440 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2023 20:49:38 +0100 Subject: [PATCH 570/572] Debug v17 --- .../accountancy/journal/purchasesjournal.php | 27 ++++++++++---- htdocs/accountancy/journal/sellsjournal.php | 35 +++++++++++++------ htdocs/compta/facture/class/facture.class.php | 1 + 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 746383fef0b..d00a968571f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -104,7 +104,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) } $sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,"; -$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; +$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur,"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= " spe.accountancy_code_customer as code_compta,"; @@ -200,8 +200,8 @@ if ($result) { $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')); } - $line = new SupplierInvoiceLine($db); - $line->fetch($obj->fdid); + //$line = new SupplierInvoiceLine($db); + //$line->fetch($obj->fdid); $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); $tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr); @@ -233,7 +233,8 @@ if ($result) { $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht; $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; - if (!empty($line->tva_npr)) { // Add an entry for counterpart + $tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0); + if ($tva_npr) { // If NPR, we add an entry for counterpartWe into tabother $tabother[$obj->rowid][$compta_counterpart_tva_npr] += $obj->total_tva; } $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1; @@ -824,7 +825,6 @@ if (empty($action) || $action == 'view') { */ print '
'; - $i = 0; print '
'; print "
'; print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print ''; print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print '
'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 758172b4d5f..71e8617f927 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -212,6 +212,12 @@ if ($object->fetch($id) >= 0) { $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= '
'; + $morehtmlright = ''; $nbtry = $nbok = 0; if ($object->statut == 2 || $object->statut == 3) { @@ -226,14 +232,14 @@ if ($object->fetch($id) >= 0) { $morehtmlright .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; print '
'; print ''; - print ''; + //print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; } else { From 6da5df45b22177ea758c94c459fdba66e22a68ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 13:21:45 +0100 Subject: [PATCH 414/572] FIX Bad value for phone in substitutions keys --- htdocs/core/lib/functions.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e6ac7f2d9f2..40fcbfbf12b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3575,15 +3575,15 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $picto = ''; } } - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } $rep .= ($withpicto ?img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone; - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } } @@ -7638,9 +7638,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, '__USER_ID__' => (string) $user->id, '__USER_LOGIN__' => (string) $user->login, '__USER_EMAIL__' => (string) $user->email, - '__USER_PHONE__' => (string) dol_print_phone($user->office_phone), - '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile), - '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile), + '__USER_PHONE__' => (string) dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1), '__USER_FAX__' => (string) $user->office_fax, '__USER_LASTNAME__' => (string) $user->lastname, '__USER_FIRSTNAME__' => (string) $user->firstname, @@ -7655,8 +7655,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray = array_merge($substitutionarray, array( '__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_EMAIL__' => $mysoc->email, - '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone), - '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax), + '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone, '', 0, 0, '', " ", '', '', -1), + '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax, '', 0, 0, '', " ", '', '', -1), '__MYCOMPANY_PROFID1__' => $mysoc->idprof1, '__MYCOMPANY_PROFID2__' => $mysoc->idprof2, '__MYCOMPANY_PROFID3__' => $mysoc->idprof3, From dbf3df52106fd13d47cd9c6733fe3832d191bf69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 13:50:25 +0100 Subject: [PATCH 415/572] Fix emailing in test mode use correct user or sender signature --- htdocs/comm/mailing/card.php | 21 ++++++++++++------- htdocs/comm/mailing/cibles.php | 4 ++-- htdocs/core/class/html.formmail.class.php | 10 +++++---- .../core/modules/mailings/fraise.modules.php | 6 +++--- .../core/modules/mailings/pomme.modules.php | 4 ++-- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index a0d8ec640d0..d46ea99c213 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -223,7 +223,6 @@ if (empty($reshook)) { $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : ''); - $targetobject = null; // Not defined with mass emailing $parameters = array('mode'=>'emailing'); $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object @@ -468,19 +467,25 @@ if (empty($reshook)) { if (!$error) { // Is the message in html - $msgishtml = -1; // Unknow by default + $msgishtml = -1; // Unknow = autodetect by default if (preg_match('/[\s\t]*/i', $object->body)) { $msgishtml = 1; } + $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : ''); + + $parameters = array('mode'=>'emailing'); + $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object + // other are set at begin of page - $object->substitutionarrayfortest['__EMAIL__'] = $object->sendto; - $object->substitutionarrayfortest['__MAILTOEMAIL__'] = ''.$object->sendto.''; + $substitutionarray['__EMAIL__'] = $object->sendto; + $substitutionarray['__MAILTOEMAIL__'] = ''.$object->sendto.''; // Subject and message substitutions - complete_substitutions_array($object->substitutionarrayfortest, $langs); - $tmpsujet = make_substitutions($object->sujet, $object->substitutionarrayfortest); - $tmpbody = make_substitutions($object->body, $object->substitutionarrayfortest); + complete_substitutions_array($substitutionarray, $langs, $targetobject); + + $tmpsujet = make_substitutions($object->sujet, $substitutionarray); + $tmpbody = make_substitutions($object->body, $substitutionarray); $arr_file = array(); $arr_mime = array(); @@ -935,7 +940,7 @@ if ($action == 'create') { */ // From - print '
'; - print ' - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - - - - - - Date: Thu, 23 Feb 2023 18:29:58 +0100 Subject: [PATCH 419/572] FIx duplicate image file from src data --- htdocs/core/class/CMailFile.class.php | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 9e8593e6d1b..92c657f257f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -273,10 +273,16 @@ class CMailFile if ($this->html_images[$i]) { $this->atleastoneimage = 1; if ($this->html_images[$i]['type'] == 'cidfromdata') { - $posindice = count($filename_list); - $filename_list[$posindice] = $this->html_images[$i]['fullpath']; - $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; - $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + if (!in_array($this->html_images[$i]['fullpath'], $filename_list)) { + // If this file path is not already into the $filename_list, we add it. + $posindice = count($filename_list); + $filename_list[$posindice] = $this->html_images[$i]['fullpath']; + $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; + $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + } else { + $posindice = array_search($this->html_images[$i]['fullpath'], $filename_list); + } + // We complete the array of cid_list $cid_list[$posindice] = $this->html_images[$i]['cid']; } dol_syslog("CMailFile::CMailfile: html_images[$i]['name']=".$this->html_images[$i]['name'], LOG_DEBUG); @@ -284,6 +290,8 @@ class CMailFile } } } + //var_dump($filename_list); + //var_dump($cid_list);exit; // Set atleastoneimage if there is at least one file (into $filename_list array) if (is_array($filename_list)) { @@ -1130,6 +1138,13 @@ class CMailFile return 'Bad value for sendmode'; } + // Now we delete image files that were created dynamically to manage data inline files + foreach ($this->html_images as $val) { + if (!empty($val['type']) && $val['type'] == 'cidfromdata') { + //dol_delete($val['fullpath']); + } + } + $parameters = array('sent' => $res); $action = ''; $reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -1659,7 +1674,7 @@ class CMailFile } /** - * Seearch images into html message and init array this->images_encoded if found + * Search images into html message and init array this->images_encoded if found * * @param string $images_dir Location of physical images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1746,7 +1761,8 @@ class CMailFile } /** - * Seearch images with data:image format into html message + * Seearch images with data:image format into html message. + * If we find some, we create it on disk. * * @param string $images_dir Location of where to store physicaly images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1788,7 +1804,7 @@ class CMailFile foreach ($matches[1] as $key => $ext) { // We save the image to send in disk $filecontent = $matches[2][$key]; - $cid = 'cid000'.dol_hash($this->html, 'md5'); + $cid = 'cid000'.dol_hash($this->html, 'md5'); // The id must not change if image is same $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; $fhandle = @fopen($destfiletmp, 'w'); From 1573ab5f383df1fd68852d0134661989b9aab9c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 18:42:15 +0100 Subject: [PATCH 420/572] Fix position of quickadd button --- htdocs/theme/md/dropdown.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 64bebc67f79..eb1fd668361 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -447,18 +447,23 @@ a.dropdown-item { max-width: 360px; } + #topmenu-quickadd-dropdown a.login-dropdown-a, #topmenu-bookmark-dropdown a.login-dropdown-a { color: #000; } + #topmenu-quickadd-dropdown .dropdown-menu, #topmenu-bookmark-dropdown .dropdown-menu { width: 230px; } + div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown { position: unset; } - div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { + div#topmenu-global-search-dropdown, + div#topmenu-quickadd-dropdown, + div#topmenu-bookmark-dropdown { line-height: unset; } From 56afa676c011eba86f439d7b6c27193de04e9f64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 15:50:57 +0100 Subject: [PATCH 421/572] Fix tags --- htdocs/comm/mailing/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 63750d5d834..80b808524c8 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -374,7 +374,7 @@ if (empty($reshook)) { if (!$resql2) { dol_print_error($db); } else { - //if cheack read is use then update prospect contact status + //if check read is use then update prospect contact status if (strpos($message, '__CHECK_READ__') !== false) { //Update status communication of thirdparty prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")"; @@ -476,6 +476,9 @@ if (empty($reshook)) { // other are set at begin of page $object->substitutionarrayfortest['__EMAIL__'] = $object->sendto; $object->substitutionarrayfortest['__MAILTOEMAIL__'] = ''.$object->sendto.''; + $object->substitutionarrayfortest['__CHECK_READ__'] = ''; + $object->substitutionarrayfortest['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; + $object->substitutionarrayfortest['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->sendto).'&mtid=0'; // Subject and message substitutions complete_substitutions_array($object->substitutionarrayfortest, $langs); From ba59e4eb3de9bdf7d2123a68f48996d11b6f448b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 18:29:58 +0100 Subject: [PATCH 422/572] FIx duplicate image file from src data --- htdocs/core/class/CMailFile.class.php | 32 ++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 46de8d8e7af..ecfe968bd02 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -273,10 +273,16 @@ class CMailFile if ($this->html_images[$i]) { $this->atleastoneimage = 1; if ($this->html_images[$i]['type'] == 'cidfromdata') { - $posindice = count($filename_list); - $filename_list[$posindice] = $this->html_images[$i]['fullpath']; - $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; - $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + if (!in_array($this->html_images[$i]['fullpath'], $filename_list)) { + // If this file path is not already into the $filename_list, we add it. + $posindice = count($filename_list); + $filename_list[$posindice] = $this->html_images[$i]['fullpath']; + $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; + $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + } else { + $posindice = array_search($this->html_images[$i]['fullpath'], $filename_list); + } + // We complete the array of cid_list $cid_list[$posindice] = $this->html_images[$i]['cid']; } dol_syslog("CMailFile::CMailfile: html_images[$i]['name']=".$this->html_images[$i]['name'], LOG_DEBUG); @@ -284,6 +290,8 @@ class CMailFile } } } + //var_dump($filename_list); + //var_dump($cid_list);exit; // Set atleastoneimage if there is at least one file (into $filename_list array) if (is_array($filename_list)) { @@ -1124,7 +1132,14 @@ class CMailFile return 'Bad value for sendmode'; } - $parameters = array(); + // Now we delete image files that were created dynamically to manage data inline files + foreach ($this->html_images as $val) { + if (!empty($val['type']) && $val['type'] == 'cidfromdata') { + //dol_delete($val['fullpath']); + } + } + + $parameters = array('sent' => $res); $action = ''; $reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -1655,7 +1670,7 @@ class CMailFile } /** - * Seearch images into html message and init array this->images_encoded if found + * Search images into html message and init array this->images_encoded if found * * @param string $images_dir Location of physical images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1742,7 +1757,8 @@ class CMailFile } /** - * Seearch images with data:image format into html message + * Seearch images with data:image format into html message. + * If we find some, we create it on disk. * * @param string $images_dir Location of where to store physicaly images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1784,7 +1800,7 @@ class CMailFile foreach ($matches[1] as $key => $ext) { // We save the image to send in disk $filecontent = $matches[2][$key]; - $cid = 'cid000'.dol_hash($this->html, 'md5'); + $cid = 'cid000'.dol_hash($this->html, 'md5'); // The id must not change if image is same $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; $fhandle = @fopen($destfiletmp, 'w'); From 0fbb197231b461885e6479d95d89077bba505dc6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 18:42:15 +0100 Subject: [PATCH 423/572] Fix position of quickadd button --- htdocs/theme/md/dropdown.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 64bebc67f79..eb1fd668361 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -447,18 +447,23 @@ a.dropdown-item { max-width: 360px; } + #topmenu-quickadd-dropdown a.login-dropdown-a, #topmenu-bookmark-dropdown a.login-dropdown-a { color: #000; } + #topmenu-quickadd-dropdown .dropdown-menu, #topmenu-bookmark-dropdown .dropdown-menu { width: 230px; } + div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown { position: unset; } - div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { + div#topmenu-global-search-dropdown, + div#topmenu-quickadd-dropdown, + div#topmenu-bookmark-dropdown { line-height: unset; } From f034b12ec1e2bc56e7637b438ddd88d314b90666 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 20:07:53 +0100 Subject: [PATCH 424/572] Clean code --- htdocs/mrp/js/lib_dispatch.js.php | 2 +- htdocs/mrp/mo_production.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php index 8470716ce8f..1dd2d9d164c 100644 --- a/htdocs/mrp/js/lib_dispatch.js.php +++ b/htdocs/mrp/js/lib_dispatch.js.php @@ -69,7 +69,7 @@ function addDispatchLine(index, type, mode) { mode = mode || 'qtymissing' - console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); + console.log("mrp/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); if(mode == 'qtymissingconsume' || mode == 'allmissingconsume') { var inputId = 'qtytoconsume'; var warehouseId = 'idwarehouse'; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index c4353bd264b..a4225a0a14a 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -432,7 +432,8 @@ $tmpbatch = new Productlot($db); $tmpstockmovement = new MouvementStock($db); $help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag'; -llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php')); +$morejs = array('/mrp/js/lib_dispatch.js.php'); +llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, $morejs); $newToken = newToken(); From 4d44e6853348f874c19bac3c707a41c142e4964b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 20:40:46 +0100 Subject: [PATCH 425/572] Fix substitution for emailing test --- htdocs/comm/mailing/card.php | 2 +- htdocs/core/class/html.formmail.class.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 06d72826101..1fec22ea979 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -323,7 +323,7 @@ if (empty($reshook)) { $newmessage = make_substitutions($message, $substitutionarray, null, 0); $moreinheader = ''; - if (preg_match('/__UNSUBSCRIBE__/', $message)) { + if (preg_match('/__UNSUBSCRIBE_(_|URL_)/', $message)) { $moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n"; $moreinheader = make_substitutions($moreinheader, $substitutionarray); } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 96d6d4c0d89..e3a60fbf6ab 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1615,8 +1615,6 @@ class FormMail extends Form $tmparray['__OTHER3__'] = 'Other3'; $tmparray['__OTHER4__'] = 'Other4'; $tmparray['__OTHER5__'] = 'Other5'; - $tmparray['__CHECK_READ__'] = 'TagCheckMail'; - $tmparray['__UNSUBSCRIBE__'] = 'TagUnsubscribe'; //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing $onlinepaymentenabled = 0; From a0446ee1196cdcff9e9e05aab5416c5d5ad4d6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:16:25 +0100 Subject: [PATCH 426/572] doc --- htdocs/delivery/class/delivery.class.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 9a11302e5bd..975ee6cbfb6 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2011-2023 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -113,6 +114,9 @@ class Delivery extends CommonObject */ public $statuts; + /** + * @var DeliveryLine[] lines + */ public $lines = array(); @@ -1150,7 +1154,6 @@ class Delivery extends CommonObject } - /** * Management class of delivery note lines */ @@ -1203,13 +1206,23 @@ class DeliveryLine extends CommonObjectLine public $product_ref; public $product_label; + public $price; + public $fk_origin_line; public $origin_id; - public $price; - + /** + * @var int origin line ID + */ public $origin_line_id; + /** + * @var int origin line ID + * @deprecated + * @see $origin_line_id + */ + public $commande_ligne_id; + /** * Constructor From 4068b1db87f0439180b96c37f82fef23ba524376 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 21:19:01 +0100 Subject: [PATCH 427/572] Fix link for read or unsubscribe must use a unique hash --- htdocs/admin/mailing.php | 2 +- htdocs/admin/mails.php | 3 ++- htdocs/admin/mails_emailing.php | 8 +++++--- htdocs/comm/mailing/card.php | 12 ++++++------ htdocs/core/actions_massactions.inc.php | 2 +- htdocs/core/actions_sendmails.inc.php | 2 +- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- .../core/actions_massactions_mail.inc.php | 1 - htdocs/public/emailing/mailing-read.php | 6 +++--- htdocs/public/emailing/mailing-unsubscribe.php | 6 ++++-- scripts/emailings/mailing-send.php | 6 +++--- 11 files changed, 27 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 19effcdfd2e..8a6f6522606 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -155,7 +155,7 @@ if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global print ' '.img_warning($langs->trans("BadEMail")); } print ''; -print ''; +print ''; print ''; print ''; print ''; // Accountancy_account_insurance print ''; print ''; // Accountancy_account_interest print ''; print ''; - } else // For external software - { + } else { + // For external software // Accountancy_account_capital print ''; print ''; From 78e3275fa983fd0958c6051485c269eb391858c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:50:11 +0100 Subject: [PATCH 432/572] doc --- htdocs/core/lib/fourn.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index c658916e359..7093493dad9 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Marc Barilley * Copyright (C) 2011-2013 Philippe Grand - * Copyright (C) 2022 Frédéric France + * Copyright (C) 2022-2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,10 +29,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param FactureFournisseur $object Object related to tabs * @return array Array of tabs to show */ -function facturefourn_prepare_head($object) +function facturefourn_prepare_head(FactureFournisseur $object) { global $db, $langs, $conf; @@ -56,7 +56,7 @@ function facturefourn_prepare_head($object) } //if ($fac->mode_reglement_code == 'PRE') - if (!empty($conf->paymentbybanktransfer->enabled)) { + if (isModEnabled('paymentbybanktransfer')) { $nbStandingOrders = 0; $sql = "SELECT COUNT(pfd.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; @@ -132,8 +132,8 @@ function facturefourn_prepare_head($object) /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs - * @return array Array of tabs to show + * @param CommandeFournisseur $object Object related to tabs + * @return array Array of tabs to show */ function ordersupplier_prepare_head(CommandeFournisseur $object) { From 4c6b8d7a20e1fa1ff56ef9a1f19d1d19cb772f39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 22:14:10 +0100 Subject: [PATCH 433/572] Fix navigation into timespent --- htdocs/projet/tasks/time.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 139a1711658..d97dee9a11b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1112,23 +1112,27 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + // Task + // Show section with information of task. If id of task is not defined and project id defined, then $projectidforalltimes is not empty. if (empty($projectidforalltimes) && empty($allprojectforuser)) { $head = task_prepare_head($object); print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); if ($action == 'deleteline') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); + $urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''); + print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); } $param = ($withproject ? '&withproject=1' : ''); + $param .= ($param ? '&' : '').'id='.$object->id; // ID of task $linkback = $withproject ? ''.$langs->trans("BackToList").'' : ''; if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); } $morehtmlref = ''; @@ -1225,17 +1229,15 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($projectstatic->id > 0 || $allprojectforuser > 0) { - if ($action == 'deleteline' && !empty($projectidforalltimes)) { - print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); - } - // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('tasktimelist')); $formconfirm = ''; if ($action == 'deleteline' && !empty($projectidforalltimes)) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); + // We must use projectidprojectid if on list of timespent of project and id=taskid if on list of timespent of a task + $urlafterconfirm = $_SERVER["PHP_SELF"]."?".($projectstatic->id > 0 ? 'projectid='.$projectstatic->id : ($object->id > 0 ? "id=".$object->id : '')).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : '')."&contextpage=".urlencode($contextpage); + $formconfirm = $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); } // Call Hook formConfirm From 043e0b6ce06318da1f18854d419affbedae24005 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 22:26:14 +0100 Subject: [PATCH 434/572] Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/core/class/commondocgenerator.class.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 319c2a7ef2c..26d90d54fb8 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -70,11 +70,6 @@ abstract class CommonDocGenerator */ public $scandir; - /** - * @var string model name - */ - public $name; - /** * @var string model description (short text) */ From 34252d34c461f647653b33151e6dadd4a5ea8b7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 22:31:21 +0100 Subject: [PATCH 435/572] Debug v18 --- htdocs/public/emailing/mailing-unsubscribe.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index f4ca2b10031..286818bad1c 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -91,6 +91,7 @@ if (empty($tag) || ($unsuscrib != '1')) { $head = ''; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; + llxHeader($head, $langs->trans("MailUnsubcribe"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); dol_syslog("public/emailing/mailing-unsubscribe.php : Launch unsubscribe requests", LOG_DEBUG); @@ -107,12 +108,12 @@ if (!$resql) { $obj = $db->fetch_object($resql); if (empty($obj)) { - print 'Email tag not found. Operation canceled.'; + print 'Emailing tag '.$tag.' not found in database. Operation canceled.'; llxFooter('', 'private'); exit; } if (empty($obj->email)) { - print 'Email for this tag not valid. Operation canceled.'; + print 'Email for this tag is not valid. Operation canceled.'; llxFooter('', 'private'); exit; } From 9e59a3d60173f0a8a98cbeb4f401438cccb71c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 08:57:44 +0100 Subject: [PATCH 436/572] fix warning --- htdocs/core/class/rssparser.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 6992612592d..663bb96a7b6 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -446,7 +446,7 @@ class RssParser $itemDescription = sanitizeVal((string) $item['description']); $itemPubDate = sanitizeVal((string) $item['pubdate']); $itemId = sanitizeVal((string) $item['guid']); - $itemAuthor = sanitizeVal((string) $item['author']); + $itemAuthor = sanitizeVal((string) ($item['author'] ?? '')); } // Loop on each category From e403b416376ac2f4c438a483a087e6708895666c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 09:14:25 +0100 Subject: [PATCH 437/572] translations --- htdocs/langs/en_US/boxes.lang | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 9e80e36b119..e74539132f6 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -118,6 +118,27 @@ BoxCustomersOutstandingBillReached=Customers with oustanding limit reached UsersHome=Home users and groups MembersHome=Home Membership ThirdpartiesHome=Home Thirdparties +productindex=Home products and services +mrpindex=Home MRP +commercialindex=Home commercial +projectsindex=Home projects +invoiceindex=Home invoices +hrmindex=Home invoices TicketsHome=Home Tickets +stockindex=Home stocks +sendingindex=Home shippings +receptionindex=Home receivings +activityindex=Home activity +proposalindex=Home proposal +ordersindex=Home orders +orderssuppliersindex=Home orders suppliers +contractindex=Home contracts +interventionindex=Home interventions +suppliersproposalsindex=Home suppliers proposals +donationindex=Home donations +specialexpensesindex=Home specials expenses +expensereportindex=Home expensereport +mailingindex=Home mailing +opensurveyindex=Home opensurvey AccountancyHome=Home Accountancy ValidatedProjects=Validated projects From e90f41da9d4f6b05ba6be7fd024dd6d408fc8e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 09:28:30 +0100 Subject: [PATCH 438/572] Update rssparser.class.php --- htdocs/core/class/rssparser.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 663bb96a7b6..6d83fd6d6da 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -36,6 +36,8 @@ class RssParser */ public $error = ''; + public $feed_version; + private $_format = ''; private $_urlRSS; private $_language; From 67d9934aa1e63dff6a21dcf0054cd10fc664ae28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 10:54:23 +0100 Subject: [PATCH 439/572] pagination works with any font --- htdocs/core/lib/pdf.lib.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e4f6b169e93..d6b8365c730 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -13,6 +13,7 @@ * Copyright (C) 2019 Lenin Rivas * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2021-2022 Anthony Berton + * Copyright (C) 2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1287,11 +1288,14 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } } // Show page nb only on iso languages (so default Helvetica font) - if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { + // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY($dims['wk'] - $dims['rm'] - 18, -$posy); - //$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); - $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); - } + // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); + // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts + // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell + $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); + $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); + // } // Show Draft Watermark if (!empty($watermark)) { From 5f8bff123b8e3d53dea3bb0180fc88c154a5777b Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 24 Feb 2023 11:05:54 +0100 Subject: [PATCH 440/572] fix process --- htdocs/core/ajax/flowjs-server.php | 3 --- htdocs/public/test/test_forms.php | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index 480dba39195..962db0b8548 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -35,9 +35,6 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} // If there is no need to load and show top and left menu if (!defined("NOLOGIN")) { define("NOLOGIN", '1'); diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index e041e1d98fa..50693000442 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -109,7 +109,7 @@ print '

'."\n"; // Test6a: Upload of big files print "Test 6a: Upload of big files
\n"; -print "The file will be uploaded in the directory: documents/test_form/temp/
\n"; +print "The file will be uploaded in the directory: documents/test/temp/
\n"; if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { print ''; @@ -121,7 +121,7 @@ if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { jQuery(document).ready(function() { var flow = new Flow({ target:"'.DOL_URL_ROOT.'/core/ajax/flowjs-server.php", - query:{module:"test_form"}, + query:{module:"test", token:"'.newToken().'"}, testChunks:false }); '; @@ -166,7 +166,7 @@ if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { '; print ''; } else { - print "If this message displays, please add flow.js file which can be found here :https://github.com/flowjs/flow.js and place the js lib in htdocs/includes/flowjs/
\n"; + print "If this message displays, please add flow.js and flow.min.js files which can be found here: https://github.com/flowjs/flow.js and place the js lib in htdocs/includes/flowjs/
\n"; } print '
'; From fdf374fdee7706a47fb9c693e2bdcec2ca7d635f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:15:17 +0100 Subject: [PATCH 441/572] Add field to protect a file by a password --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 1 + htdocs/install/mysql/tables/llx_ecm_files.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 5f4a0f2cdd0..522940b62ed 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -82,4 +82,5 @@ ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_user_valid ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_projet (fk_projet); ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_account(fk_account); +ALTER TABLE llx_ecm_files ADD COLUMN share_pass varchar(32) after share; diff --git a/htdocs/install/mysql/tables/llx_ecm_files.sql b/htdocs/install/mysql/tables/llx_ecm_files.sql index cf9f3a8f148..14952d45594 100644 --- a/htdocs/install/mysql/tables/llx_ecm_files.sql +++ b/htdocs/install/mysql/tables/llx_ecm_files.sql @@ -22,6 +22,7 @@ CREATE TABLE llx_ecm_files ref varchar(128), -- contains hash from filename+filepath label varchar(128) NOT NULL, -- contains hash of file content share varchar(128) NULL, -- contains hash for file sharing + share_pass varchar(32) NULL, -- password to access the file (encoded with dolEncrypt) entity integer DEFAULT 1 NOT NULL, -- multi company id filepath varchar(255) NOT NULL, -- relative to dolibarr document dir. Example module/def filename varchar(255) NOT NULL, -- file name only without any directory From 27c15c523dcfe685e8266500f0d23cc49a396e2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:27:14 +0100 Subject: [PATCH 442/572] CSS --- htdocs/product/reassort.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 22c475ab337..bfe12d7efe2 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -465,7 +465,7 @@ if ($resql) { print $product->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; - print '
'; + print ''; if (isModEnabled("service") && $type == 1) { print ''; } } @@ -523,7 +523,7 @@ if ($resql) { if (!empty($conf->global->PRODUCT_USE_UNITS)) { print ''; } - print ''; From ca6e7dcb4164359b1d3fdf97b6200544030b5c36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:31:46 +0100 Subject: [PATCH 443/572] Fix sql error --- htdocs/product/stock/stockatdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 69893559dfa..da6627942c5 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -276,10 +276,10 @@ if (!empty($canvas)) { $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; } if ($fk_warehouse > 0) { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } else { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } // Add where from hooks From c266681379762dc853c6ba568418f598a384b5a0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 24 Feb 2023 11:32:56 +0100 Subject: [PATCH 444/572] fix : Warning: Constant DOL_URL_ROOT already defined in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/filemanagerdol/connectors/php/config.inc.php on line 40 --- htdocs/core/filemanagerdol/connectors/php/config.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 848153d84fc..368b82c42e7 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -37,7 +37,7 @@ $pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine if ($pos == '/') { $pos = ''; // si $pos vaut /, on le met a '' } -define('DOL_URL_ROOT', $pos); +//define('DOL_URL_ROOT', $pos); $entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null); // SECURITY: You must explicitly enable this "connector". (Set it to "true"). From 2a16db0e860fe5aa5705f4532630c969f2fbc81b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 24 Feb 2023 11:35:07 +0100 Subject: [PATCH 445/572] fix : Warning: Undefined variable in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/filemanagerdol/browser/default/browser.php on line 52 --- htdocs/core/filemanagerdol/browser/default/browser.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php index 0c1b29d12b2..1cf6d8612c2 100644 --- a/htdocs/core/filemanagerdol/browser/default/browser.php +++ b/htdocs/core/filemanagerdol/browser/default/browser.php @@ -49,6 +49,7 @@ if (!empty($conf->modules_parts['theme'])) { // This slow down } //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; +$themeparam = ''; print ''."\n"; ?> From 2cb3e260f7fdc6be019de07663ded89b6e3f3d04 Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 24 Feb 2023 12:20:39 +0100 Subject: [PATCH 446/572] add module verification --- htdocs/core/ajax/flowjs-server.php | 9 ++++++++- htdocs/public/test/test_forms.php | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index 962db0b8548..d520c57c9c5 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -62,7 +62,7 @@ $flowTotalSize = GETPOST('flowTotalSize', 'alpha'); top_httphead(); dol_syslog(join(',', $_GET)); -$result = true; +$result = false; if (!empty($upload_dir)) { $temp_dir = $upload_dir.'/'.$flowIdentifier; @@ -71,6 +71,12 @@ if (!empty($upload_dir)) { $upload_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'; } +if ($module != "test" && !isModEnabled($module)) { + echo json_encode("The module ".$module." is not enabled"); + header("HTTP/1.0 400"); + die(); +} + if ($_SERVER['REQUEST_METHOD'] === 'GET') { $chunk_file = $temp_dir.'/'.$flowFilename.'.part'.$flowChunkNumber; if (file_exists($chunk_file)) { @@ -83,6 +89,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (file_exists($upload_dir.'/'.$flowFilename)) { echo json_encode('File '.$flowIdentifier.' was already uploaded'); header("HTTP/1.0 200 Ok"); + die(); } elseif (!empty($_FILES)) foreach ($_FILES as $file) { // check the error status if ($file['error'] != 0) { diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index 50693000442..b7ed524e297 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -161,6 +161,11 @@ if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { $("#filespan").text("No file selected."); $(this).hide(); }) + flow.on("fileError", function(file, message){ + console.log("Error on file upload",file, message); + $("#"+file.uniqueIdentifier+"pgbar").width(20+"%"); + $("#"+file.uniqueIdentifier+"pgbar").children("span").text("ERROR UPLOAD"); + }); } }) '; From 393b0e7c4c48e7b826805795d3af095d69f0088b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 12:56:11 +0100 Subject: [PATCH 447/572] NEW Support multiselect in the warehouse selection combo box --- .../product/class/html.formproduct.class.php | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index b4da53f4635..beb84f3e455 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -260,7 +260,7 @@ class FormProduct /** * Return list of warehouses * - * @param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) + * @param string|int|array $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) * @param string $htmlname Name of html select html * @param string $filterstatus warehouse status filter, following comma separated filter options can be used * 'warehouseopen' = select products from open warehouses, @@ -272,17 +272,18 @@ class FormProduct * @param string $empty_label Empty label if needed (only if $empty=1) * @param int $showstock 1=Show stock count * @param int $forcecombo 1=Force combo iso ajax select2 - * @param array $events Events to add to select2 - * @param string $morecss Add more css classes to HTML select + * @param array $events Events to add to select2 + * @param string $morecss Add more css classes to HTML select * @param array $exclude Warehouses ids to exclude * @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse * @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by + * @param int $multiselect 1=Allow multiselect * @return string HTML select * * @throws Exception */ - public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') + public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref', $multiselect = 0) { global $conf, $langs, $user, $hookmanager; @@ -307,17 +308,20 @@ class FormProduct if (strpos($htmlname, 'search_') !== 0) { if (empty($user->fk_warehouse) || $user->fk_warehouse == -1) { - if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { + if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { $selected = $conf->global->MAIN_DEFAULT_WAREHOUSE; } } else { - if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { $selected = $user->fk_warehouse; } } } - $out .= ''; } @@ -330,15 +334,21 @@ class FormProduct } if (($fk_product || ($showstock > 0)) && ($arraytypes['stock'] != 0 || ($showstock > 0))) { if ($arraytypes['stock'] <= 0) { - $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; + $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } else { - $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; + $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } } $out .= ''; $fieldtosortcurrentstock = 'stock'; -if ($fk_warehouse > 0) { +if (!empty($search_fk_warehouse)) { $fieldtosortcurrentstock = 'stock_reel'; } @@ -506,9 +525,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) { }*/ $currentstock = ''; - if ($fk_warehouse > 0) { + if (!empty($search_fk_warehouse)) { //if ($productid > 0) { - $currentstock = $stock_prod_warehouse[$objp->rowid][$fk_warehouse]; + foreach ($search_fk_warehouse as $val) { + if (!is_numeric($currentstock)) { + $currentstock = 0; + } + $currentstock += $stock_prod_warehouse[$objp->rowid][$val]; + } //} else { // $currentstock = $objp->stock_reel; //} @@ -521,17 +545,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } if ($mode == 'future') { - $prod->load_stock('warehouseopen, warehouseinternal', 0, $dateendofday); - $stock = $prod->stock_theorique; - $prod->load_stock('warehouseopen, warehouseinternal', 0); - $virtualstock = $prod->stock_theorique; + $prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0, $dateendofday); + $stock = $prod->stock_theorique; // virtual stock at a date + $prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0); + $virtualstock = $prod->stock_theorique; // virtual stock in infinite future } else { - if ($fk_warehouse > 0) { - $stock = $currentstock - $movements_prod_warehouse[$objp->rowid][$fk_warehouse]; - $nbofmovement = $movements_prod_warehouse_nb[$objp->rowid][$fk_warehouse]; + $stock = $currentstock; + $nbofmovement = 0; + if (!empty($search_fk_warehouse)) { + foreach ($search_fk_warehouse as $val) { + $stock -= $movements_prod_warehouse[$objp->rowid][$val]; + $nbofmovement += $movements_prod_warehouse_nb[$objp->rowid][$val]; + } } else { - $stock = $currentstock - $movements_prod[$objp->rowid]; - $nbofmovement = $movements_prod_nb[$objp->rowid]; + $stock -= $movements_prod[$objp->rowid]; + $nbofmovement += $movements_prod_nb[$objp->rowid]; } } @@ -585,7 +613,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; From 904babed3ecb0cd78b8918a2ca768ba0e7f1ff14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 13:28:19 +0100 Subject: [PATCH 449/572] Fix filter on warehouse must not be visible on stock at date in future --- htdocs/product/stock/stockatdate.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 69893559dfa..1f9b82a4392 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -361,10 +361,14 @@ print img_picto('', 'product', 'class="pictofiwedwidth"').' '; print ' '; print $form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, $langs->trans('Product'), 0, 'maxwidth300', 0, '', null, 1); -print '   '; -print img_picto('', 'stock', 'class="pictofiwedwidth"'); -print ' '; -print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifonenodefault'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref'); +if ($mode != 'future') { + // A virtual stock in future has no sense on a per warehouse view, so no filter on warehouse is available for stock at date in future + print '   '; + print img_picto('', 'stock', 'class="pictofiwedwidth"'); + print ' '; + print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifonenodefault'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref'); +} + print ''; $parameters = array(); From ad84346cae11869e3594ab5efa1b4075071a1deb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:31:46 +0100 Subject: [PATCH 450/572] Fix sql error --- htdocs/product/stock/stockatdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 1f9b82a4392..4138841b3bb 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -276,10 +276,10 @@ if (!empty($canvas)) { $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; } if ($fk_warehouse > 0) { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } else { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } // Add where from hooks From a3a9d6e6a28448fde9650eff54fb4a729bf44d1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:27:14 +0100 Subject: [PATCH 451/572] CSS --- htdocs/product/reassort.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index f3c354b88a4..b0f6f4b3283 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -464,7 +464,7 @@ if ($resql) { print $product->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; - print ''; + print ''; if (isModEnabled("service") && $type == 1) { print ''; } } @@ -514,7 +514,7 @@ if ($resql) { if (!empty($conf->global->PRODUCT_USE_UNITS)) { print ''; } - print ''; From fae051deb4eeef7f6ac729c355a3fd577ef2e93c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 15:14:18 +0100 Subject: [PATCH 452/572] Fix warning --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3d4a094c30b..deba6883277 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3411,8 +3411,8 @@ if (!function_exists("llxFooter")) { } // Wrapper to add log when clicking on download or preview - if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0 && $object->statut > 0) { - if (in_array($object->element, array('facture'))) { // Restrict for the moment to element 'facture' + if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0) { + if (in_array($object->element, array('facture')) && $object->statut > 0) { // Restrict for the moment to element 'facture' print "\n\n"; ?> '."\n"; + } + print "\n"; print "\n"; } @@ -507,7 +514,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio llxHeaderVierge($langs->trans("NewSubscription")); print '
'; -print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center'); +print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"').'   '.$langs->trans("NewSubscription"), '', '', 0, 0, 'center'); print '
'; @@ -532,7 +539,9 @@ print ''; if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEWFORM_FORCETYPE) || $action == 'create') { print ''; print '
'; - print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; + + $messagemandatory = ''.$langs->trans("FieldsWithAreMandatory", '*').''; + //print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; print dol_get_fiche_head(''); @@ -579,7 +588,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW $defaulttype = $tmp[0]; $isempty = 0; } - print '
'."\n"; } else { @@ -591,7 +600,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''."\n"; } else { @@ -609,21 +618,21 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').''."\n"; // Lastname - print ''."\n"; + print ''."\n"; // Firstname - print ''."\n"; + print ''."\n"; // EMail - print ''."\n"; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; } // Gender @@ -699,7 +708,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW // TODO Move this into generic feature. if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); - print ''; - print ''; // Recipients / adressed-to @@ -1489,8 +1489,8 @@ class FormTicket } } - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO.' (generic email)'; + if (getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')) { + $sendto[] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').' (generic email)'; } // Print recipient list diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index a78a610ed1c..ce872c7ac38 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -46,6 +46,9 @@ $track_id = GETPOST('track_id', 'alpha', 3); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +// Store current page url +$url_page_current = DOL_URL_ROOT.'/ticket/agenda.php'; + $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index b5453ed638b..38d00de71fa 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -252,7 +252,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $linkback = ''.$langs->trans("BackToList").' '; - dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, ''); + dol_banner_tab($object, 'ref', $linkback, (!empty($user->socid) ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1, ''); print dol_get_fiche_end(); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 1c7a25323e2..9c2208e9864 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -49,6 +49,9 @@ $track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +// Store current page url +$url_page_current = DOL_URL_ROOT.'/ticket/document.php'; + // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 1ad01a7ae67..b42cff070f2 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -46,6 +46,9 @@ $track_id = GETPOST('track_id', 'alpha', 3); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +// Store current page url +$url_page_current = DOL_URL_ROOT.'/ticket/messaging.php'; + $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", "aZ09comma"); $sortorder = GETPOST("sortorder", 'aZ09comma'); From a5703a9618a6c50d230d5c24a090f6483f1f7f48 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 1 Mar 2023 18:15:15 +0100 Subject: [PATCH 542/572] fix message for delete api --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 87311ce1259..16464caa03a 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1005,7 +1005,7 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) { $check = dolReplaceInFile($file_api, array($allContent => '')); if ($check) { dolReplaceInFile($file_api, array($begin => '', $end => '')); - setEventMessages($langs->trans("ApiObjectDeleted"), null); + setEventMessages($langs->trans("ApiObjectDeleted", $langs->transnoentities($objectname)), null); } fclose($handle); } From 64440da194c2274f0ae5e9118f21246f06246b07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 18:43:52 +0100 Subject: [PATCH 543/572] css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 307d2b25b69..6a31211db45 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7123,7 +7123,7 @@ div.tabsElem a.tab { } .publicnewmemberform #tablesubscribe { - color: #888; + color: #666; } /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5f3f965c021..3702f5bfdbb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -7043,6 +7043,10 @@ border-top-right-radius: 6px; border: 1px solid #888; } +.publicnewmemberform #tablesubscribe { + color: #666; +} + /* ============================================================================== */ /* Ticket module */ From f6271d83dbebb2bb2ea90791c32a62e722cf16bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 19:28:32 +0100 Subject: [PATCH 544/572] Debug v17 --- htdocs/admin/agenda.php | 4 + htdocs/core/modules/modPartnership.class.php | 30 +++--- ...terface_50_modAgenda_ActionsAuto.class.php | 4 +- .../mysql/data/llx_c_action_trigger.sql | 9 ++ .../modulebuilder/template/myobject_card.php | 2 +- htdocs/partnership/admin/about.php | 74 ------------- htdocs/partnership/partnership_card.php | 100 ++++++++++-------- 7 files changed, 85 insertions(+), 138 deletions(-) delete mode 100644 htdocs/partnership/admin/about.php diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 0969dc9c66b..7a29c881f77 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -194,6 +194,10 @@ if (!empty($triggers)) { if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { continue; } + if ($trigger['code'] == 'ACTION_CREATE') { + // This is the trigger to add an event, enabling it will create infinite loop + continue; + } if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $trigger['code'])) { print ''; diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 8e8421540c7..44ef6b527db 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -212,7 +212,7 @@ class modPartnership extends DolibarrModules // Dictionaries $this->dictionaries=array( - 'langs'=>'partnership@partnership', + 'langs'=>'partnership', // List of tables we want to see into dictonnary editor 'tabname'=>array("c_partnership_type"), // Label of tables @@ -291,7 +291,7 @@ class modPartnership extends DolibarrModules // 'leftmenu'=>'partnership', // 'url'=>'/partnership/partnership_list.php', // // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - // 'langs'=>'partnership@partnership', + // 'langs'=>'partnership', // 'position'=>1100+$r, // // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. // 'enabled'=>'$conf->partnership->enabled', @@ -349,18 +349,18 @@ class modPartnership extends DolibarrModules $r = 1; /* BEGIN MODULEBUILDER EXPORT PARTNERSHIP */ /* - $langs->load("partnership@partnership"); + $langs->load("partnership"); $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='partnership@partnership'; + $this->export_icon[$r]='partnership'; // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array - $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership'; + $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; //unset($this->export_fields_array[$r]['t.fieldtoremove']); //$keyforclass = 'PartnershipLine'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnershipline@partnership'; $keyforalias='tl'; //include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership'; + $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; //$keyforselect='partnershipline'; $keyforaliasextra='extraline'; $keyforelement='partnershipline@partnership'; //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; @@ -380,13 +380,13 @@ class modPartnership extends DolibarrModules $r = 1; /* BEGIN MODULEBUILDER IMPORT PARTNERSHIP */ /* - $langs->load("partnership@partnership"); + $langs->load("partnership"); $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='partnership@partnership'; - $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership'; + $this->export_icon[$r]='partnership'; + $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership'; + $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) $this->export_sql_start[$r]='SELECT DISTINCT '; @@ -417,11 +417,11 @@ class modPartnership extends DolibarrModules // Create extrafields during init //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); - //$result1=$extrafields->addExtraField('partnership_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result2=$extrafields->addExtraField('partnership_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result3=$extrafields->addExtraField('partnership_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result4=$extrafields->addExtraField('partnership_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result5=$extrafields->addExtraField('partnership_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); + //$result1=$extrafields->addExtraField('partnership_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result2=$extrafields->addExtraField('partnership_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result3=$extrafields->addExtraField('partnership_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result4=$extrafields->addExtraField('partnership_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result5=$extrafields->addExtraField('partnership_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); // Permissions $this->remove($options); diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d8b57918d83..f4c515c1f24 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -981,6 +981,8 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->trackid = 'sub'.$object->id; } elseif (preg_match('/^MEMBER_/', $action)) { $object->trackid = 'mem'.$object->id; + } elseif (preg_match('/^PARTNERSHIP_/', $action)) { + $object->trackid = 'pship'.$object->id; } elseif (preg_match('/^PROJECT_/', $action)) { $object->trackid = 'proj'.$object->id; } elseif (preg_match('/^TASK_/', $action)) { @@ -1079,7 +1081,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to; } - // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table + // Object linked (if link is for thirdparty, contact or project, it is a recording error. We should not have links in link table // for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources. if (!in_array($elementtype, array('societe', 'contact', 'project'))) { $actioncomm->fk_element = $elementid; diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 9aa28c116c8..ad33a4e4f6a 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -150,6 +150,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',52); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',53); + +-- recruitment module insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504); @@ -178,3 +180,10 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903); + +-- partnership module +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_CREATE','Partnership created','Executed when a partnership is created','partnership',58000); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_MODIFY','Partnership modified','Executed when a partnership is modified','partnership',58002); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_SENTBYMAIL','Mails sent from partnership file','Executed when you send email from partnership file','partnership',58004); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_DELETE','Partnership deleted','Executed when a partnership is deleted','partnership',58006); + diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 6bb89d1aaf7..dc8dafd433e 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -511,7 +511,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/partnership/admin/about.php b/htdocs/partnership/admin/about.php deleted file mode 100644 index 47423bf4709..00000000000 --- a/htdocs/partnership/admin/about.php +++ /dev/null @@ -1,74 +0,0 @@ - - * Copyright (C) 2021 Dorian Laurent - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file partnership/admin/about.php - * \ingroup partnership - * \brief About page of module Partnership. - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once '../lib/partnership.lib.php'; - -// Translations -$langs->loadLangs(array("errors", "admin", "partnership@partnership")); - -// Access control -if (!$user->admin) { - accessforbidden(); -} - -// Parameters -$action = GETPOST('action', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - - -/* - * Actions - */ - - -/* - * View - */ - -$form = new Form($db); - -$page_name = "PartnershipAbout"; -llxHeader('', $langs->trans($page_name)); - -// Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); - -// Configuration header -$head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'about', '', 0, 'partnership@partnership'); - -require_once DOL_DOCUMENT_ROOT.'/core/modules/modPartnership.class.php'; -$tmpmodule = new modPartnership($db); -print $tmpmodule->getDescLong(); - -// Page end -print dol_get_fiche_end(); -llxFooter(); -$db->close(); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index b544ad94fc7..7679b63da09 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -39,10 +39,11 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'partnershipcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $lineid = GETPOST('lineid', 'int'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); // Initialize technical objects $object = new Partnership($db); @@ -73,20 +74,25 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php +$permissiontoread = $user->hasRight('partnership', 'read'); +$permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('partnership', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissionnote = $user->hasRight('partnership', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('partnership', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); -// Security check - Protection if external user +// Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; -//$result = restrictedArea($user, 'partnership', $object->id); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); +//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft); +if (!isModEnabled('partnership')) { + accessforbidden(); +} +if (!$permissiontoread) { + accessforbidden(); +} if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); @@ -119,11 +125,11 @@ if (empty($reshook)) { $fk_partner = ($managedfor == 'member') ? GETPOST('fk_member', 'int') : GETPOST('fk_soc', 'int'); $obj_partner = ($managedfor == 'member') ? $object->fk_member : $object->fk_soc; + $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record + // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; - $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record - // Action accept object if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { $result = $object->validate($user); @@ -264,6 +270,10 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { + if (empty($permissiontoadd)) { + accessforbidden('NotEnoughPermissions', 0, 1); + } + print load_fiche_titre($langs->trans("NewPartnership"), '', 'object_'.$object->picto); print ''; @@ -333,9 +343,8 @@ if (($id || $ref) && $action == 'edit') { // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $res = $object->fetch_optionals(); - $head = partnershipPrepareHead($object); + print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto); $formconfirm = ''; @@ -405,38 +414,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref = '
'; /* // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + } // Project - if (!empty($conf->project->enabled)) { - $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project') . ' '; - if ($permissiontoadd) { - //if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; - $morehtmlref .= ' : '; - if ($action == 'classify') { - //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 0, 1, '', 'maxwidth300'); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(); - } else { - $morehtmlref .= ''; - } - } - }*/ + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } + } + */ $morehtmlref .= '
'; if (!isset($npfilter)) { $npfilter = ""; @@ -632,8 +638,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->partnership->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->partnership->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->partnership->write; // If you can create/edit, you can remove a file on card + $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content + $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card print $formfile->showdocuments('partnership:Partnership', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } @@ -651,7 +657,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); print ''; } From 12bd795afc7d34014e4400565651c9ea96bbcc87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 20:10:37 +0100 Subject: [PATCH 545/572] Work on Kanban view --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/adherents/class/adherent_type.class.php | 2 +- htdocs/bom/class/bom.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 4 ++-- htdocs/compta/bank/list.php | 2 +- htdocs/compta/cashcontrol/class/cashcontrol.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- .../compta/paiement/cheque/class/remisecheque.class.php | 2 +- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 +-- htdocs/compta/sociales/class/chargesociales.class.php | 2 +- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/core/class/html.formcategory.class.php | 2 +- htdocs/don/class/don.class.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/expensereport/class/paymentexpensereport.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/hrm/class/evaluation.class.php | 2 +- .../knowledgemanagement/class/knowledgerecord.class.php | 2 +- htdocs/loan/class/loan.class.php | 2 +- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/recruitment/class/recruitmentcandidature.class.php | 2 +- htdocs/recruitment/class/recruitmentjobposition.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- .../supplier_proposal/class/supplier_proposal.class.php | 2 +- htdocs/theme/eldy/global.inc.php | 8 ++++---- htdocs/ticket/class/ticket.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- 40 files changed, 44 insertions(+), 45 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f2e84e5127a..89a1ed2904d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3323,7 +3323,7 @@ class Adherent extends CommonObject $return .= '
'.$this->getmorphylib('', 2).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index eda018e6dca..396dea45b0e 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -1016,7 +1016,7 @@ class AdherentType extends CommonObject } } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index d5e3532dbd6..361ac64928e 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1589,7 +1589,7 @@ class BOM extends CommonObject $return .= '
'.$prod->getNomUrl(1).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 46f06614941..5fc0de4c43f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3976,7 +3976,7 @@ class Propal extends CommonObject $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 89b2a5f31d9..3ee2ad037b5 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1844,10 +1844,10 @@ class Account extends CommonObject } if (method_exists($this, 'solde')) { $return .= '
'; - $return .= ''.$langs->trans("Balance").' : '.price($this->solde(1), 0, $langs, 1, -1, -1, $this->currency_code).''; + $return .= ''.$langs->trans("Balance").' : '.price(price2num($this->solde(1), 'MT'), 0, $langs, 1, -1, -1, $this->currency_code).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 668ada03fdb..bc2c2528d07 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -787,7 +787,7 @@ foreach ($accounts as $key => $type) { if (!empty($arrayfields['balance']['checked'])) { print '
'; if (!$i) { diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 8cc3c93b59c..deb86fba456 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -495,7 +495,7 @@ class CashControl extends CommonObject $return .= '
'.$langs->trans("Year").' : '.$this->year_close.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ed4d8bfd498..265b5732f24 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5819,7 +5819,7 @@ class Facture extends CommonInvoice $return .= '
'.$this->fk_user_author.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 53751cce194..5c885267559 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -1050,7 +1050,7 @@ class RemiseCheque extends CommonObject $return .= ' | '.$this->account_id.''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } if (property_exists($this, 'amount')) { $return .= ' |
'.$langs->trans("Amount").' : '.price($this->amount).'
'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 7d7127fc6ba..cbe2eda9533 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2524,7 +2524,6 @@ class BonPrelevement extends CommonObject { global $langs; - $return = '
'; $return .= '
'; $return .= ''; @@ -2540,7 +2539,7 @@ class BonPrelevement extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->total).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= '
'; $return .= '
'; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 3619ebfad7a..140f1cffec6 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -779,7 +779,7 @@ class ChargeSociales extends CommonObject $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 2ec1199dd29..220863a0cb2 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -935,7 +935,7 @@ class Tva extends CommonObject $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->datev).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->paiementtype, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index b44d22da312..407eed06921 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -2202,7 +2202,7 @@ class Contact extends CommonObject $return .= ' : '.$this->LibPubPriv($this->priv).''; }*/ if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f494bf22ef5..14f5cb62bfa 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2844,7 +2844,7 @@ class Contrat extends CommonObject $return .= '
'.$langs->trans("DateContract").' : '.dol_print_date($this->date_contrat, 'day').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 695b1ab657b..ef252765ea0 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -41,7 +41,7 @@ class FormCategory extends Form * @param string $showempty 1 or 'string' to add an empty entry * @return string A HTML filter box (Note: selected results can get with GETPOST("search_category_".$type."_list")) */ - public function getFilterBox($type, array $preSelected, $morecss = "minwidth300 widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty = '') + public function getFilterBox($type, array $preSelected, $morecss = "minwidth300imp widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty = '') { global $langs, $db; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 08491e9b4a3..01b1e1bf6cc 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -1171,7 +1171,7 @@ class Don extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->labelStatus, 5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 76a0614da18..4bac14b34f1 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2793,7 +2793,7 @@ class ExpenseReport extends CommonObject $return .= ''.dol_print_date($this->date_fin, 'day').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 053f46d20cf..955181cf632 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -744,7 +744,7 @@ class PaymentExpenseReport extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index bd76ca7bbc3..e739ee0806e 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1503,7 +1503,7 @@ class Fichinter extends CommonObject $return .= '
'.$langs->trans("Duration").' : '.convertSecondToTime($this->duration, 'allhourmin').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 170f60912aa..17033086e69 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3648,7 +3648,7 @@ class CommandeFournisseur extends CommonOrder $return .= '
'.$langs->trans("Billed").' : '.yn($this->billed).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 34af6f4cbda..7e4dad3f219 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3307,7 +3307,7 @@ class FactureFournisseur extends CommonInvoice $return .= '
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 4717db8bea0..619d8a3fc85 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2493,7 +2493,7 @@ class Holiday extends CommonObject $return .= ''.dol_print_date($this->date_fin, 'day').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index a62b16b54f1..ab87aaeeef5 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -1084,7 +1084,7 @@ class Evaluation extends CommonObject } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 275b0a2a2e3..15682d00fc9 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -1145,7 +1145,7 @@ class KnowledgeRecord extends CommonObject $return .= ''.dolGetFirstLineOfText($this->question).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 951d430e96f..ef44b2fb196 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -751,7 +751,7 @@ class Loan extends CommonObject } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->totalpaid, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2dcb87ea523..19d99557569 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -921,7 +921,7 @@ class MyObject extends CommonObject $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 2e9072ac0f2..e5af1f2bddf 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1661,7 +1661,7 @@ class Mo extends CommonObject $return .= '
'.$langs->trans('Quantity').' : '.$this->qty.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 26650f81d2a..6a5f4623618 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -1343,7 +1343,7 @@ class Partnership extends CommonObject $return .= '
'.$this->label.'
'; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8939132cff9..d4a30517068 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -6404,7 +6404,7 @@ class Product extends CommonObject $return .= '
'.$langs->trans('PhysicalStock').' : '.$this->stock_reel.''; } if (method_exists($this, 'getLibStatut')) { - $return .='
'.$this->getLibStatut(5, 1).' '.$this->getLibStatut(5, 0).''; + $return .='
'.$this->getLibStatut(3, 1).' '.$this->getLibStatut(3, 0).''; } $return .= ''; $return .= ''; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 6b0d558c689..416d96ad55b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -977,7 +977,7 @@ class Entrepot extends CommonObject $return .= '
'.price($this->sellvalue).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c9a811ad245..fc4f6acb426 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2419,7 +2419,7 @@ class Project extends CommonObject $return .= '
'.price($this->opp_amount).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index abb07d36480..1f203113b3a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1002,7 +1002,7 @@ if ($user->rights->user->user->lire) { // Filter on categories if (isModEnabled('categorie') && $user->rights->categorie->lire) { $formcategory = new FormCategory($db); - $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth300imp widthcentpercentminusx'); } // Filter on customer categories if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST) && !empty($conf->categorie->enabled) && $user->rights->categorie->lire) { diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index e3dfd4bd135..809b8d0cd54 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -1053,7 +1053,7 @@ class RecruitmentCandidature extends CommonObject $return .= '
'.$langs->trans("phone").' : '.$this->phone.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 69ec74deb9d..b0ca58d6b8f 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1138,7 +1138,7 @@ class RecruitmentJobPosition extends CommonObject $return .= ' | '.$langs->trans("Remuneration").' : '.$this->remuneration_suggested.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '.$obj->nbapplications.'
'; + $return .= '
'.$this->getLibStatut(3).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '.$obj->nbapplications.'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 90666a6853d..7192a14e9d3 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -770,7 +770,7 @@ class Salary extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 01f35b9ea17..6ae3cad817a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5225,7 +5225,7 @@ class Societe extends CommonObject } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 892c3f77687..fbcf04aacd2 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2789,7 +2789,7 @@ class SupplierProposal extends CommonObject $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ttc).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 6a31211db45..4ce4a7ed19e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4253,15 +4253,15 @@ div.liste_titre_bydiv { border-top-style: solid; border-left: px solid var(--colortopbordertitle1); - /* border-right: px solid var(--colortopbordertitle1); */ + border-right: px solid var(--colortopbordertitle1); border-collapse: collapse; - display: table; padding: 2px 0px 2px 0; box-shadow: none; - /*width: calc(100% - 1px); 1px more, i don't know why so i remove */ - width: calc(100%); + /*width: calc(100% - 1px); 1px less because display is table and with100%, it generated a right border 1px left compared to the div-table-responsive under */ + width: unset; + /* display: table; */ } tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable.tr, tagtr.liste_titre { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6f309b7656f..207ba4d6a50 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -3021,7 +3021,7 @@ class Ticket extends CommonObject $return .= '
'.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$this->type_code, 'c_ticket_type', 'code', 'label', $this->type_code).'
'; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 648fd61fa6c..3fc11f9eadd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3089,7 +3089,7 @@ class User extends CommonObject $return .= '
'.img_picto('', 'email').' '.$this->email.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; From 03bf66a6b10af27d253677ae21f31439ad47a467 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 21:20:16 +0100 Subject: [PATCH 546/572] css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4ce4a7ed19e..aafabf45d63 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7115,7 +7115,7 @@ div.tabsElem a.tab { border: 1px solid #888; } .publicnewmemberform div.tabBarWithBottom { - border: 1px solid #f0f0f0; + border: 1px solid #e8e8e8; padding: 30px; border-radius: 8px; background-color: #f8f8f8; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3702f5bfdbb..2a46cf83911 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -7042,6 +7042,13 @@ border-top-right-radius: 6px; .public_border { border: 1px solid #888; } +.publicnewmemberform div.tabBarWithBottom { + border: 1px solid #e8e8e8; + padding: 30px; + border-radius: 8px; + background-color: #f8f8f8; + /*box-shadow: 2px 2px 10px #ddd;*/ +} .publicnewmemberform #tablesubscribe { color: #666; From a62d029d7d7ee744d40e57704f7c99f193f0718d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 21:37:18 +0100 Subject: [PATCH 547/572] Disable non secured feature --- htdocs/core/ajax/fileupload.php | 6 +++- htdocs/core/class/fileupload.class.php | 38 ++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 67f95700976..379a2e689a3 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -45,9 +45,13 @@ error_reporting(E_ALL | E_STRICT); $fk_element = GETPOST('fk_element', 'int'); $element = GETPOST('element', 'alpha'); - $upload_handler = new FileUpload(null, $fk_element, $element); +// Feature not enabled. Warning feature not used and not secured so disabled. +if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; +} + /* * View diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index ccea7de2d84..5a8e75b1e69 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -46,6 +46,12 @@ class FileUpload global $db, $conf; global $object; global $hookmanager; + + // Feature not enabled. Warning feature not used and not secured so disabled. + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $hookmanager->initHooks(array('fileupload')); $this->fk_element = $fk_element; @@ -238,6 +244,10 @@ class FileUpload */ protected function getFileObject($file_name) { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_path = $this->options['upload_dir'].$file_name; if (is_file($file_path) && $file_name[0] !== '.') { $file = new stdClass(); @@ -278,6 +288,10 @@ class FileUpload { global $maxwidthmini, $maxheightmini; + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_path = $this->options['upload_dir'].$file_name; $new_file_path = $options['upload_dir'].$file_name; @@ -309,6 +323,10 @@ class FileUpload */ protected function validate($uploaded_file, $file, $error, $index) { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + if ($error) { $file->error = $error; return false; @@ -399,8 +417,8 @@ class FileUpload // Also remove control characters and spaces (\x00..\x20) around the filename: $file_name = trim(basename(stripslashes($name)), ".\x00..\x20"); // Add missing file extension for known image types: - if (strpos($file_name, '.') === false && - preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { + $matches = array(); + if (strpos($file_name, '.') === false && preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { $file_name .= '.'.$matches[1]; } if ($this->options['discard_aborted_uploads']) { @@ -424,6 +442,10 @@ class FileUpload */ protected function handleFileUpload($uploaded_file, $name, $size, $type, $error, $index) { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file = new stdClass(); $file->name = $this->trimFileName($name, $type, $index); $file->mime = dol_mimetype($file->name, '', 2); @@ -470,6 +492,10 @@ class FileUpload */ public function get() { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; if ($file_name) { @@ -488,6 +514,10 @@ class FileUpload */ public function post() { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { return $this->delete(); } @@ -543,6 +573,10 @@ class FileUpload */ public function delete() { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; $file_path = $this->options['upload_dir'].$file_name; From 0d3a4d68b2281332611edf0314b9faca6c2e0ca6 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 1 Mar 2023 23:20:42 +0100 Subject: [PATCH 548/572] add comment in api_mymodule for seperate methods --- .../template/class/api_mymodule.class.php | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index fdb56ff3c67..a48b2f5010b 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -54,6 +54,8 @@ class MyModuleApi extends DolibarrApi $this->myobject = new MyObject($this->db); } + /*begin methods CRUD*/ + /** * Get properties of a myobject object * @@ -307,6 +309,31 @@ class MyModuleApi extends DolibarrApi } + /** + * Validate fields before create or update object + * + * @param array $data Array of data to validate + * @return array + * + * @throws RestException + */ + private function _validate($data) + { + $myobject = array(); + foreach ($this->myobject->fields as $field => $propfield) { + if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) { + continue; // Not a mandatory field + } + if (!isset($data[$field])) { + throw new RestException(400, "$field field missing"); + } + $myobject[$field] = $data[$field]; + } + return $myobject; + } + + /*end methods CRUD*/ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas @@ -369,27 +396,4 @@ class MyModuleApi extends DolibarrApi return $object; } - - /** - * Validate fields before create or update object - * - * @param array $data Array of data to validate - * @return array - * - * @throws RestException - */ - private function _validate($data) - { - $myobject = array(); - foreach ($this->myobject->fields as $field => $propfield) { - if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) { - continue; // Not a mandatory field - } - if (!isset($data[$field])) { - throw new RestException(400, "$field field missing"); - } - $myobject[$field] = $data[$field]; - } - return $myobject; - } } From 14a59483f58e99cc95af9c6fdc43274432ff25b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 23:50:02 +0100 Subject: [PATCH 549/572] Debug v17 --- htdocs/admin/pdf.php | 10 ++++++++ htdocs/admin/system/security.php | 4 ++-- htdocs/core/ajax/onlineSign.php | 23 +++++++++++++------ ...e_20_modWorkflow_WorkflowManager.class.php | 5 +++- htdocs/core/website.inc.php | 8 +++---- htdocs/includes/tcpdi/tcpdi.php | 2 +- htdocs/main.inc.php | 8 +++---- 7 files changed, 41 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index d8cc8d554a2..a015e2319b0 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -271,9 +271,19 @@ print ''; clearstatcache(); +if (getDolGlobalString('PDF_SECURITY_ENCRYPTION')) { + print '
'; + print 'The not supported and hidden option PDF_SECURITY_ENCRYPTION has been enabled. This means a lof of feature related to PDF will be broken, like mass PDF generation or online signature of PDF.'."\n"; + print 'You should disable this option.'; + print '
'; +} + + + // Misc options print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); + print '
'; print '
'.$langs->trans("MailTitle").''.$object->title.'
'.$langs->trans("MailTitle").''.$object->title.'
'.$langs->trans("MailFrom").''; $emailarray = CMailFile::getArrayAddress($object->email_from); diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 86ce2eb70b2..b2f051bc3a6 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -58,6 +58,12 @@ if ($object->fetch($id) >= 0) { $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= '
'; + $morehtmlright = ''; $nbtry = $nbok = 0; if ($object->statut == 2 || $object->statut == 3) { @@ -71,7 +77,7 @@ if ($object->fetch($id) >= 0) { $morehtmlright .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '

'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c0e1ee67660..855fb711a86 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -168,7 +168,11 @@ class Form $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; } if (!empty($notabletag) && $notabletag == 1) { - $ret .= ' : '; + if ($text) { + $ret .= ' : '; + } else { + $ret .= ' '; + } } if (!empty($notabletag) && $notabletag == 3) { $ret .= ' '; @@ -9350,7 +9354,7 @@ class Form // Left part of banner if ($morehtmlleft) { if ($conf->browser->layout == 'phone') { - $ret .= '
'.$morehtmlleft.'
'; // class="center" to have photo in middle + $ret .= '
'.$morehtmlleft.'
'; } else { $ret .= '
'.$morehtmlleft.'
'; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 1750cf00c7f..ad88ea06e1c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -249,7 +249,7 @@ input { padding: 4px; padding-left: 5px; } -.tableforfield input { +.tableforfield input, .refidno input { padding: 2px; } select { @@ -624,7 +624,7 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { text-transform: uppercase; color: #444; } -.valuefield .button, .valuefieldcreate .button, .refidno .button { +.valuefield .button, .valuefieldcreate .button, .refidno .button:not(.smallpaddingimp) { margin-top: 0 !important; margin-bottom: 0 !important; font-size: 0.85em !important; @@ -2954,9 +2954,12 @@ if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { .login_table .tdinputlogin input#securitycode { font-size: 1em; } +/* For the static info message */ .login_main_home { word-break: break-word; + width: fit-content; } +/* For the result or error message */ .login_main_message { text-align: center; max-width: 570px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 24078c3ca8f..2e0809ec311 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -456,6 +456,10 @@ a.commonlink { color: var(--colortextlink) !important; text-decoration: none; } input { font-size: unset; } +.tableforfield input, .refidno input { + padding: 2px; +} + /* input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FDFDFD; @@ -875,6 +879,9 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } +.refidno .button.smallpaddingimp { + font-size: 0.85em !important; +} .button:focus, .buttonDelete:focus { -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); @@ -3066,6 +3073,7 @@ form#login { .login_main_home { word-break: break-word; + width: fit-content; } .login_main_message { text-align: center; From 790a28f4577df845150ddc213e453c9f40e56979 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 12:17:35 +0100 Subject: [PATCH 412/572] Look and feel v18 --- htdocs/theme/md/style.css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2e0809ec311..9a06b361f66 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -547,8 +547,8 @@ input, select { border: none; text-shadow: none; text-transform: uppercase; - font-weight: bold; - margin: 0em 0.9em; + /* font-weight: bold; */ + margin: 0em 0.8em; padding: 0.6em 0.7em; line-height: 17px; } From 45cdbd8a600cd60bff7c3b3c511613b7279d92ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 12:18:02 +0100 Subject: [PATCH 413/572] Fix checkbox --- htdocs/core/lib/usergroups.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 273e7285273..64747c1bbf6 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -366,7 +366,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print '
'.$langs->trans("DefaultSkin").''.$conf->global->MAIN_THEME.' '.$langs->trans("UsePersonalValue").'  
'; + print '
'; print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); print ''; print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 71e8617f927..79905182ee3 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -241,7 +241,7 @@ if ($object->fetch($id) >= 0) { //print '
'.$langs->trans("MailTitle").''.$object->title.'
'.$langs->trans("MailFrom").''; + print '
'.$langs->trans("MailFrom").''; $emailarray = CMailFile::getArrayAddress($object->email_from); foreach ($emailarray as $email => $name) { if ($name && $name != $email) { @@ -291,7 +291,7 @@ if ($object->fetch($id) >= 0) { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('');//.' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 137e5f7d779..96d6d4c0d89 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -540,11 +540,15 @@ class FormMail extends Form // Substitution array/string $helpforsubstitution = ''; if (is_array($this->substit) && count($this->substit)) { - $helpforsubstitution .= $langs->trans('AvailableVariables').' :
'."\n"; + $helpforsubstitution .= $langs->trans('AvailableVariables').' :

'."\n"; } foreach ($this->substit as $key => $val) { $helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'
'; } + if (is_array($this->substit) && count($this->substit)) { + $helpforsubstitution .= '
'; + } + if (!empty($this->withsubstit)) { // Unset or set ->withsubstit=0 to disable this. $out .= '
'; //$out.='
'; @@ -1599,7 +1603,7 @@ class FormMail extends Form $tmparray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount'), $object); // Note: On email templated edition, this is null because it is related to all type of objects complete_substitutions_array($tmparray, $langs, null, $parameters); - // For mass emailing, we have different keys + // For mass emailing, we have different keys specific to the data into tagerts list $tmparray['__ID__'] = 'IdRecord'; $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; $tmparray['__EMAIL__'] = 'EMailRecipient'; @@ -1611,8 +1615,6 @@ class FormMail extends Form $tmparray['__OTHER3__'] = 'Other3'; $tmparray['__OTHER4__'] = 'Other4'; $tmparray['__OTHER5__'] = 'Other5'; - $tmparray['__USER_SIGNATURE__'] = 'TagUserSignature'; - $tmparray['__SENDEREMAIL_SIGNATURE__'] = 'TagEmailSenderSignature'; $tmparray['__CHECK_READ__'] = 'TagCheckMail'; $tmparray['__UNSUBSCRIBE__'] = 'TagUnsubscribe'; //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 9fe6a615f5d..8d55ac65864 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -201,11 +201,11 @@ class mailing_fraise extends MailingTargets $s .= ''; - $s .= '
'; + $s .= '
'; $s .= $langs->trans("DateEndSubscription").':  '; - $s .= $langs->trans("After").' > '.$form->selectDate(-1, 'subscriptionafter', 0, 0, 1, 'fraise', 1, 0, 0); + $s .= $langs->trans("After").' > '.$form->selectDate(-1, 'subscriptionafter', 0, 0, 1, 'fraise', 1, 0, 0); $s .= '   '; - $s .= $langs->trans("Before").' < '.$form->selectDate(-1, 'subscriptionbefore', 0, 0, 1, 'fraise', 1, 0, 0); + $s .= ''.$langs->trans("Before").' < '.$form->selectDate(-1, 'subscriptionbefore', 0, 0, 1, 'fraise', 1, 0, 0); return $s; } diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 7fdcdeb0c60..907028ca881 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -118,7 +118,7 @@ class mailing_pomme extends MailingTargets $langs->load("users"); $s = ''; - $s .= ''; $s .= ''; $s .= ''; $s .= ''; @@ -126,7 +126,7 @@ class mailing_pomme extends MailingTargets $s .= ajax_combobox("filter_pomme"); $s .= ' '; - $s .= ''; $s .= ''; $s .= ''; $s .= ''; From 9216a6f8708c6866d52f3203933be9529a4059b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 13:21:45 +0100 Subject: [PATCH 416/572] FIX Bad value for phone in substitutions keys --- htdocs/core/lib/functions.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d503026a868..c06630e96a2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3572,15 +3572,15 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $picto = ''; } } - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } $rep .= ($withpicto ?img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone; - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } } @@ -7586,9 +7586,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, '__USER_ID__' => (string) $user->id, '__USER_LOGIN__' => (string) $user->login, '__USER_EMAIL__' => (string) $user->email, - '__USER_PHONE__' => (string) dol_print_phone($user->office_phone), - '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile), - '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile), + '__USER_PHONE__' => (string) dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1), '__USER_FAX__' => (string) $user->office_fax, '__USER_LASTNAME__' => (string) $user->lastname, '__USER_FIRSTNAME__' => (string) $user->firstname, @@ -7603,8 +7603,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray = array_merge($substitutionarray, array( '__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_EMAIL__' => $mysoc->email, - '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone), - '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax), + '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone, '', 0, 0, '', " ", '', '', -1), + '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax, '', 0, 0, '', " ", '', '', -1), '__MYCOMPANY_PROFID1__' => $mysoc->idprof1, '__MYCOMPANY_PROFID2__' => $mysoc->idprof2, '__MYCOMPANY_PROFID3__' => $mysoc->idprof3, From 6afb899f0540da6dab0568beb1a9e23fdebcef76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 15:50:57 +0100 Subject: [PATCH 417/572] Fix tags --- htdocs/comm/mailing/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d46ea99c213..06d72826101 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -373,7 +373,7 @@ if (empty($reshook)) { if (!$resql2) { dol_print_error($db); } else { - //if cheack read is use then update prospect contact status + //if check read is use then update prospect contact status if (strpos($message, '__CHECK_READ__') !== false) { //Update status communication of thirdparty prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")"; @@ -480,6 +480,9 @@ if (empty($reshook)) { // other are set at begin of page $substitutionarray['__EMAIL__'] = $object->sendto; $substitutionarray['__MAILTOEMAIL__'] = ''.$object->sendto.''; + $substitutionarray['__CHECK_READ__'] = ''; + $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->sendto).'&mtid=0'; // Subject and message substitutions complete_substitutions_array($substitutionarray, $langs, $targetobject); From 4252db1c7938d691c452e816624ee96dfa7737e8 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 23 Feb 2023 15:51:52 +0100 Subject: [PATCH 418/572] FIX : Impossible to create value for product attribute (variant) --- htdocs/variants/card.php | 4 +--- .../tpl/productattributevalueline_create.tpl.php | 14 -------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 5f1065f5171..8daf1239deb 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -330,9 +330,7 @@ if ($action == 'create') { print ''; } - if (!empty($object->lines)) { - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/variants/tpl', ($permissiontoedit ? 1 : 0)); - } + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/variants/tpl', ($permissiontoedit ? 1 : 0)); if (!empty($object->lines) || ($permissiontoedit && $action != 'selectlines' && $action != 'editline')) { print '
'; diff --git a/htdocs/variants/tpl/productattributevalueline_create.tpl.php b/htdocs/variants/tpl/productattributevalueline_create.tpl.php index f23e7175f58..21ea651f3ef 100644 --- a/htdocs/variants/tpl/productattributevalueline_create.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_create.tpl.php @@ -40,20 +40,6 @@ $objectline = null; print "\n"; $nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines); -if ($nolinesbefore) { - ?> -
-
trans('AddNewLine'); ?> -
trans('Value'); ?> 
webmaster@example.com>'.dol_escape_htmltag('').'
'; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index e9a8132188c..06f4dfdea85 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -48,13 +48,14 @@ if ($action == 'test' || ($action == 'send' && $trackid = 'test')) { $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, - '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__CHECK_READ__' => '', '__USER_LOGIN__' => $user->login, '__USER_EMAIL__' => $user->email, '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__ID__' => 'RecipientIdRecord', //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails + '__LOGIN__' => $user->login, '__LASTNAME__' => 'RecipientLastname', '__FIRSTNAME__' => 'RecipientFirstname', '__ADDRESS__'=> 'RecipientAddress', diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index b9cb57e0d80..1f638be3286 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -42,11 +42,13 @@ if ($action == 'test' || $action == 'send') { $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, - '__ID__' => 'RecipientIdRecord', - //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails - '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__CHECK_READ__' => '', + '__USER_LOGIN__' => $user->login, + '__USER_EMAIL__' => $user->email, '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails + '__ID__' => 'RecipientIdRecord', + //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails '__LOGIN__' => $user->login, '__LASTNAME__' => 'RecipientLastname', '__FIRSTNAME__' => 'RecipientFirstname', diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 1fec22ea979..066fbedef51 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -248,9 +248,9 @@ if (empty($reshook)) { $substitutionarray['__OTHER5__'] = $other5; $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter) $substitutionarray['__SENDEREMAIL_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter) - $substitutionarray['__CHECK_READ__'] = ''; - $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; - $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid; + $substitutionarray['__CHECK_READ__'] = ''; + $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'-'.$obj->tag.'-'.$obj->email.'-'.$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid); $onlinepaymentenabled = 0; if (isModEnabled('paypal')) { @@ -480,9 +480,9 @@ if (empty($reshook)) { // other are set at begin of page $substitutionarray['__EMAIL__'] = $object->sendto; $substitutionarray['__MAILTOEMAIL__'] = ''.$object->sendto.''; - $substitutionarray['__CHECK_READ__'] = ''; - $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; - $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->sendto).'&mtid=0'; + $substitutionarray['__CHECK_READ__'] = 'sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0" width="1" height="1" style="width:1px;height:1px" border="0"/>'; + $substitutionarray['__UNSUBSCRIBE__'] = 'sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0" target="_blank" rel="noopener noreferrer">'.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-undefinedintestmode-".$obj->sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0'; // Subject and message substitutions complete_substitutions_array($substitutionarray, $langs, $targetobject); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c526f9312a0..460b6407789 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -469,7 +469,7 @@ if (!$error && $massaction == 'confirm_presend') { $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ', array_keys($listofqualifiedobj)) : $objecttmp->id); $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); $substitutionarray['__EMAIL__'] = $thirdparty->email; - $substitutionarray['__CHECK_READ__'] = ''; + $substitutionarray['__CHECK_READ__'] = ''; $parameters = array('mode'=>'formemail'); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 4f7580bb8ca..ab8a30455ff 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -346,7 +346,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO // Make substitution in email content $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); $substitutionarray['__EMAIL__'] = $sendto; - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; $parameters = array('mode'=>'formemail'); complete_substitutions_array($substitutionarray, $langs, $object, $parameters); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index ce36d2bb899..817ec534b4b 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -282,7 +282,7 @@ if ($massaction == 'presend') { $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); $substitutionarray['__EMAIL__'] = $sendto; - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__CHECK_READ__'] = ''; $substitutionarray['__PERSONALIZED__'] = ''; // deprecated $substitutionarray['__CONTACTCIVNAME__'] = ''; diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php index 5398291e69f..2e03777c572 100644 --- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -191,7 +191,6 @@ if (!$error && $massaction == 'confirm_presend_attendees') { } $substitutionarray['__EVENTORGANIZATION_ICS_LINK__'] = $html_link; $substitutionarray['__EVENTORGANIZATION_URL_LINK__'] = $url_link; - $substitutionarray['__CHECK_READ__'] = ''; $parameters = array('mode' => 'formemail'); diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index 5829c62dbd7..2382639ab6e 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -85,17 +85,17 @@ $securitykey = GETPOST('securitykey'); dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); -if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) { +if ($securitykey != dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-".$tag."-".$email."-".$mtid, 'md5')) { print 'Bad security key value.'; exit; } -if (!empty($tag)) { +if (!empty($tag) && $tag != 'undefined') { dol_syslog("public/emailing/mailing-read.php : Update status of email target and thirdparty for tag ".$tag, LOG_DEBUG); $sql = "SELECT mc.rowid, mc.email, mc.statut, mc.source_type, mc.source_id, m.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m"; - $sql .= " WHERE mc.fk_mailing = m.rowid AND mc.tag='".$db->escape($tag)."'"; + $sql .= " WHERE mc.fk_mailing = m.rowid AND mc.tag = '".$db->escape($tag)."'"; $resql = $db->query($sql); if (!$resql) dol_print_error($db); diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index a5291d06b7f..f4ca2b10031 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -61,6 +61,8 @@ global $user, $conf, $langs; $langs->loadLangs(array("main", "mails")); +$mtid = GETPOST('mtid'); +$email = GETPOST('email'); $tag = GETPOST('tag'); // To retreive the emailing, and recipient $unsuscrib = GETPOST('unsuscrib'); $securitykey = GETPOST('securitykey'); @@ -70,9 +72,9 @@ $securitykey = GETPOST('securitykey'); * Actions */ -dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); +dol_syslog("public/emailing/mailing-unsubscribe.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); -if ($securitykey != getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')) { +if ($securitykey != dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-".$tag."-".$email."-".$mtid, 'md5')) { print 'Bad security key value.'; exit; } diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 3e79be8472c..f2aeecec444 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -229,9 +229,9 @@ if ($resql) { $substitutionarray['__OTHER5__'] = $other5; $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter) $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility - $substitutionarray['__CHECK_READ__'] = ''; - $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; - $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid; + $substitutionarray['__CHECK_READ__'] = 'tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" width="1" height="1" style="width:1px;height:1px" border="0"/>'; + $substitutionarray['__UNSUBSCRIBE__'] = 'tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" target="_blank">'.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid); $onlinepaymentenabled = 0; if (!empty($conf->paypal->enabled)) { From 7ec32d2458807731446be5c0f8cc214c9cbd23cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 21:28:58 +0100 Subject: [PATCH 428/572] Fix phpunit --- htdocs/projet/class/task.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index fea80f6d13a..7ff5d651fed 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -811,6 +811,8 @@ class Task extends CommonObjectLine * @param array $search_array_options Array of search * @param int $loadextras Fetch all Extrafields on each task * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action + * @param string $sortfield Sort field + * @param string $sortorder Sort order * @return array Array of tasks */ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') From 52f325c74eaab83172f2d1d4d2fb4b4a7e6207f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:34:54 +0100 Subject: [PATCH 429/572] clean code --- htdocs/loan/card.php | 14 +++++++------- htdocs/loan/class/loan.class.php | 6 ++++-- htdocs/loan/class/loanschedule.class.php | 2 +- htdocs/loan/schedule.php | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 921784e4c21..661a727268f 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -350,22 +350,22 @@ if ($action == 'create') { // Accountancy_account_capital print '
'.$langs->trans("LoanAccountancyCapitalCode").''; - print $formaccounting->select_account(GETPOST('accountancy_account_capital') ?GETPOST('accountancy_account_capital') : $conf->global->LOAN_ACCOUNTING_ACCOUNT_CAPITAL, 'accountancy_account_capital', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_capital') ?GETPOST('accountancy_account_capital') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_CAPITAL'), 'accountancy_account_capital', 1, '', 1, 1); print '
'.$langs->trans("LoanAccountancyInsuranceCode").''; - print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ?GETPOST('accountancy_account_insurance') : $conf->global->LOAN_ACCOUNTING_ACCOUNT_INSURANCE, 'accountancy_account_insurance', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ?GETPOST('accountancy_account_insurance') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INSURANCE'), 'accountancy_account_insurance', 1, '', 1, 1); print '
'.$langs->trans("LoanAccountancyInterestCode").''; - print $formaccounting->select_account(GETPOST('accountancy_account_interest') ?GETPOST('accountancy_account_interest') : $conf->global->LOAN_ACCOUNTING_ACCOUNT_INTEREST, 'accountancy_account_interest', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_interest') ?GETPOST('accountancy_account_interest') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INTEREST'), 'accountancy_account_interest', 1, '', 1, 1); print '
'.$langs->trans("LoanAccountancyCapitalCode").''; @@ -441,11 +441,11 @@ if ($id > 0) { $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, -1, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); } } else { if (!empty($object->fk_project)) { diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 54ad6dfb92b..951d430e96f 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2018 Frédéric France + * Copyright (C) 2015-2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,6 +66,9 @@ class Loan extends CommonObject public $account_capital; public $account_insurance; public $account_interest; + public $accountancy_account_capital; + public $accountancy_account_insurance; + public $accountancy_account_interest; /** * @var integer|string date_creation @@ -641,7 +644,6 @@ class Loan extends CommonObject $this->fk_bank = 1; $this->label = 'SPECIMEN'; $this->specimen = 1; - $this->socid = 1; $this->account_capital = 16; $this->account_insurance = 616; $this->account_interest = 518; diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 50314ce99fc..2618d50c6fd 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index fc91fc2f86d..61d763b693e 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -161,11 +161,11 @@ if (!empty($conf->project->enabled)) { $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref .= ''; $morehtmlref .= '
'; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, -1, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); } } } else { From fe5f08afe340809b84a5dff9fea7841a5f906d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:36:22 +0100 Subject: [PATCH 430/572] clean code --- htdocs/loan/card.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 661a727268f..65d9d5da9b1 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -76,7 +76,7 @@ if ($reshook < 0) { } if (empty($reshook)) { // Classify paid - if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->loan->write) { + if ($action == 'confirm_paid' && $confirm == 'yes' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setPaid($user); if ($result > 0) { @@ -87,7 +87,7 @@ if (empty($reshook)) { } // Delete loan - if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->loan->write) { + if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->delete($user); if ($result > 0) { @@ -100,12 +100,12 @@ if (empty($reshook)) { } // Add loan - if ($action == 'add' && $user->rights->loan->write) { + if ($action == 'add' && $user->hasRight('loan', 'write')) { if (!$cancel) { $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth', 'int'), GETPOST('startday', 'int'), GETPOST('startyear', 'int')); - $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); + $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); $capital = price2num(GETPOST('capital')); - $rate = price2num(GETPOST('rate')); + $rate = price2num(GETPOST('rate')); if (!$capital) { $error++; $action = 'create'; @@ -168,23 +168,23 @@ if (empty($reshook)) { header("Location: list.php"); exit(); } - } elseif ($action == 'update' && $user->rights->loan->write) { + } elseif ($action == 'update' && $user->hasRight('loan', 'write')) { // Update record if (!$cancel) { $result = $object->fetch($id); $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth', 'int'), GETPOST('startday', 'int'), GETPOST('startyear', 'int')); - $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); - $capital = price2num(GETPOST('capital')); + $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); + $capital = price2num(GETPOST('capital')); if (!$capital) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); $action = 'edit'; } else { $object->datestart = $datestart; - $object->dateend = $dateend; - $object->capital = $capital; - $object->nbterm = GETPOST("nbterm", 'int'); + $object->dateend = $dateend; + $object->capital = $capital; + $object->nbterm = GETPOST("nbterm", 'int'); $object->rate = price2num(GETPOST("rate", 'alpha')); $object->insurance_amount = price2num(GETPOST('insurance_amount', 'int')); @@ -225,7 +225,7 @@ if (empty($reshook)) { } // Link to a project - if ($action == 'classin' && $user->rights->loan->write) { + if ($action == 'classin' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setProject($projectid); if ($result < 0) { @@ -233,7 +233,7 @@ if (empty($reshook)) { } } - if ($action == 'setlabel' && $user->rights->loan->write) { + if ($action == 'setlabel' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY'); if ($result < 0) { @@ -426,13 +426,13 @@ if ($id > 0) { $morehtmlref = '
'; // Ref loan - $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->hasRight('loan', 'write'), 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->hasRight('loan', 'write'), 'string', '', null, null, '', 1); // Project if (isModEnabled('project')) { $langs->loadLangs(array("projects")); $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->loan->write) { + if ($user->hasRight('loan', 'write')) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } @@ -740,17 +740,17 @@ if ($id > 0) { print '
'; // Edit - if (($object->paid == 0 || $object->paid == 2) && $user->rights->loan->write) { + if (($object->paid == 0 || $object->paid == 2) && $user->hasRight('loan', 'write')) { print ''; } // Emit payment - if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) { + if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->hasRight('loan', 'write')) { print ''; } // Classify 'paid' - if (($object->paid == 0 || $object->paid == 2) && round($staytopay) <= 0 && $user->rights->loan->write) { + if (($object->paid == 0 || $object->paid == 2) && round($staytopay) <= 0 && $user->hasRight('loan', 'write')) { print ''; } From ed60d4fe22e5a8d259967093b5530313f6efe6f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 21:40:56 +0100 Subject: [PATCH 431/572] Debug v18 --- htdocs/core/class/html.form.class.php | 16 +++++++++------- htdocs/projet/tasks/time.php | 14 +++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 855fb711a86..a5d93f75202 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7009,8 +7009,8 @@ class Form $retstring = ''; - $hourSelected = 0; - $minSelected = 0; + $hourSelected = ''; + $minSelected = ''; // Hours if ($iSecond != '') { @@ -7024,14 +7024,14 @@ class Form $retstring .= '"; } elseif ($typehour == 'text' || $typehour == 'textselect') { - $retstring .= ''; + $retstring .= ''; } else { return 'BadValueForParameterTypeHour'; } @@ -7046,21 +7046,23 @@ class Form if ($minunderhours) { $retstring .= '
'; } else { - $retstring .= ' '; + if ($typehour != 'text') { + $retstring .= ' '; + } } if ($typehour == 'select' || $typehour == 'textselect') { $retstring .= '"; } elseif ($typehour == 'text') { - $retstring .= ''; + $retstring .= ''; } if ($typehour != 'text') { diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 30f2a867af0..57f1a5259cb 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2021 Laurent Destailleur + * Copyright (C) 2006-2023 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet @@ -1921,20 +1921,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Duration - Time spent print '
'; - $durationtouse_start = 0; + $durationtouse_start = ''; if ($search_timespent_starthour || $search_timespent_startmin) { $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60); } - print '
'.$langs->trans('from').' '; - $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text'); + print '
'.$langs->trans('from').' '; + print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1); print '
'; - $durationtouse_end = 0; + $durationtouse_end = ''; if ($search_timespent_endhour || $search_timespent_endmin) { $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60); } - print '
'.$langs->trans('at').' '; - $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text'); + print '
'.$langs->trans('at').' '; + print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1); print '
'; print '
'.$product->label.''.dol_escape_htmltag($product->label).''; @@ -502,7 +502,7 @@ if ($resql) { if ($nb_warehouse > 1) { foreach ($warehouses_list as &$wh) { print ''; - print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : $product->stock_warehouse[$wh['id']]->real, 0, $langs, 1, 0); + print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : price2num($product->stock_warehouse[$wh['id']]->real, 'MS'), 0, $langs, 1, 0); print ''.dol_escape_htmltag($objp->unit_short).''; + print ''; print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"'); print ''.$langs->trans("Movements").''; print '
'; if ($nbofmovement > 0) { - print ''.$langs->trans("Movements").''; + print ''.$langs->trans("Movements").''; print ' '.$nbofmovement.''; } print ''.$product->label.''.dol_escape_htmltag($product->label).''; @@ -495,7 +495,7 @@ if ($resql) { if ($nb_warehouse > 1) { foreach ($warehouses_list as &$wh) { print ''; - print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : $product->stock_warehouse[$wh['id']]->real, 0, $langs, 1, 0); + print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : price2num($product->stock_warehouse[$wh['id']]->real, 'MS'), 0, $langs, 1, 0); print ''.$objp->unit_short.''; + print ''; print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"'); print ''.$langs->trans("Movements").''; print '
'.$langs->trans("Type").' *'; + print '
'.$langs->trans("Type").' *'; print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); print '
'.$langs->trans('MemberNature').' *'."\n"; + print '
'.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print '
'.$langs->trans("Lastname").' *
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? ' *' : '').''; + print '
'.$langs->trans("Email").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? ' *' : '').''; //print img_picto('', 'email', 'class="pictofixedwidth"'); print '
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordRetype").' *
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordRetype").' *
'.$langs->trans("TurnoverOrBudget").' *'; + print '
'.$langs->trans("TurnoverOrBudget").' *'; print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); print ' € or $'; diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 4fa4d25e543..9891a9f3c9d 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -150,10 +150,17 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ */ function llxFooterVierge() { + global $conf; + print ''; printCommonFooter('public'); + if (!empty($conf->use_javascript_ajax)) { + print "\n".''."\n"; + print ''."\n"; + } + print "\n"; print "\n"; } @@ -163,6 +170,7 @@ function llxFooterVierge() /* * Actions */ + $parameters = array(); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); @@ -536,7 +544,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio llxHeaderVierge($langs->trans("NewPartnershipRequest")); print '
'; -print load_fiche_titre($langs->trans("NewPartnershipRequest"), '', '', 0, 0, 'center'); +print load_fiche_titre(img_picto('', 'hands-helping', 'class="pictofixedwidth"').'   '.$langs->trans("NewPartnershipRequest"), '', '', 0, 0, 'center'); print '
'; @@ -560,7 +568,8 @@ print ''; print '
'; -print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; +$messagemandatory = ''.$langs->trans("FieldsWithAreMandatory", '*').''; +//print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; print dol_get_fiche_head(''); @@ -592,20 +601,20 @@ if (getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { print ''."\n"; if (!getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { - print ''."\n"; } // Company -print ''."\n"; // Lastname -print ''."\n"; +print ''."\n"; // Firstname -print ''."\n"; +print ''."\n"; // EMail -print ''."\n"; // Address diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index cf7293109c7..2777e48c7f5 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1663,7 +1663,7 @@ if ($ispaymentok) { $content .= $companylangs->transnoentitiesnoconv("None"); } else { $topic .= ($ispostactionok ? '' : ' ('.$companylangs->trans("WarningPostActionErrorAfterPayment").')'); - $content .= ''.$companylangs->transnoentitiesnoconv("Error").''; + $content .= ''.$companylangs->transnoentitiesnoconv("Error").''; } $content .= '
'."\n"; foreach ($postactionmessages as $postactionmessage) { diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 5644123392b..bd8ccd07901 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -486,11 +486,11 @@ jQuery(document).ready(function () { print '
'.$langs->trans('PartnershipType').' *'."\n"; + print '
'.$langs->trans('PartnershipType').' *'."\n"; print $form->selectarray("partnershiptype", $listofpartnership, GETPOSTISSET('partnershiptype') ? GETPOST('partnershiptype', 'int') : 'ifone', 1); print '
'.$langs->trans("Company").' *'; +print '
'.$langs->trans("Company").' *'; print img_picto('', 'company', 'class="pictofixedwidth"'); print '
'.$langs->trans("Lastname").' *
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").' *'; +print '
'.$langs->trans("Email").' *'; //print img_picto('', 'email', 'class="pictofixedwidth"'); print '
'."\n"; // Lastname -print ''."\n"; +print ''."\n"; // Firstname -print ''."\n"; +print ''."\n"; // EMail -print ''."\n"; +print ''."\n"; // Company print ''."\n"; // Address @@ -538,7 +538,7 @@ $parameters['tpl_context']='public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Comments print ''; -print ''; +print ''; print ''; print ''."\n"; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index dd9c8c7cdb0..cc7b6bb8e01 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -595,13 +595,13 @@ jQuery(document).ready(function () { print '
'.$langs->trans("Lastname").' *
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").' *
'.$langs->trans("Email").' *
'.$langs->trans("Company").'
'.$langs->trans("Message").' *'.$langs->trans("Message").' *
'."\n"; // Name -print ''; +print ''; print ''; print ''; // Email -print ''."\n"; +print ''."\n"; // Company -print ''."\n"; // Address print ''; } // Type of event -print ''."\n"; +print ''."\n"; print ''; // Label -print ''."\n"; +print ''."\n"; print ''."\n"; // Note -print ''."\n"; +print ''."\n"; print ''."\n"; print "
lastname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'.$langs->trans("Email").'*
'.$langs->trans("Company").'*'; +print '
'.$langs->trans("Company").'*'; print '
'.$langs->trans("Address").''."\n"; @@ -646,13 +646,13 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print '
'.$langs->trans("Format").'*
'.$langs->trans("Format").'*'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'
'.$langs->trans("LabelOfBooth").'*
'.$langs->trans("LabelOfBooth").'*
'.$langs->trans("Description").'*
'.$langs->trans("Description").'*
\n"; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 417466a1f44..5078164f6ce 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -528,17 +528,17 @@ jQuery(document).ready(function () { print ''."\n"; // Last Name -print ''; +print ''; print ''; print ''; // First Name -print ''; +print ''; print ''; print ''; // Email -print ''."\n"; +print ''."\n"; // Company -print ''."\n"; // Address print ''; } // Type of event -print ''."\n"; +print ''."\n"; print ''; // Label -print ''."\n"; +print ''."\n"; print ''."\n"; // Note -print ''."\n"; +print ''."\n"; print ''."\n"; print "
lastname).'" autofocus="autofocus">
firstname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'.$langs->trans("Email").'*
'.$langs->trans("Company").'*'; +print '
'.$langs->trans("Company").'*'; print '
'.$langs->trans("Address").''."\n"; @@ -580,13 +580,13 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print '
'.$langs->trans("Format").'*
'.$langs->trans("Format").'*'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'
'.$langs->trans("LabelOfconference").'*
'.$langs->trans("LabelOfconference").'*
'.$langs->trans("Description").'*
'.$langs->trans("Description").'*
\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index fc0af24a3a1..307d2b25b69 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -411,8 +411,8 @@ input.buttonpaymentstripe { background-position: 8px 11px; } .logopublicpayment #dolpaymentlogo { - max-height: 100px; - max-width: 320px; + max-height: 80px; + max-width: 300px; image-rendering: -webkit-optimize-contrast; /* better rendering on public page header */ } @@ -7114,8 +7114,17 @@ div.tabsElem a.tab { .public_border { border: 1px solid #888; } +.publicnewmemberform div.tabBarWithBottom { + border: 1px solid #f0f0f0; + padding: 30px; + border-radius: 8px; + background-color: #f8f8f8; + /*box-shadow: 2px 2px 10px #ddd;*/ +} - +.publicnewmemberform #tablesubscribe { + color: #888; +} /* ============================================================================== */ /* Ticket module */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9d7737bc0ca..5f3f965c021 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -669,7 +669,8 @@ input.buttonpaymentstripe { background-position: 8px 7px; } .logopublicpayment #dolpaymentlogo { - max-height: 100px; + max-height: 80px; + max-width: 300px; image-rendering: -webkit-optimize-contrast; /* better rendering on public page header */ } a.butStatus { From 921cd13f266b42a234940b4b3b3fa55ecb7f7920 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Mar 2023 17:38:38 +0100 Subject: [PATCH 541/572] FIX avoid php8 warnings --- htdocs/core/class/html.formticket.class.php | 8 ++++---- htdocs/ticket/agenda.php | 3 +++ htdocs/ticket/contact.php | 2 +- htdocs/ticket/document.php | 3 +++ htdocs/ticket/messaging.php | 3 +++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4f3ae4bc5e6..0baa4dd5f8a 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1423,7 +1423,7 @@ class FormTicket $res = $ticketstat->fetch('', '', $this->track_id); print '
'; - $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':'')); + $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : (getDolGlobalInt('TICKETS_MESSAGE_FORCE_MAIL')?'checked':'')); print ' '; print ''; $texttooltip = $langs->trans("TicketMessageSendEmailHelp", '{s1}'); @@ -1455,7 +1455,7 @@ class FormTicket // Subject print '
'; print ''; - print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; + print ''.price(price2num($solde, 'MT'), 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; print ''; print '
'; print ''; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index c185878e658..03aa1b19d76 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -574,11 +574,11 @@ print '
'; print 'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."
"; print '
'; -$examplecsprule = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; +$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; print 'MAIN_SECURITY_FORCECSPRO = '.(empty($conf->global->MAIN_SECURITY_FORCECSPRO) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCECSPRO).'   ('.$langs->trans("Example").': "'.$examplecsprule.'")
'; print '
'; -$examplecsprule = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; +$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; print 'MAIN_SECURITY_FORCECSP = '.(empty($conf->global->MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").': "'.$examplecsprule.'")
'; print '
'; diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index c2823407ac6..89aa597661c 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -90,7 +90,8 @@ if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnable top_httphead(); if ($action == "importSignature") { - if (!empty($signature) && $signature[0] == "image/png;base64") { + $issignatureok = (!empty($signature) && $signature[0] == "image/png;base64"); + if ($issignatureok) { $signature = $signature[1]; $data = base64_decode($signature); @@ -143,7 +144,6 @@ if ($action == "importSignature") { $pdf->SetCompression(false); } - //$pdf->Open(); $pagecount = $pdf->setSourceFile($sourcefile); // original PDF @@ -155,7 +155,7 @@ if ($action == "importSignature") { $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); $pdf->useTemplate($tppl); } catch (Exception $e) { - dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); $response = $e->getMessage(); $error++; } @@ -207,9 +207,6 @@ if ($action == "importSignature") { } if (!$error) { - $db->commit(); - $response = "success"; - setEventMessages("PropalSigned", null, 'warnings'); if (method_exists($object, 'call_trigger')) { //customer is not a user !?! so could we use same user as validation ? $user = new User($db); @@ -218,13 +215,25 @@ if ($action == "importSignature") { $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); if ($result < 0) { $error++; + $response = "error in trigger ".$object->error; + } else { + $response = "success"; } + } else { + $response = "success"; } } else { - $db->rollback(); $error++; $response = "error sql"; } + + if (!$error) { + $db->commit(); + $response = "success"; + setEventMessages("PropalSigned", null, 'warnings'); + } else { + $db->rollback(); + } } } elseif ($mode == 'contract') { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index b6bd9bb73a8..f85a26697b7 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -75,7 +75,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (isModEnabled('commande') && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { $object->fetchObjectLinked(); if (!empty($object->linkedObjectsIds['commande'])) { - setEventMessages($langs->trans("OrderExists"), null, 'warnings'); + if (empty($object->context['closedfromonlinesignature'])) { + $langs->load("orders"); + setEventMessages($langs->trans("OrderExists"), null, 'warnings'); + } return $ret; } else { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index b934f333b1a..d9fe10c8868 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -117,8 +117,8 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSPRO'); if (!is_object($hookmanager)) { @@ -149,8 +149,8 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP'); if (!is_object($hookmanager)) { diff --git a/htdocs/includes/tcpdi/tcpdi.php b/htdocs/includes/tcpdi/tcpdi.php index aaa1d70c095..9e87ac2f221 100644 --- a/htdocs/includes/tcpdi/tcpdi.php +++ b/htdocs/includes/tcpdi/tcpdi.php @@ -333,7 +333,7 @@ class TCPDI extends FPDF_TPL { break; } } - } elseif ($tpl['x'] != 0 || $tpl['y'] != 0) { + } elseif (!empty($tpl['x']) || !empty($tpl['y'])) { $tx = -$tpl['x'] * 2; $ty = $tpl['y'] * 2; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 20b73126656..b9469cf55ea 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1474,8 +1474,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('MAIN_SECURITY_FORCECSPRO'); if (!is_object($hookmanager)) { @@ -1511,8 +1511,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('MAIN_SECURITY_FORCECSP'); if (!is_object($hookmanager)) { From 6d21fd1c463f6dbf85e71bc69541e993a3fb89a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2023 03:20:26 +0100 Subject: [PATCH 550/572] Fix var_dump --- htdocs/admin/notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index a7fd042969b..965a1c8a117 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -265,7 +265,7 @@ print load_fiche_titre($title, '', 'email'); // Load array of available notifications $notificationtrigger = new InterfaceNotification($db); $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); -var_dump($listofnotifiedevents); + // Editing global variables not related to a specific theme $constantes = array(); foreach ($listofnotifiedevents as $notifiedevent) { From 2273201707bcdc9e0a3682e1bbdca3da15925cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Mar 2023 09:49:00 +0100 Subject: [PATCH 551/572] fix ADD_UNSPLASH_LOGIN_BACKGROUND --- htdocs/core/tpl/login.tpl.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 4900acc9ec2..e18b2930de0 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -134,10 +134,12 @@ $(document).ready(function () {
'; print ''; } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index bc2c2528d07..073e9de9a15 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -574,6 +574,7 @@ $total = array(); $found = 0; $i = 0; $lastcurrencycode = ''; +$imaxinloop = ($limit ? min($num, $limit) : $num); foreach ($accounts as $key => $type) { if ($i >= $limit) { @@ -600,7 +601,7 @@ foreach ($accounts as $key => $type) { } // Output Kanban print $objecttmp->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print ''; } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 204ea92041f..d72238e3fe6 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -85,9 +85,10 @@ $search_type_id = GETPOST('search_type_id', 'int'); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -174,6 +175,14 @@ $result = restrictedArea($user, 'banque', '', '', ''); * Actions */ +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} + $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -183,6 +192,23 @@ if ($reshook < 0) { if (empty($reshook)) { // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + foreach ($object->fields as $key => $val) { + $search[$key] = ''; + if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { + $search[$key.'_dtstart'] = ''; + $search[$key.'_dtend'] = ''; + } + } + $toselect = array(); + $search_array_options = array(); + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } } /* @@ -282,7 +308,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -296,520 +322,526 @@ if ($limit) { } $resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); +if (!$resql) { + dol_print_error($db); + exit; +} - // Direct jump if only one record found - if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { - $obj = $db->fetch_object($resql); - $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$id); - exit; - } +$num = $db->num_rows($resql); - // must be place behind the last "header(...)" call - llxHeader('', $langs->trans("VariousPayments")); +// Direct jump if only one record found +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$id); + exit; +} - $i = 0; - $total = 0; +// must be place behind the last "header(...)" call +llxHeader('', $langs->trans("VariousPayments")); - $param = ''; - if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); - } - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); - } - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_label) { - $param .= '&search_label='.urlencode($search_label); - } - if ($search_datep_start) { - $param .= '&search_datep_start='.urlencode($search_datep_start); - } - if ($search_datep_end) { - $param .= '&search_datep_end='.urlencode($search_datep_end); - } - if ($search_datev_start) { - $param .= '&search_datev_start='.urlencode($search_datev_start); - } - if ($search_datev_end) { - $param .= '&search_datev_end='.urlencode($search_datev_end); - } - if ($search_type_id > 0) { - $param .= '&search_type_id='.urlencode($search_type_id); - } - if ($search_amount_deb) { - $param .= '&search_amount_deb='.urlencode($search_amount_deb); - } - if ($search_amount_cred) { - $param .= '&search_amount_cred='.urlencode($search_amount_cred); - } - if ($search_bank_account > 0) { - $param .= '&search_account='.urlencode($search_bank_account); - } - if ($search_accountancy_account > 0) { - $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); - } - if ($search_accountancy_subledger > 0) { - $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } +$i = 0; +$total = 0; - $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; - if (!empty($socid)) { - $url .= '&socid='.urlencode($socid); - } - $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); +$param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_label) { + $param .= '&search_label='.urlencode($search_label); +} +if ($search_datep_start) { + $param .= '&search_datep_start='.urlencode($search_datep_start); +} +if ($search_datep_end) { + $param .= '&search_datep_end='.urlencode($search_datep_end); +} +if ($search_datev_start) { + $param .= '&search_datev_start='.urlencode($search_datev_start); +} +if ($search_datev_end) { + $param .= '&search_datev_end='.urlencode($search_datev_end); +} +if ($search_type_id > 0) { + $param .= '&search_type_id='.urlencode($search_type_id); +} +if ($search_amount_deb) { + $param .= '&search_amount_deb='.urlencode($search_amount_deb); +} +if ($search_amount_cred) { + $param .= '&search_amount_cred='.urlencode($search_amount_cred); +} +if ($search_bank_account > 0) { + $param .= '&search_account='.urlencode($search_bank_account); +} +if ($search_accountancy_account > 0) { + $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); +} +if ($search_accountancy_subledger > 0) { + $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} - print '
'; +$url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; +if (!empty($socid)) { + $url .= '&socid='.urlencode($socid); +} +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +print ''; + +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; - print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); - if ($search_all) { - foreach ($fieldstosearchall as $key => $val) { - $fieldstosearchall[$key] = $langs->trans($val); +if ($search_all) { + foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall[$key] = $langs->trans($val); + } + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields +$moreforfilter= ''; + +print '
'; +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + +print ''; + +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''; +} + +// Ref +if ($arrayfields['ref']['checked']) { + print ''; +} + +// Label +if ($arrayfields['label']['checked']) { + print ''; +} + +// Payment date +if ($arrayfields['datep']['checked']) { + print ''; +} + +// Value date +if ($arrayfields['datev']['checked']) { + print ''; +} + +// Payment type +if ($arrayfields['type']['checked']) { + print ''; +} + +// Project +if ($arrayfields['project']['checked']) { + print ''; +} + +// Bank account +if ($arrayfields['bank']['checked']) { + print ''; +} + +// Bank entry +if ($arrayfields['entry']['checked']) { + print ''; +} + +// Accounting account +if (!empty($arrayfields['account']['checked'])) { + print ''; +} + +// Subledger account +if (!empty($arrayfields['subledger']['checked'])) { + print ''; +} + +// Debit +if (!empty($arrayfields['debit']['checked'])) { + print ''; +} + +// Credit +if ($arrayfields['credit']['checked']) { + print ''; +} + +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +print ''; + + +print ''; + +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); +} + +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); +} + +if ($arrayfields['ref']['checked']) { + print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['label']['checked']) { + print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['datep']['checked']) { + print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); +} +if ($arrayfields['datev']['checked']) { + print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); +} +if ($arrayfields['type']['checked']) { + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'center '); +} +if ($arrayfields['project']['checked']) { + print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['bank']['checked']) { + print_liste_field_titre($arrayfields['bank']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); +} +if ($arrayfields['entry']['checked']) { + print_liste_field_titre($arrayfields['entry']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); +} +if (!empty($arrayfields['account']['checked'])) { + print_liste_field_titre($arrayfields['account']['label'], $_SERVER["PHP_SELF"], 'v.accountancy_code', '', $param, '', $sortfield, $sortorder, 'left '); +} +if (!empty($arrayfields['subledger']['checked'])) { + print_liste_field_titre($arrayfields['subledger']['label'], $_SERVER["PHP_SELF"], 'v.subledger_account', '', $param, '', $sortfield, $sortorder, 'left '); +} +if ($arrayfields['debit']['checked']) { + print_liste_field_titre($arrayfields['debit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); +} +if ($arrayfields['credit']['checked']) { + print_liste_field_titre($arrayfields['credit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); +} + +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); +} +print ''; + + +$totalarray = array(); +$totalarray['nbfield'] = 0; +$totalarray['val']['total_cred'] = 0; +$totalarray['val']['total_deb'] = 0; + +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { + $obj = $db->fetch_object($resql); + + $variousstatic->id = $obj->rowid; + $variousstatic->ref = $obj->rowid; + $variousstatic->label = $obj->label; + $variousstatic->datep = $obj->datep; + $variousstatic->type_payment = $obj->payment_code; + $bankline->fetch($obj->fk_bank); + $variousstatic->fk_bank = $bankline->getNomUrl(1); + $variousstatic->amount = $obj->amount; + + $accountingaccount->fetch('', $obj->accountancy_code, 1); + $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); + + if ($mode == 'kanban') { + if ($i == 0) { + print ''; +} + +$db->free($resql); + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->selectDate($search_datep_start ? $search_datep_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_datep_end ? $search_datep_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print '
'; + print $form->selectDate($search_datev_start ? $search_datev_start : -1, 'search_date_value_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_datev_end ? $search_datev_end : -1, 'search_date_value_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100', 1); + print ''; + // TODO + print ''; + $form->select_comptes($search_bank_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100'); + print ''; + print ''; + print ''; + print '
'; + print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200'); + print '
'; + print '
'; + print '
'; + print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print '
'; + print '
'; } - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; - } - - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields - $moreforfilter= ''; - - print '
'; - print ''; - - print ''; - - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''; - } - - // Ref - if ($arrayfields['ref']['checked']) { - print ''; - } - - // Label - if ($arrayfields['label']['checked']) { - print ''; - } - - // Payment date - if ($arrayfields['datep']['checked']) { - print ''; - } - - // Value date - if ($arrayfields['datev']['checked']) { - print ''; - } - - // Payment type - if ($arrayfields['type']['checked']) { - print ''; - } - - // Project - if ($arrayfields['project']['checked']) { - print ''; - } - - // Bank account - if ($arrayfields['bank']['checked']) { - print ''; - } - - // Bank entry - if ($arrayfields['entry']['checked']) { - print ''; - } - - // Accounting account - if (!empty($arrayfields['account']['checked'])) { - print ''; - } - - // Subledger account - if (!empty($arrayfields['subledger']['checked'])) { - print ''; - } - - // Debit - if (!empty($arrayfields['debit']['checked'])) { - print ''; - } - - // Credit - if ($arrayfields['credit']['checked']) { - print ''; - } - - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - - print ''; - - - print ''; - - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); - } - - if ($arrayfields['ref']['checked']) { - print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['label']['checked']) { - print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['datep']['checked']) { - print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); - } - if ($arrayfields['datev']['checked']) { - print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); - } - if ($arrayfields['type']['checked']) { - print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'center '); - } - if ($arrayfields['project']['checked']) { - print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['bank']['checked']) { - print_liste_field_titre($arrayfields['bank']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - } - if ($arrayfields['entry']['checked']) { - print_liste_field_titre($arrayfields['entry']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['account']['checked'])) { - print_liste_field_titre($arrayfields['account']['label'], $_SERVER["PHP_SELF"], 'v.accountancy_code', '', $param, '', $sortfield, $sortorder, 'left '); - } - if (!empty($arrayfields['subledger']['checked'])) { - print_liste_field_titre($arrayfields['subledger']['label'], $_SERVER["PHP_SELF"], 'v.subledger_account', '', $param, '', $sortfield, $sortorder, 'left '); - } - if ($arrayfields['debit']['checked']) { - print_liste_field_titre($arrayfields['debit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); - } - if ($arrayfields['credit']['checked']) { - print_liste_field_titre($arrayfields['credit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right '); - } - - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - print ''; - - - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val']['total_cred'] = 0; - $totalarray['val']['total_deb'] = 0; - - while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); - - $variousstatic->id = $obj->rowid; - $variousstatic->ref = $obj->rowid; - $variousstatic->label = $obj->label; - $variousstatic->datep = $obj->datep; - $variousstatic->type_payment = $obj->payment_code; - $bankline->fetch($obj->fk_bank); - $variousstatic->fk_bank = $bankline->getNomUrl(1); - $variousstatic->amount = $obj->amount; - - $accountingaccount->fetch('', $obj->accountancy_code, 1); - $variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1); - - if ($mode == 'kanban') { - if ($i == 0) { - print ''; + } + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } - // Output Kanban + } - print $variousstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { - print ''; - print ''; + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''; + } + + // Ref + if ($arrayfields['ref']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } - } else { - print ''; + } - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + // Label payment + if ($arrayfields['label']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } + } - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''; + // Date payment + if ($arrayfields['datep']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } + } - // Ref - if ($arrayfields['ref']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } + + // Date value + if ($arrayfields['datev']['checked']) { + print '"; + if (!$i) { + $totalarray['nbfield']++; } + } - // Label payment - if ($arrayfields['label']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } + // Type + if ($arrayfields['type']['checked']) { + print '"; - if (!$i) { - $totalarray['nbfield']++; - } + print $obj->num_payment; + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - - // Date value - if ($arrayfields['datev']['checked']) { - print '"; - if (!$i) { - $totalarray['nbfield']++; - } + // Project + if ($arrayfields['project']['checked']) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Project - if ($arrayfields['project']['checked']) { - print ''; - if (!$i) { - $totalarray['nbfield']++; + // Bank account + if ($arrayfields['bank']['checked']) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Bank entry - if ($arrayfields['entry']['checked']) { - $bankline->fetch($obj->fk_bank); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + // Bank entry + if ($arrayfields['entry']['checked']) { + $bankline->fetch($obj->fk_bank); + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Accounting account - if (!empty($arrayfields['account']['checked'])) { - $accountingaccount->fetch('', $obj->accountancy_code, 1); + // Accounting account + if (!empty($arrayfields['account']['checked'])) { + $accountingaccount->fetch('', $obj->accountancy_code, 1); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Accounting subledger account - if (!empty($arrayfields['subledger']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + // Accounting subledger account + if (!empty($arrayfields['subledger']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } + } - // Debit - if ($arrayfields['debit']['checked']) { - print ''; - } - - // Credit - if ($arrayfields['credit']['checked']) { - print ''; - } - - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + // Debit + if ($arrayfields['debit']['checked']) { + print ''."\n"; + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; + } + print ''; } - $i++; - } - // Show total line - include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + // Credit + if ($arrayfields['credit']['checked']) { + print ''; + } - // If no record found - if ($num == 0) { - $colspan = 1; - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - $colspan++; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - print ''; + + print ''."\n"; } - - $db->free($resql); - - $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print '
'; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $form->selectDate($search_datep_start ? $search_datep_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_datep_end ? $search_datep_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; - print '
'; - print '
'; - print $form->selectDate($search_datev_start ? $search_datev_start : -1, 'search_date_value_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_datev_end ? $search_datev_end : -1, 'search_date_value_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; - print '
'; - print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100', 1); - print ''; - // TODO - print ''; - $form->select_comptes($search_bank_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100'); - print ''; - print ''; - print ''; - print '
'; - print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200'); - print '
'; - print '
'; - print '
'; - print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200'); - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print '
'; - print '
'; + // Output Kanban + print $variousstatic->getKanbanView(''); + if ($i == ($imaxinloop) - 1) { + print '
'; + print '
'.(($offset * $limit) + $i).''.$variousstatic->getNomUrl(1)."
'.$variousstatic->label."'.(($offset * $limit) + $i).''.dol_print_date($obj->datep, 'day')."'.$variousstatic->getNomUrl(1)."'.dol_print_date($obj->datev, 'day')."'.$variousstatic->label."'; + if ($obj->payment_code) { + print $langs->trans("PaymentTypeShort".$obj->payment_code); + print ' '; } - - // Date payment - if ($arrayfields['datep']['checked']) { - print ''.dol_print_date($obj->datep, 'day')."'.dol_print_date($obj->datev, 'day')."'; + if ($obj->fk_project > 0) { + $proj->fetch($obj->fk_project); + print $proj->getNomUrl(1); } - - // Type - if ($arrayfields['type']['checked']) { - print ''; - if ($obj->payment_code) { - print $langs->trans("PaymentTypeShort".$obj->payment_code); - print ' '; - } - print $obj->num_payment; - print ''; - if ($obj->fk_project > 0) { - $proj->fetch($obj->fk_project); - print $proj->getNomUrl(1); - } - print ''; + if ($obj->bid > 0) { + $accountstatic->id = $obj->bid; + $accountstatic->ref = $obj->bref; + $accountstatic->number = $obj->bnumber; + + if (isModEnabled('accounting')) { + $accountstatic->account_number = $obj->bank_account_number; + $accountingjournal->fetch($obj->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); } + + $accountstatic->label = $obj->blabel; + print $accountstatic->getNomUrl(1); + } else { + print ' '; } - - // Bank account - if ($arrayfields['bank']['checked']) { - print ''; - if ($obj->bid > 0) { - $accountstatic->id = $obj->bid; - $accountstatic->ref = $obj->bref; - $accountstatic->number = $obj->bnumber; - - if (isModEnabled('accounting')) { - $accountstatic->account_number = $obj->bank_account_number; - $accountingjournal->fetch($obj->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); - } - - $accountstatic->label = $obj->blabel; - print $accountstatic->getNomUrl(1); - } else { - print ' '; - } - print ''.$bankline->getNomUrl(1).''.$bankline->getNomUrl(1).''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''.length_accounta($obj->subledger_account).''.length_accounta($obj->subledger_account).''; - if ($obj->sens == 0) { - print ''.price($obj->amount).''; - $totalarray['val']['total_deb'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_deb'; - } - print ''; - if ($obj->sens == 1) { - print ''.price($obj->amount).''; - $totalarray['val']['total_cred'] += $obj->amount; - } - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; - } - print ''; + if ($obj->sens == 0) { + print ''.price($obj->amount).''; + $totalarray['val']['total_deb'] += $obj->amount; } if (!$i) { $totalarray['nbfield']++; } - - print '
'; + if ($obj->sens == 1) { + print ''.price($obj->amount).''; + $totalarray['val']['total_cred'] += $obj->amount; + } + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'total_cred'; + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; - print '
'."\n"; - - print ''."\n"; -} else { - dol_print_error($db); + $i++; } +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print ''."\n"; + // End of page llxFooter(); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 23c7d87f87a..5f9d0c507d3 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1928,7 +1928,7 @@ if ($resql) { $userstatic->fetch($obj->fk_user_author); $facturestatic->fk_user_author = $userstatic->getNomUrl(1); print $facturestatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print ''; print '
'.$langs->trans("DatePayment").'".$langs->trans("PayedByThisPayment")."
'; print '
'; } - // Output Kanban $contracttmp->societe = $socstatic->getNomUrl(); $contracttmp->date_contrat = $obj->date_contrat; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index a895db4f3a6..320c1616d22 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -289,7 +289,8 @@ if ($resql) { } print "
'; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { @@ -652,11 +663,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -766,6 +775,9 @@ while ($i < $imaxinloop) { print ''; } print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -834,9 +846,9 @@ while ($i < $imaxinloop) { print ''; } print '
'; print '
'; } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - if ($massactionbutton || $massaction) { - $selected = 0; - } - // Output Kanban - print $object->getKanbanView(''); + if ($massactionbutton || $massaction) { + $selected = 0; } + // Output Kanban + print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print '
'; print '
'; print '
'; } // Output Kanban - - print $paymentsalstatic->getKanbanView(''); - if ($i == (min($num, $limit) - 1)) { + if ($i == ($imaxinloop - 1)) { print '
'; print '
"; print ""; @@ -837,7 +837,7 @@ if (empty($action) || $action == 'view') { print '"; print "\n"; - $r = ''; + $i = 0; $invoicestatic = new FactureFournisseur($db); $companystatic = new Fournisseur($db); @@ -887,6 +887,7 @@ if (empty($action) || $action == 'view') { print ''; print ""; + $i++; continue; } if ($errorforinvoice[$key] == 'somelinesarenotbound') { @@ -906,6 +907,8 @@ if (empty($action) || $action == 'view') { print ''; print ''; print ""; + + $i++; } // Third party @@ -936,6 +939,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // Product / Service @@ -972,6 +977,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // VAT @@ -1009,6 +1016,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } } } @@ -1037,11 +1046,17 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } } } } + if (!$i) { + print ''; + } + print "
'.$langs->trans("AccountingCredit")."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.($mt >= 0 ? price($mt) : '')."'.($mt < 0 ? price(-$mt) : '')."
'.($mt >= 0 ? price($mt) : '')."'.($mt < 0 ? price(-$mt) : '')."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.$langs->trans("NoRecordFound").'
"; print '
'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 2854ba67606..2ae5bd77ab2 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -107,7 +107,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) } $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,"; -$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,"; +$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= " spe.accountancy_code_customer as code_compta,"; @@ -205,17 +205,17 @@ if ($result) { $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')); } - $line = new FactureLigne($db); - $line->fetch($obj->fdid); - - // Situation invoices handling - $prev_progress = $line->get_prev_progress($obj->rowid); - if ($obj->type == Facture::TYPE_SITUATION) { // Avoid divide by 0 if ($obj->situation_percent == 0) { $situation_ratio = 0; } else { + $line = new FactureLigne($db); + $line->fetch($obj->fdid); + + // Situation invoices handling + $prev_progress = $line->get_prev_progress($obj->rowid); + $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent; } } else { @@ -255,8 +255,9 @@ if ($result) { // For credit notes, we hope to have situation_ratio = 1 so the compensation has no effect to avoid introducing troubles with credit notes. $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio; - if (empty($line->tva_npr)) { - $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; // We ignore line if VAT is a NPR + $tva_npr = (($obj->info_bits & 1 == 1) ? 1 : 0); + if (!$tva_npr) { // We ignore line if VAT is a NPR + $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio; } $tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1 * $situation_ratio; $tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2 * $situation_ratio; @@ -775,7 +776,6 @@ if (empty($action) || $action == 'view') { */ print '
'; - $i = 0; print '
'; print ""; print ""; @@ -788,7 +788,7 @@ if (empty($action) || $action == 'view') { print '"; print "\n"; - $r = ''; + $i = 0; $companystatic = new Client($db); $invoicestatic = new Facture($db); @@ -836,6 +836,7 @@ if (empty($action) || $action == 'view') { print ''; print ""; + $i++; continue; } if ($errorforinvoice[$key] == 'somelinesarenotbound') { @@ -855,6 +856,8 @@ if (empty($action) || $action == 'view') { print ''; print ''; print ""; + + $i++; } // Third party @@ -885,6 +888,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // Product / Service @@ -921,6 +926,8 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } // VAT @@ -957,11 +964,17 @@ if (empty($action) || $action == 'view') { print '"; print '"; print ""; + + $i++; } } } } + if (!$i) { + print ''; + } + print "
'.$langs->trans("AccountingCredit")."
'.($mt >= 0 ? price($mt) : '')."'.($mt < 0 ? price(-$mt) : '')."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'.$langs->trans("NoRecordFound").'
"; print '
'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2447db6af5d..045048e7395 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6412,6 +6412,7 @@ class FactureLigne extends CommonInvoiceLine { // phpcs:enable global $invoicecache; + if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { return 0; } else { From 6f8b1108ca5ce51a93b78bb95e92c3ba90ab1e8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2023 21:21:16 +0100 Subject: [PATCH 571/572] css --- htdocs/admin/dict.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 224d321a0cf..c19777c9007 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1926,8 +1926,8 @@ if ($id > 0) { if (!is_null($withentity)) { print ''; } - print ''; - print ''; + print ''; + print ''; print '