From abc3209f518af7e528c5b6cc253d2c9a2c66cb18 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 9 Dec 2022 16:31:43 +0100 Subject: [PATCH 001/580] 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/580] 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/580] 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/580] 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/580] 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/580] 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/580] 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/580] 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/580] 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/580] 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/580] 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 993c1d28c4c0fd93f069b71d9692382eae5a7d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 30 Jan 2023 23:24:23 +0100 Subject: [PATCH 012/580] work on ajax tooltip --- htdocs/commande/class/commande.class.php | 58 ++++++- htdocs/core/ajax/ajaxtooltip.php | 200 +++++++++++++++++++++++ htdocs/core/class/commonobject.class.php | 51 ++++++ htdocs/core/js/lib_foot.js.php | 71 +++++--- htdocs/product/class/product.class.php | 120 +++++++++++++- htdocs/user/class/user.class.php | 108 +++++++++++- 6 files changed, 578 insertions(+), 30 deletions(-) create mode 100644 htdocs/core/ajax/ajaxtooltip.php diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2a462f77bc4..4dcae469aaa 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3714,6 +3714,48 @@ class Commande extends CommonOrder return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip)); } + /** + * getTooltipContentArray + * @param array $parameters + * @since v18 + * @return array + */ + public function getTooltipContentArray($parameters) + { + global $conf, $langs, $user; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("Order")]; + } + + if ($user->rights->commande->lire) { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Order").''; + if (isset($this->statut)) { + $datas[] = ' '.$this->getLibStatut(5); + } + $datas['Ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + $datas['RefCustomer'] = '
'.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer); + if (!empty($this->total_ht)) { + $datas['AmountHT'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['VAT'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['AmountTTC'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->date)) { + $datas['Date'] = '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); + } + if (!empty($this->delivery_date)) { + $datas['DeliveryDate'] = '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } + } + + return $datas; + } /** * Return clicable link of object (with eventually picto) @@ -3795,10 +3837,20 @@ class Commande extends CommonOrder $label = $langs->trans("Order"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="order-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; + } - $target_value=array('_self', '_blank', '_parent', '_top'); + $target_value = array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { $linkclose .= ' target="'.dol_escape_htmltag($target).'"'; } diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php new file mode 100644 index 00000000000..2342bcf35f1 --- /dev/null +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -0,0 +1,200 @@ + + * 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/ajax/ajaxtooltip.php + * \ingroup tooltip + * \brief This script returns content of tooltip + */ + + +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'); +} +include '../../main.inc.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; + +top_httphead(); + +$id = GETPOST('id', 'int'); +$objecttype = GETPOST('objecttype', 'aZ09'); + +$html = ''; +$regs = array(); +$params = array(); +if (GETPOSTISSET('infologin')) { + $params['infologin'] = GETPOST('infologin', 'int'); +} +if (GETPOSTISSET('option')) { + $params['option'] = GETPOST('option', 'restricthtml'); +} +// If we ask a resource form external module (instead of default path) +if (preg_match('/^([^@]+)@([^@]+)$/i', $objecttype, $regs)) { + $myobject = $regs[1]; + $module = $regs[2]; +} else { + // Parse $objecttype (ex: project_task) + $module = $myobject = $objecttype; + if (preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { + $module = $regs[1]; + $myobject = $regs[2]; + } +} + +// Generic case for $classpath +$classpath = $module.'/class'; + +// Special cases, to work with non standard path +if ($objecttype == 'facture' || $objecttype == 'invoice') { + $langs->load('bills'); + $classpath = 'compta/facture/class'; + $module = 'facture'; + $myobject = 'facture'; +} elseif ($objecttype == 'commande' || $objecttype == 'order') { + $langs->load('orders'); + $classpath = 'commande/class'; + $module = 'commande'; + $myobject = 'commande'; +} elseif ($objecttype == 'propal') { + $langs->load('propal'); + $classpath = 'comm/propal/class'; +} elseif ($objecttype == 'supplier_proposal') { + $langs->load('supplier_proposal'); + $classpath = 'supplier_proposal/class'; +} elseif ($objecttype == 'shipping') { + $langs->load('sendings'); + $classpath = 'expedition/class'; + $myobject = 'expedition'; + $module = 'expedition_bon'; +} elseif ($objecttype == 'delivery') { + $langs->load('deliveries'); + $classpath = 'delivery/class'; + $myobject = 'delivery'; + $module = 'delivery_note'; +} elseif ($objecttype == 'contract') { + $langs->load('contracts'); + $classpath = 'contrat/class'; + $module = 'contrat'; + $myobject = 'contrat'; +} elseif ($objecttype == 'member') { + $langs->load('members'); + $classpath = 'adherents/class'; + $module = 'adherent'; + $myobject = 'adherent'; +} elseif ($objecttype == 'cabinetmed_cons') { + $classpath = 'cabinetmed/class'; + $module = 'cabinetmed'; + $myobject = 'cabinetmedcons'; +} elseif ($objecttype == 'fichinter') { + $langs->load('interventions'); + $classpath = 'fichinter/class'; + $module = 'ficheinter'; + $myobject = 'fichinter'; +} elseif ($objecttype == 'project') { + $langs->load('projects'); + $classpath = 'projet/class'; + $module = 'projet'; +} elseif ($objecttype == 'task') { + $langs->load('projects'); + $classpath = 'projet/class'; + $module = 'projet'; + $myobject = 'task'; +} elseif ($objecttype == 'stock') { + $classpath = 'product/stock/class'; + $module = 'stock'; + $myobject = 'stock'; +} elseif ($objecttype == 'inventory') { + $classpath = 'product/inventory/class'; + $module = 'stock'; + $myobject = 'inventory'; +} elseif ($objecttype == 'mo') { + $classpath = 'mrp/class'; + $module = 'mrp'; + $myobject = 'mo'; +} elseif ($objecttype == 'productlot') { + $classpath = 'product/stock/class'; + $module = 'stock'; + $myobject = 'productlot'; +} + +// Generic case for $classfile and $classname +$classfile = strtolower($myobject); +$classname = ucfirst($myobject); +//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath; + +if ($objecttype == 'invoice_supplier') { + $classfile = 'fournisseur.facture'; + $classname = 'FactureFournisseur'; + $classpath = 'fourn/class'; + $module = 'fournisseur'; +} elseif ($objecttype == 'order_supplier') { + $classfile = 'fournisseur.commande'; + $classname = 'CommandeFournisseur'; + $classpath = 'fourn/class'; + $module = 'fournisseur'; +} elseif ($objecttype == 'supplier_proposal') { + $classfile = 'supplier_proposal'; + $classname = 'SupplierProposal'; + $classpath = 'supplier_proposal/class'; + $module = 'supplier_proposal'; +} elseif ($objecttype == 'stock') { + $classpath = 'product/stock/class'; + $classfile = 'entrepot'; + $classname = 'Entrepot'; +} elseif ($objecttype == 'facturerec') { + $classpath = 'compta/facture/class'; + $classfile = 'facture-rec'; + $classname = 'FactureRec'; + $module = 'facture'; +} elseif ($objecttype == 'mailing') { + $classpath = 'comm/mailing/class'; + $classfile = 'mailing'; + $classname = 'Mailing'; +} + +if (isModEnabled($module)) { + $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); + if ($res) { + if (class_exists($classname)) { + $object = new $classname($db); + $res = $object->fetch($id); + if ($res > 0) { + $html = $object->getTooltipContent($params); + } elseif ($res == 0) { + $html = $langs->trans('Deleted'); + } + unset($object); + } else { + dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR); + } + } +} + +print $html; + +$db->close(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 25f16cbbdb4..416e1ca737b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -664,6 +664,57 @@ abstract class CommonObject } return -1; } + /** + * getTooltipContentArray + * + * @since v18 + * @param array $params + * @return array + */ + public function getTooltipContentArray($params) + { + return []; + } + + /** + * getTooltipContent + * + * @param array $params + * @since v18 + * @return string + */ + public function getTooltipContent($params) + { + global $action, $extrafields, $langs, $hookmanager; + + $datas = $this->getTooltipContentArray($params); + + if (!empty($extrafields->attributes[$this->table_element]['label'])) { + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { + if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) { + $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); + } + $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); + if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { + $datas[$key]= '
'. $labelextra . ''; + } else { + $value = $this->array_options['options_' . $key]; + $datas[$key]= '
'. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element); + } + } + } + + $hookmanager->initHooks(array($this->element . 'dao')); + $parameters = array( + 'tooltipcontentarray' => &$datas + ); + // Note that $action and $object may have been modified by some hooks + $hookmanager->executeHooks('getTooltipContent', $parameters, $this, $action); + + $label = implode($datas); + + return $label; + } /** diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index c037b86a7b9..7ec398f3368 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -65,38 +65,63 @@ if (empty($dolibarr_nocache)) { // Wrapper to show tooltips (html or onclick popup) -print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */\n"; -print "jQuery(document).ready(function () {\n"; +print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */ +jQuery(document).ready(function () {\n"; if (empty($conf->dol_no_mouse_hover)) { - print 'jQuery(".classfortooltip").tooltip({ + print ' + jQuery(".classfortooltip").tooltip({ show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 }, hide: { delay: 250, duration: 20 }, tooltipClass: "mytooltip", content: function () { - console.log("Return title for popup"); - return $(this).prop("title"); /* To force to get title as is */ - } - });'."\n"; + console.log("Return title for popup"); + return $(this).prop("title"); /* To force to get title as is */ + } + }); + jQuery(".classforajaxtooltip").tooltip({ + show: { collision: "flipfit", effect:"toggle", delay:50, duration: 20 }, + hide: { delay: 250, duration: 20 }, + tooltipClass: "mytooltip", + open: function (event, ui) { + var id = $(this).attr("id"); + var params = $(this).attr("data-params"); + $.ajax({ + url:"' . dol_buildpath('/core/ajax/ajaxtooltip.php', 1) . '", + type: "post", + data: JSON.parse(params), + success: function(response){ + // Setting content option + $("#"+id).tooltip("option","content",response); + } + }); + console.log(event); + } + }); + jQuery(".classforajaxtooltip").mouseout(function(){ + console.log("hide ajax tooltip"); + $(this).tooltip("close"); + }); + '; } print ' -jQuery(".classfortooltiponclicktext").dialog({ - closeOnEscape: true, classes: { "ui-dialog": "highlight" }, - maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).', - modal: true, - autoOpen: false - }).css("z-index: 5000"); -jQuery(".classfortooltiponclick").click(function () { - console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\')); - if ($(this).attr(\'dolid\')) { - obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */ - obj.dialog("open"); - return false; - } -});'."\n"; - -print "});\n"; + jQuery(".classfortooltiponclicktext").dialog({ + closeOnEscape: true, classes: { "ui-dialog": "highlight" }, + maxHeight: window.innerHeight-60, width: '.($conf->browser->layout == 'phone' ? max($_SESSION['dol_screenwidth'] - 20, 320) : 700).', + modal: true, + autoOpen: false + }).css("z-index: 5000"); + jQuery(".classfortooltiponclick").click(function () { + console.log("We click on tooltip for element with dolid="+$(this).attr(\'dolid\')); + if ($(this).attr(\'dolid\')) { + obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */ + obj.dialog("open"); + return false; + } + }); +}); +'; // Wrapper to manage dropdown diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 60de90d819d..e7160ef467a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4999,6 +4999,112 @@ class Product extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("ShowProduct")]; + } + + if (!empty($this->entity)) { + $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80); + if ($this->nbphoto > 0) { + $datas['photo'] = '
' . $tmpphoto . '
'; + //$label .= '
'; + } + } + + if ($this->type == Product::TYPE_PRODUCT) { + $datas['picto'] = img_picto('', 'product').' '.$langs->trans("Product").''; + } elseif ($this->type == Product::TYPE_SERVICE) { + $datas['picto']= img_picto('', 'service').' '.$langs->trans("Service").''; + } + if (isset($this->status) && isset($this->status_buy)) { + $datas['status']= ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1); + } + + if (!empty($this->ref)) { + $datas['ref']= '
'.$langs->trans('ProductRef').': '.$this->ref; + } + if (!empty($this->label)) { + $datas['label']= '
'.$langs->trans('ProductLabel').': '.$this->label; + } + if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if (isModEnabled('productbatch')) { + $langs->load("productbatch"); + $datas['batchstatus']= "
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2); + } + } + if (isModEnabled('barcode')) { + $datas['barcode']= '
'.$langs->trans('BarCode').': '.$this->barcode; + } + + if ($this->type == Product::TYPE_PRODUCT) { + if ($this->weight) { + $datas['weight']= "
".$langs->trans("Weight").': '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); + } + $labelsize = ""; + if ($this->length) { + $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Length").': '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units); + } + if ($this->width) { + $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Width").': '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units); + } + if ($this->height) { + $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Height").': '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units); + } + if ($labelsize) { + $datas['size']= "
".$labelsize; + } + + $labelsurfacevolume = ""; + if ($this->surface) { + $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."".$langs->trans("Surface").': '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units); + } + if ($this->volume) { + $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."".$langs->trans("Volume").': '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); + } + if ($labelsurfacevolume) { + $datas['surface']= "
" . $labelsurfacevolume; + } + } + if (!empty($this->pmp) && $this->pmp) { + $datas['pmp'] = "
".$langs->trans("PMPValue").': '.price($this->pmp, 0, '', 1, -1, -1, $conf->currency); + } + + if (isModEnabled('accounting')) { + if ($this->status && isset($this->accountancy_code_sell)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + $selllabel = '
'; + $selllabel .= '
'.$langs->trans('ProductAccountancySellCode').': '.length_accountg($this->accountancy_code_sell); + $selllabel .= '
'.$langs->trans('ProductAccountancySellIntraCode').': '.length_accountg($this->accountancy_code_sell_intra); + $selllabel .= '
'.$langs->trans('ProductAccountancySellExportCode').': '.length_accountg($this->accountancy_code_sell_export); + $datas['accountancysell'] = $selllabel; + } + if ($this->status_buy && isset($this->accountancy_code_buy)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + if (empty($this->status)) { + $buylabel = '
'; + } + $buylabel .= '
'.$langs->trans('ProductAccountancyBuyCode').': '.length_accountg($this->accountancy_code_buy); + $buylabel .= '
'.$langs->trans('ProductAccountancyBuyIntraCode').': '.length_accountg($this->accountancy_code_buy_intra); + $buylabel .= '
'.$langs->trans('ProductAccountancyBuyExportCode').': '.length_accountg($this->accountancy_code_buy_export); + $datas['accountancybuy'] = $buylabel; + } + } + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * @@ -5119,8 +5225,18 @@ class Product extends CommonObject $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; - $linkclose .= ' class="nowraponall classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="product-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="nowraponall classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; + $linkclose .= ' class="nowraponall classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } } else { $linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"'; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 2893378bdd9..0a963da1f5d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2744,6 +2744,99 @@ class User extends CommonObject return $result; } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $menumanager; + + $infologin = $params['infologin'] ?? 0; + $option = $params['option'] ?? ''; + + $datas = []; + if (!empty($this->photo)) { + $photo = '
'; + $photo .= Form::showphoto('userphoto', $this, 0, 60, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1); // Force height to 60 so we total height of tooltip can be calculated and collision can be managed + $photo .= '
'; + $datas['photo'] = $photo; + //$label .= '
'; + } + + // Info Login + $datas['opendiv'] = '
'; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("User").' '.$this->getLibStatut(4); + $datas['name'] = '
'.$langs->trans('Name').': '.dol_string_nohtmltag($this->getFullName($langs, '')); + if (!empty($this->login)) { + $datas['login'] = '
'.$langs->trans('Login').': '.dol_string_nohtmltag($this->login); + } + if (!empty($this->job)) { + $datas['job'] = '
'.$langs->trans("Job").': '.dol_string_nohtmltag($this->job); + } + $datas['email'] = '
'.$langs->trans("Email").': '.dol_string_nohtmltag($this->email); + if (!empty($this->office_phone) || !empty($this->office_fax) || !empty($this->fax)) { + $phonelist = array(); + if ($this->office_phone) { + $phonelist[] = dol_print_phone($this->office_phone, $this->country_code, $this->id, 0, '', ' ', 'phone'); + } + if ($this->office_fax) { + $phonelist[] = dol_print_phone($this->office_fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); + } + if ($this->user_mobile) { + $phonelist[] = dol_print_phone($this->user_mobile, $this->country_code, $this->id, 0, '', ' ', 'mobile'); + } + $datas['phones'] = '
'.$langs->trans('Phone').': '.implode(' ', $phonelist); + } + if (!empty($this->admin)) { + $datas['administrator'] = '
'.$langs->trans("Administrator").': '.yn($this->admin); + } + if (!empty($this->accountancy_code) || $option == 'accountancy') { + $datas['accountancycode'] = '
'.$langs->trans("AccountancyCode").': '.$this->accountancy_code; + } + $company = ''; + if (!empty($this->socid)) { // Add thirdparty for external users + $thirdpartystatic = new Societe($this->db); + $thirdpartystatic->fetch($this->socid); + if (empty($hidethirdpartylogo)) { + $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company + } + $company = ' ('.$langs->trans("Company").': '.img_picto('', 'company').' '.dol_string_nohtmltag($thirdpartystatic->name).')'; + } + $type = ($this->socid ? $langs->trans("ExternalUser").$company : $langs->trans("InternalUser")); + $datas['type'] = '
'.$langs->trans("Type").': '.$type; + $datas['closediv'] = '
'; + if ($infologin > 0) { + $datas['newlinelogin'] = '
'; + $datas['session'] = '
'.$langs->trans("Session").''; + $datas['ip'] = '
'.$langs->trans("IPAddress").': '.dol_string_nohtmltag(getUserRemoteIP()); + if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { + $datas['multicompany'] = '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (User entity '.$this->entity.')'; + } + $datas['authentication'] = '
'.$langs->trans("AuthenticationMode").': '.dol_string_nohtmltag($_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)')); + $datas['connectedsince'] = '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser'); + $datas['previousconnexion'] = '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser'); + $datas['currenttheme'] = '
'.$langs->trans("CurrentTheme").': '.dol_string_nohtmltag($conf->theme); + $datas['currentmenumanager'] = '
'.$langs->trans("CurrentMenuManager").': '.dol_string_nohtmltag($menumanager->name); + $s = picto_from_langcode($langs->getDefaultLang()); + $datas['currentuserlang'] = '
'.$langs->trans("CurrentUserLanguage").': '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang()); + $datas['browser'] = '
'.$langs->trans("Browser").': '.dol_string_nohtmltag($conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')'); + $datas['layout'] = '
'.$langs->trans("Layout").': '.dol_string_nohtmltag($conf->browser->layout); + $datas['screen'] = '
'.$langs->trans("Screen").': '.dol_string_nohtmltag($_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']); + if ($conf->browser->layout == 'phone') { + $datas['phone'] = '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); + } + if (!empty($_SESSION["disablemodules"])) { + $datas['disabledmodules'] = '
'.$langs->trans("DisabledModules").':
'.dol_string_nohtmltag(join(', ', explode(',', $_SESSION["disablemodules"]))); + } + } + + return $datas; + } + /** * Return a HTML link to the user card (with optionaly the picto) * Use this->id,this->lastname, this->firstname @@ -2877,8 +2970,19 @@ class User extends CommonObject $label = $langs->trans("ShowUser"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'infologin' => $infologin, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="user-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } } $linkstart .= $linkclose.'>'; From 7eb0b712520f97e84a2c6ebb76ca0116d08ab79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 31 Jan 2023 22:43:54 +0100 Subject: [PATCH 013/580] work on ajax tooltip --- htdocs/commande/class/commande.class.php | 8 ++++---- htdocs/core/ajax/ajaxtooltip.php | 4 ---- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/product/class/product.class.php | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4dcae469aaa..16f22c80c91 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3716,11 +3716,11 @@ class Commande extends CommonOrder /** * getTooltipContentArray - * @param array $parameters + * @param array $params params to construct tooltip data * @since v18 * @return array */ - public function getTooltipContentArray($parameters) + public function getTooltipContentArray($params) { global $conf, $langs, $user; @@ -3730,7 +3730,7 @@ class Commande extends CommonOrder return ['optimize' => $langs->trans("Order")]; } - if ($user->rights->commande->lire) { + if ($user->hasRight('commande', 'lire')) { $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Order").''; if (isset($this->statut)) { $datas[] = ' '.$this->getLibStatut(5); @@ -3807,7 +3807,7 @@ class Commande extends CommonOrder $label = ''; - if ($user->rights->commande->lire) { + if ($user->hasRight('commande', 'lire')) { $label = img_picto('', $this->picto).' '.$langs->trans("Order").''; if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 2342bcf35f1..569f2fc6ad7 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -106,10 +106,6 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'adherents/class'; $module = 'adherent'; $myobject = 'adherent'; -} elseif ($objecttype == 'cabinetmed_cons') { - $classpath = 'cabinetmed/class'; - $module = 'cabinetmed'; - $myobject = 'cabinetmedcons'; } elseif ($objecttype == 'fichinter') { $langs->load('interventions'); $classpath = 'fichinter/class'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 416e1ca737b..b209d7450f4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -668,7 +668,7 @@ abstract class CommonObject * getTooltipContentArray * * @since v18 - * @param array $params + * @param array $params params to construct tooltip data * @return array */ public function getTooltipContentArray($params) @@ -679,7 +679,7 @@ abstract class CommonObject /** * getTooltipContent * - * @param array $params + * @param array $params params * @since v18 * @return string */ diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e7160ef467a..ab9d33a0500 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5001,7 +5001,7 @@ class Product extends CommonObject /** * getTooltipContentArray - * @param array $params + * @param array $params params to construct tooltip data * @since v18 * @return array */ From 8d71b8101384b15d6563d2f388cb5fdb996a9d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 1 Feb 2023 20:58:40 +0100 Subject: [PATCH 014/580] ajax tooltip on propal --- htdocs/comm/propal/class/propal.class.php | 62 +++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c4328328f18..dba4e0e84d6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3690,6 +3690,52 @@ class Propal extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("Proposal")]; + } + if ($user->hasRight('propal', 'lire')) { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Proposal").''; + if (isset($this->statut)) { + $datas['status'] = ' '.$this->getLibStatut(5); + } + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_client)) { + $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + } + if (!empty($this->total_ht)) { + $datas['amountht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['vat'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['amountttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->date)) { + $datas['date'] = '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); + } + if (!empty($this->delivery_date)) { + $datas['deliverydate'] = '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } + } + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * @@ -3737,7 +3783,7 @@ class Propal extends CommonObject $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); } if (!empty($this->delivery_date)) { - $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); } if ($option == '') { @@ -3768,8 +3814,18 @@ class Propal extends CommonObject $label = $langs->trans("Proposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="propal-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; + } } $linkstart = ' Date: Wed, 1 Feb 2023 21:29:50 +0100 Subject: [PATCH 015/580] ajax tooltip on contact --- htdocs/contact/class/contact.class.php | 63 ++++++++++++++++++++++++-- htdocs/core/ajax/ajaxtooltip.php | 5 +- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 52ea2b69c8d..9d585245f0f 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1404,6 +1404,52 @@ class Contact extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("ShowContact")]; + } + if (!empty($this->photo) && class_exists('Form')) { + $photo = '
'; + $photo .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. + $photo .= '
'; + $datas['photo'] = $photo; + } + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Contact").' ' . $this->getLibStatut(4); + $datas['name'] = '
'.$langs->trans("Name").': '.$this->getFullName($langs); + // if ($this->civility_id) $datas['civility'] = '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate civilty_id code + if (!empty($this->poste)) { + $datas['job'] = '
'.$langs->trans("Poste").': '.$this->poste; + } + $datas['email'] = '
'.$langs->trans("EMail").': '.$this->email; + $phonelist = array(); + $country_code = empty($this->country_code) ? '': $this->country_code; + if ($this->phone_pro) { + $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', ' ', 'phone'); + } + if ($this->phone_mobile) { + $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', ' ', 'mobile'); + } + if ($this->phone_perso) { + $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', ' ', 'phone'); + } + $datas['phonelist'] = '
'.$langs->trans("Phone").': '.implode(' ', $phonelist); + $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); + + return $datas; + } + /** * Return name of contact with link (and eventually picto) * Use $this->id, $this->lastname, $this->firstname, this->civility_id @@ -1421,7 +1467,8 @@ class Contact extends CommonObject { global $conf, $langs, $hookmanager; - $result = ''; $label = ''; + $result = ''; + $label = ''; if (!empty($this->photo) && class_exists('Form')) { $label .= '
'; $label .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. @@ -1472,8 +1519,18 @@ class Contact extends CommonObject $label = $langs->trans("ShowContact"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="contact-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } } $linkstart = ' Date: Wed, 1 Feb 2023 21:57:45 +0100 Subject: [PATCH 016/580] ajax tooltip on thirdparty --- htdocs/societe/class/societe.class.php | 148 ++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fa6d77ad485..8cd49efe0b6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2597,6 +2597,140 @@ class Societe extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $langs->loadLangs(['companies, commercial']); + + $datas = []; + + $option = $params['option'] ?? ''; + $name = $this->name; + + if (!empty($this->name_alias) && empty($noaliasinname)) { + $name .= ' ('.$this->name_alias.')'; + } + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("ShowCompany")]; + } + + $label = ''; + $label2 = ''; + + if (!empty($this->logo) && class_exists('Form')) { + $photo = '
'; + $photo .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. + $photo .= '
'; + $datas['photo'] = $photo; + } elseif (!empty($this->logo_squarred) && class_exists('Form')) { + /*$label.= '
'; + $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. + $label.= '
';*/ + } + + $datas['divopen'] = '
'; + + if ($option == 'customer' || $option == 'compta' || $option == 'category') { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Customer").''; + } elseif ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Prospect").''; + } elseif ($option == 'supplier' || $option == 'category_supplier') { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Supplier").''; + } elseif ($option == 'agenda') { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").''; + } elseif ($option == 'project') { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").''; + } elseif ($option == 'margin') { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").''; + } elseif ($option == 'contact') { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").''; + } elseif ($option == 'ban') { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").''; + } + + // By default + if (empty($datas['picto'] )) { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").''; + } + if (isset($this->status)) { + $datas['status'] = ' '.$this->getLibStatut(5); + } + if (isset($this->client) && isset($this->fournisseur)) { + $datas['type'] = '   ' . $this->getTypeUrl(1); + } + + $datas['name'] = '
'.$langs->trans('Name').': '.dol_escape_htmltag($this->name); + if (!empty($this->name_alias)) { + $datas['namealias'] = ' ('.dol_escape_htmltag($this->name_alias).')'; + } + + if ($this->email) { + $datas['email'] = '
'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; + } + if (!empty($this->phone) || !empty($this->fax)) { + $phonelist = array(); + if ($this->phone) { + $phonelist[] = dol_print_phone($this->phone, $this->country_code, $this->id, 0, '', ' ', 'phone'); + } + if ($this->fax) { + $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); + } + $datas['phonelist'] = '
'.implode(' ', $phonelist); + } + + if (!empty($this->address)) { + $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country + } elseif (!empty($this->country_code)) { + $datas['address'] = '
'.$langs->trans('Country').': '.$this->country_code; + } + if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) { + $datas['vatintra'] = '
'.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra); + } + + if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) { + if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') { + $datas['profid1'] = '
'.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1; + } + if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') { + $datas['profid2'] = '
'.$langs->trans('ProfId2'.$this->country_code).': '.$this->idprof2; + } + if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') { + $datas['profid3'] = '
'.$langs->trans('ProfId3'.$this->country_code).': '.$this->idprof3; + } + if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') { + $datas['profid4'] = '
'.$langs->trans('ProfId4'.$this->country_code).': '.$this->idprof4; + } + if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') { + $datas['profid5'] = '
'.$langs->trans('ProfId5'.$this->country_code).': '.$this->idprof5; + } + if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') { + $datas['profid6'] = '
'.$langs->trans('ProfId6'.$this->country_code).': '.$this->idprof6; + } + } + if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) { + $datas['customercode'] = '
'.$langs->trans('CustomerCode').': '.$this->code_client; + } + if (!empty($this->code_fournisseur) && $this->fournisseur) { + $datas['suppliercode'] = '
'.$langs->trans('SupplierCode').': '.$this->code_fournisseur; + } + if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) { + $datas['accountancycustomercode'] = '
'.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client); + } + if (isModEnabled('accounting') && $this->fournisseur) { + $datas['accountancysuppliercode'] = '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur; + } + + $datas['divclose'] = '
'; + + return $datas; + } /** * Return a link on thirdparty (with picto) @@ -2787,8 +2921,18 @@ class Societe extends CommonObject $label = $langs->trans("ShowCompany"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip refurl valignmiddle"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="societe-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip refurl valignmiddle"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip refurl valignmiddle"'; + } $target_value = array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { $linkclose .= ' target="'.dol_escape_htmltag($target).'"'; From 29d1197cbb73c5f98f06777aeb0fc4e40fcb2f1f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 1 Feb 2023 21:03:52 +0000 Subject: [PATCH 017/580] Fixing style errors. --- 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 8cd49efe0b6..9481fb52e3f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2656,7 +2656,7 @@ class Societe extends CommonObject } // By default - if (empty($datas['picto'] )) { + if (empty($datas['picto'])) { $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ThirdParty").''; } if (isset($this->status)) { From 2df357c7c2e3987380e75a88a8e381803b411a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 1 Feb 2023 22:28:29 +0100 Subject: [PATCH 018/580] do not use cache for thirdparty in order list --- htdocs/commande/list.php | 6 +++++- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 119d88e7cf4..9c06f86e8c3 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2077,7 +2077,11 @@ if ($resql) { // Third party if (!empty($arrayfields['s.nom']['checked'])) { print ''; - print $getNomUrl_cache[$obj->socid]; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + print $companystatic->getNomUrl(1, 'customer', 100, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); + } else { + print $getNomUrl_cache[$obj->socid]; + } // If module invoices enabled and user with invoice creation permissions if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9481fb52e3f..13da1bd6c03 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2927,7 +2927,7 @@ class Societe extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="societe-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' id="' . uniqid('societe-') . '" title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip refurl valignmiddle"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; From 895957e89da1de1e296e3310acb93108d6939642 Mon Sep 17 00:00:00 2001 From: mgabriel Date: Thu, 2 Feb 2023 08:41:08 +0100 Subject: [PATCH 019/580] 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 020/580] 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 021/580] 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 022/580] 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 e96cafa952b4e9e4384c5a3434c7f2a8e10c181a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 11:03:08 +0100 Subject: [PATCH 023/580] add ajaxtooltip on member type --- .../adherents/class/adherent_type.class.php | 35 +++++++++++++++++-- htdocs/core/ajax/ajaxtooltip.php | 9 ++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index f5a5a8933d0..639f417bb94 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -688,6 +688,27 @@ class AdherentType extends CommonObject //return $morphy; } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $datas = []; + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("MemberType").' '.$this->getLibStatut(4); + $datas['label'] = '
'.$langs->trans("Label").': '.$this->label; + if (isset($this->subscription)) { + $datas['subscription'] = '
'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription); + } + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -725,8 +746,16 @@ class AdherentType extends CommonObject $url .= '&save_lastsearch_values=1'; } } - - $linkstart = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkstart = ''; + } else { + $linkstart = ''; + } $linkend = ''; $result .= $linkstart; @@ -741,7 +770,6 @@ class AdherentType extends CommonObject return $result; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of status (activity, closed) * @@ -753,6 +781,7 @@ class AdherentType extends CommonObject return $this->LibStatut($this->status, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the label of a given status * diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 516794896dc..e52d3cfd3d9 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -141,7 +141,6 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { // Generic case for $classfile and $classname $classfile = strtolower($myobject); $classname = ucfirst($myobject); -// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."\n"; if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; @@ -171,9 +170,17 @@ if ($objecttype == 'invoice_supplier') { $classpath = 'comm/mailing/class'; $classfile = 'mailing'; $classname = 'Mailing'; +} elseif ($objecttype == 'adherent_type') { + $langs->load('members'); + $classpath = 'adherents/class'; + $classfile = 'adherent_type'; + $module = 'adherent'; + $myobject = 'adherent_type'; + $classname = 'AdherentType'; } elseif ($objecttype == 'contact') { $module = 'societe'; } +// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."\n"; if (isModEnabled($module)) { $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); From 463c87b393c9e5f96fd6e3c37caaf319a3bf77a2 Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 2 Feb 2023 13:30:32 +0100 Subject: [PATCH 024/580] 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 025/580] 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 1e305c4f860a3d0ae262b40fff0a4657182bfd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 20:53:26 +0100 Subject: [PATCH 026/580] add ajax tooltip on member --- htdocs/adherents/class/adherent.class.php | 61 ++++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index a9db33b9980..dd7fe7f33b5 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2250,6 +2250,53 @@ class Adherent extends CommonObject return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code); } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $langs->load("users"); + return ['optimize' => $langs->trans("ShowUser")]; + } + if (!empty($this->photo)) { + $photo = '
'; + $photo .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1); + $photo .= '
'; + $datas['photo'] = $photo; + //$label .= '
'; + } + + $datas['divopen'] = '
'; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Member").' '.$this->getLibStatut(4); + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->login)) { + $datas['login'] = '
'.$langs->trans('Login').': '.$this->login; + } + if (!empty($this->firstname) || !empty($this->lastname)) { + $datas['name'] = '
'.$langs->trans('Name').': '.$this->getFullName($langs); + } + if (!empty($this->company)) { + $datas['company'] = '
'.$langs->trans('Company').': '.$this->company; + } + if (!empty($this->email)) { + $datas['email'] = '
'.$langs->trans("EMail").': '.$this->email; + } + $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); + $datas['divclose'] = '
'; + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -2324,8 +2371,18 @@ class Adherent extends CommonObject $label = $langs->trans("ShowUser"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="' . uniqid('member') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } } $linkstart .= $linkclose.'>'; From a367fd24b7bb9df02b37ae469d522e1e7a7372e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 21:16:09 +0100 Subject: [PATCH 027/580] add ajax tooltip on account --- htdocs/compta/bank/class/account.class.php | 49 ++++++++++++++++++++-- htdocs/core/ajax/ajaxtooltip.php | 7 +++- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e144677832f..b72767fdcc4 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 JC Prieto - * 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 @@ -1367,6 +1367,40 @@ class Account extends CommonObject return $nb; } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $langs; + include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; + + $datas = []; + + $pictos = img_picto('', $this->picto).' '.$langs->trans("BankAccount").''; + if (isset($this->status)) { + $pictos .= ' '.$this->getLibStatut(5); + } + $datas['picto'] = $pictos; + $datas['label'] = '
'.$langs->trans('Label').': '.$this->label; + $datas['accountnumber'] = '
'.$langs->trans('AccountNumber').': '.$this->number; + $datas['iban'] = '
'.$langs->trans('IBAN').': '.getIbanHumanReadable($this); + $datas['bic'] = '
'.$langs->trans('BIC').': '.$this->bic; + $datas['accountcurrency'] = '
'.$langs->trans("AccountCurrency").': '.$this->currency_code; + + if (isModEnabled('accounting')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + $langs->load("accountancy"); + $datas['accountaccounting'] = '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); + $datas['accountancyjournal'] = '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; + } + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -1403,8 +1437,17 @@ class Account extends CommonObject $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); $label .= '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; } - - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose = '" data-params='.json_encode($params).' id="' . uniqid('member') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip"'; + } else { + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + } $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id; if ($mode == 'transactions') { diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index e52d3cfd3d9..2656a788631 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -75,6 +75,11 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'compta/facture/class'; $module = 'facture'; $myobject = 'facture'; +} elseif ($objecttype == 'bank_account') { + $langs->loadLangs(['banks', 'compta']); + $classpath = 'compta/bank/class'; + $module = 'banque'; + $myobject = 'account'; } elseif ($objecttype == 'commande' || $objecttype == 'order') { $langs->load('orders'); $classpath = 'commande/class'; @@ -180,7 +185,7 @@ if ($objecttype == 'invoice_supplier') { } elseif ($objecttype == 'contact') { $module = 'societe'; } -// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."\n"; +// print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."
"; if (isModEnabled($module)) { $res = dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); From a5b1f8c20e2095eebca96952ce43b771f0d66336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 21:29:23 +0100 Subject: [PATCH 028/580] add ajax tooltip on bom --- htdocs/bom/class/bom.class.php | 53 ++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index d7982a44069..2bbd1759453 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -16,7 +16,7 @@ */ /** - * \file bom/class/bom.class.php + * \file htdocs/bom/class/bom.class.php * \ingroup bom * \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete) */ @@ -1064,6 +1064,43 @@ class BOM extends CommonObject return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN'); } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $langs->load('mrp'); + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("ShowBillOfMaterials")]; + } + $picto = img_picto('', $this->picto).' '.$langs->trans("BillOfMaterials").''; + if (isset($this->status)) { + $picto .= ' '.$this->getLibStatut(5); + } + $datas['picto'] = $picto; + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + if (isset($this->label)) { + $datas['label'] = '
'.$langs->trans('Label').': '.$this->label; + } + if (!empty($this->fk_product) && $this->fk_product > 0) { + include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $product = new Product($this->db); + $resultFetch = $product->fetch($this->fk_product); + if ($resultFetch > 0) { + $datas['product'] = "
".$langs->trans("Product").': '.$product->ref.' - '.$product->label; + } + } + + return $datas; + } /** * Return a link to the object card (with optionaly the picto) @@ -1123,8 +1160,18 @@ class BOM extends CommonObject $label = $langs->trans("ShowBillOfMaterials"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="' . uniqid('bom') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } From 9f365ac568a447387e690ef175c25be55ddf7f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 21:35:40 +0100 Subject: [PATCH 029/580] add ajax tooltip on modulebuilder --- .../template/class/myobject.class.php | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index c988da72b3f..1ae0991b5f2 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2023 Frédéric France * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -750,6 +751,30 @@ class MyObject extends CommonObject return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MYOBJECT_REOPEN'); } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("ShowMyObject")]; + } + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("MyObject").''; + if (isset($this->status)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['ref'] .= '
'.$langs->trans('Ref').': '.$this->ref; + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -796,8 +821,18 @@ class MyObject extends CommonObject $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' id="propal-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } From a07916858f7740dd6260ec2242fb15839bdf4ad7 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 2 Feb 2023 21:36:41 +0100 Subject: [PATCH 030/580] 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 ba2f87d307c4cb52091acc5e64a5d5ce93f22517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 21:57:34 +0100 Subject: [PATCH 031/580] add ajax tooltip on contract --- htdocs/bom/class/bom.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 90 +++++++++++++++++++++++--- 2 files changed, 83 insertions(+), 9 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 2bbd1759453..d96274ede59 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1074,7 +1074,7 @@ class BOM extends CommonObject { global $conf, $langs, $user; - $langs->load('mrp'); + $langs->loadLangs(['product', 'mrp']); $datas = []; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ad2cbcea84b..66b7bd083bf 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2015-2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -185,6 +185,7 @@ class Contrat extends CommonObject public $nbofserviceswait; public $nbofservicesopened; public $nbofservicesexpired; + public $nbofservicesclosed; //public $lower_planned_end_date; //public $higher_planner_end_date; @@ -1981,6 +1982,42 @@ class Contrat extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("ShowContract")]; + } + if ($user->hasRight('contrat', 'lire')) { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Contract").''; + /* Status of a contract is status of all services, so disabled + if (isset($this->statut)) { + $label .= ' '.$this->getLibStatut(5); + }*/ + $datas['ref'] = '
'.$langs->trans('Ref').': '.($this->ref ? $this->ref : $this->id); + $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '. $this->ref_customer; + $datas['refsupplier'] = '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; + if (!empty($this->total_ht)) { + $datas['amountht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['vatamount'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['amounttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + } + return $datas; + } /** * Return clicable name (with picto eventually) @@ -2013,7 +2050,7 @@ class Contrat extends CommonObject $label = ''; - if ($user->rights->contrat->lire) { + if ($user->hasRight('contrat', 'lire')) { $label = img_picto('', $this->picto).' '.$langs->trans("Contract").''; /* Status of a contract is status of all services, so disabled if (isset($this->statut)) { @@ -2037,11 +2074,20 @@ class Contrat extends CommonObject $linkclose = ''; if (empty($notooltip) && $user->rights->contrat->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowOrder"); + $label = $langs->trans("ShowContract"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; + $linkclose .= '" data-params='.json_encode($params).' id="' . uniqid('contract') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; + } } $linkstart = 'trans("ShowContractOfService").': '.$this->label; + if (empty($datas['label'])) { + $datas['label'] = $this->description; + } + + return $datas; + } + + /** + * Return clicable name (with picto eventually) for ContratLigne * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $maxlength Max length @@ -3087,8 +3152,17 @@ class ContratLigne extends CommonObjectLine if (empty($label)) { $label = $this->description; } - - $link = ''; + $link = ''; + } $linkend = ''; $picto = 'service'; From ffa9e1e52f20a4c3864cd91ed7ae3be311037ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 22:23:43 +0100 Subject: [PATCH 032/580] add ajax tooltip on categories --- htdocs/categories/class/categorie.class.php | 38 +++++++++++++++++++-- htdocs/core/ajax/ajaxtooltip.php | 7 +++- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 4d6e3e1736f..5dcad42d936 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -10,7 +10,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2022 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 @@ -1597,6 +1597,23 @@ class Categorie extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $datas = []; + + $datas['label'] = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label); + + return $datas; + } + /** * Return name and link of category (with picto) * Use ->id, ->ref, ->label, ->color @@ -1622,7 +1639,22 @@ class Categorie extends CommonObject } } - $link = ''; + $link = ''; + $link2 .= '" data-params='.json_encode($params).' id="' . uniqid('category') . '" title="' . $langs->trans('Loading') . '"'; + $link2 .= ' class="classforajaxtooltip '.$forced_color.'">'; + } else { + $link .= '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">'; + $link2 = $link; + } $linkend = ''; $picto = 'category'; @@ -1635,7 +1667,7 @@ class Categorie extends CommonObject $result .= ' '; } if ($withpicto != 2) { - $result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; + $result .= $link2.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; } global $action; $hookmanager->initHooks(array($this->element . 'dao')); diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 2656a788631..ae4f17246d1 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -75,11 +75,16 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'compta/facture/class'; $module = 'facture'; $myobject = 'facture'; -} elseif ($objecttype == 'bank_account') { +} elseif ($objecttype == 'bank_accoun') { $langs->loadLangs(['banks', 'compta']); $classpath = 'compta/bank/class'; $module = 'banque'; $myobject = 'account'; +} elseif ($objecttype == 'category') { + $langs->loadLangs(['categories']); + $classpath = 'categories/class'; + $module = 'categorie'; + $myobject = 'categorie'; } elseif ($objecttype == 'commande' || $objecttype == 'order') { $langs->load('orders'); $classpath = 'commande/class'; From 41dd574b1623974225e9f070d65cd0f0045f5602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 22:59:54 +0100 Subject: [PATCH 033/580] clean js --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/adherents/class/adherent_type.class.php | 2 +- htdocs/bom/class/bom.class.php | 2 +- htdocs/categories/class/categorie.class.php | 8 ++------ htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 4 ++-- htdocs/core/js/lib_foot.js.php | 4 ++-- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- 14 files changed, 17 insertions(+), 21 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index dd7fe7f33b5..4dffa624719 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2377,7 +2377,7 @@ class Adherent extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="' . uniqid('member') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 639f417bb94..5543a6e8e76 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -752,7 +752,7 @@ class AdherentType extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkstart = ''; + $linkstart = ''; } else { $linkstart = ''; } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index d96274ede59..39fcb1650f0 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1166,7 +1166,7 @@ class BOM extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="' . uniqid('bom') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5dcad42d936..618a31df34f 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1646,14 +1646,10 @@ class Categorie extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $link2 = $link; - $link .= '" data-params='.json_encode($params).' id="' . uniqid('category') . '" title="' . $langs->trans('Loading') . '"'; + $link .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $link .= ' class="classforajaxtooltip '.$forced_color.'">'; - $link2 .= '" data-params='.json_encode($params).' id="' . uniqid('category') . '" title="' . $langs->trans('Loading') . '"'; - $link2 .= ' class="classforajaxtooltip '.$forced_color.'">'; } else { $link .= '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">'; - $link2 = $link; } $linkend = ''; @@ -1667,7 +1663,7 @@ class Categorie extends CommonObject $result .= ' '; } if ($withpicto != 2) { - $result .= $link2.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; + $result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; } global $action; $hookmanager->initHooks(array($this->element . 'dao')); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index dba4e0e84d6..0876b3ea6d6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3820,7 +3820,7 @@ class Propal extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="propal-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 16f22c80c91..f14989ab3ea 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3843,7 +3843,7 @@ class Commande extends CommonOrder 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="order-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b72767fdcc4..ed44d13dfae 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1443,7 +1443,7 @@ class Account extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose = '" data-params='.json_encode($params).' id="' . uniqid('member') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose = '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip"'; } else { $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9d585245f0f..c6bf780be8b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1525,7 +1525,7 @@ class Contact extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="contact-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 66b7bd083bf..b3da9b1ad49 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2082,7 +2082,7 @@ class Contrat extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, ]; - $linkclose .= '" data-params='.json_encode($params).' id="' . uniqid('contract') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; @@ -3158,7 +3158,7 @@ class ContratLigne extends CommonObjectLine 'id' => $this->fk_contrat, 'objecttype' => $this->element, ]; - $link .= '" data-params='.json_encode($params).' id="' . uniqid('contract') . '" title="' . $langs->trans('Loading') . '"'; + $link .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $link .= ' class="classforajaxtooltip"'; } else { $link = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 7ec398f3368..8efda4e3812 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -84,7 +84,7 @@ if (empty($conf->dol_no_mouse_hover)) { hide: { delay: 250, duration: 20 }, tooltipClass: "mytooltip", open: function (event, ui) { - var id = $(this).attr("id"); + var elem = $(this); var params = $(this).attr("data-params"); $.ajax({ url:"' . dol_buildpath('/core/ajax/ajaxtooltip.php', 1) . '", @@ -92,7 +92,7 @@ if (empty($conf->dol_no_mouse_hover)) { data: JSON.parse(params), success: function(response){ // Setting content option - $("#"+id).tooltip("option","content",response); + elem.tooltip("option","content",response); } }); console.log(event); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 1ae0991b5f2..3fd978e2069 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -827,7 +827,7 @@ class MyObject extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="propal-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ab9d33a0500..e585d35ebae 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5231,7 +5231,7 @@ class Product extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="product-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="nowraponall classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 13da1bd6c03..269bae466bd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2927,7 +2927,7 @@ class Societe extends CommonObject 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="' . uniqid('societe-') . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip refurl valignmiddle"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0a963da1f5d..1516769f387 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2977,7 +2977,7 @@ class User extends CommonObject 'infologin' => $infologin, 'option' => $option, ]; - $linkclose .= ' data-params='.json_encode($params).' id="user-' . uniqid() . '" title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; From 22fb5a4e6a8d1930cf8ebc2034e29adb2e026291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 23:12:54 +0100 Subject: [PATCH 034/580] add ajax tooltip on delivery --- htdocs/delivery/class/delivery.class.php | 30 ++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 3b560ce1026..717696ac430 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -720,6 +720,24 @@ class Delivery extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $datas = []; + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowReceiving").':
'; + $datas['picto'] .= ''.$langs->trans("Status").': '.$this->ref; + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -750,8 +768,16 @@ class Delivery extends CommonObject } //} - - $linkstart = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; + $linkstart = ''; + } $linkend = ''; if ($withpicto) { From a4a541a146f52f0b1daaafddc4c8a03f04bae897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 23:19:55 +0100 Subject: [PATCH 035/580] add ajax tooltip on delivery --- htdocs/core/ajax/ajaxtooltip.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index ae4f17246d1..93244c89050 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -75,7 +75,7 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'compta/facture/class'; $module = 'facture'; $myobject = 'facture'; -} elseif ($objecttype == 'bank_accoun') { +} elseif ($objecttype == 'bank_account') { $langs->loadLangs(['banks', 'compta']); $classpath = 'compta/bank/class'; $module = 'banque'; @@ -205,7 +205,6 @@ if (isModEnabled($module)) { } unset($object); } else { - print "Class with classname ".$classname." is unknown even after the include"; dol_syslog("Class with classname ".$classname." is unknown even after the include", LOG_ERR); } } From a32a0cc25a3164726a83f32b6edd40e5ab43972e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Feb 2023 23:28:09 +0100 Subject: [PATCH 036/580] add ajax tooltip on warehouse --- htdocs/product/stock/class/entrepot.class.php | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 3ce244a4bb1..080abfa6605 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -689,6 +689,32 @@ class Entrepot extends CommonObject } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + $langs->load('stocks'); + $datas = []; + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("Warehouse")]; + } + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Warehouse").''; + if (isset($this->statut)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['ref'] .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); + if (!empty($this->lieu)) { + $datas['locationsummary'] .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; + } + + return $datas; + } + /** * Return clickable name (possibility with the pictogram) * @@ -743,8 +769,18 @@ class Entrepot extends CommonObject $label = $langs->trans("Warehouse"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; + } } $linkstart = ' Date: Thu, 2 Feb 2023 23:47:01 +0100 Subject: [PATCH 037/580] add ajax tooltip on actioncomm --- htdocs/comm/action/class/actioncomm.class.php | 83 ++++++++++++++++++- htdocs/core/ajax/ajaxtooltip.php | 5 ++ htdocs/product/stock/class/entrepot.class.php | 1 - 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index af98356ab18..23a6b5a67c5 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * 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 @@ -1568,6 +1568,73 @@ class ActionComm extends CommonObject return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + $langs->load('agenda'); + $datas = []; + + // Set label of type + $labeltype = ''; + if ($this->type_code) { + $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code) ? $langs->transnoentities("Action".$this->type_code) : $this->type_label; + } + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if ($this->type_code != 'AC_OTH_AUTO') { + $labeltype = $langs->trans('ActionAC_MANUAL'); + } + } + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans('Action').''; + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.dol_escape_htmltag($this->ref); + } + if (!empty($this->label)) { + $datas['title'] = '
'.$langs->trans('Title').': '.dol_escape_htmltag($this->label); + } + if (!empty($labeltype)) { + $datas['labeltype'] = '
'.$langs->trans('Type').': '.dol_escape_htmltag($labeltype); + } + if (!empty($this->location)) { + $datas['location'] = '
'.$langs->trans('Location').': '.dol_escape_htmltag($this->location); + } + if (isset($this->transparency)) { + $datas['transparency'] = '
'.$langs->trans('Busy').': '.yn($this->transparency); + } + if (!empty($this->email_msgid)) { + $langs->load("mails"); + $datas['space'] = '
'; + // $datas['email'] = '
'.img_picto('', 'email').' '.$langs->trans("Email").''; + $datas['mailtopic'] = '
'.$langs->trans('MailTopic').': '.dol_escape_htmltag($this->email_subject); + $datas['mailfrom'] = '
'.$langs->trans('MailFrom').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from); + $datas['mailto'] = '
'.$langs->trans('MailTo').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to); + if (!empty($this->email_tocc)) { + $datas['mailcc'] = '
'.$langs->trans('MailCC').': '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_tocc); + } + /* Disabled because bcc must remain by defintion not visible + if (!empty($this->email_tobcc)) { + $datas['mailccc'] = '
'.$langs->trans('MailCCC').': '.$this->email_tobcc; + } */ + } + if (!empty($this->note_private)) { + $datas['description'] = '
'.$langs->trans('Description').':
'; + // Try to limit length of content + $texttoshow = dolGetFirstLineOfText($this->note_private, 10); + // Restrict height of content into the tooltip + $datas['note'] = '
'; + $datas['note'] .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '
', $texttoshow)); + $datas['note'] .= '
'; + } + + return $datas; + } + /** * Return URL of event * Use $this->id, $this->type_code, $this->label and $this->type_label @@ -1668,8 +1735,18 @@ class ActionComm extends CommonObject $label = $langs->trans("ShowAction"); $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"'; - $linkclose .= ' class="'.$classname.' classfortooltip"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="'.$classname.' classforajaxtooltip"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"'; + $linkclose .= ' class="'.$classname.' classfortooltip"'; + } } else { $linkclose .= ' class="'.$classname.'"'; } diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 93244c89050..84dd613d1b5 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -93,6 +93,11 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { } elseif ($objecttype == 'propal') { $langs->load('propal'); $classpath = 'comm/propal/class'; +} elseif ($objecttype == 'action') { + $langs->load('agenda'); + $classpath = 'comm/action/class'; + $module = 'agenda'; + $myobject = 'actioncomm'; } elseif ($objecttype == 'supplier_proposal') { $langs->load('supplier_proposal'); $classpath = 'supplier_proposal/class'; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 080abfa6605..78e2ba0a173 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -688,7 +688,6 @@ class Entrepot extends CommonObject return dolGetStatus($label, $labelshort, '', $statusType, $mode); } - /** * getTooltipContentArray * @param array $params params to construct tooltip data From 140a3b462d8348db9be5884bfc1c2aa8e1fad158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 3 Feb 2023 09:29:02 +0100 Subject: [PATCH 038/580] add ajax tooltip on usergroup --- htdocs/core/ajax/ajaxtooltip.php | 4 +++ htdocs/user/card.php | 8 ++--- htdocs/user/class/usergroup.class.php | 44 +++++++++++++++++++++++++-- htdocs/user/passwordforgotten.php | 2 +- test/phpunit/AllTests.php | 2 +- 5 files changed, 51 insertions(+), 9 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 84dd613d1b5..d5461b0dc1b 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -151,6 +151,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'product/stock/class'; $module = 'stock'; $myobject = 'productlot'; +} elseif ($objecttype == 'usergroup') { + $classpath = 'user/class'; + $module = 'user'; + $myobject = 'usergroup'; } // Generic case for $classfile and $classname diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 964f4b9a67f..f7ea29d6720 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; -if (!empty($conf->ldap->enabled)) { +if (isModEnabled('ldap')) { require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; } if (isModEnabled('adherent')) { @@ -785,7 +785,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "
"; - if (!empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) { + if (isModEnabled('ldap')et($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) { // Show form to add an account from LDAP if sync LDAP -> Dolibarr is set $ldap = new Ldap(); $result = $ldap->connect_bind(); @@ -1375,7 +1375,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Connexion ldap // pour recuperer passDoNotExpire et userChangePassNextLogon - if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) { + if (isModEnabled('ldap') && !empty($object->ldap_sid)) { $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result > 0) { @@ -2896,7 +2896,7 @@ if ($action == 'create' || $action == 'adduserldap') { print '
'; } - if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) { + if (isModEnabled('ldap') && !empty($object->ldap_sid)) { $ldap->unbind(); } } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index a9884ca59d1..327de8def0b 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2014 Alexis Algoud * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Abbes Bahfir + * 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 @@ -28,7 +29,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -if (!empty($conf->ldap->enabled)) { +if (isModEnabled('ldap')) { require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"; } @@ -706,6 +707,33 @@ class UserGroup extends CommonObject return ''; } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $menumanager; + + $option = $params['option'] ?? ''; + + $datas = []; + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $langs->load("users"); + return ['optimize' => $langs->trans("ShowGroup")]; + } + $datas['divopen'] = '
'; + $datas['picto'] = img_picto('', 'group').' '.$langs->trans("Group").'
'; + $datas['name'] = ''.$langs->trans('Name').': '.$this->name; + $datas['description'] = '
'.$langs->trans("Description").': '.$this->note; + $datas['divclose'] = '
'; + + return $datas; + } + /** * Return a link to the user card (with optionaly the picto) * Use this->id,this->lastname, this->firstname @@ -759,8 +787,18 @@ class UserGroup extends CommonObject $label = $langs->trans("ShowGroup"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } } $linkstart = '
ldap->enabled)) { +if (isModEnabled('ldap')) { require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; } diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 1d57db17ffc..ec419ad9987 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -41,7 +41,7 @@ if (empty($conf->adherent->enabled)) { print "Error: Module member must be enabled to have significant results.\n"; exit(1); } -if (!empty($conf->ldap->enabled)) { +if (isModEnabled('ldap')) { print "Error: LDAP module should not be enabled.\n"; exit(1); } From ba27b8c24ce97a2c2baae28c09751baec5490c55 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 3 Feb 2023 08:29:51 +0000 Subject: [PATCH 039/580] Fixing style errors. --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f7ea29d6720..bf66b29cf5b 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -785,7 +785,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "
"; - if (isModEnabled('ldap')et($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) { + if (isModEnabled('ldap')et($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR) {) // Show form to add an account from LDAP if sync LDAP -> Dolibarr is set $ldap = new Ldap(); $result = $ldap->connect_bind(); From 6ab742a530451b408b711cb11f5cee41d4355c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 3 Feb 2023 09:46:04 +0100 Subject: [PATCH 040/580] add ajax tooltip on usergroup --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f7ea29d6720..b3d83ddb239 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -785,7 +785,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "
"; - if (isModEnabled('ldap')et($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) { + if (isModEnabled('ldap') && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) { // Show form to add an account from LDAP if sync LDAP -> Dolibarr is set $ldap = new Ldap(); $result = $ldap->connect_bind(); From c2f91b2e15cec9f680041aef260d348a2b2213cd Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 3 Feb 2023 14:02:46 +0100 Subject: [PATCH 041/580] FIX attach file and send by mail in ticket --- htdocs/core/class/html.formticket.class.php | 8 ++++---- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index cea007f8e61..cd6b9ecd7fc 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -910,7 +910,7 @@ class FormTicket $langs->loadLangs(array('other', 'mails')); // Clear temp files. Must be done at beginning, before call of triggers - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { + if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { $this->clear_attached_files(); } @@ -943,10 +943,10 @@ class FormTicket $listofmimes = array(); $keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { - if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) { + if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { + if (!empty($arraydefaultmessage->joinfiles) && !empty($this->param['fileinit']) && is_array($this->param['fileinit'])) { foreach ($this->param['fileinit'] as $file) { - $this->add_attached_files($file, basename($file), dol_mimetype($file)); + $formmail->add_attached_files($file, basename($file), dol_mimetype($file)); } } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e03bdabe617..d12df619bb0 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2454,7 +2454,7 @@ class Ticket extends CommonObject $maxheightmini = 72; $formmail = new FormMail($this->db); - + $formmail->trackid = 'tic'.$this->id; $attachedfiles = $formmail->get_attached_files(); $filepath = $attachedfiles['paths']; From 73bbf57db0032541a7d96d24cdc2418572f8716a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Feb 2023 19:14:08 +0100 Subject: [PATCH 042/580] add ajax tooltip on supplier proposal --- .../class/supplier_proposal.class.php | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f2e6d19afa8..98dc1e66af2 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2022 Gauthier VERDOL * @@ -2468,6 +2468,46 @@ class SupplierProposal extends CommonObject } } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $menumanager; + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("ShowSupplierProposal")]; + } + + $option = $params['option'] ?? ''; + $datas = []; + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("SupplierProposal").''; + if (isset($this->status)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_fourn)) { + $datas['ref_supplier'] = '
'.$langs->trans('RefSupplier').': '.$this->ref_fourn; + } + if (!empty($this->total_ht)) { + $datas['amount_ht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['amount_vat'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['amount_ttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * @@ -2534,8 +2574,18 @@ class SupplierProposal extends CommonObject $label = $langs->trans("ShowSupplierProposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; + $linkclose .= ' class="classforajaxtooltip"'; + } else { + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; + } } $linkstart = '
Date: Sat, 4 Feb 2023 21:22:30 +0100 Subject: [PATCH 043/580] fix for double tooltip --- htdocs/user/class/user.class.php | 30 ++++++++++++++------------- htdocs/user/class/usergroup.class.php | 28 +++++++++++++------------ 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 053ba1359fc..26b3ad3860d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2947,25 +2947,27 @@ class User extends CommonObject $linkstart = ' $this->id, + 'objecttype' => $this->element, + 'infologin' => $infologin, + 'option' => $option, + ]; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); $label = $langs->trans("ShowUser"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'infologin' => $infologin, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams . ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } $linkstart .= $linkclose.'>'; @@ -2980,7 +2982,7 @@ class User extends CommonObject } // Only picto if ($withpictoimg > 0) { - $picto = ''.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1).''; + $picto = ''.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams.' class="paddingright '.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1).''; } else { // Picto must be a photo $picto = ''.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).''; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 45028ca993e..dcc5ca3bb39 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -793,24 +793,26 @@ class UserGroup extends CommonObject } $linkclose = ""; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); $label = $langs->trans("ShowGroup"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } $linkstart = '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); } if ($withpicto != 2) { $result .= $this->name; From 5a33e40667510b3edee0677dfa94844f28ba2ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Feb 2023 21:34:48 +0100 Subject: [PATCH 044/580] fix for double tooltip --- .../template/class/myobject.class.php | 28 ++++++++++--------- htdocs/product/stock/class/entrepot.class.php | 28 ++++++++++--------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 0e17492ba80..157b8079808 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -816,23 +816,25 @@ class MyObject extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -853,7 +855,7 @@ class MyObject 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) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 78e2ba0a173..deb7f8c8d52 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -763,23 +763,25 @@ class Entrepot extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Warehouse"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = '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); } if ($withpicto != 2) { $result .= (($showfullpath || !empty($conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO)) ? $this->get_full_arbo() : $this->label); From 7928bfd6cff8128b53be90a8e39afaf7df90ff46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Feb 2023 21:48:02 +0100 Subject: [PATCH 045/580] add ajax tooltip on societeaccount --- htdocs/societe/class/societe.class.php | 28 +++++++------- htdocs/societe/class/societeaccount.class.php | 37 ++++++++++++++++++- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index adc08af21c4..c7e0e568b39 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2916,23 +2916,25 @@ class Societe extends CommonObject $linkstart .= '"'; $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowCompany"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip refurl valignmiddle"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip refurl valignmiddle"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.' refurl valignmiddle"'; $target_value = array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { $linkclose .= ' target="'.dol_escape_htmltag($target).'"'; @@ -2951,7 +2953,7 @@ class Societe extends CommonObject $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name); diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 09fee02c8a3..110f0826516 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -362,6 +362,27 @@ class SocieteAccount extends CommonObject return $this->deleteCommon($user, $notrigger); } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $langs->loadLangs(['companies, commercial']); + + $datas = []; + $option = $params['option'] ?? ''; + + $datas['picto'] = ''.$langs->trans("WebsiteAccount").''; + $datas['login'] = '
'.$langs->trans('Login').': '.$this->login; + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -405,13 +426,25 @@ class SocieteAccount extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("WebsiteAccount"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -422,7 +455,7 @@ class SocieteAccount extends CommonObject $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= $this->ref; From 83b4fde50c2c02914a1a6e867fff8af1447bbfb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Feb 2023 22:00:47 +0100 Subject: [PATCH 046/580] add ajax tooltip on salaries --- htdocs/core/ajax/ajaxtooltip.php | 3 ++ htdocs/salaries/class/salary.class.php | 52 ++++++++++++++++++++------ 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index d5461b0dc1b..a72b57c4ebe 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -198,6 +198,9 @@ if ($objecttype == 'invoice_supplier') { $classname = 'AdherentType'; } elseif ($objecttype == 'contact') { $module = 'societe'; +} elseif ($objecttype == 'salary') { + $classpath = 'salaries/class'; + $module = 'salaries'; } // print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath."
"; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 2f7bb36869e..4eb403a71a1 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -479,6 +479,25 @@ class Salary extends CommonObject } } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $langs->loadLangs(['salaries']); + + $datas = []; + $option = $params['option'] ?? ''; + $datas['picto'] = ''.$langs->trans("Salary").''; + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + + return $datas; + } /** * Send name clicable (with possibly the picto) @@ -523,29 +542,40 @@ class Salary extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - - /* - $hookmanager->initHooks(array('myobjectdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } $linkstart = '
'; $linkend = ''; $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->ref; + if ($withpicto) { + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright pictofixedwidth"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.' pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1); + } + if ($withpicto != 2) { + $result .= $this->ref; + } $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); From 473690f49b804fcd1a39121affc95bae11e30084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Feb 2023 22:09:18 +0100 Subject: [PATCH 047/580] fix for double tooltip --- htdocs/comm/propal/class/propal.class.php | 28 ++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 109cf8368e9..b3271309855 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3809,23 +3809,25 @@ class Propal extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip) && $user->rights->propal->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Proposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } $linkstart = 'picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From a501ae8961ced3e3ee9871a1bc779721c4899933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 09:46:29 +0100 Subject: [PATCH 048/580] fix tooltip --- htdocs/product/class/product.class.php | 31 +++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e585d35ebae..4077fadeb5e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5219,24 +5219,25 @@ class Product extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowProduct"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="nowraponall classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; - $linkclose .= ' class="nowraponall classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; + $linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"'; } @@ -5269,10 +5270,10 @@ class Product extends CommonObject $result .= $linkstart; if ($withpicto) { if ($this->type == Product::TYPE_PRODUCT) { - $result .= (img_object(($notooltip ? '' : $label), 'product', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1)); + $result .= (img_object(($notooltip ? '' : $label), 'product', ($notooltip ? 'class="paddingright"' : $dataparams.' class="paddingright '.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1)); } if ($this->type == Product::TYPE_SERVICE) { - $result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1)); + $result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddingright"' : $dataparams.' class="paddingright '.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1)); } } $result .= dol_escape_htmltag($newref); From 661c82473e677b661da0b528fe80042ddd309b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 10:00:48 +0100 Subject: [PATCH 049/580] add ajax tooltip on productlot --- .../stock/class/mouvementstock.class.php | 10 ++++- .../product/stock/class/productlot.class.php | 44 ++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 43760d808b2..2b7c1c025f1 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -46,10 +46,18 @@ class MouvementStock extends CommonObject */ public $product_id; + /** + * @var int ID warehouse + * @deprecated + * @see $warehouse_id + */ + public $entrepot_id; + /** * @var int ID warehouse */ public $warehouse_id; + public $qty; /** @@ -541,7 +549,7 @@ class MouvementStock extends CommonObject } elseif (empty($fk_product_stock)) { $fk_product_stock = $this->db->last_insert_id($this->db->prefix()."product_stock"); } - } + }entrepot_id // Update detail of stock for the lot. if (!$error && isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 649c5578fa4..890a9fbd0f6 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -585,6 +585,34 @@ class Productlot extends CommonObject } + /** + * getTooltipContentArray + * @param array $params params to construct tooltip data + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $langs->loadLangs(['stocks', 'productbatch']); + + $datas = []; + $option = $params['option'] ?? ''; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Batch").''; + $datas['divopen'] = '
'; + $datas['batch'] = ''.$langs->trans('Batch').': '.$this->batch; + if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) { + $datas['eatby'] = '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day'); + } + if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + $datas['sellby'] = '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day'); + } + $datas['divclose'] = '
'; + + return $datas; + } + /** * Return a link to the a lot card (with optionaly the picto) * Use this->id,this->lastname, this->firstname @@ -629,13 +657,25 @@ class Productlot extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -654,7 +694,7 @@ class Productlot extends CommonObject $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= $this->batch; From 9ab6c3114199d22617684650d9a24a4068fddc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 14:13:20 +0100 Subject: [PATCH 050/580] fix tooltip --- htdocs/adherents/class/adherent.class.php | 28 ++++++++++--------- .../adherents/class/adherent_type.class.php | 26 +++++++++-------- .../stock/class/mouvementstock.class.php | 2 +- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4dffa624719..d51035d500e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2365,24 +2365,26 @@ class Adherent extends CommonObject $linkstart .= '
$this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); $label = $langs->trans("ShowUser"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } $linkstart .= $linkclose.'>'; @@ -2400,7 +2402,7 @@ class Adherent extends CommonObject // Only picto if ($withpictoimg > 0) { $picto = ''. - img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).''; + img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams.' class="'.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1).''; } else { // Picto must be a photo $picto = ''; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 9a27b87f249..1a8c6c7b26c 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -735,7 +735,18 @@ class AdherentType extends CommonObject $option = ''; $url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id); - + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if ($option != 'nolink') { // Add param to save lastsearch_values or not $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); @@ -746,21 +757,12 @@ class AdherentType extends CommonObject $url .= '&save_lastsearch_values=1'; } } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkstart = ''; - } else { - $linkstart = ''; - } + $linkstart = ''; $linkend = ''; $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2b7c1c025f1..2392962a500 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -549,7 +549,7 @@ class MouvementStock extends CommonObject } elseif (empty($fk_product_stock)) { $fk_product_stock = $this->db->last_insert_id($this->db->prefix()."product_stock"); } - }entrepot_id + } // Update detail of stock for the lot. if (!$error && isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { From 8b6bb4161cc592e1433a72a986915925ef5ae6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 16:02:03 +0100 Subject: [PATCH 051/580] fix tooltip --- htdocs/bom/class/bom.class.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 553372a31f8..109e01818e4 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1155,23 +1155,25 @@ class BOM extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowBillOfMaterials"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -1182,7 +1184,7 @@ class BOM extends CommonObject $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= $this->ref; From 6e07cee3fcbf3a0c5a952ccc10e16cbe2d28de60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 17:04:26 +0100 Subject: [PATCH 052/580] fix tooltip --- htdocs/categories/class/categorie.class.php | 15 ++++---- htdocs/contact/class/contact.class.php | 30 ++++++++------- htdocs/contrat/class/contrat.class.php | 41 +++++++++++---------- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 618a31df34f..5dc7d53cc49 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1638,26 +1638,27 @@ class Categorie extends CommonObject $forced_color = 'categtextblack'; } } - - $link = ''; - } else { - $link .= '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">'; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); } + $link = ''; $linkend = ''; $picto = 'category'; if ($withpicto) { - $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); + $result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend); } if ($withpicto && $withpicto != 2) { $result .= ' '; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 459c7807c43..103b8177994 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1514,23 +1514,25 @@ class Contact extends CommonObject $url .= $moreparam; $linkclose = ""; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowContact"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } $linkstart = ''; + $linkstart = ''; $linkend = ''; } @@ -1547,7 +1549,7 @@ class Contact extends CommonObject if ($withpicto < 0) { $result .= ''.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).''; } else { - $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); } } if ($withpicto != 2 && $withpicto != -2) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 7785a8ad3e7..981d7d71f02 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2072,31 +2072,32 @@ class Contrat extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); + } if (empty($notooltip) && $user->rights->contrat->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowContract"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - ]; - $linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; } - $linkstart = ''; $linkend = ''; $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= ($this->ref ? $this->ref : $this->id); @@ -3152,17 +3153,19 @@ class ContratLigne extends CommonObjectLine if (empty($label)) { $label = $this->description; } - $link = ''; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); } + $link = ''; $linkend = ''; $picto = 'service'; @@ -3171,7 +3174,7 @@ class ContratLigne extends CommonObjectLine } if ($withpicto) { - $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); + $result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend); } if ($withpicto && $withpicto != 2) { $result .= ' '; From 19631fef742d73fd7502df071a2497c080a611ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 20:41:29 +0100 Subject: [PATCH 053/580] fix tooltip --- htdocs/comm/action/class/actioncomm.class.php | 28 ++++++++++--------- htdocs/commande/class/commande.class.php | 28 ++++++++++--------- htdocs/product/class/product.class.php | 2 ++ htdocs/societe/class/societe.class.php | 7 +++-- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 23a6b5a67c5..a127cc2d3f2 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1727,6 +1727,18 @@ class ActionComm extends CommonObject $tooltip .= '
'; } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) // $linkclose = ' style="background-color:#'.$this->type_color.'"'; @@ -1735,18 +1747,8 @@ class ActionComm extends CommonObject $label = $langs->trans("ShowAction"); $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="'.$classname.' classforajaxtooltip"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"'; - $linkclose .= ' class="'.$classname.' classfortooltip"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"'; + $linkclose .= $dataparams.' class="'.$classname.' '.$classfortooltip.'"'; } else { $linkclose .= ' class="'.$classname.'"'; } @@ -1806,7 +1808,7 @@ class ActionComm extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } $result .= dol_escape_htmltag($labelshort); $result .= $linkend; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d5e6fff5fce..f44a545c879 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3832,23 +3832,25 @@ class Commande extends CommonOrder } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip) && $user->rights->commande->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Order"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; - } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; $target_value = array('_self', '_blank', '_parent', '_top'); if (in_array($target, $target_value)) { @@ -3867,7 +3869,7 @@ class Commande extends CommonOrder $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4077fadeb5e..00e745cff47 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5009,6 +5009,8 @@ class Product extends CommonObject { global $conf, $langs; + $langs->load('products'); + $datas = []; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c7e0e568b39..1541ca8e8bb 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2665,15 +2665,16 @@ class Societe extends CommonObject if (isset($this->client) && isset($this->fournisseur)) { $datas['type'] = '   ' . $this->getTypeUrl(1); } - $datas['name'] = '
'.$langs->trans('Name').': '.dol_escape_htmltag($this->name); if (!empty($this->name_alias)) { $datas['namealias'] = ' ('.dol_escape_htmltag($this->name_alias).')'; } - - if ($this->email) { + if (!empty($this->email)) { $datas['email'] = '
'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; } + if (!empty($this->url)) { + $datas['url'] = '
'.img_picto('', 'globe', 'class="pictofixedwidth"').$this->url; + } if (!empty($this->phone) || !empty($this->fax)) { $phonelist = array(); if ($this->phone) { From c0c10866e909af56003c5c347249fe6597b2b044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 20:54:18 +0100 Subject: [PATCH 054/580] fix tooltip --- htdocs/compta/bank/class/account.class.php | 12 ++++---- htdocs/core/class/commonobject.class.php | 2 +- htdocs/delivery/class/delivery.class.php | 12 ++++---- .../class/supplier_proposal.class.php | 28 ++++++++++--------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b978d9cba56..230b0336631 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1460,17 +1460,19 @@ class Account extends CommonObject $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); $label .= '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; } + $classfortooltip = 'classfortooltip'; + $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $params = [ 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, ]; - $linkclose = '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip"'; - } else { - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); } + $linkclose = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">'; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id; if ($mode == 'transactions') { @@ -1500,7 +1502,7 @@ class Account extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : ''); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e30ef60b124..f3bde4fe826 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -696,7 +696,7 @@ abstract class CommonObject } $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { - $datas[$key]= '
'. $labelextra . ''; + $datas[$key]= '
'. $labelextra . ''; } else { $value = $this->array_options['options_' . $key]; $datas[$key]= '
'. $labelextra . ': ' . $extrafields->showOutputField($key, $value, '', $this->table_element); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 717696ac430..525d5458891 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -768,20 +768,22 @@ class Delivery extends CommonObject } //} + $classfortooltip = 'classfortooltip'; + $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $params = [ 'id' => $this->id, 'objecttype' => $this->element, ]; - $linkstart = ''; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); } + $linkstart = ''; $linkend = ''; if ($withpicto) { - $result .= ($linkstart.img_object($label, $this->picto, 'class="classfortooltip"').$linkend); + $result .= ($linkstart.img_object($label, $this->picto, $dataparams.' class="'.$classfortooltip.'"').$linkend); } if ($withpicto && $withpicto != 2) { $result .= ' '; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 98dc1e66af2..db3070f8b8d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2569,23 +2569,25 @@ class SupplierProposal extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip) && $user->rights->propal->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowSupplierProposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"'; - $linkclose .= ' class="classforajaxtooltip"'; - } else { - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; - } + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.'"'; } $linkstart = 'picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From 1ad1889d98125dacfc3768b41ea2964240c36381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 21:06:30 +0100 Subject: [PATCH 055/580] fix tooltip --- htdocs/compta/bank/class/account.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 230b0336631..7032f9c40e2 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -244,6 +244,20 @@ class Account extends CommonObject */ public $date_solde; + /** + * Balance. Used in Account::create + * @var float + * @deprecated + * @see $balance + */ + public $solde; + + /** + * Balance. Used in Account::create + * @var float + */ + public $balance; + /** * Creditor Identifier CI. Some banks use different ICS for direct debit and bank tranfer * @var string From b7b4737ef8228fe1c789ce98205e15b5c7a82828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 21:28:27 +0100 Subject: [PATCH 056/580] add ajax tooltip on holidays --- htdocs/holiday/class/holiday.class.php | 40 +++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e4a82be6ea7..dc4e09d6fe9 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Juanjo Menent - * Copyright (C) 2018-2021 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 @@ -1299,6 +1299,28 @@ class Holiday extends CommonObject return $result; } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('holiday'); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Holiday").''; + if (isset($this->statut)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref; + + return $datas; + } /** * Return clicable name (with picto eventually) @@ -1333,13 +1355,23 @@ class Holiday extends CommonObject $url .= '&save_lastsearch_values=1'; } //} - - $linkstart = '
'; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); + } + $linkstart = ''; $linkend = ''; $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From 1e0125540a5eb0b70f6b3ab1f18874e9d32356aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 21:43:18 +0100 Subject: [PATCH 057/580] add ajax tooltip on invoices --- htdocs/compta/facture/class/facture.class.php | 84 ++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 75869a900dd..ed2c729b424 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1766,6 +1766,71 @@ class Facture extends CommonInvoice return $deposit; } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $mysoc, $user; + + $langs->load('bills'); + + $datas = []; + $moretitle = $params['moretitle'] ?? ''; + $picto = $this->picto; + if ($this->type == self::TYPE_REPLACEMENT) { + $picto .= 'r'; // Replacement invoice + } + if ($this->type == self::TYPE_CREDIT_NOTE) { + $picto .= 'a'; // Credit note + } + if ($this->type == self::TYPE_DEPOSIT) { + $picto .= 'd'; // Deposit invoice + } + + if ($user->hasRight("facture", "read")) { + $datas['picto'] = img_picto('', $picto).' '.$langs->trans("Invoice").''; + if (isset($this->statut) && isset($this->alreadypaid)) { + $datas['picto'] .= ' '.$this->getLibStatut(5, $this->alreadypaid); + } + $datas['picto'] .= ' '.$this->getLibType(1); + if ($moretitle) { + $datas['picto'] = ' - '.$moretitle; + } + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_customer)) { + $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.$this->ref_customer; + } + if (!empty($this->date)) { + $datas['date'] = '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); + } + if (!empty($this->total_ht)) { + $datas['amountht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['amountvat'] = '
'.$langs->trans('AmountVAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_localtax1) && $this->total_localtax1 != 0) { + // We keep test != 0 because $this->total_localtax1 can be '0.00000000' + $datas['amountlt1'] = '
'.$langs->transcountry('AmountLT1', $mysoc->country_code).': '.price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_localtax2) && $this->total_localtax2 != 0) { + $datas['amountlt2'] = '
'.$langs->transcountry('AmountLT2', $mysoc->country_code).': '.price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['amountttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + } + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * @@ -1863,13 +1928,26 @@ class Facture extends CommonInvoice } $linkclose = ($target ? ' target="'.$target.'"' : ''); + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'moretitle' => $moretitle, + 'option' => $option, + ]; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + $label = $langs->trans('Loading'); + } if (empty($notooltip) && $user->hasRight("facture", "read")) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Invoice"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.'"'; } $linkstart = 'ref, $max) : $this->ref); From c1b959cdc806db2721ef209dfb2a97c824ab3918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 22:56:46 +0100 Subject: [PATCH 058/580] add ajax tooltip on supplier_order --- .../class/fournisseur.commande.class.php | 63 +++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c7357813d43..600c0c09915 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2018-2022 Ferran Marcet * Copyright (C) 2021 Josep Lluís Amador * Copyright (C) 2022 Gauthier VERDOL @@ -818,6 +818,49 @@ class CommandeFournisseur extends CommonOrder return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $langs->loadLangs(['bills', 'orders']); + + $datas = []; + if ($user->hasRight("fournisseur", "commande", "read")) { + $datas['picto'] = ''.$langs->trans("SupplierOrder").''; + if (isset($this->statut)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_supplier)) { + $datas['refsupplier'] = '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; + } + if (!empty($this->total_ht)) { + $datas['totalht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['totaltva'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['totalttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->date)) { + $datas['date'] = '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); + } + if (!empty($this->delivery_date)) { + $datas['deliverydate'] = '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } + } + return $datas; + } /** * Return clicable name (with picto eventually) @@ -880,13 +923,25 @@ class CommandeFournisseur extends CommonOrder } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowOrder"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.'"'; } $linkstart = '
picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From b238830c82e62b7e10ed2f56a45f1d872805bca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 23:19:56 +0100 Subject: [PATCH 059/580] keep original label --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/bom/class/bom.class.php | 2 +- htdocs/categories/class/categorie.class.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 4 +- htdocs/delivery/class/delivery.class.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 89 ++++++++++++++++++- htdocs/holiday/class/holiday.class.php | 2 +- .../template/class/myobject.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- .../product/stock/class/productlot.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/societe/class/societeaccount.class.php | 2 +- .../class/supplier_proposal.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- htdocs/user/class/usergroup.class.php | 2 +- 23 files changed, 108 insertions(+), 27 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index d51035d500e..0b645571947 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2375,7 +2375,7 @@ class Adherent extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 109e01818e4..4420950af30 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1165,7 +1165,7 @@ class BOM extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5dc7d53cc49..f57bca581bd 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1648,7 +1648,7 @@ class Categorie extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } $link = ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index a127cc2d3f2..fd5b55e70fe 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1737,7 +1737,7 @@ class ActionComm extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) // $linkclose = ' style="background-color:#'.$this->type_color.'"'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index b3271309855..51c8c4518b5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3819,7 +3819,7 @@ class Propal extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip) && $user->rights->propal->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f44a545c879..5f810a8610a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3842,7 +3842,7 @@ class Commande extends CommonOrder ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip) && $user->rights->commande->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ed2c729b424..82ef9fc5b06 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1939,7 +1939,7 @@ class Facture extends CommonInvoice ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip) && $user->hasRight("facture", "read")) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 103b8177994..d0e9a2200f3 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1524,7 +1524,7 @@ class Contact extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 981d7d71f02..c3177bd2b1e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2081,7 +2081,7 @@ class Contrat extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip) && $user->rights->contrat->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { @@ -3162,7 +3162,7 @@ class ContratLigne extends CommonObjectLine ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } $link = ''; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 525d5458891..b9c301806f9 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -777,7 +777,7 @@ class Delivery extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } $linkstart = ''; $linkend = ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 600c0c09915..2ba0097af33 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -933,7 +933,7 @@ class CommandeFournisseur extends CommonOrder ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index dd9ba7a6248..6572fc29cbb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2015-2022 Ferran Marcet * Copyright (C) 2016-2021 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -2700,6 +2700,74 @@ class FactureFournisseur extends CommonInvoice } } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('bills'); + + $datas = []; + $moretitle = $params['moretitle'] ?? ''; + $picto = $this->picto; + if ($this->type == self::TYPE_REPLACEMENT) { + $picto .= 'r'; // Replacement invoice + } + if ($this->type == self::TYPE_CREDIT_NOTE) { + $picto .= 'a'; // Credit note + } + if ($this->type == self::TYPE_DEPOSIT) { + $picto .= 'd'; // Deposit invoice + } + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("SupplierInvoice").''; + if ($this->type == self::TYPE_REPLACEMENT) { + $datas['picto'] .= ''.$langs->transnoentitiesnoconv("InvoiceReplace").''; + } elseif ($this->type == self::TYPE_CREDIT_NOTE) { + $datas['picto'] .= ''.$langs->transnoentitiesnoconv("CreditNote").''; + } elseif ($this->type == self::TYPE_DEPOSIT) { + $datas['picto'] .= ''.$langs->transnoentitiesnoconv("Deposit").''; + } + if (isset($this->status)) { + $alreadypaid = -1; + if (isset($this->alreadypaid)) { + $alreadypaid = $this->alreadypaid; + } + + $$datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid); + } + if ($moretitle) { + $datas['picto'] .= ' - '.$moretitle; + } + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_supplier)) { + $datas['refsupplier'] = '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; + } + if (!empty($this->label)) { + $datas['label'] = '
'.$langs->trans('Label').': '.$this->label; + } + if (!empty($this->date)) { + $datas['date'] = '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); + } + if (!empty($this->total_ht)) { + $datas['amountht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['totaltva'] = '
'.$langs->trans('AmountVAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['totalttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + return $datas; + } /** * Return clicable name (with picto eventually) @@ -2801,13 +2869,26 @@ class FactureFournisseur extends CommonInvoice } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + 'moretitle' => $moretitle, + ]; + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowSupplierInvoice"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.'"'; } $linkstart = 'trans('Loading'); + // $label = $langs->trans('Loading'); } $linkstart = ''; $linkend = ''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 157b8079808..8ad88bdec8a 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -826,7 +826,7 @@ class MyObject extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 00e745cff47..877bcedecdd 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5231,7 +5231,7 @@ class Product extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index deb7f8c8d52..5af056d8080 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -773,7 +773,7 @@ class Entrepot extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 890a9fbd0f6..1ddcb073d3f 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -667,7 +667,7 @@ class Productlot extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 4eb403a71a1..d201c4f44c0 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -552,7 +552,7 @@ class Salary extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1541ca8e8bb..7860ef161c3 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2927,7 +2927,7 @@ class Societe extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 110f0826516..a10fee1666e 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -436,7 +436,7 @@ class SocieteAccount extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index db3070f8b8d..d7013c596b0 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2579,7 +2579,7 @@ class SupplierProposal extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip) && $user->rights->propal->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 26b3ad3860d..17123f7e40a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2958,7 +2958,7 @@ class User extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index dcc5ca3bb39..8d5a054f646 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -803,7 +803,7 @@ class UserGroup extends CommonObject ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); + // $label = $langs->trans('Loading'); } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { From e5190ef6a575976cce91904e87bff13e902fb17f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 23:28:54 +0100 Subject: [PATCH 060/580] add ajax tooltip on mo --- htdocs/mrp/class/mo.class.php | 45 ++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 9a7ba6007cc..3ea38f28251 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1077,6 +1077,33 @@ class Mo extends CommonObject return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MRP_MO_REOPEN'); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('mrp'); + + $datas = []; + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ManufacturingOrder").''; + if (isset($this->status)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + if (isset($this->label)) { + $datas['label'] = '
'.$langs->trans('Label').': '.$this->label; + } + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -1124,13 +1151,25 @@ class Mo extends CommonObject } $linkclose = ''; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + 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'); + } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMo"); $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.'"' : ''); } @@ -1141,7 +1180,7 @@ class Mo extends CommonObject $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= $this->ref; From 06904246f86511f83c1d2fbb24843b96917b49e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 23:40:02 +0100 Subject: [PATCH 061/580] clean code --- htdocs/holiday/class/holiday.class.php | 26 +++++++--------- .../template/class/myobject.class.php | 30 ++++++++----------- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9666b1642ef..e3a605a09aa 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1336,11 +1336,18 @@ class Holiday extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Holiday").''; - if (isset($this->statut)) { - $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 = $langs->trans('Loading'); } - $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id; @@ -1355,17 +1362,6 @@ class Holiday extends CommonObject $url .= '&save_lastsearch_values=1'; } //} - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - ]; - $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); - } $linkstart = ''; $linkend = ''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 8ad88bdec8a..e4594e6d615 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -794,13 +794,19 @@ class MyObject extends CommonObject } $result = ''; - - $label = img_picto('', $this->picto).' '.$langs->trans("MyObject").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id; @@ -816,18 +822,6 @@ class MyObject extends CommonObject } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMyObject"); From 2e7371eee649798adbab3d73dcbb54773ba73bde Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 6 Feb 2023 08:45:44 +0100 Subject: [PATCH 062/580] 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 063/580] 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 064/580] 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 1c24804f06f36b95f212bfbcf2e90901f377271a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 14:14:15 +0100 Subject: [PATCH 065/580] clean code --- htdocs/core/js/lib_foot.js.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 8efda4e3812..b319185909a 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -95,13 +95,8 @@ if (empty($conf->dol_no_mouse_hover)) { elem.tooltip("option","content",response); } }); - console.log(event); } }); - jQuery(".classforajaxtooltip").mouseout(function(){ - console.log("hide ajax tooltip"); - $(this).tooltip("close"); - }); '; } From 394c3f847c4ffb1fb62a08d2d3f45450fb387797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Mon, 6 Feb 2023 17:03:51 +0100 Subject: [PATCH 066/580] FIX clicktodial backtopage --- 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 f9adc7bcf40..dafa33242df 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3410,7 +3410,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $type = 'AC_FAX'; } if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE)) { - $link = ''.img_object($langs->trans("AddAction"), "calendar").''; + $link = ''.img_object($langs->trans("AddAction"), "calendar").''; } if ($link) { $newphone = '
'.$newphone.' '.$link.'
'; From fc767cbfbef84278a5998dd0d08c649133d01eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 6 Feb 2023 17:56:21 +0100 Subject: [PATCH 067/580] FIX discount wasn't taken into account when adding a line in BOM --- htdocs/bom/class/bom.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 0e57bebd922..e414954d1a5 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1058,8 +1058,10 @@ class BOM extends CommonObject return -1; } $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp); - if (empty($line->unit_cost)) { - if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) { + if ((empty($line->unit_cost)) && ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)) { + if ($productFournisseur->fourn_remise_percent != "0") { + $line->unit_cost = $productFournisseur->fourn_unitprice_with_discount; + } else { $line->unit_cost = $productFournisseur->fourn_unitprice; } } From 016d1117a69f3818485b3b7ad8e8c0d4a321fa7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 6 Feb 2023 18:02:28 +0100 Subject: [PATCH 068/580] added my name to the file --- htdocs/bom/class/bom.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index e414954d1a5..8b866e221de 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2019 Laurent Destailleur + * 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 From adb97f5622e5932ac68832f78474a5600f489c0b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 6 Feb 2023 19:44:58 +0100 Subject: [PATCH 069/580] fix : Warning: Attempt to read property default_lang on null in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/expensereport/card.php on line 1193 --- htdocs/expensereport/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e258f057e69..9a13ba4c30c 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1190,7 +1190,9 @@ if (empty($reshook)) { $outputlangs = $langs; $newlang = GETPOST('lang_id', 'alpha'); if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $user = new User($db); + $user->fetch($object->fk_user_author); + $newlang = $user->lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); From f4972997325eea9595c1612da9fd5b2e647a65f8 Mon Sep 17 00:00:00 2001 From: Jean-Patrice Clerc <81645374+jpclerc-beep@users.noreply.github.com> Date: Mon, 6 Feb 2023 21:04:40 +0100 Subject: [PATCH 070/580] Ajout de la ligne pour enregistrer l'email du formulaire --- htdocs/public/project/new.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index c44002340d6..a15b8a6131f 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -222,6 +222,7 @@ if (empty($reshook) && $action == 'add') { } else { $thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); } + $thirdparty->email = GETPOST('email'); $thirdparty->address = GETPOST('address'); $thirdparty->zip = GETPOST('zip'); $thirdparty->town = GETPOST('town'); From 1b9f8d46b05def1bbc900db192d5bcafd4a418e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 21:14:24 +0100 Subject: [PATCH 071/580] clean code --- htdocs/adherents/class/adherent.class.php | 48 +++++-------------- .../adherents/class/adherent_type.class.php | 25 ++++------ 2 files changed, 22 insertions(+), 51 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 0b645571947..e2b7cda5e07 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2319,33 +2319,21 @@ class Adherent extends CommonObject } $result = ''; - $label = ''; $linkstart = ''; $linkend = ''; - - if (!empty($this->photo)) { - $label .= '
'; - $label .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1); - $label .= '
'; - //$label .= '
'; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - - $label .= '
'; - $label .= img_picto('', $this->picto).' '.$langs->trans("Member").''; - $label .= ' '.$this->getLibStatut(4); - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->login)) { - $label .= '
'.$langs->trans('Login').': '.$this->login; - } - if (!empty($this->firstname) || !empty($this->lastname)) { - $label .= '
'.$langs->trans('Name').': '.$this->getFullName($langs); - } - if (!empty($this->company)) { - $label .= '
'.$langs->trans('Company').': '.$this->company; - } - $label .= '
'; + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.((int) $this->id); if ($option == 'subscription') { @@ -2365,18 +2353,6 @@ class Adherent extends CommonObject $linkstart .= ' $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; - $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 1a8c6c7b26c..9819110e6bc 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -724,29 +724,24 @@ class AdherentType extends CommonObject global $langs; $result = ''; - - $label = img_picto('', $this->picto).' '.$langs->trans("MemberType").''; - $label .= ' '.$this->getLibStatut(4); - $label .= '
'.$langs->trans("Label").': '.$this->label; - if (isset($this->subscription)) { - $label .= '
'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription); - } - $option = ''; - $url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id); $classfortooltip = 'classfortooltip'; $dataparams = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; 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 = $langs->trans('Loading'); } + + $label = implode($this->getTooltipContentArray($params)); + + $url = DOL_URL_ROOT.'/adherents/type.php?rowid='.((int) $this->id); if ($option != 'nolink') { // Add param to save lastsearch_values or not $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); From dc15349e83784bbdb8df41a7bd1a1833e40d2f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 21:43:50 +0100 Subject: [PATCH 072/580] clean code --- htdocs/bom/class/bom.class.php | 42 +++------ htdocs/categories/class/categorie.class.php | 28 +++--- htdocs/contact/class/contact.class.php | 98 +++++++++------------ 3 files changed, 71 insertions(+), 97 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 4420950af30..8746999e00b 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1121,24 +1121,20 @@ class BOM extends CommonObject } $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } - $label = img_picto('', $this->picto).' '.$langs->trans("BillOfMaterials").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - if (isset($this->label)) { - $label .= '
'.$langs->trans('Label').': '.$this->label; - } - if (!empty($this->fk_product) && $this->fk_product > 0) { - include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $product = new Product($db); - $resultFetch = $product->fetch($this->fk_product); - if ($resultFetch > 0) { - $label .= "
".$langs->trans("Product").': '.$product->ref.' - '.$product->label; - } - } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id; @@ -1155,18 +1151,6 @@ class BOM extends CommonObject } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowBillOfMaterials"); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f57bca581bd..592b0204983 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1605,7 +1605,7 @@ class Categorie extends CommonObject */ public function getTooltipContentArray($params) { - global $conf, $langs, $user; + global $langs; $datas = []; @@ -1629,7 +1629,19 @@ class Categorie extends CommonObject global $langs, $hookmanager; $result = ''; - $label = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label); + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } + $label = implode($this->getTooltipContentArray($params)); // Check contrast with background and correct text color $forced_color = 'categtextwhite'; @@ -1638,18 +1650,6 @@ class Categorie extends CommonObject $forced_color = 'categtextblack'; } } - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } $link = '
'; $linkend = ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d0e9a2200f3..b44d22da312 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -133,6 +133,11 @@ class Contact extends CommonObject public $civility_code; public $civility; + /** + * @var string gender + */ + public $gender; + /** * @var int egroupware_id */ @@ -193,6 +198,11 @@ class Contact extends CommonObject public $socid; // both socid and fk_soc are used public $fk_soc; // both socid and fk_soc are used + /** + * @var string thirdparty name + */ + public $socname; + /** * @var int 0=inactive, 1=active */ @@ -206,6 +216,14 @@ class Contact extends CommonObject */ public $email; + /** + * Email + * @var string + * @deprecated + * @see $email + */ + public $mail; + /** * URL * @var string @@ -1045,12 +1063,12 @@ class Contact extends CommonObject $this->country_id = $obj->country_id; $this->country_code = $obj->country_id ? $obj->country_code : ''; - $this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; + $this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; - $this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used - $this->socid = $obj->fk_soc; // Both fk_soc and socid are used - $this->socname = $obj->socname; - $this->poste = $obj->poste; + $this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used + $this->socid = $obj->fk_soc; // Both fk_soc and socid are used + $this->socname = $obj->socname; + $this->poste = $obj->poste; $this->statut = $obj->statut; $this->fk_prospectlevel = $obj->fk_prospectlevel; @@ -1066,22 +1084,22 @@ class Contact extends CommonObject $this->phone_perso = trim($obj->phone_perso); $this->phone_mobile = trim($obj->phone_mobile); - $this->email = $obj->email; + $this->email = $obj->email; $this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array()); - $this->photo = $obj->photo; - $this->priv = $obj->priv; - $this->mail = $obj->email; + $this->photo = $obj->photo; + $this->priv = $obj->priv; + $this->mail = $obj->email; $this->birthday = $this->db->jdate($obj->birthday); - $this->note = $obj->note_private; // deprecated - $this->note_private = $obj->note_private; + $this->note = $obj->note_private; // deprecated + $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->default_lang = $obj->default_lang; + $this->default_lang = $obj->default_lang; $this->user_id = $obj->user_id; - $this->user_login = $obj->user_login; + $this->user_login = $obj->user_login; $this->canvas = $obj->canvas; - $this->import_key = $obj->import_key; + $this->import_key = $obj->import_key; // Define gender according to civility $this->setGenderFromCivility(); @@ -1468,35 +1486,19 @@ class Contact extends CommonObject global $conf, $langs, $hookmanager; $result = ''; - $label = ''; - if (!empty($this->photo) && class_exists('Form')) { - $label .= '
'; - $label .= Form::showphoto('contact', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. - $label .= '
'; - //$label .= '
'; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - - $label .= img_picto('', $this->picto).' '.$langs->trans("Contact").''; - $label .= ' '.$this->getLibStatut(4); - $label .= '
'.$langs->trans("Name").': '.$this->getFullName($langs); - //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code - if (!empty($this->poste)) { - $label .= '
'.$langs->trans("Poste").': '.$this->poste; - } - $label .= '
'.$langs->trans("EMail").': '.$this->email; - $phonelist = array(); - $country_code = empty($this->country_code) ? '': $this->country_code; - if ($this->phone_pro) { - $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', ' ', 'phone'); - } - if ($this->phone_mobile) { - $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', ' ', 'mobile'); - } - if ($this->phone_perso) { - $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', ' ', 'phone'); - } - $label .= '
'.$langs->trans("Phone").': '.implode(' ', $phonelist); - $label .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id; @@ -1514,18 +1516,6 @@ class Contact extends CommonObject $url .= $moreparam; $linkclose = ""; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowContact"); From f3b5990d2b8012909fb24614ee4aa89d5eefdcf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 21:49:23 +0100 Subject: [PATCH 073/580] clean code --- htdocs/contrat/class/contrat.class.php | 37 ++++++-------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c3177bd2b1e..97b586a2cde 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2047,42 +2047,21 @@ class Contrat extends CommonObject $url .= '&save_lastsearch_values=1'; } //} - - $label = ''; - - if ($user->hasRight('contrat', 'lire')) { - $label = img_picto('', $this->picto).' '.$langs->trans("Contract").''; - /* Status of a contract is status of all services, so disabled - if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); - }*/ - $label .= '
'.$langs->trans('Ref').': '.($this->ref ? $this->ref : $this->id); - $ref_customer = (!empty($this->ref_customer) ? $this->ref_customer : (empty($this->ref_client) ? '' : $this->ref_client)); - $label .= '
'.$langs->trans('RefCustomer').': '.$ref_customer; - $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - } - - $linkclose = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); // $label = $langs->trans('Loading'); } + + $label = implode($this->getTooltipContentArray($params)); + + $linkclose = ''; if (empty($notooltip) && $user->rights->contrat->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowContract"); From 4a74e7d87519f686f2322c0310a848a6d1fb7a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 21:59:32 +0100 Subject: [PATCH 074/580] clean code --- htdocs/compta/facture/class/facture.class.php | 53 ++++--------------- htdocs/delivery/class/delivery.class.php | 30 ++++++----- 2 files changed, 26 insertions(+), 57 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 82ef9fc5b06..8505af85ce5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1890,57 +1890,22 @@ class Facture extends CommonInvoice if ($this->type == self::TYPE_DEPOSIT) { $picto .= 'd'; // Deposit invoice } - $label = ''; - - if ($user->hasRight("facture", "read")) { - $label = img_picto('', $picto).' '.$langs->trans("Invoice").''; - if (isset($this->statut) && isset($this->alreadypaid)) { - $label .= ' '.$this->getLibStatut(5, $this->alreadypaid); - } - $label .= '   '.$this->getLibType(1); - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->ref_client)) { - $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - } - if (!empty($this->date)) { - $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); - } - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('AmountVAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_localtax1) && $this->total_localtax1 != 0) { // We keep test != 0 because $this->total_localtax1 can be '0.00000000' - $label .= '
'.$langs->transcountry('AmountLT1', $mysoc->country_code).': '.price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_localtax2) && $this->total_localtax2 != 0) { - $label .= '
'.$langs->transcountry('AmountLT2', $mysoc->country_code).': '.price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - if ($moretitle) { - $label .= ' - '.$moretitle; - } - } - - $linkclose = ($target ? ' target="'.$target.'"' : ''); + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'moretitle' => $moretitle, + 'option' => $option, + ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'moretitle' => $moretitle, - 'option' => $option, - ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); // $label = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); + + $linkclose = ($target ? ' target="'.$target.'"' : ''); if (empty($notooltip) && $user->hasRight("facture", "read")) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Invoice"); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 8fa0094f219..bb0d8ac162d 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -108,6 +108,11 @@ class Delivery extends CommonObject public $commande_id; + /** + * @var array statuts labels + */ + public $statuts; + public $lines = array(); @@ -751,8 +756,18 @@ class Delivery extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("ShowReceiving").':
'; - $label .= ''.$langs->trans("Status").': '.$this->ref; + $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 = $langs->trans('Loading'); + } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/delivery/card.php?id='.$this->id; @@ -768,17 +783,6 @@ class Delivery extends CommonObject } //} - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - ]; - $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); - } $linkstart = ''; $linkend = ''; From 8a5e983d7ea3f8c8ecfffe630510bf6c9fd0e1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 22:21:54 +0100 Subject: [PATCH 075/580] clean code --- htdocs/comm/propal/class/propal.class.php | 54 +++------ htdocs/commande/class/commande.class.php | 42 ++----- htdocs/mrp/class/mo.class.php | 34 +++--- htdocs/product/class/product.class.php | 106 ++---------------- htdocs/product/stock/class/entrepot.class.php | 33 +++--- .../product/stock/class/productlot.class.php | 34 +++--- 6 files changed, 72 insertions(+), 231 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 51c8c4518b5..3a48230de40 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3756,36 +3756,22 @@ class Propal extends CommonObject } $result = ''; - $label = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } + $label = implode($this->getTooltipContentArray($params)); + $url = ''; - if ($user->rights->propal->lire) { - $label = img_picto('', $this->picto).' '.$langs->trans("Proposal").''; - if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); - } - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->ref_client)) { - $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - } - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->date)) { - $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); - } - if (!empty($this->delivery_date)) { - $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); - } - if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; } elseif ($option == 'compta') { // deprecated @@ -3809,18 +3795,6 @@ class Propal extends CommonObject } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip) && $user->rights->propal->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Proposal"); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5f810a8610a..5b111f67e6c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3804,46 +3804,22 @@ class Commande extends CommonOrder if ($short) { return $url; } - - $label = ''; - - if ($user->hasRight('commande', 'lire')) { - $label = img_picto('', $this->picto).' '.$langs->trans("Order").''; - if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - $label .= '
'.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer); - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->date)) { - $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); - } - if (!empty($this->delivery_date)) { - $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); - } - } - - $linkclose = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; 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 = ''; if (empty($notooltip) && $user->rights->commande->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Order"); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 3ea38f28251..ddfd8a7f57b 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1123,16 +1123,20 @@ class Mo extends CommonObject } $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } - $label = img_picto('', $this->picto).' '.$langs->trans("ManufacturingOrder").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - if (isset($this->label)) { - $label .= '
'.$langs->trans('Label').': '.$this->label; - } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$this->id; if ($option == 'production') { @@ -1151,18 +1155,6 @@ class Mo extends CommonObject } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMo"); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 877bcedecdd..6686b4fce8d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5125,114 +5125,28 @@ class Product extends CommonObject global $conf, $langs, $hookmanager; include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; - $result = ''; $label = ''; + $result = ''; $newref = $this->ref; if ($maxlength) { $newref = dol_trunc($newref, $maxlength, 'middle'); } - - if (!empty($this->entity)) { - $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80); - if ($this->nbphoto > 0) { - $label .= '
'; - $label .= $tmpphoto; - $label .= '
'; - //$label .= '
'; - } - } - - if ($this->type == Product::TYPE_PRODUCT) { - $label .= img_picto('', 'product').' '.$langs->trans("Product").''; - } elseif ($this->type == Product::TYPE_SERVICE) { - $label .= img_picto('', 'service').' '.$langs->trans("Service").''; - } - if (isset($this->status) && isset($this->status_buy)) { - $label .= ' '.$this->getLibStatut(5, 0); - $label .= ' '.$this->getLibStatut(5, 1); - } - - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('ProductRef').': '.$this->ref; - } - if (!empty($this->label)) { - $label .= '
'.$langs->trans('ProductLabel').': '.$this->label; - } - if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - if (isModEnabled('productbatch')) { - $langs->load("productbatch"); - $label .= "
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2); - } - } - if (isModEnabled('barcode')) { - $label .= '
'.$langs->trans('BarCode').': '.$this->barcode; - } - - if ($this->type == Product::TYPE_PRODUCT) { - if ($this->weight) { - $label .= "
".$langs->trans("Weight").': '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units); - } - $labelsize = ""; - if ($this->length) { - $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Length").': '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units); - } - if ($this->width) { - $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Width").': '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units); - } - if ($this->height) { - $labelsize .= ($labelsize ? " - " : "")."".$langs->trans("Height").': '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units); - } - if ($labelsize) { - $label .= "
".$labelsize; - } - - $labelsurfacevolume = ""; - if ($this->surface) { - $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."".$langs->trans("Surface").': '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units); - } - if ($this->volume) { - $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."".$langs->trans("Volume").': '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); - } - if ($labelsurfacevolume) { - $label .= "
".$labelsurfacevolume; - } - } - if (!empty($this->pmp) && $this->pmp) { - $label .= "
".$langs->trans("PMPValue").': '.price($this->pmp, 0, '', 1, -1, -1, $conf->currency); - } - - if (isModEnabled('accounting')) { - if ($this->status && isset($this->accountancy_code_sell)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - $label .= '
'; - $label .= '
'.$langs->trans('ProductAccountancySellCode').': '.length_accountg($this->accountancy_code_sell); - $label .= '
'.$langs->trans('ProductAccountancySellIntraCode').': '.length_accountg($this->accountancy_code_sell_intra); - $label .= '
'.$langs->trans('ProductAccountancySellExportCode').': '.length_accountg($this->accountancy_code_sell_export); - } - if ($this->status_buy && isset($this->accountancy_code_buy)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - if (empty($this->status)) { - $label .= '
'; - } - $label .= '
'.$langs->trans('ProductAccountancyBuyCode').': '.length_accountg($this->accountancy_code_buy); - $label .= '
'.$langs->trans('ProductAccountancyBuyIntraCode').': '.length_accountg($this->accountancy_code_buy_intra); - $label .= '
'.$langs->trans('ProductAccountancyBuyExportCode').': '.length_accountg($this->accountancy_code_buy_export); - } - } - - $linkclose = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; 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 = ''; if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowProduct"); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 5af056d8080..e6d3ecbd236 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -739,15 +739,20 @@ class Entrepot extends CommonObject } $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } - $label = img_picto('', $this->picto).' '.$langs->trans("Warehouse").''; - if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= '
'.$langs->trans('Ref').': '.(empty($this->ref) ? $this->label : $this->ref); - if (!empty($this->lieu)) { - $label .= '
'.$langs->trans('LocationSummary').': '.$this->lieu; - } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id; @@ -763,18 +768,6 @@ class Entrepot extends CommonObject } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Warehouse"); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 1ddcb073d3f..39a8d5721a9 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -632,16 +632,20 @@ class Productlot extends CommonObject global $menumanager; $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } - $label = img_picto('', $this->picto).' '.$langs->trans("Batch").''; - $label .= '
'; - $label .= ''.$langs->trans('Batch').': '.$this->batch; - if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) { - $label .= '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day'); - } - if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { - $label .= '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day'); - } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/product/stock/productlot_card.php?id='.$this->id; @@ -657,18 +661,6 @@ class Productlot extends CommonObject } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMyObject"); From e5a1b226f3f33c955f6af5e45f8f5596a93948b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 22:28:03 +0100 Subject: [PATCH 076/580] clean code --- htdocs/salaries/class/salary.class.php | 59 ++++++++++++++------------ 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index d201c4f44c0..acf811b4f88 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -79,6 +79,17 @@ class Salary extends CommonObject */ public $fk_bank; + /** + * @var int + * @see $accountid + */ + public $fk_account; + + /** + * @var int + */ + public $accountid; + /** * @var int ID */ @@ -250,7 +261,8 @@ class Salary extends CommonObject $this->fk_bank = $obj->fk_bank; $this->fk_user_author = $obj->fk_user_author; $this->fk_user_modif = $obj->fk_user_modif; - $this->fk_account = $this->accountid = $obj->fk_account; + $this->fk_account = $obj->fk_account; + $this->accountid = $obj->fk_account; // Retrieve all extrafield // fetch optionals attributes and labels @@ -518,42 +530,35 @@ class Salary extends CommonObject if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } - $label = ''.$langs->trans("Salary").''; - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - if ($this->label) { - $label .= '
'.$langs->trans('Label').': '.$this->label; - } - if ($this->datesp && $this->dateep) { - $label .= '
'.$langs->trans('Period').': '.dol_print_date($this->datesp, 'day').' - '.dol_print_date($this->dateep, 'day'); - } - if (isset($this->amount)) { - $label .= '
'.$langs->trans('Amount').': '.price($this->amount); - } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id; if ($option != 'nolink') { // Add param to save lastsearch_values or not $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { + $add_save_lastsearch_values = 1; + } + if ($add_save_lastsearch_values) { + $url .= '&save_lastsearch_values=1'; + } } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowMyObject"); From 3238d82386f7bca056dad365df819d6c5b10ebc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 22:50:36 +0100 Subject: [PATCH 077/580] clean code --- .../class/fournisseur.commande.class.php | 109 ++++++++------- .../fourn/class/fournisseur.facture.class.php | 67 ++-------- htdocs/societe/class/societe.class.php | 124 +++--------------- 3 files changed, 88 insertions(+), 212 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2ba0097af33..335bd6b2df4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -100,14 +100,37 @@ class CommandeFournisseur extends CommonOrder */ public $ref; + /** + * @var string ref supplier + */ public $ref_supplier; + + /** + * @var string ref supplier + * @deprecated + * @see $ref_supplier + */ + public $ref_fourn; + public $brouillon; + /** + * @var int + */ public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Ordered/Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process runing // -> 6=Canceled -> (reopen) 2=Approved // -> 9=Refused -> (reopen) 1=Validated // Note: billed or not is on another field "billed" - public $statuts; // List of status + + /** + * @var array List of status + */ + public $statuts; + + /** + * @var array List of status short + */ + public $statuts_short; public $billed; @@ -169,7 +192,12 @@ class CommandeFournisseur extends CommonOrder */ public $lines = array(); - //Add for supplier_proposal + /** + * @var CommandeFournisseurLigne + */ + public $line; + + // Add for supplier_proposal public $origin; public $origin_id; public $linked_objects = array(); @@ -389,9 +417,9 @@ class CommandeFournisseur extends CommonOrder $this->ref_supplier = $obj->ref_supplier; $this->socid = $obj->fk_soc; $this->fourn_id = $obj->fk_soc; - $this->statut = $obj->fk_statut; - $this->status = $obj->fk_statut; - $this->billed = $obj->billed; + $this->statut = $obj->fk_statut; + $this->status = $obj->fk_statut; + $this->billed = $obj->billed; $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; $this->user_approve_id = $obj->fk_user_approve; @@ -587,10 +615,10 @@ class CommandeFournisseur extends CommonOrder // Multicurrency $line->fk_multicurrency = $objp->fk_multicurrency; $line->multicurrency_code = $objp->multicurrency_code; - $line->multicurrency_subprice = $objp->multicurrency_subprice; - $line->multicurrency_total_ht = $objp->multicurrency_total_ht; - $line->multicurrency_total_tva = $objp->multicurrency_total_tva; - $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $line->multicurrency_subprice = $objp->multicurrency_subprice; + $line->multicurrency_total_ht = $objp->multicurrency_total_ht; + $line->multicurrency_total_tva = $objp->multicurrency_total_tva; + $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->special_code = $objp->special_code; $line->fk_parent_line = $objp->fk_parent_line; @@ -877,38 +905,21 @@ class CommandeFournisseur extends CommonOrder global $langs, $conf, $user, $hookmanager; $result = ''; - - $label = ''; - - if ($user->hasRight("fournisseur", "commande", "read")) { - $label = ''.$langs->trans("SupplierOrder").''; - if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); - } - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->ref_supplier)) { - $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - } - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->date)) { - $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); - } - if (!empty($this->delivery_date)) { - $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); - } + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - $picto = 'order'; + $label = implode($this->getTooltipContentArray($params)); + $url = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$this->id; if ($option !== 'nolink') { @@ -923,18 +934,6 @@ class CommandeFournisseur extends CommonOrder } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowOrder"); @@ -3702,6 +3701,14 @@ class CommandeFournisseurLigne extends CommonOrderLine * @var string */ public $ref_supplier; + + /** + * @var string ref supplier + * @deprecated + * @see $ref_supplier + */ + public $ref_fourn; + public $remise; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 6572fc29cbb..c6cc2acc722 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2821,47 +2821,21 @@ class FactureFournisseur extends CommonInvoice if ($this->type == self::TYPE_DEPOSIT) { $picto .= 'd'; // Deposit invoice } + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + 'moretitle' => $moretitle, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } - $label = img_picto('', $this->picto).' '.$langs->trans("SupplierInvoice").''; - if ($this->type == self::TYPE_REPLACEMENT) { - $label = ''.$langs->transnoentitiesnoconv("InvoiceReplace").''; - } elseif ($this->type == self::TYPE_CREDIT_NOTE) { - $label = ''.$langs->transnoentitiesnoconv("CreditNote").''; - } elseif ($this->type == self::TYPE_DEPOSIT) { - $label = ''.$langs->transnoentitiesnoconv("Deposit").''; - } - if (isset($this->status)) { - $alreadypaid = -1; - if (isset($this->alreadypaid)) { - $alreadypaid = $this->alreadypaid; - } - - $label .= ' '.$this->getLibStatut(5, $alreadypaid); - } - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->ref_supplier)) { - $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - } - if (!empty($this->label)) { - $label .= '
'.$langs->trans('Label').': '.$this->label; - } - if (!empty($this->date)) { - $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day'); - } - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('AmountVAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - if ($moretitle) { - $label .= ' - '.$moretitle; - } + $label = implode($this->getTooltipContentArray($params)); $ref = $this->ref; if (empty($ref)) { @@ -2869,19 +2843,6 @@ class FactureFournisseur extends CommonInvoice } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - 'moretitle' => $moretitle, - ]; - $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowSupplierInvoice"); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7860ef161c3..bc0e8cff3bd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2607,7 +2607,7 @@ class Societe extends CommonObject { global $conf, $langs, $user; - $langs->loadLangs(['companies, commercial']); + $langs->loadLangs(['companies', 'commercial']); $datas = []; @@ -2621,9 +2621,6 @@ class Societe extends CommonObject return ['optimize' => $langs->trans("ShowCompany")]; } - $label = ''; - $label2 = ''; - if (!empty($this->logo) && class_exists('Form')) { $photo = '
'; $photo .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. @@ -2787,122 +2784,45 @@ class Societe extends CommonObject $name .= ' ('.$this->name_alias.')'; } - $result = ''; $label = ''; $label2 = ''; - $linkstart = ''; $linkend = ''; - - if (!empty($this->logo) && class_exists('Form')) { - $label .= '
'; - $label .= Form::showphoto('societe', $this, 0, 40, 0, 'photoref', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. - $label .= '
'; - //$label .= '
'; - } elseif (!empty($this->logo_squarred) && class_exists('Form')) { - /*$label.= '
'; - $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. - $label.= '
';*/ + $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - - $label .= '
'; + $label = implode($this->getTooltipContentArray($params)); + $linkstart = ''; + $linkend = ''; if ($option == 'customer' || $option == 'compta' || $option == 'category') { - $label .= img_picto('', $this->picto).' '.$langs->trans("Customer").''; $linkstart = ''.$langs->trans("Prospect").''; $linkstart = ''.$langs->trans("Supplier").''; $linkstart = ''.$langs->trans("ThirdParty").''; $linkstart = ''.$langs->trans("ThirdParty").''; $linkstart = ''.$langs->trans("ThirdParty").''; $linkstart = ''.$langs->trans("ThirdParty").''; $linkstart = ''.$langs->trans("ThirdParty").''; $linkstart = ''.$langs->trans("ThirdParty").''; $linkstart = 'email; - } - if (!empty($this->phone) || !empty($this->fax)) { - $phonelist = array(); - if ($this->phone) { - $phonelist[] = dol_print_phone($this->phone, $this->country_code, $this->id, 0, '', ' ', 'phone'); - } - if ($this->fax) { - $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); - } - $label .= '
'.implode(' ', $phonelist); - } - - if (!empty($this->address)) { - $label2 .= '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country - } elseif (!empty($this->country_code)) { - $label2 .= '
'.$langs->trans('Country').': '.$this->country_code; - } - if (!empty($this->tva_intra) || (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP) && strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'vatnumber') !== false)) { - $label2 .= '
'.$langs->trans('VATIntra').': '.dol_escape_htmltag($this->tva_intra); - } - - if (!empty($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP)) { - if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid1') !== false && $langs->trans('ProfId1'.$this->country_code) != '-') { - $label2 .= '
'.$langs->trans('ProfId1'.$this->country_code).': '.$this->idprof1; - } - if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid2') !== false && $langs->trans('ProfId2'.$this->country_code) != '-') { - $label2 .= '
'.$langs->trans('ProfId2'.$this->country_code).': '.$this->idprof2; - } - if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid3') !== false && $langs->trans('ProfId3'.$this->country_code) != '-') { - $label2 .= '
'.$langs->trans('ProfId3'.$this->country_code).': '.$this->idprof3; - } - if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid4') !== false && $langs->trans('ProfId4'.$this->country_code) != '-') { - $label2 .= '
'.$langs->trans('ProfId4'.$this->country_code).': '.$this->idprof4; - } - if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid5') !== false && $langs->trans('ProfId5'.$this->country_code) != '-') { - $label2 .= '
'.$langs->trans('ProfId5'.$this->country_code).': '.$this->idprof5; - } - if (strpos($conf->global->SOCIETE_SHOW_FIELD_IN_TOOLTIP, 'profid6') !== false && $langs->trans('ProfId6'.$this->country_code) != '-') { - $label2 .= '
'.$langs->trans('ProfId6'.$this->country_code).': '.$this->idprof6; - } - } - if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) { - $label2 .= '
'.$langs->trans('CustomerCode').': '.$this->code_client; - } - if (!empty($this->code_fournisseur) && $this->fournisseur) { - $label2 .= '
'.$langs->trans('SupplierCode').': '.$this->code_fournisseur; - } - if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) { - $label2 .= '
'.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client); - } - if (isModEnabled('accounting') && $this->fournisseur) { - $label2 .= '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur; - } - $label .= ($label2 ? '
'.$label2 : '').'
'; // Add type of canvas $linkstart .= (!empty($this->canvas) ? '&canvas='.$this->canvas : ''); @@ -2917,18 +2837,6 @@ class Societe extends CommonObject $linkstart .= '"'; $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowCompany"); From ff94600d8f37c16f8425fadb2b081dffe88b015d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 23:00:42 +0100 Subject: [PATCH 078/580] clean code --- htdocs/user/class/user.class.php | 99 +++++---------------------- htdocs/user/class/usergroup.class.php | 38 +++++----- 2 files changed, 36 insertions(+), 101 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 17123f7e40a..ff92cc54ede 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2849,82 +2849,30 @@ class User extends CommonObject $withpictoimg = 0; } - $result = ''; $label = ''; $companylink = ''; - - if (!empty($this->photo)) { - $label .= '
'; - $label .= Form::showphoto('userphoto', $this, 0, 60, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1); // Force height to 60 so we total height of tooltip can be calculated and collision can be managed - $label .= '
'; - //$label .= '
'; + $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'infologin' => $infologin, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - - // Info Login - $label .= '
'; - $label .= img_picto('', $this->picto).' '.$langs->trans("User").''; - $label .= ' '.$this->getLibStatut(4); - $label .= '
'.$langs->trans('Name').': '.dol_string_nohtmltag($this->getFullName($langs, '')); - if (!empty($this->login)) { - $label .= '
'.$langs->trans('Login').': '.dol_string_nohtmltag($this->login); - } - if (!empty($this->job)) { - $label .= '
'.$langs->trans("Job").': '.dol_string_nohtmltag($this->job); - } - $label .= '
'.$langs->trans("Email").': '.dol_string_nohtmltag($this->email); - if (!empty($this->office_phone) || !empty($this->office_fax) || !empty($this->fax)) { - $phonelist = array(); - if ($this->office_phone) { - $phonelist[] = dol_print_phone($this->office_phone, $this->country_code, $this->id, 0, '', ' ', 'phone'); - } - if ($this->office_fax) { - $phonelist[] = dol_print_phone($this->office_fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); - } - if ($this->user_mobile) { - $phonelist[] = dol_print_phone($this->user_mobile, $this->country_code, $this->id, 0, '', ' ', 'mobile'); - } - $label .= '
'.$langs->trans('Phone').': '.implode(' ', $phonelist); - } - if (!empty($this->admin)) { - $label .= '
'.$langs->trans("Administrator").': '.yn($this->admin); - } - if (!empty($this->accountancy_code) || $option == 'accountancy') { - $label .= '
'.$langs->trans("AccountancyCode").': '.$this->accountancy_code; - } - $company = ''; + $label = implode($this->getTooltipContentArray($params)); + $companylink = ''; if (!empty($this->socid)) { // Add thirdparty for external users - $thirdpartystatic = new Societe($db); + $thirdpartystatic = new Societe($this->db); $thirdpartystatic->fetch($this->socid); if (empty($hidethirdpartylogo)) { $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company } - $company = ' ('.$langs->trans("Company").': '.img_picto('', 'company').' '.dol_string_nohtmltag($thirdpartystatic->name).')'; - } - $type = ($this->socid ? $langs->trans("ExternalUser").$company : $langs->trans("InternalUser")); - $label .= '
'.$langs->trans("Type").': '.$type; - $label .= '
'; - if ($infologin > 0) { - $label .= '
'; - $label .= '
'.$langs->trans("Session").''; - $label .= '
'.$langs->trans("IPAddress").': '.dol_string_nohtmltag(getUserRemoteIP()); - if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { - $label .= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (User entity '.$this->entity.')'; - } - $label .= '
'.$langs->trans("AuthenticationMode").': '.dol_string_nohtmltag($_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)')); - $label .= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser'); - $label .= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser'); - $label .= '
'.$langs->trans("CurrentTheme").': '.dol_string_nohtmltag($conf->theme); - $label .= '
'.$langs->trans("CurrentMenuManager").': '.dol_string_nohtmltag($menumanager->name); - $s = picto_from_langcode($langs->getDefaultLang()); - $label .= '
'.$langs->trans("CurrentUserLanguage").': '.dol_string_nohtmltag(($s ? $s.' ' : '').$langs->getDefaultLang()); - $label .= '
'.$langs->trans("Browser").': '.dol_string_nohtmltag($conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')'); - $label .= '
'.$langs->trans("Layout").': '.dol_string_nohtmltag($conf->browser->layout); - $label .= '
'.$langs->trans("Screen").': '.dol_string_nohtmltag($_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']); - if ($conf->browser->layout == 'phone') { - $label .= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); - } - if (!empty($_SESSION["disablemodules"])) { - $label .= '
'.$langs->trans("DisabledModules").':
'.dol_string_nohtmltag(join(', ', explode(',', $_SESSION["disablemodules"]))); - } } + if ($infologin < 0) { $label = ''; } @@ -2947,19 +2895,6 @@ class User extends CommonObject $linkstart = '
$this->id, - 'objecttype' => $this->element, - 'infologin' => $infologin, - 'option' => $option, - ]; - $classfortooltip = 'classforajaxtooltip'; - $dataparams = ' data-params='.json_encode($params); - // $label = $langs->trans('Loading'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 8d5a054f646..04554b282d0 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -105,6 +105,11 @@ class UserGroup extends CommonObject private $_tab_loaded = array(); // Array of cache of already loaded permissions + /** + * @var int all_permissions_are_loaded + */ + public $all_permissions_are_loaded; + public $oldcopy; // To contains a clone of this when we need to save old properties of object public $fields = array( @@ -767,13 +772,20 @@ class UserGroup extends CommonObject $withpicto = 0; } - $result = ''; $label = ''; - - $label .= '
'; - $label .= img_picto('', 'group').' '.$langs->trans("Group").'
'; - $label .= ''.$langs->trans('Name').': '.$this->name; - $label .= '
'.$langs->trans("Description").': '.$this->note; - $label .= '
'; + $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } + $label = implode($this->getTooltipContentArray($params)); if ($option == 'permissions') { $url = DOL_URL_ROOT.'/user/group/perms.php?id='.$this->id; @@ -793,18 +805,6 @@ class UserGroup extends CommonObject } $linkclose = ""; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); From 769e28e3c0e4d53c506e049889f059d48ac70e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 23:08:34 +0100 Subject: [PATCH 079/580] clean code --- htdocs/core/class/commonobject.class.php | 5 +++ .../workstation/class/workstation.class.php | 45 +++++++++++++++---- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b22424d1171..f1b83861ef5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -593,6 +593,11 @@ abstract class CommonObject protected $labelStatus; protected $labelStatusShort; + /** + * @var int showphoto_on_popup + */ + public $showphoto_on_popup; + /** * @var array nb used in load_stateboard */ diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index ac51aeae1d2..3adf2f3cd8a 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -683,6 +683,29 @@ class Workstation extends CommonObject return $this->setStatusCommon($user, self::STATUS_DISABLED, $notrigger, 'WORKSTATION_DISABLED'); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('holiday'); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Workstation").''; + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + if (isset($this->status)) { + $datas['status'] = '
'.$langs->trans("Status").": ".$this->getLibStatut(5); + } + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -703,12 +726,18 @@ class Workstation extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Workstation").''; - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - if (isset($this->status)) { - $label .= '
'.$langs->trans("Status").": ".$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 = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/workstation/workstation_card.php', 1).'?id='.$this->id; @@ -729,8 +758,8 @@ class Workstation extends CommonObject $label = $langs->trans("ShowWorkstation"); $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.'"' : ''); } @@ -743,7 +772,7 @@ class Workstation extends CommonObject if (empty($this->showphoto_on_popup)) { if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'mrp'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'mrp'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } } else { if ($withpicto) { From fe38c5817d4f268dd5fd6e3038e19ec71d727d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Feb 2023 23:24:06 +0100 Subject: [PATCH 080/580] doc --- htdocs/ticket/class/ticket.class.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5faea34ad6c..a304ffe7f78 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * Copyright (C) 2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -198,6 +198,26 @@ class Ticket extends CommonObject */ public $cache_category_tickets; + /** + * @var array tickets severity + */ + public $cache_severity_tickets; + + /** + * @var array cache msgs ticket + */ + public $cache_msgs_ticket; + + /** + * @var array statuts labels + */ + public $statuts; + + /** + * @var array statuts short labels + */ + public $statuts_short; + /** * @var int Notify thirdparty at create */ @@ -1251,7 +1271,7 @@ class Ticket extends CommonObject { global $conf, $langs; - if (!empty($this->cache_category_ticket) && count($this->cache_category_tickets)) { + if (!empty($this->cache_category_tickets) && count($this->cache_category_tickets)) { // Cache already loaded return 0; } From 4d0217fb18df618cb11f2eebdd779868a90d7bd0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 6 Feb 2023 22:25:14 +0000 Subject: [PATCH 081/580] Fixing style errors. --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index a304ffe7f78..693a239feac 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -214,7 +214,7 @@ class Ticket extends CommonObject public $statuts; /** - * @var array statuts short labels + * @var array statuts short labels */ public $statuts_short; From 614a9c2a1e6b68804a5c64f2245117fb51180405 Mon Sep 17 00:00:00 2001 From: "Esteban L. Castro" <43482256+elcf@users.noreply.github.com> Date: Mon, 6 Feb 2023 18:29:50 -0400 Subject: [PATCH 082/580] 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 d5deec862d0..fd4368b78af 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 bce55fc3b4252c5f012df34700c21e18c02120a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 01:40:20 +0100 Subject: [PATCH 083/580] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 28d2c7593fc..009dd47dbb5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -451,7 +451,7 @@ ExtrafieldCheckBox=Checkboxes ExtrafieldCheckBoxFromList=Checkboxes from table ExtrafieldLink=Link to an object ComputedFormula=Computed field -ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $object.
WARNING: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.
Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

Example of formula:
$object->id < 10 ? round($object->id / 2, 2): ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

Example to reload object
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetchNoCompute($obj->id ? $obj->id: ($obj->rowid ? $obj->rowid: $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1'

Other example of formula to force load of object and its parent object:
(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found' +ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $objectoffield.
WARNING: If you need properties of an object not loaded, just fetch yourself the object into your formula like in the second example.
Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

Example of formula:
$objectoffield->id < 10 ? round($objectoffield->id / 2, 2): ($objectoffield->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

Example to reload object
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1')

Other example of formula to force load of object and its parent object:
(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found' Computedpersistent=Store computed field ComputedpersistentDesc=Computed extra fields will be stored in the database, however, the value will only be recalculated when the object of this field is changed. If the computed field depends on other objects or global data this value might be wrong!! ExtrafieldParamHelpPassword=Leaving this field blank means this value will be stored without encryption (field must be only hidden with star on screen).
Set 'auto' to use the default encryption rule to save password into database (then value read will be the hash only, no way to retrieve original value) From 7553a99fcb2d2469848ca1175054081a91fb1822 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 01:43:38 +0100 Subject: [PATCH 084/580] Doc --- ChangeLog | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4da3132248c..1b877e2b4b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,15 +3,6 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 18.0.0 compared to 17.0.0 ***** - -WARNING: - -Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: -* The deprecated method escapeunderscore() of database handlers has been removed. You must use escapeforlike instead. - - - ***** ChangeLog for 17.0.0 compared to 16.0.0 ***** @@ -218,7 +209,8 @@ Following changes may create regressions for some external modules, but were nec * Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande. * Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES * Rename the substitution for "project label" instead of "project title" in substitution variables - +* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object. + ***** ChangeLog for 16.0.4 compared to 16.0.3 ***** From 9d52783e8a4a24fac6edf05b02a4cfc0e4aeaedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Feb 2023 09:09:47 +0100 Subject: [PATCH 085/580] Update ticket.class.php --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 693a239feac..ba8590dc8a5 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -239,7 +239,7 @@ class Ticket extends CommonObject public $oldcopy; /** - * @var array array of TicketsLine + * @var TicketsLine[] array of TicketsLine */ public $lines; From 7c4858fdc3ae5d42db94b4a63582aa788666b115 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 11:05:09 +0100 Subject: [PATCH 086/580] Add page with help for ingoing email setup --- htdocs/admin/mails_ingoing.php | 137 +++++++++++++++++++++++++++++++++ htdocs/core/lib/admin.lib.php | 5 ++ htdocs/langs/en_US/mails.lang | 1 + 3 files changed, 143 insertions(+) create mode 100644 htdocs/admin/mails_ingoing.php diff --git a/htdocs/admin/mails_ingoing.php b/htdocs/admin/mails_ingoing.php new file mode 100644 index 00000000000..010d933821e --- /dev/null +++ b/htdocs/admin/mails_ingoing.php @@ -0,0 +1,137 @@ + + * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2016 Jonathan TISSEAU + * + * 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/admin/mails_ingoing.php + * \brief Page to setup emails entry + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("companies", "products", "admin", "mails", "other", "errors")); + +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); + +$trackid = GETPOST('trackid'); + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +if ($action == 'update' && !$cancel) { +} + + + +/* + * View + */ + +$form = new Form($db); + +$linuxlike = 1; +if (preg_match('/^win/i', PHP_OS)) { + $linuxlike = 0; +} +if (preg_match('/^mac/i', PHP_OS)) { + $linuxlike = 0; +} + + +//$wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails'; +$wikihelp = ''; +llxHeader('', $langs->trans("Setup"), $wikihelp); + +print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup'); + +$head = email_admin_prepare_head(); + +// List of sending methods +$listofmethods = array(); +$listofmethods['mail'] = 'PHP mail function'; +$listofmethods['smtps'] = 'SMTP/SMTPS socket library'; +if (version_compare(phpversion(), '7.0', '>=')) { + $listofmethods['swiftmailer'] = 'Swift Mailer socket library'; +} + +// List of oauth services +$oauthservices = array(); + +foreach ($conf->global as $key => $val) { + if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) { + $key = preg_replace('/^OAUTH_/', '', $key); + $key = preg_replace('/_ID$/', '', $key); + if (preg_match('/^.*-/', $key)) { + $name = preg_replace('/^.*-/', '', $key); + } else { + $name = $langs->trans("NoName"); + } + $provider = preg_replace('/-.*$/', '', $key); + $provider = ucfirst(strtolower($provider)); + + $oauthservices[$key] = $name." (".$provider.")"; + } +} + +print dol_get_fiche_head($head, 'common_ingoing', '', -1); + +print '
'; +print ''.$langs->trans("EMailsInGoingDesc", $langs->transnoentitiesnoconv("EmailCollector"))."
\n"; +print "

\n"; + +/* +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''; +print ''; + +print '
'; + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + +// SMTPS oauth service +if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") { + $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE]; + if (empty($text)) { + $text = $langs->trans("Undefined").img_warning(); + } + print ''; +} + +print '
'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''.$text.'
'; +print '
'; +*/ + +print dol_get_fiche_end(); + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 71bcc082961..b3ee5dc259a 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -2054,6 +2054,11 @@ function email_admin_prepare_head() $head[$h][2] = 'templates'; $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/mails_ingoing.php"; + $head[$h][1] = $langs->trans("InGoingEmailSetup", $langs->transnoentitiesnoconv("EMailing")); + $head[$h][2] = 'common_ingoing'; + $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'email_admin', 'remove'); return $head; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index f83637c9c40..a112de8ceb2 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -179,3 +179,4 @@ RecordCreatedByEmailCollector=Record created by the Email Collector %s from emai DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new contact DefaultStatusEmptyMandatory=Empty but mandatory WarningLimitSendByDay=WARNING: The setup or contract of your instance limits your number of emails per day to %s. Trying to send more may result in having your instance slow down or suspended. Please contact your support if you need a higher quota. +EMailsInGoingDesc=Incoming emails are managed by the module %s. You must enable and configure it if you need to support ingoing emails. From c545b98a24deb842c72bc303d41b66a0cdfe059a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 11:39:29 +0100 Subject: [PATCH 087/580] The Use of PHP-IMAP lib must be enabled from interface --- htdocs/admin/emailcollector_list.php | 60 +++++++++++++++++----------- htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index fb09143412f..de18b57b297 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -273,25 +273,6 @@ 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; - -/* If a group by is required -$sql.= " GROUP BY "; -foreach ($object->fields as $key => $val) { - $sql .= "t.".$db->escape($key).", "; -} -// Add fields from extrafields -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.', ' : ''); - } -} -// Add where from hooks -$parameters=array(); -$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; -$sql = preg_replace('/,\s*$/', '', $sql); -*/ - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -333,6 +314,22 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); + +$linkback = '
'.$langs->trans("BackToModuleList").''; +print load_fiche_titre($title, $linkback, 'title_setup'); + + +$head = array(); +$h = 0; +$head[$h][0] = DOL_URL_ROOT."/admin/emailcollector_list.php"; +$head[$h][1] = $langs->trans("Setup"); +$head[$h][2] = 'common'; +$h++; + +print dol_get_fiche_head($head, 'common', '', -1); + + + $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; @@ -388,11 +385,9 @@ print ''; print ''; print ''; -$linkback = ''.$langs->trans("BackToModuleList").''; - $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton.' '.$linkback, '', $limit, 0, 0, 1); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'email', 0, $newcardbutton, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) /*$topicmail=""; @@ -699,7 +694,22 @@ print ''.$langs->trans("Parameter").''; print ''; print "\n"; -// Hide e-mail headers from collected messages +// MAIN_IMAP_USE_PHPIMAP: Enable use of the PHP Imap library +print ''; +//print $form->textwithpicto($langs->trans("MAIN_IMAP_USE_PHPIMAP"), $langs->transnoentitiesnoconv("MAIN_IMAP_USE_PHPIMAPDesc")); +print $langs->trans("MAIN_IMAP_USE_PHPIMAP"); +print ''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_IMAP_USE_PHPIMAP'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_IMAP_USE_PHPIMAP", $arrval, $conf->global->MAIN_IMAP_USE_PHPIMAP); +} +print ''; +print ''; + +// MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER: Hide e-mail headers from collected messages print ''.$form->textwithpicto($langs->trans("EmailCollectorHideMailHeaders"), $langs->transnoentitiesnoconv("EmailCollectorHideMailHeadersHelp")).''; print ''; if ($conf->use_javascript_ajax) { @@ -738,6 +748,10 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n print $formfile->showdocuments('massfilesarea_emailcollector', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } + +dol_get_fiche_end(); + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 009dd47dbb5..66210ef9d52 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2348,3 +2348,4 @@ AllowExternalDownload=Allow external download (without login, using a shared lin DeadlineDayVATSubmission=Deadline day for vat submission on the next month MaxNumberOfAttachementOnForms=Max number of joinded files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s +MAIN_IMAP_USE_PHPIMAP=Use the PHP-IMAP library for IMAP instead of native PHP IMAP. This also allow the use of OAuth2 connection for IMAP. \ No newline at end of file From 2190dcc9f7e390d6e739fb3450dbd080c0f74c00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 13:40:28 +0100 Subject: [PATCH 088/580] Fix status of website --- 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 3aa1b622f6e..3a625818ba4 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2807,7 +2807,7 @@ if (!GETPOST('hide_websitemenu')) { $atleastonepage = (is_array($array) && count($array) > 0); $websitepage = new WebSitePage($db); - if ($pageid > 0 && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone')) { + if ($pageid > 0) { $websitepage->fetch($pageid); } From 31d5547e33e96dde2e74b0ca2e18dfaea5dca479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Feb 2023 13:48:07 +0100 Subject: [PATCH 089/580] clean code --- .../class/supplier_proposal.class.php | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index d7013c596b0..fbd95b25738 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2529,26 +2529,20 @@ class SupplierProposal extends CommonObject $url = ''; $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } - $label = img_picto('', $this->picto).' '.$langs->trans("SupplierProposal").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->ref_fourn)) { - $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_fourn; - } - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } + $label = implode($this->getTooltipContentArray($params)); if ($option == '') { $url = DOL_URL_ROOT.'/supplier_proposal/card.php?id='.$this->id.$get_params; @@ -2569,18 +2563,6 @@ class SupplierProposal extends CommonObject } $linkclose = ''; - $classfortooltip = 'classfortooltip'; - $dataparams = ''; - 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'); - } if (empty($notooltip) && $user->rights->propal->lire) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowSupplierProposal"); From 2fd6b9438fb835bd865d86cc32e3c67ae62abc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Feb 2023 13:55:36 +0100 Subject: [PATCH 090/580] add ajax tooltip on ticket --- htdocs/ticket/class/ticket.class.php | 57 +++++++++++++++++++++------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5faea34ad6c..3be6e282875 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1400,6 +1400,34 @@ class Ticket extends CommonObject return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', $params); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $langs; + + $langs->load('ticket'); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Ticket").''; + $datas['picto'] .= ' '.$this->getLibStatut(4); + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + $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; + } + if ($this->date_modification) { + $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.$this->date_modification; + } + + return $datas; + } /** * Return a link to the object card (with optionaly the picto) @@ -1423,18 +1451,19 @@ class Ticket extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Ticket").''; - $label .= ' '.$this->getLibStatut(4); - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref.'
'; - $label .= ''.$langs->trans('TicketTrackId').': '.$this->track_id.'
'; - $label .= ''.$langs->trans('Subject').': '.$this->subject; - if ($this->date_creation) { - $label .= '
'.$langs->trans('DateCreation').': '.$this->date_creation; - } - if ($this->date_modification) { - $label .= '
'.$langs->trans('DateModification').': '.$this->date_modification; + $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 = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); + $url = DOL_URL_ROOT.'/ticket/card.php?id='.$this->id; if ($option != 'nolink') { @@ -1454,8 +1483,8 @@ class Ticket extends CommonObject $label = $langs->trans("ShowTicket"); $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.'"' : ''); } @@ -1466,7 +1495,7 @@ class Ticket extends CommonObject $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= $this->ref; From df411abe414edf82363c00a1346f45e02c7f7218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Feb 2023 14:07:27 +0100 Subject: [PATCH 091/580] add ajax tooltip on task --- htdocs/core/ajax/ajaxtooltip.php | 3 +- htdocs/projet/class/task.class.php | 56 +++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index a72b57c4ebe..7afbc88ae17 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -130,8 +130,7 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $langs->load('projects'); $classpath = 'projet/class'; $module = 'projet'; -} elseif ($objecttype == 'task') { - $langs->load('projects'); +} elseif ($objecttype == 'project_task') { $classpath = 'projet/class'; $module = 'projet'; $myobject = 'task'; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 597e680f8f0..1a4f96bacc6 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2014 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2020 Juanjo Menent * Copyright (C) 2022 Charlene Benke * @@ -696,6 +696,34 @@ class Task extends CommonObjectLine } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $langs; + + $langs->load('projects'); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Task").''; + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->label)) { + $datas['label'] = '
'.$langs->trans('LabelTask').': '.$this->label; + } + if ($this->date_start || $this->date_end) { + $datas['range'] = "
".get_date_range($this->date_start, $this->date_end, '', $langs, 0); + } + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -717,16 +745,18 @@ class Task extends CommonObjectLine } $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Task").''; - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->label)) { - $label .= '
'.$langs->trans('LabelTask').': '.$this->label; - } - if ($this->date_start || $this->date_end) { - $label .= "
".get_date_range($this->date_start, $this->date_end, '', $langs, 0); + $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 = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option == 'withproject' ? '&withproject=1' : ''); // Add param to save lastsearch_values or not @@ -744,8 +774,8 @@ class Task extends CommonObjectLine $label = $langs->trans("ShowTask"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip nowraponall"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.' nowraponall"'; } else { $linkclose .= ' class="nowraponall"'; } @@ -758,7 +788,7 @@ class Task extends CommonObjectLine $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From 8d1a84d56c8fece9c540247c7e2b3037f0193818 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 7 Feb 2023 14:56:38 +0100 Subject: [PATCH 092/580] fix : Warning: Undefined property: ExpenseReport:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/lib/pdf.lib.php on line 2289 --- .../expensereport/class/expensereport.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 2c4b4bec855..74d668f9d59 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -133,6 +133,21 @@ class ExpenseReport extends CommonObject public $statuts_short = array(); public $statuts_logo; + // Multicurrency + /** + * @var int Currency ID + */ + public $fk_multicurrency; + + /** + * @var string multicurrency code + */ + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + /** * Draft status From 495a8656522df4c752c4f48ddbf5ed39d268889b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 7 Feb 2023 14:59:02 +0100 Subject: [PATCH 093/580] fix : Warning: Undefined property: ExpenseReportLine:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/lib/pdf.lib.php on line 2289 --- .../expensereport/class/expensereport.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 74d668f9d59..5526b5564c4 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2754,6 +2754,21 @@ class ExpenseReportLine extends CommonObjectLine public $total_localtax1; public $total_localtax2; + // Multicurrency + /** + * @var int Currency ID + */ + public $fk_multicurrency; + + /** + * @var string multicurrency code + */ + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + /** * @var int ID into llx_ecm_files table to link line to attached file */ From 4cd7f7bedaceaaea1898bb04cf141127ef9c5fc6 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 7 Feb 2023 15:56:28 +0100 Subject: [PATCH 094/580] fix : Warning: Undefined property: pdf_standard:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/expensereport/doc/pdf_standard.modules.php on line 582 --- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index f365173ddbe..80418a86f91 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -92,6 +92,7 @@ class pdf_standard extends ModeleExpenseReport public $posxtva; public $posxup; public $posxqty; + public $posxtype; public $postotalht; public $postotalttc; From 9ad29faa32520163fe8e461c093891201f45146e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 7 Feb 2023 16:01:09 +0100 Subject: [PATCH 095/580] fix : Warning: Undefined property: pdf_standard:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/expensereport/doc/pdf_standard.modules.php on line 589 --- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 80418a86f91..4363a7e90f1 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016-2022 Philippe Grand + * Copyright (C) 2016-2023 Philippe Grand * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Francis Appels * Copyright (C) 2019 Markus Welters @@ -93,6 +93,7 @@ class pdf_standard extends ModeleExpenseReport public $posxup; public $posxqty; public $posxtype; + public $posxprojet; public $postotalht; public $postotalttc; From 6f8c26fa4741b8d491d78c8937aeb3bfcf2da50f Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 7 Feb 2023 16:18:13 +0100 Subject: [PATCH 096/580] NEW can stay on edit field when errors occurs --- htdocs/core/class/html.form.class.php | 8 ++++++-- htdocs/product/stock/productlot_card.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c6cf71fbe44..7de2938e299 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -202,9 +202,10 @@ class Form * @param string $paramid Key of parameter for id ('id', 'socid') * @param string $gm 'auto' or 'tzuser' or 'tzuserrel' or 'tzserver' (when $typeofdata is a date) * @param array $moreoptions Array with more options. For example array('addnowlink'=>1), array('valuealreadyhtmlescaped'=>1) + * @param string $editaction [=''] use GETPOST default action or set action to edit mode * @return string HTML edit field */ - public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 1, $formatfunc = '', $paramid = 'id', $gm = 'auto', $moreoptions = array()) + public function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 1, $formatfunc = '', $paramid = 'id', $gm = 'auto', $moreoptions = array(), $editaction = '') { global $conf, $langs; @@ -233,7 +234,10 @@ class Form if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|day|datepicker|dayhour|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select $ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); } else { - $editmode = (GETPOST('action', 'aZ09') == 'edit'.$htmlname); + if ($editaction == '') { + $editaction = GETPOST('action', 'aZ09'); + } + $editmode = ($editaction == 'edit'.$htmlname); if ($editmode) { $ret .= "\n"; $ret .= ''; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index acf2f526773..a39d92f93aa 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -469,7 +469,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print $form->editfieldkey($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print ''; - print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); + print $form->editfieldval($langs->trans('SellByDate'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker', '', null, null, '', 1, '', 'id', 'auto', array(), $action); print ''; print ''; } @@ -479,7 +479,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print $form->editfieldkey($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print ''; - print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); + print $form->editfieldval($langs->trans('EatByDate'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker', '', null, null, '', 1, '', 'id', 'auto', array(), $action); print ''; print ''; } From 55d6e2ead026cf7dde9124e26432d97e3b63a9b5 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 7 Feb 2023 17:24:16 +0100 Subject: [PATCH 097/580] Fix prelevement line : the link to the facture was to a customer facture, even when it was a facturefourn. --- htdocs/compta/prelevement/line.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index cba7777b734..6eb10ce6a1a 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -309,7 +309,11 @@ if ($id) { print img_object($langs->trans("ShowBill"), "bill"); print ' '; - print ''.$obj->ref."\n"; + if ($type == 'bank-transfer') { + print ''.$obj->ref."\n"; + } else { + print ''.$obj->ref."\n"; + } print ''; print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name."\n"; From e71ad2e23bd937ee3d448c365a997f3357dfd63a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 20:12:53 +0100 Subject: [PATCH 098/580] Maxi debug of OAuth module --- htdocs/admin/oauth.php | 21 +- htdocs/admin/oauthlogintokens.php | 31 ++- htdocs/core/lib/functions.lib.php | 4 +- htdocs/core/lib/oauth.lib.php | 12 +- .../modules/oauth/generic_oauthcallback.php | 49 ++-- .../modules/oauth/github_oauthcallback.php | 23 +- .../modules/oauth/google_oauthcallback.php | 5 +- .../modules/oauth/microsoft_oauthcallback.php | 211 ++++++++++++++++++ .../oauth/stripelive_oauthcallback.php | 27 +-- .../oauth/stripetest_oauthcallback.php | 27 +-- .../OAuth/Common/Storage/DoliStorage.php | 6 + .../OAuth/OAuth2/Service/AbstractService.php | 4 +- .../OAuth/OAuth2/Service/Microsoft.php | 64 +++--- htdocs/langs/en_US/admin.lang | 3 +- htdocs/langs/en_US/mails.lang | 1 - htdocs/langs/en_US/oauth.lang | 1 + 16 files changed, 348 insertions(+), 141 deletions(-) create mode 100644 htdocs/core/modules/oauth/microsoft_oauthcallback.php diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 217dfd63cc9..2425f12d9bd 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -84,6 +84,11 @@ if ($action == 'update') { $error++; } } + if (GETPOSTISSET($constvalue.'_TENANT')) { + if (!dolibarr_set_const($db, $constvalue.'_TENANT', GETPOST($constvalue.'_TENANT'), 'chaine', 0, '', $conf->entity)) { + $error++; + } + } if (GETPOSTISSET($constvalue.'_SCOPE')) { if (is_array(GETPOST($constvalue.'_SCOPE'))) { $scopestring = implode(',', GETPOST($constvalue.'_SCOPE')); @@ -128,6 +133,8 @@ if ($action == 'confirm_delete') { $callbacktodel .= '/core/modules/oauth/stripelive_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl); } elseif ($label == 'OAUTH_STRIPE_TEST') { $callbacktodel .= '/core/modules/oauth/stripetest_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl); + } elseif ($label == 'OAUTH_MICROSOFT') { + $callbacktodel .= '/core/modules/oauth/microsoft_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl); } elseif ($label == 'OAUTH_OTHER') { $callbacktodel .= '/core/modules/oauth/generic_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl); } @@ -242,8 +249,10 @@ if (count($listinsetup) > 0) { $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array); $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array); if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); } else { + $keybeforeprovider = $keyforsupportedoauth2array; $keyforprovider = ''; } $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); @@ -337,6 +346,16 @@ if (count($listinsetup) > 0) { print ''; print ''; + // Tenant + if ($keybeforeprovider == 'MICROSOFT') { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + // TODO Move this into token generation ? if ($supported) { if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') { @@ -386,7 +405,7 @@ if (count($listinsetup) > 0) { print '
'; - print $form->buttonsSaveCancel("Modify", ''); + print $form->buttonsSaveCancel("Save", ''); print ''; } diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 9a0532880cd..d6fcc9e0f7c 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -162,8 +162,10 @@ if ($mode == 'setup' && $user->admin) { $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array); $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array); if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); } else { + $keybeforeprovider = $keyforsupportedoauth2array; $keyforprovider = ''; } $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); @@ -179,13 +181,12 @@ if ($mode == 'setup' && $user->admin) { $state = $shortscope; // TODO USe a better state // Define $urltorenew, $urltodelete, $urltocheckperms - // TODO Use array $supportedoauth2array if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') { // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). // We pass this param list in to 'state' because we need it before and after the redirect. // Note: github does not accept csrf key inside the state parameter (only known values) - $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($shortscope).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltocheckperms = 'https://github.com/settings/applications/'; } elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') { @@ -195,17 +196,9 @@ if ($mode == 'setup' && $user->admin) { $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltocheckperms = 'https://security.google.com/settings/security/permissions'; - } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') { - $urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = ''; - $urltocheckperms = ''; - } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') { - $urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = ''; - $urltocheckperms = ''; - } elseif ($keyforsupportedoauth2array = 'OAUTH_OTHER_NAME') { - $urltorenew = $urlwithroot.'/core/modules/oauth/generic_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = ''; + } elseif (!empty($supportedoauth2array[$keyforsupportedoauth2array]['returnurl'])) { + $urltorenew = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltocheckperms = ''; } else { $urltorenew = ''; @@ -220,17 +213,19 @@ if ($mode == 'setup' && $user->admin) { $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); } - // Show value of token $tokenobj = null; // Token require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; // Dolibarr storage - $storage = new DoliStorage($db, $conf); + $storage = new DoliStorage($db, $conf, $keyforprovider); try { + // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' + print $OAUTH_SERVICENAME; $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); } catch (Exception $e) { // Return an error if token not found + //print $e->getMessage(); } // Set other properties @@ -321,7 +316,11 @@ if ($mode == 'setup' && $user->admin) { // Links to delete/checks token if (is_object($tokenobj)) { //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ? - print ''.$langs->trans('DeleteAccess').'
'; + if ($urltodelete) { + print ''.$langs->trans('DeleteAccess').'
'; + } else { + print ''.$langs->trans('GoOnTokenProviderToDeleteToken').'
'; + } } // Request remote token if ($urltorenew) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d47b71d39cf..e94b9d5e4c0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4102,7 +4102,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'proposal', 'puce', 'stock', 'resize', 'service', 'stats', 'trip', 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', - 'github', 'google', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', + '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', @@ -4123,7 +4123,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (in_array($pictowithouttext, array('card', 'bell', 'clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) { $fa = 'far'; } - if (in_array($pictowithouttext, array('black-tie', 'github', 'google', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) { + if (in_array($pictowithouttext, array('black-tie', 'github', 'google', 'microsoft', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) { $fa = 'fab'; } diff --git a/htdocs/core/lib/oauth.lib.php b/htdocs/core/lib/oauth.lib.php index 83359ef1c65..4f504196b47 100644 --- a/htdocs/core/lib/oauth.lib.php +++ b/htdocs/core/lib/oauth.lib.php @@ -25,15 +25,17 @@ // Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) $supportedoauth2array = array( - 'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'availablescopes'=> 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print,admin_directory_user,gmail_full'), + 'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/', 'availablescopes'=> 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print,admin_directory_user,gmail_full', 'returnurl'=>'/core/modules/oauth/google_oauthcallback.php'), ); if (isModEnabled('stripe')) { - $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'availablescopes'=>'read_write'); - $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write'); + $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'', 'availablescopes'=>'read_write', 'returnurl'=>'/core/modules/oauth/stripetest_oauthcallback.php'); + $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write', 'returnurl'=>'/core/modules/oauth/stripelive_oauthcallback.php'); } -$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers', 'availablescopes'=>'user,public_repo'); +$supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers', 'availablescopes'=>'user,public_repo', 'returnurl'=>'/core/modules/oauth/github_oauthcallback.php'); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'availablescopes'=>'Standard'); + $supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'availablescopes'=>'Standard', 'returnurl'=>'/core/modules/oauth/generic_oauthcallback.php'); + // See https://learn.microsoft.com/fr-fr/azure/active-directory/develop/quickstart-register-app#register-an-application + $supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,IMAP.AccessAsUser.All', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php'); } diff --git a/htdocs/core/modules/oauth/generic_oauthcallback.php b/htdocs/core/modules/oauth/generic_oauthcallback.php index 34422111d5d..a394c7f4986 100644 --- a/htdocs/core/modules/oauth/generic_oauthcallback.php +++ b/htdocs/core/modules/oauth/generic_oauthcallback.php @@ -66,7 +66,7 @@ $httpClient = new \OAuth\Common\Http\Client\CurlClient(); $serviceFactory->setHttpClient($httpClient); // Dolibarr storage -$storage = new DoliStorage($db, $conf); +$storage = new DoliStorage($db, $conf, $keyforprovider); // Setup the credentials for the requests $keyforparamid = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_ID'; @@ -77,9 +77,11 @@ $credentials = new Credentials( $currentUri->getAbsoluteUri() ); +$state = GETPOST('state'); + $requestedpermissionsarray = array(); -if (GETPOST('state')) { - $requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back +if ($state) { + $requestedpermissionsarray = explode(',', $state); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back } if ($action != 'delete' && empty($requestedpermissionsarray)) { print 'Error, parameter state is not defined'; @@ -88,7 +90,8 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) { //var_dump($requestedpermissionsarray);exit; // Instantiate the Api service using the credentials, http client and storage mechanism for the token -$apiService = $serviceFactory->createService($genericstring, $credentials, $storage, $requestedpermissionsarray); +// ucfirst(strtolower($genericstring)) must be the name of a class into OAuth/OAuth2/Services/Xxxx +$apiService = $serviceFactory->createService(ucfirst(strtolower($genericstring)), $credentials, $storage, $requestedpermissionsarray); /* var_dump($genericstring.($keyforprovider ? '-'.$keyforprovider : '')); @@ -128,35 +131,25 @@ if ($action == 'delete') { exit(); } -if (GETPOST('code')) { // We are coming from oauth provider page +if (GETPOST('code') || GETPOST('error')) { // We are coming from oauth provider page // We should have //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) - dol_syslog("We are coming from the oauth provider page"); - //llxHeader('',$langs->trans("OAuthSetup")); - - //$linkback=''.$langs->trans("BackToModuleList").''; - //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); - - //print dol_get_fiche_head(); - // retrieve the CSRF state parameter - $state = GETPOSTISSET('state') ? GETPOST('state') : null; - //print ''; + dol_syslog("We are coming from the oauth provider page code=".dol_trunc(GETPOST('code'), 5)." error=".GETPOST('error')); // This was a callback request from service, get the token try { - //var_dump($_GET['code']); //var_dump($state); - //var_dump($apiService); // OAuth\OAuth2\Service\GitHub + //var_dump($apiService); // OAuth\OAuth2\Service\Xxx - //$token = $apiService->requestAccessToken(GETPOST('code'), $state); - $token = $apiService->requestAccessToken(GETPOST('code')); - // Github is a service that does not need state to be stored. - // Into constructor of GitHub, the call - // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) - // has not the ending parameter to true like the Google class constructor. + if (GETPOST('error')) { + setEventMessages(GETPOST('error').' '.GETPOST('error_description'), null, 'errors'); + } else { + //$token = $apiService->requestAccessToken(GETPOST('code'), $state); + $token = $apiService->requestAccessToken(GETPOST('code')); - setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + } $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; unset($_SESSION["backtourlsavedbeforeoauthjump"]); @@ -166,15 +159,17 @@ if (GETPOST('code')) { // We are coming from oauth provider page } catch (Exception $e) { print $e->getMessage(); } -} else { // If entry on page with no parameter, we arrive here +} else { + // If we enter this page without 'code' parameter, we arrive here. This is the case when we want to get the redirect + // to the OAuth provider login page. $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; $_SESSION['oauthstateanticsrf'] = $state; // This may create record into oauth_state before the header redirect. // Creation of record with state in this tables depend on the Provider used (see its constructor). - if (GETPOST('state')) { - $url = $apiService->getAuthorizationUri(array('state' => GETPOST('state'))); + if ($state) { + $url = $apiService->getAuthorizationUri(array('state' => $state)); } else { $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated } diff --git a/htdocs/core/modules/oauth/github_oauthcallback.php b/htdocs/core/modules/oauth/github_oauthcallback.php index 24140718880..7656a1cda37 100644 --- a/htdocs/core/modules/oauth/github_oauthcallback.php +++ b/htdocs/core/modules/oauth/github_oauthcallback.php @@ -65,7 +65,7 @@ $httpClient = new \OAuth\Common\Http\Client\CurlClient(); $serviceFactory->setHttpClient($httpClient); // Dolibarr storage -$storage = new DoliStorage($db, $conf); +$storage = new DoliStorage($db, $conf, $keyforprovider); // Setup the credentials for the requests $keyforparamid = 'OAUTH_GITHUB'.($keyforprovider ? '-'.$keyforprovider : '').'_ID'; @@ -115,30 +115,21 @@ if ($action == 'delete') { exit(); } -if (!empty($_GET['code'])) { // We are coming from oauth provider page +if (GETPOST('code')) { // We are coming from oauth provider page // We should have //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) - dol_syslog("We are coming from the oauth provider page"); - //llxHeader('',$langs->trans("OAuthSetup")); - - //$linkback=''.$langs->trans("BackToModuleList").''; - //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); - - //print dol_get_fiche_head(); - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - //print '
'; + dol_syslog("We are coming from the oauth provider page code=".dol_trunc(GETPOST('code'), 5)); // This was a callback request from service, get the token try { - //var_dump($_GET['code']); //var_dump($state); //var_dump($apiService); // OAuth\OAuth2\Service\GitHub - //$token = $apiService->requestAccessToken($_GET['code'], $state); - $token = $apiService->requestAccessToken($_GET['code']); - // Github is a service that does not need state to be stored. + //$token = $apiService->requestAccessToken(GETPOST('code'), $state); + $token = $apiService->requestAccessToken(GETPOST('code')); + // Github is a service that does not need state to be stored as second paramater of requestAccessToken + // Into constructor of GitHub, the call // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) // has not the ending parameter to true like the Google class constructor. diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index ed0caa1a4ff..c26187e4475 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -137,7 +137,7 @@ if ($action == 'delete') { } if (GETPOST('code')) { // We are coming from oauth provider page. - dol_syslog("We are coming from the oauth provider page keyforprovider=".$keyforprovider); + dol_syslog("We are coming from the oauth provider page keyforprovider=".$keyforprovider." code=".dol_trunc(GETPOST('code'), 5)); // We must validate that the $state is the same than the one into $_SESSION['oauthstateanticsrf'], return error if not. if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) { @@ -146,7 +146,6 @@ if (GETPOST('code')) { // We are coming from oauth provider page. } else { // This was a callback request from service, get the token try { - //var_dump($_GET['code']); //var_dump($state); //var_dump($apiService); // OAuth\OAuth2\Service\Google @@ -193,7 +192,7 @@ if (GETPOST('code')) { // We are coming from oauth provider page. } } } else { - // If we enter this page without 'code' parameter, we arrive here. this is the case when we want to get the redirect + // If we enter this page without 'code' parameter, we arrive here. This is the case when we want to get the redirect // to the OAuth provider login page. $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; diff --git a/htdocs/core/modules/oauth/microsoft_oauthcallback.php b/htdocs/core/modules/oauth/microsoft_oauthcallback.php new file mode 100644 index 00000000000..ed47eec06e1 --- /dev/null +++ b/htdocs/core/modules/oauth/microsoft_oauthcallback.php @@ -0,0 +1,211 @@ + + * Copyright (C) 2015 Frederic 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/modules/oauth/microsoft_oauthcallback.php + * \ingroup oauth + * \brief Page to get oauth callback + */ + +// Load Dolibarr environment +require '../../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; +use OAuth\Common\Storage\DoliStorage; +use OAuth\Common\Consumer\Credentials; +use OAuth\OAuth2\Service\GitHub; + +// Define $urlwithroot +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + +$action = GETPOST('action', 'aZ09'); +$backtourl = GETPOST('backtourl', 'alpha'); +$keyforprovider = GETPOST('keyforprovider', 'aZ09'); +if (empty($keyforprovider) && !empty($_SESSION["oauthkeyforproviderbeforeoauthjump"]) && (GETPOST('code') || $action == 'delete')) { + $keyforprovider = $_SESSION["oauthkeyforproviderbeforeoauthjump"]; +} +$genericstring = 'MICROSOFT'; + + +/** + * Create a new instance of the URI class with the current URI, stripping the query string + */ +$uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); +//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); +//$currentUri->setQuery(''); +$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/microsoft_oauthcallback.php'); + + +/** + * Load the credential for the service + */ + +/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */ +$serviceFactory = new \OAuth\ServiceFactory(); +$httpClient = new \OAuth\Common\Http\Client\CurlClient(); +// TODO Set options for proxy and timeout +// $params=array('CURLXXX'=>value, ...) +//$httpClient->setCurlParameters($params); +$serviceFactory->setHttpClient($httpClient); + +// Dolibarr storage +$storage = new DoliStorage($db, $conf, $keyforprovider); + +// Setup the credentials for the requests +$keyforparamid = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_ID'; +$keyforparamsecret = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_SECRET'; +$keyforparamtenant = 'OAUTH_'.$genericstring.($keyforprovider ? '-'.$keyforprovider : '').'_TENANT'; +$credentials = new Credentials( + getDolGlobalString($keyforparamid), + getDolGlobalString($keyforparamsecret), + $currentUri->getAbsoluteUri() +); + +$state = GETPOST('state'); + +$requestedpermissionsarray = array(); +if ($state) { + $requestedpermissionsarray = explode(',', $state); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back +} +if ($action != 'delete' && empty($requestedpermissionsarray)) { + print 'Error, parameter state is not defined'; + exit; +} +//var_dump($requestedpermissionsarray);exit; + +// Instantiate the Api service using the credentials, http client and storage mechanism for the token +// ucfirst(strtolower($genericstring)) must be the name of a class into OAuth/OAuth2/Services/Xxxx +// $requestedpermissionsarray contains list of scopes. +// Conversion into URL is done by Reflection on constant with name SCOPE_scope_in_uppercase +try { + $apiService = $serviceFactory->createService(ucfirst(strtolower($genericstring)), $credentials, $storage, $requestedpermissionsarray); +} catch (Exception $e) { + print $e->getMessage(); + exit; +} +/* +var_dump($genericstring.($keyforprovider ? '-'.$keyforprovider : '')); +var_dump($credentials); +var_dump($storage); +var_dump($requestedpermissionsarray); +*/ + +if (empty($apiService)) { + print 'Error, failed to create serviceFactory'; + exit; +} + +// access type needed to have oauth provider refreshing token +//$apiService->setAccessType('offline'); + +$langs->load("oauth"); + +if (!getDolGlobalString($keyforparamid)) { + accessforbidden('Setup of service is not complete. Customer ID is missing'); +} +if (!getDolGlobalString($keyforparamsecret)) { + accessforbidden('Setup of service is not complete. Secret key is missing'); +} + + +/* + * Actions + */ + +if ($action == 'delete') { + $storage->clearToken($genericstring); + + setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); + + header('Location: '.$backtourl); + exit(); +} + +//dol_syslog("GET=".join(',', $_GET)); + + +if (GETPOST('code') || GETPOST('error')) { // We are coming from oauth provider page + // We should have + //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) + + dol_syslog("We are coming from the oauth provider page code=".dol_trunc(GETPOST('code'), 5)." error=".GETPOST('error')); + + // This was a callback request from service, get the token + try { + //var_dump($state); + //var_dump($apiService); // OAuth\OAuth2\Service\Microsoft + + if (GETPOST('error')) { + setEventMessages(GETPOST('error').' '.GETPOST('error_description'), null, 'errors'); + } else { + $apiService->tenant = getDolGlobalString($keyforparamtenant); + + //$token = $apiService->requestAccessToken(GETPOST('code'), $state); + $token = $apiService->requestAccessToken(GETPOST('code')); + // Microsoft is a service that does not need state to be stored as second paramater of requestAccessToken + + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + } + + $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; + unset($_SESSION["backtourlsavedbeforeoauthjump"]); + + header('Location: '.$backtourl); + exit(); + } catch (Exception $e) { + print $e->getMessage(); + } +} else { + // If we enter this page without 'code' parameter, we arrive here. This is the case when we want to get the redirect + // to the OAuth provider login page. + $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; + $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; + $_SESSION['oauthstateanticsrf'] = $state; + + //if (!preg_match('/^forlogin/', $state)) { + // $apiService->setApprouvalPrompt('auto'); + //} + $apiService->tenant = getDolGlobalString($keyforparamtenant); + + // This may create record into oauth_state before the header redirect. + // Creation of record with state in this tables depend on the Provider used (see its constructor). + if ($state) { + $url = $apiService->getAuthorizationUri(array('state' => $state)); + } else { + $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + } + + // Show url to get authorization + //var_dump((string) $url);exit; + dol_syslog("Redirect to url=".$url); + + // we go on oauth provider authorization page + header('Location: '.$url); + exit(); +} + + +/* + * View + */ + +// No view at all, just actions + +$db->close(); diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php index ef35b6573cc..bc16b44461a 100644 --- a/htdocs/core/modules/oauth/stripelive_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -65,7 +65,7 @@ $httpClient = new \OAuth\Common\Http\Client\CurlClient(); $serviceFactory->setHttpClient($httpClient); // Dolibarr storage -$storage = new DoliStorage($db, $conf); +$storage = new DoliStorage($db, $conf, $keyforprovider); // Setup the credentials for the requests $keyforparamid = 'OAUTH_STRIPE_LIVE'.($keyforprovider ? '-'.$keyforprovider : '').'_ID'; @@ -121,33 +121,20 @@ if ($action == 'delete') { exit(); } -if (!empty($_GET['code'])) { // We are coming from oauth provider page +if (GETPOST('code')) { // We are coming from oauth provider page // We should have //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) - dol_syslog("We are coming from the oauth provider page"); - //llxHeader('',$langs->trans("OAuthSetup")); - - //$linkback=''.$langs->trans("BackToModuleList").''; - //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); - - //print dol_get_fiche_head(); - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - //print '
'; + dol_syslog("We are coming from the oauth provider page code=".dol_trunc(GETPOST('code'), 5)); // This was a callback request from service, get the token try { - //var_dump($_GET['code']); //var_dump($state); - //var_dump($apiService); // OAuth\OAuth2\Service\GitHub + //var_dump($apiService); // OAuth\OAuth2\Service\Stripe - //$token = $apiService->requestAccessToken($_GET['code'], $state); - $token = $apiService->requestAccessToken($_GET['code']); - // Github is a service that does not need state to be stored. - // Into constructor of GitHub, the call - // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) - // has not the ending parameter to true like the Google class constructor. + //$token = $apiService->requestAccessToken(GETPOST('code'), $state); + $token = $apiService->requestAccessToken(GETPOST('code')); + // Stripe is a service that does not need state to be stored as second paramater of requestAccessToken setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token diff --git a/htdocs/core/modules/oauth/stripetest_oauthcallback.php b/htdocs/core/modules/oauth/stripetest_oauthcallback.php index a5d481dbef5..12d133da14c 100644 --- a/htdocs/core/modules/oauth/stripetest_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripetest_oauthcallback.php @@ -65,7 +65,7 @@ $httpClient = new \OAuth\Common\Http\Client\CurlClient(); $serviceFactory->setHttpClient($httpClient); // Dolibarr storage -$storage = new DoliStorage($db, $conf); +$storage = new DoliStorage($db, $conf, $keyforprovider); // Setup the credentials for the requests $keyforparamid = 'OAUTH_STRIPE_TEST'.($keyforprovider ? '-'.$keyforprovider : '').'_ID'; @@ -121,33 +121,20 @@ if ($action == 'delete') { exit(); } -if (!empty($_GET['code'])) { // We are coming from oauth provider page +if (GETPOST('code')) { // We are coming from oauth provider page // We should have //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) - dol_syslog("We are coming from the oauth provider page"); - //llxHeader('',$langs->trans("OAuthSetup")); - - //$linkback=''.$langs->trans("BackToModuleList").''; - //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); - - //print dol_get_fiche_head(); - // retrieve the CSRF state parameter - $state = isset($_GET['state']) ? $_GET['state'] : null; - //print '
'; + dol_syslog("We are coming from the oauth provider page code=".dol_trunc(GETPOST('code'), 5)); // This was a callback request from service, get the token try { - //var_dump($_GET['code']); //var_dump($state); - //var_dump($apiService); // OAuth\OAuth2\Service\GitHub + //var_dump($apiService); // OAuth\OAuth2\Service\Stripe - //$token = $apiService->requestAccessToken($_GET['code'], $state); - $token = $apiService->requestAccessToken($_GET['code']); - // Github is a service that does not need state to be stored. - // Into constructor of GitHub, the call - // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) - // has not the ending parameter to true like the Google class constructor. + //$token = $apiService->requestAccessToken(GETPOST('code'), $state); + $token = $apiService->requestAccessToken(GETPOST('code')); + // Stripe is a service that does not need state to be stored as second paramater of requestAccessToken setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 3e09e53fbe6..cf280262e99 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -126,6 +126,9 @@ class DoliStorage implements TokenStorageInterface $sql.= " SET token = '".$this->db->escape($serializedToken)."'"; $sql.= " WHERE rowid = ".((int) $obj['rowid']); $resql = $this->db->query($sql); + if (!$resql) { + dol_print_error($this->db); + } } else { // save $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, token, entity, datec)"; @@ -133,6 +136,9 @@ class DoliStorage implements TokenStorageInterface $sql .= " '".$this->db->idate(dol_now())."'"; $sql .= ")"; $resql = $this->db->query($sql); + if (!$resql) { + dol_print_error($this->db); + } } //print $sql; diff --git a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php index 996506afbec..0de0219306a 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php +++ b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php @@ -56,8 +56,8 @@ abstract class AbstractService extends BaseAbstractService implements ServiceInt $this->stateParameterInAuthUrl = $stateParameterInAutUrl; foreach ($scopes as $scope) { - if (!$this->isValidScope($scope)) { - throw new InvalidScopeException('Scope ' . $scope . ' is not valid for service ' . get_class($this)); + if (!$this->isValidScope($scope)) { + throw new InvalidScopeException('Scope ' . $scope . ' is not valid for service ' . get_class($this)); } } diff --git a/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php b/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php index c815b22bd44..b1b6a042c01 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php +++ b/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php @@ -12,30 +12,35 @@ use OAuth\Common\Http\Uri\UriInterface; class Microsoft extends AbstractService { - const SCOPE_BASIC = 'wl.basic'; - const SCOPE_OFFLINE = 'wl.offline_access'; - const SCOPE_SIGNIN = 'wl.signin'; - const SCOPE_BIRTHDAY = 'wl.birthday'; - const SCOPE_CALENDARS = 'wl.calendars'; - const SCOPE_CALENDARS_UPDATE = 'wl.calendars_update'; - const SCOPE_CONTACTS_BIRTHDAY = 'wl.contacts_birthday'; - const SCOPE_CONTACTS_CREATE = 'wl.contacts_create'; - const SCOPE_CONTACTS_CALENDARS = 'wl.contacts_calendars'; - const SCOPE_CONTACTS_PHOTOS = 'wl.contacts_photos'; - const SCOPE_CONTACTS_SKYDRIVE = 'wl.contacts_skydrive'; - const SCOPE_EMAILS = 'wl.emails'; - const SCOPE_EVENTS_CREATE = 'wl.events_create'; - const SCOPE_MESSENGER = 'wl.messenger'; - const SCOPE_PHONE_NUMBERS = 'wl.phone_numbers'; - const SCOPE_PHOTOS = 'wl.photos'; - const SCOPE_POSTAL_ADDRESSES = 'wl.postal_addresses'; - const SCOPE_SHARE = 'wl.share'; - const SCOPE_SKYDRIVE = 'wl.skydrive'; - const SCOPE_SKYDRIVE_UPDATE = 'wl.skydrive_update'; - const SCOPE_WORK_PROFILE = 'wl.work_profile'; - const SCOPE_APPLICATIONS = 'wl.applications'; - const SCOPE_APPLICATIONS_CREATE = 'wl.applications_create'; - const SCOPE_IMAP = 'wl.imap'; + const SCOPE_BASIC = 'basic'; + const SCOPE_OFFLINE_ACCESS = 'offline_access'; + const SCOPE_SIGNIN = 'signin'; + const SCOPE_BIRTHDAY = 'birthday'; + const SCOPE_CALENDARS = 'calendars'; + const SCOPE_CALENDARS_UPDATE = 'calendars_update'; + const SCOPE_CONTACTS_BIRTHDAY = 'contacts_birthday'; + const SCOPE_CONTACTS_CREATE = 'contacts_create'; + const SCOPE_CONTACTS_CALENDARS = 'contacts_calendars'; + const SCOPE_CONTACTS_PHOTOS = 'contacts_photos'; + const SCOPE_CONTACTS_SKYDRIVE = 'contacts_skydrive'; + const SCOPE_EMAIL = 'email'; + const SCOPE_EVENTS_CREATE = 'events_create'; + const SCOPE_MESSENGER = 'messenger'; + const SCOPE_OPENID = 'openid'; + const SCOPE_PHONE_NUMBERS = 'phone_numbers'; + const SCOPE_PHOTOS = 'photos'; + const SCOPE_POSTAL_ADDRESSES = 'postal_addresses'; + const SCOPE_PROFILE = 'profile'; + const SCOPE_SHARE = 'share'; + const SCOPE_SKYDRIVE = 'skydrive'; + const SCOPE_SKYDRIVE_UPDATE = 'skydrive_update'; + const SCOPE_WORK_PROFILE = 'work_profile'; + const SCOPE_APPLICATIONS = 'applications'; + const SCOPE_APPLICATIONS_CREATE = 'applications_create'; + const SCOPE_IMAP = 'imap'; + const SOCPE_IMAP_AccessAsUser_All='IMAP.AccessAsUser.All'; + + public string $tenant; /** * MS uses some magical not officialy supported scope to get even moar info like full emailaddresses. @@ -48,7 +53,8 @@ class Microsoft extends AbstractService * * Considering this scope is not officially supported: use with care */ - const SCOPE_CONTACTS_EMAILS = 'wl.contacts_emails'; + const SCOPE_CONTACTS_EMAILS = 'contacts_emails'; + public function __construct( CredentialsInterface $credentials, @@ -69,7 +75,9 @@ class Microsoft extends AbstractService */ public function getAuthorizationEndpoint() { - return new Uri('https://login.live.com/oauth20_authorize.srf'); + //return new Uri('https://login.live.com/oauth20_authorize.srf'); + //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize'); + return new Uri('https://login.microsoftonline.com/'.$this->tenant.'/oauth2/v2.0/authorize'); } /** @@ -77,7 +85,9 @@ class Microsoft extends AbstractService */ public function getAccessTokenEndpoint() { - return new Uri('https://login.live.com/oauth20_token.srf'); + //return new Uri('https://login.live.com/oauth20_token.srf'); + //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/token'); + return new Uri('https://login.microsoftonline.com/'.$this->tenant.'/oauth2/v2.0/token'); } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 66210ef9d52..29551ac0874 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2348,4 +2348,5 @@ AllowExternalDownload=Allow external download (without login, using a shared lin DeadlineDayVATSubmission=Deadline day for vat submission on the next month MaxNumberOfAttachementOnForms=Max number of joinded files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s -MAIN_IMAP_USE_PHPIMAP=Use the PHP-IMAP library for IMAP instead of native PHP IMAP. This also allow the use of OAuth2 connection for IMAP. \ No newline at end of file +EMailsInGoingDesc=Incoming emails are managed by the module %s. You must enable and configure it if you need to support ingoing emails. +MAIN_IMAP_USE_PHPIMAP=Use the PHP-IMAP library for IMAP instead of native PHP IMAP. This also allow the use of OAuth2 connection for IMAP (module OAuth must also be activated). diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index a112de8ceb2..f83637c9c40 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -179,4 +179,3 @@ RecordCreatedByEmailCollector=Record created by the Email Collector %s from emai DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new contact DefaultStatusEmptyMandatory=Empty but mandatory WarningLimitSendByDay=WARNING: The setup or contract of your instance limits your number of emails per day to %s. Trying to send more may result in having your instance slow down or suspended. Please contact your support if you need a higher quota. -EMailsInGoingDesc=Incoming emails are managed by the module %s. You must enable and configure it if you need to support ingoing emails. diff --git a/htdocs/langs/en_US/oauth.lang b/htdocs/langs/en_US/oauth.lang index 01bb08e38bd..e773c470b30 100644 --- a/htdocs/langs/en_US/oauth.lang +++ b/htdocs/langs/en_US/oauth.lang @@ -33,6 +33,7 @@ OAUTH_STRIPE_TEST_NAME=OAuth Stripe Test OAUTH_STRIPE_LIVE_NAME=OAuth Stripe Live OAUTH_ID=OAuth ID OAUTH_SECRET=OAuth secret +OAUTH_TENANT=OAuth tenant OAuthProviderAdded=OAuth provider added AOAuthEntryForThisProviderAndLabelAlreadyHasAKey=An OAuth entry for this provider and label already exists URLOfServiceForAuthorization=URL provided by OAuth service for authentication From d82a8dc7b137a07d93561c8bf9bb270146b0033a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Feb 2023 20:35:11 +0100 Subject: [PATCH 099/580] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 29551ac0874..46339a7bf6d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2349,4 +2349,4 @@ DeadlineDayVATSubmission=Deadline day for vat submission on the next month MaxNumberOfAttachementOnForms=Max number of joinded files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s EMailsInGoingDesc=Incoming emails are managed by the module %s. You must enable and configure it if you need to support ingoing emails. -MAIN_IMAP_USE_PHPIMAP=Use the PHP-IMAP library for IMAP instead of native PHP IMAP. This also allow the use of OAuth2 connection for IMAP (module OAuth must also be activated). +MAIN_IMAP_USE_PHPIMAP=Use the PHP-IMAP library for IMAP instead of native PHP IMAP. This also allows the use of an OAuth2 connection for IMAP (module OAuth must also be activated). From eef350d1d37af2a9d531d73f292956c529d84e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Feb 2023 21:44:39 +0100 Subject: [PATCH 100/580] add ajax tooltip on dolresource --- .../adherents/class/adherent_type.class.php | 3 +- htdocs/core/ajax/ajaxtooltip.php | 5 +- .../class/emailcollector.class.php | 3 +- htdocs/langs/en_US/dict.lang | 1 + htdocs/resource/class/dolresource.class.php | 55 +++++++++++++++---- 5 files changed, 52 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 9819110e6bc..a744ce71bdc 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -698,8 +698,9 @@ class AdherentType extends CommonObject { global $conf, $langs, $user; - $datas = []; + $langs->load('members'); + $datas = []; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("MemberType").' '.$this->getLibStatut(4); $datas['label'] = '
'.$langs->trans("Label").': '.$this->label; if (isset($this->subscription)) { diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 7afbc88ae17..d10b0f1a43e 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -154,6 +154,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'user/class'; $module = 'user'; $myobject = 'usergroup'; +} elseif ($objecttype == 'dolresource') { + $classpath = 'resource/class'; + $module = 'resource'; + $myobject = 'dolresource'; } // Generic case for $classfile and $classname @@ -189,7 +193,6 @@ if ($objecttype == 'invoice_supplier') { $classfile = 'mailing'; $classname = 'Mailing'; } elseif ($objecttype == 'adherent_type') { - $langs->load('members'); $classpath = 'adherents/class'; $classfile = 'adherent_type'; $module = 'adherent'; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 13fcbfbef6b..f832a6ff842 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -382,11 +382,10 @@ class EmailCollector extends CommonObject // Clear fields $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; + $object->label = $langs->trans("CopyOf")." ".$object->label; if (empty($object->host)) { $object->host = 'imap.example.com'; } - // ... // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index 00ab5a05f24..e3b159e50de 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -247,6 +247,7 @@ CountryJE=Jersey CountryME=Montenegro CountryBL=Saint Barthelemy CountryMF=Saint Martin +CountryXK=Kosovo ##### Civilities ##### CivilityMME=Mrs. diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 99cc586cbb9..5d0c0481b98 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -52,6 +52,9 @@ class Dolresource extends CommonObject public $type_label; + /** + * @var string description + */ public $description; public $fk_country; @@ -761,6 +764,33 @@ class Dolresource extends CommonObject } } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('resource'); + + $datas = []; + + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Resource").''; + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + /*if (isset($this->status)) { + $datas['status'] = '
' . $langs->trans("Status").": ".$this->getLibStatut(5); + }*/ + if (isset($this->type_label)) { + $datas['label'] = '
'.$langs->trans("ResourceType").": ".$this->type_label; + } + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * @@ -777,15 +807,18 @@ class Dolresource extends CommonObject global $conf, $langs, $hookmanager; $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("Resource").''; - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - /*if (isset($this->status)) { - $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5); - }*/ - if (isset($this->type_label)) { - $label .= '
'.$langs->trans("ResourceType").": ".$this->type_label; + $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 = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/resource/card.php?id='.$this->id; @@ -806,8 +839,8 @@ class Dolresource extends CommonObject $label = $langs->trans("ShowMyObject"); $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.'"' : ''); } @@ -820,7 +853,7 @@ class Dolresource extends CommonObject $result .= $linkstart; 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); } if ($withpicto != 2) { $result .= $this->ref; From 39ec2331384243252bb45212c984c818ae838dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Feb 2023 21:52:33 +0100 Subject: [PATCH 101/580] add count extrafields in admin dolresource --- htdocs/core/lib/resource.lib.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index ebfbaf224f6..1fa2aa2f2e1 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2016 Gilles Poirier + * Copyright (C) 2013 Jean-François Ferry + * Copyright (C) 2016 Gilles Poirier + * 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 @@ -26,7 +27,7 @@ /** * Prepare head for tabs * - * @param Object $object Object + * @param Dolresource $object Object * @return array Array of head entries */ function resource_prepare_head($object) @@ -114,7 +115,10 @@ function resource_prepare_head($object) function resource_admin_prepare_head() { - global $langs, $conf, $user; + global $conf, $db, $langs, $user; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('resource'); $h = 0; $head = array(); @@ -132,6 +136,10 @@ function resource_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/resource_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['resource']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; From 019802ec33a75f61530dddc2fbd8adfda37585e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Feb 2023 22:12:47 +0100 Subject: [PATCH 102/580] add ajax tooltip on project --- htdocs/projet/class/project.class.php | 88 ++++++++++++++++++--------- 1 file changed, 60 insertions(+), 28 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6eb7384c11d..adc617e55c2 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1244,6 +1244,50 @@ class Project extends CommonObject return dolGetStatus($langs->transnoentitiesnoconv($this->statuts_long[$status]), $langs->transnoentitiesnoconv($this->statuts_short[$status]), '', $statusClass, $mode); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('projects'); + $option = $params['option'] ?? ''; + $moreinpopup = $params['morinpopup'] ?? ''; + + $datas = []; + if ($option != 'nolink') { + $datas['picto'] = img_picto('', $this->picto, 'class="pictofixedwidth"').' '.$langs->trans("Project").''; + } + if (isset($this->status)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['ref'] = (isset($datas['picto']) ? '
' : '').''.$langs->trans('Ref').': '.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto + $datas['label'] = '
'.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto + if (isset($this->public)) { + $datas['visibility'] = '
'.$langs->trans("Visibility").": "; + $datas['visibility'] .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject")); + } + if (!empty($this->thirdparty_name)) { + $datas['thirdparty'] = '
'.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto + } + if (!empty($this->date_start)) { + $datas['datestart'] = '
'.$langs->trans('DateStart').': '.dol_print_date($this->date_start, 'day'); // The space must be after the : to not being explode when showing the title in img_picto + } + if (!empty($this->date_end)) { + $datas['dateend'] = '
'.$langs->trans('DateEnd').': '.dol_print_date($this->date_end, 'day'); // The space must be after the : to not being explode when showing the title in img_picto + } + if ($moreinpopup) { + $datas['moreinpopup'] = '
'.$moreinpopup; + } + + return $datas; + } + /** * Return clickable name (with picto eventually) * @@ -1269,32 +1313,20 @@ class Project extends CommonObject if (!empty($conf->global->PROJECT_OPEN_ALWAYS_ON_TAB)) { $option = $conf->global->PROJECT_OPEN_ALWAYS_ON_TAB; } - - $label = ''; - if ($option != 'nolink') { - $label = img_picto('', $this->picto, 'class="pictofixedwidth"').' '.$langs->trans("Project").''; - } - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= ($label ? '
' : '').''.$langs->trans('Ref').': '.$this->ref; // The space must be after the : to not being explode when showing the title in img_picto - $label .= ($label ? '
' : '').''.$langs->trans('Label').': '.$this->title; // The space must be after the : to not being explode when showing the title in img_picto - if (isset($this->public)) { - $label .= '
'.$langs->trans("Visibility").": "; - $label .= ($this->public ? img_picto($langs->trans('SharedProject'), 'world', 'class="pictofixedwidth"').$langs->trans("SharedProject") : img_picto($langs->trans('PrivateProject'), 'private', 'class="pictofixedwidth"').$langs->trans("PrivateProject")); - } - if (!empty($this->thirdparty_name)) { - $label .= ($label ? '
' : '').''.$langs->trans('ThirdParty').': '.$this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto - } - if (!empty($this->date_start)) { - $label .= ($label ? '
' : '').''.$langs->trans('DateStart').': '.dol_print_date($this->date_start, 'day'); // The space must be after the : to not being explode when showing the title in img_picto - } - if (!empty($this->date_end)) { - $label .= ($label ? '
' : '').''.$langs->trans('DateEnd').': '.dol_print_date($this->date_end, 'day'); // The space must be after the : to not being explode when showing the title in img_picto - } - if ($moreinpopup) { - $label .= '
'.$moreinpopup; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'moreinpopup' => $moreinpopup, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); $url = ''; if ($option != 'nolink') { @@ -1325,8 +1357,8 @@ class Project extends CommonObject $label = $langs->trans("ShowProject"); $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.'"' : ''); } @@ -1342,7 +1374,7 @@ class Project extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : 'class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').'classfortooltip pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="pictofixedwidth"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'pictofixedwidth ' : '').$classfortooltip.' pictofixedwidth em088"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From 411fbc1a045e877d3849e203bdd0cdf52cb69e7e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 00:13:42 +0100 Subject: [PATCH 103/580] FIX Bug in php-imap library. Fatal error if imap connet fails --- .../webklex/php-imap/src/Connection/Protocols/Protocol.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/webklex/php-imap/src/Connection/Protocols/Protocol.php b/htdocs/includes/webklex/php-imap/src/Connection/Protocols/Protocol.php index ef01d46ec9b..6087ac55b75 100644 --- a/htdocs/includes/webklex/php-imap/src/Connection/Protocols/Protocol.php +++ b/htdocs/includes/webklex/php-imap/src/Connection/Protocols/Protocol.php @@ -190,7 +190,7 @@ abstract class Protocol implements ProtocolInterface { STREAM_CLIENT_CONNECT, stream_context_create($this->defaultSocketOptions($transport)) ); - stream_set_timeout($stream, $timeout); + //stream_set_timeout($stream, $timeout); // Hang id $strem empty and already done line 199 if (!$stream) { throw new ConnectionFailedException($errstr, $errno); From 310fd4e369c5c38d8d99384f2c71e4d5d3e5d6e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 01:28:14 +0100 Subject: [PATCH 104/580] Debug IMAP-PHP for MS --- htdocs/admin/emailcollector_card.php | 205 +++++++++--------- htdocs/admin/oauthlogintokens.php | 6 +- htdocs/core/class/CMailFile.class.php | 4 +- htdocs/core/lib/oauth.lib.php | 2 +- htdocs/core/lib/security.lib.php | 3 +- .../modules/oauth/google_oauthcallback.php | 2 + .../modules/oauth/microsoft_oauthcallback.php | 4 +- .../modules/printing/printgcp.modules.php | 19 +- .../class/emailcollector.class.php | 2 +- .../OAuth/Common/Storage/DoliStorage.php | 63 +++++- .../OAuth/OAuth2/Service/Microsoft.php | 21 +- htdocs/printing/admin/printing.php | 4 +- 12 files changed, 204 insertions(+), 131 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 8dfafb19b63..462839245fa 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -107,6 +107,7 @@ $permissiondellink = $user->admin; // Used by the include of actions_dellink.inc $permissiontoadd = $user->admin; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $debuginfo = ''; +$error = 0; /* @@ -121,8 +122,6 @@ if ($reshook < 0) { } if (empty($reshook)) { - $error = 0; - $permissiontoadd = 1; $permissiontodelete = 1; if (empty($backtopage)) { @@ -397,104 +396,112 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $connectstringsource = ''; $connectstringtarget = ''; - if (function_exists('imap_open')) { - // Note: $object->host has been loaded by the fetch - $usessl = 1; + // Note: $object->host has been loaded by the fetch + $usessl = 1; - $connectstringserver = $object->getConnectStringIMAP($usessl); + $connectstringserver = $object->getConnectStringIMAP($usessl); - if ($action == 'scan') { - if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { - if ($object->acces_type == 1) { - // Mode OAUth2 with PHP-IMAP - require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array - $keyforsupportedoauth2array = $object->oauth_service; - if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { - $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); - } else { - $keyforprovider = ''; - } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); - $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; - - $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); - - require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; - //$debugtext = "Host: ".$this->host."
Port: ".$this->port."
Login: ".$this->login."
Password: ".$this->password."
access type: ".$this->acces_type."
oauth service: ".$this->oauth_service."
Max email per collect: ".$this->maxemailpercollect; - //dol_syslog($debugtext); - - $storage = new DoliStorage($db, $conf); - - try { - $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); - $expire = true; - // Is token expired or will token expire in the next 30 seconds - // if (is_object($tokenobj)) { - // $expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30)); - // } - // Token expired so we refresh it - if (is_object($tokenobj) && $expire) { - $credentials = new Credentials( - getDolGlobalString('OAUTH_'.$object->oauth_service.'_ID'), - getDolGlobalString('OAUTH_'.$object->oauth_service.'_SECRET'), - getDolGlobalString('OAUTH_'.$object->oauth_service.'_URLAUTHORIZE') - ); - $serviceFactory = new \OAuth\ServiceFactory(); - $oauthname = explode('-', $OAUTH_SERVICENAME); - // ex service is Google-Emails we need only the first part Google - $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); - // We have to save the token because Google give it only once - $refreshtoken = $tokenobj->getRefreshToken(); - $tokenobj = $apiService->refreshAccessToken($tokenobj); - $tokenobj->setRefreshToken($refreshtoken); - $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); - } - $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); - if (is_object($tokenobj)) { - $token = $tokenobj->getAccessToken(); - } else { - $object->error = "Token not found"; - return -1; - } - } catch (Exception $e) { - print $e->getMessage(); - } - - $cm = new ClientManager(); - $client = $cm->make([ - 'host' => $object->host, - 'port' => $object->port, - 'encryption' => 'ssl', - 'validate_cert' => true, - 'protocol' => 'imap', - 'username' => $object->login, - 'password' => $token, - 'authentication' => "oauth", - ]); + if ($action == 'scan') { + if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { + if ($object->acces_type == 1) { + // Mode OAUth2 with PHP-IMAP + require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array + $keyforsupportedoauth2array = $object->oauth_service; + if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); } else { - // Mode login/pass with PHP-IMAP - $cm = new ClientManager(); - $client = $cm->make([ - 'host' => $object->host, - 'port' => $object->port, - 'encryption' => 'ssl', - 'validate_cert' => true, - 'protocol' => 'imap', - 'username' => $object->login, - 'password' => $object->password, - 'authentication' => "login", - ]); + $keyforprovider = ''; } + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; + + $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : '')); + + require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; + //$debugtext = "Host: ".$this->host."
Port: ".$this->port."
Login: ".$this->login."
Password: ".$this->password."
access type: ".$this->acces_type."
oauth service: ".$this->oauth_service."
Max email per collect: ".$this->maxemailpercollect; + //dol_syslog($debugtext); + + $storage = new DoliStorage($db, $conf, $keyforprovider); + + try { + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + $expire = true; + // Is token expired or will token expire in the next 30 seconds + // if (is_object($tokenobj)) { + // $expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30)); + // } + // Token expired so we refresh it + if (is_object($tokenobj) && $expire) { + $credentials = new Credentials( + getDolGlobalString('OAUTH_'.$object->oauth_service.'_ID'), + getDolGlobalString('OAUTH_'.$object->oauth_service.'_SECRET'), + getDolGlobalString('OAUTH_'.$object->oauth_service.'_URLAUTHORIZE') + ); + $serviceFactory = new \OAuth\ServiceFactory(); + $oauthname = explode('-', $OAUTH_SERVICENAME); + // ex service is Google-Emails we need only the first part Google + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + // We have to save the token because Google give it only once + $refreshtoken = $tokenobj->getRefreshToken(); + $tokenobj = $apiService->refreshAccessToken($tokenobj); + $tokenobj->setRefreshToken($refreshtoken); + $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); + } + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + if (is_object($tokenobj)) { + $token = $tokenobj->getAccessToken(); + } else { + $error++; + $morehtml .= "Token not found"; + } + } catch (Exception $e) { + $error++; + $morehtml .= $e->getMessage(); + } + + if (empty($object->login)) { + $error++; + $morehtml .= 'Error: Login is empty. Must be email owner when using MAIN_IMAP_USE_PHPIMAP and OAuth.'; + } + + $cm = new ClientManager(); + $client = $cm->make([ + 'host' => $object->host, + 'port' => $object->port, + 'encryption' => 'ssl', + 'validate_cert' => true, + 'protocol' => 'imap', + 'username' => $object->login, + 'password' => $token, + 'authentication' => "oauth", + ]); + } else { + // Mode login/pass with PHP-IMAP + $cm = new ClientManager(); + $client = $cm->make([ + 'host' => $object->host, + 'port' => $object->port, + 'encryption' => 'ssl', + 'validate_cert' => true, + 'protocol' => 'imap', + 'username' => $object->login, + 'password' => $object->password, + 'authentication' => "login", + ]); + } + if (!$error) { try { $client->connect(); - } catch (ConnectionFailedException $e) { - print $e->getMessage(); - } - $f = $client->getFolders(false, $object->source_directory); - $nbemail = $f[0]->examine()["exists"]; - $morehtml .= $nbemail; - } else { + $f = $client->getFolders(false, $object->source_directory); + $nbemail = $f[0]->examine()["exists"]; + $morehtml .= $nbemail; + } catch (ConnectionFailedException $e) { + $morehtml .= 'ConnectionFailedException '.$e->getMessage(); + } + } + } else { + if (function_exists('imap_open')) { try { if ($sourcedir) { //$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); @@ -521,7 +528,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //dol_syslog("end imap_open connection=".var_export($connection, true)); } catch (Exception $e) { - print $e->getMessage(); + $morehtml .= $e->getMessage(); } if (!$connection) { @@ -540,16 +547,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea dol_syslog("Imap close"); imap_close($connection); } + } else { + $morehtml .= 'IMAP functions not available on your PHP. '; } - } else { - $morehtml .= ''.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").''; } - - $morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); } else { - $morehtml .= 'IMAP functions not available on your PHP. '; + $morehtml .= ''.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").''; } + $morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'
'.$morehtml.'
', '', 0, '', '', 0, ''); print '
'; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index d6fcc9e0f7c..5c0ecdb007d 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -221,8 +221,11 @@ if ($mode == 'setup' && $user->admin) { $storage = new DoliStorage($db, $conf, $keyforprovider); try { // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' - print $OAUTH_SERVICENAME; + print ''."\n"; $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + //print $storage->token.'
'; + //print $tokenobj->getExtraParams()['id_token'].'
'; + //print $tokenobj->getAccessToken().'
'; } catch (Exception $e) { // Return an error if token not found //print $e->getMessage(); @@ -342,7 +345,6 @@ if ($mode == 'setup' && $user->admin) { print '
'; print ''; 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 "
'; if (is_object($tokenobj)) { - //var_dump($tokenobj); $tokentoshow = $tokenobj->getAccessToken(); print ''.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'
'; //print 'Refresh: '.$tokenobj->getRefreshToken().'
'; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index a7a87e1ce6e..f6611669556 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -908,7 +908,7 @@ class CMailFile require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; - $storage = new DoliStorage($db, $conf); + $storage = new DoliStorage($db, $conf, $keyforprovider); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); $expire = false; @@ -1030,7 +1030,7 @@ class CMailFile require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; - $storage = new DoliStorage($db, $conf); + $storage = new DoliStorage($db, $conf, $keyforprovider); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); diff --git a/htdocs/core/lib/oauth.lib.php b/htdocs/core/lib/oauth.lib.php index 4f504196b47..2074485cd6e 100644 --- a/htdocs/core/lib/oauth.lib.php +++ b/htdocs/core/lib/oauth.lib.php @@ -35,7 +35,7 @@ $supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', ' if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'availablescopes'=>'Standard', 'returnurl'=>'/core/modules/oauth/generic_oauthcallback.php'); // See https://learn.microsoft.com/fr-fr/azure/active-directory/develop/quickstart-register-app#register-an-application - $supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,IMAP.AccessAsUser.All', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php'); + $supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,IMAP.AccessAsUser.All,SMTP.Send,Mail.Read,Mail.Send', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php'); } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 51c3434a456..a097ba23e3e 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -119,6 +119,7 @@ function dolGetRandomBytes($length) function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") { global $dolibarr_main_instance_unique_id; + global $dolibarr_disable_dolcrypt_for_debug; if ($chain === '' || is_null($chain)) { return ''; @@ -136,7 +137,7 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") $newchain = $chain; - if (function_exists('openssl_encrypt')) { + if (function_exists('openssl_encrypt') && empty($dolibarr_disable_dolcrypt_for_debug)) { $ivlen = 16; if (function_exists('openssl_cipher_iv_length')) { $ivlen = openssl_cipher_iv_length($ciphering); diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index c26187e4475..bd59e513ddf 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -217,6 +217,8 @@ if (GETPOST('code')) { // We are coming from oauth provider page. //$url .= 'hd=xxx'; } + //var_dump($url);exit; + // we go on oauth provider authorization page header('Location: '.$url); exit(); diff --git a/htdocs/core/modules/oauth/microsoft_oauthcallback.php b/htdocs/core/modules/oauth/microsoft_oauthcallback.php index ed47eec06e1..4ff573725f3 100644 --- a/htdocs/core/modules/oauth/microsoft_oauthcallback.php +++ b/htdocs/core/modules/oauth/microsoft_oauthcallback.php @@ -155,10 +155,9 @@ if (GETPOST('code') || GETPOST('error')) { // We are coming from oauth provi if (GETPOST('error')) { setEventMessages(GETPOST('error').' '.GETPOST('error_description'), null, 'errors'); } else { - $apiService->tenant = getDolGlobalString($keyforparamtenant); - //$token = $apiService->requestAccessToken(GETPOST('code'), $state); $token = $apiService->requestAccessToken(GETPOST('code')); + //print $token; // Microsoft is a service that does not need state to be stored as second paramater of requestAccessToken setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token @@ -182,7 +181,6 @@ if (GETPOST('code') || GETPOST('error')) { // We are coming from oauth provi //if (!preg_match('/^forlogin/', $state)) { // $apiService->setApprouvalPrompt('auto'); //} - $apiService->tenant = getDolGlobalString($keyforparamtenant); // This may create record into oauth_state before the header redirect. // Creation of record with state in this tables depend on the Provider used (see its constructor). diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index c04d3ac9ca5..c1b6ba6c86e 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -116,10 +116,12 @@ class printing_printgcp extends PrintingDriver 'type'=>'info', ); } else { + $keyforprovider = ''; // @FIXME + $this->google_id = getDolGlobalString('OAUTH_GOOGLE_ID'); $this->google_secret = getDolGlobalString('OAUTH_GOOGLE_SECRET'); // Token storage - $storage = new DoliStorage($this->db, $this->conf); + $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); //$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE); // Setup the credentials for the requests $credentials = new Credentials( @@ -254,8 +256,11 @@ class printing_printgcp extends PrintingDriver public function getlistAvailablePrinters() { $ret = array(); + + $keyforprovider = ''; // @FIXME + // Token storage - $storage = new DoliStorage($this->db, $this->conf); + $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, @@ -392,8 +397,11 @@ class printing_printgcp extends PrintingDriver 'content' => base64_encode($contents), // encode file content as base64 'contentType' => $contenttype, ); + + $keyforprovider = ''; // @FIXME + // Dolibarr Token storage - $storage = new DoliStorage($this->db, $this->conf); + $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, @@ -441,8 +449,11 @@ class printing_printgcp extends PrintingDriver $error = 0; $html = ''; + + $keyforprovider = ''; // @FIXME + // Token storage - $storage = new DoliStorage($this->db, $this->conf); + $storage = new DoliStorage($this->db, $this->conf, $keyforprovider); // Setup the credentials for the requests $credentials = new Credentials( $this->google_id, diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 2c23f6e0475..2002adafd86 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1082,7 +1082,7 @@ class EmailCollector extends CommonObject //$debugtext = "Host: ".$this->host."
Port: ".$this->port."
Login: ".$this->login."
Password: ".$this->password."
access type: ".$this->acces_type."
oauth service: ".$this->oauth_service."
Max email per collect: ".$this->maxemailpercollect; //dol_syslog($debugtext); - $storage = new DoliStorage($db, $conf); + $storage = new DoliStorage($db, $conf, $keyforprovider); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index cf280262e99..60af1f631c6 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -57,6 +57,8 @@ class DoliStorage implements TokenStorageInterface private $key; //private $stateKey; private $keyforprovider; + public $token; + private $tenant; public $state; public $date_creation; @@ -73,6 +75,7 @@ class DoliStorage implements TokenStorageInterface $this->db = $db; $this->conf = $conf; $this->keyforprovider = $keyforprovider; + $this->token = ''; $this->tokens = array(); $this->states = array(); //$this->key = $key; @@ -96,7 +99,7 @@ class DoliStorage implements TokenStorageInterface /** * {@inheritDoc} */ - public function storeAccessToken($service, TokenInterface $token) + public function storeAccessToken($service, TokenInterface $tokenobj) { global $conf; @@ -104,16 +107,25 @@ class DoliStorage implements TokenStorageInterface //var_dump($token); dol_syslog("storeAccessToken service=".$service); - include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; - $serializedToken = dolEncrypt(serialize($token)); + $servicepluskeyforprovider = $service; + if (!empty($this->keyforprovider)) { + // We clean the keyforprovider after the - to be sure it is not present + $servicepluskeyforprovider = preg_replace('/\-'.preg_quote($this->keyforprovider, '/').'$/', '', $servicepluskeyforprovider); + // Now we add the keyforprovider + $servicepluskeyforprovider .= '-'.$this->keyforprovider; + } - $this->tokens[$service] = $token; + include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; + $serializedToken = serialize($tokenobj); if (!is_array($this->tokens)) { $this->tokens = array(); } + + $this->tokens[$service] = $tokenobj; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " WHERE service = '".$this->db->escape($service.($this->keyforprovider?'-'.$this->keyforprovider:''))."'"; + $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; $sql .= " AND entity IN (".getEntity('oauth_token').")"; $resql = $this->db->query($sql); if (! $resql) { @@ -123,7 +135,7 @@ class DoliStorage implements TokenStorageInterface if ($obj) { // update $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; - $sql.= " SET token = '".$this->db->escape($serializedToken)."'"; + $sql.= " SET token = '".$this->db->escape(dolEncrypt($serializedToken))."'"; $sql.= " WHERE rowid = ".((int) $obj['rowid']); $resql = $this->db->query($sql); if (!$resql) { @@ -132,7 +144,7 @@ class DoliStorage implements TokenStorageInterface } else { // save $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, token, entity, datec)"; - $sql .= " VALUES ('".$this->db->escape($service.($this->keyforprovider?'-'.$this->keyforprovider:''))."', '".$this->db->escape($serializedToken)."', ".((int) $conf->entity).", "; + $sql .= " VALUES ('".$this->db->escape($servicepluskeyforprovider)."', '".$this->db->escape(dolEncrypt($serializedToken))."', ".((int) $conf->entity).", "; $sql .= " '".$this->db->idate(dol_now())."'"; $sql .= ")"; $resql = $this->db->query($sql); @@ -147,15 +159,26 @@ class DoliStorage implements TokenStorageInterface } /** - * {@inheritDoc} + * Load token and other data from a $service + * Note: Token load are cumulated into array ->tokens when other properties are erased by last loaded token. + * + * @return void */ public function hasAccessToken($service) { // get from db dol_syslog("hasAccessToken service=".$service); + $servicepluskeyforprovider = $service; + if (!empty($this->keyforprovider)) { + // We clean the keyforprovider after the - to be sure it is not present + $servicepluskeyforprovider = preg_replace('/\-'.preg_quote($this->keyforprovider, '/').'$/', '', $servicepluskeyforprovider); + // Now we add the keyforprovider + $servicepluskeyforprovider .= '-'.$this->keyforprovider; + } + $sql = "SELECT token, datec, tms, state FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " WHERE service = '".$this->db->escape($service.(empty($this->keyforprovider) ? '' : '-'.$this->keyforprovider))."'"; + $sql .= " WHERE service = '".$this->db->escape($servicepluskeyforprovider)."'"; $sql .= " AND entity IN (".getEntity('oauth_token').")"; $resql = $this->db->query($sql); if (! $resql) { @@ -164,18 +187,20 @@ class DoliStorage implements TokenStorageInterface $result = $this->db->fetch_array($resql); if ($result) { include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; - $token = unserialize(dolDecrypt($result['token'])); + $tokenobj = unserialize(dolDecrypt($result['token'])); + $this->token = dolDecrypt($result['token']); $this->date_creation = $this->db->jdate($result['datec']); $this->date_modification = $this->db->jdate($result['tms']); $this->state = $result['state']; } else { - $token = ''; + $tokenobj = ''; + $this->token = ''; $this->date_creation = null; $this->date_modification = null; $this->state = ''; } - $this->tokens[$service] = $token; + $this->tokens[$service] = $tokenobj; return is_array($this->tokens) && isset($this->tokens[$service]) @@ -331,4 +356,18 @@ class DoliStorage implements TokenStorageInterface // allow chaining return $this; } + + /** + * Return the token + * + * @return string String for the tenant used to create the token + */ + public function getTenant() + { + // Set/Reset tenant now so it will be defined for. + // TODO We must store it into the table llx_oauth_token + $this->tenant = getDolGlobalString('OAUTH_MICROSOFT'.($this->keyforprovider ? '-'.$this->keyforprovider : '').'_TENANT'); + + return $this->tenant; + } } diff --git a/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php b/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php index b1b6a042c01..e94799b81cf 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php +++ b/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php @@ -38,9 +38,13 @@ class Microsoft extends AbstractService const SCOPE_APPLICATIONS = 'applications'; const SCOPE_APPLICATIONS_CREATE = 'applications_create'; const SCOPE_IMAP = 'imap'; - const SOCPE_IMAP_AccessAsUser_All='IMAP.AccessAsUser.All'; + const SOCPE_IMAP_ACCESSASUSERALL = 'IMAP.AccessAsUser.All'; + const SOCPE_SMTPSEND = 'SMTP.Send'; + const SOCPE_MAILREAD = 'Mail.Read'; + const SOCPE_MAILSEND = 'Mail.Send'; + + protected $storage; - public string $tenant; /** * MS uses some magical not officialy supported scope to get even moar info like full emailaddresses. @@ -65,6 +69,8 @@ class Microsoft extends AbstractService ) { parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); + $this->storage = $storage; + if (null === $baseApiUri) { $this->baseApiUri = new Uri('https://apis.live.net/v5.0/'); } @@ -75,9 +81,11 @@ class Microsoft extends AbstractService */ public function getAuthorizationEndpoint() { - //return new Uri('https://login.live.com/oauth20_authorize.srf'); + $tenant = $this->storage->getTenant(); + + //return new Uri('https://login.live.com/oauth20_authorize.srf'); //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize'); - return new Uri('https://login.microsoftonline.com/'.$this->tenant.'/oauth2/v2.0/authorize'); + return new Uri('https://login.microsoftonline.com/'.$tenant.'/oauth2/v2.0/authorize'); } /** @@ -85,9 +93,11 @@ class Microsoft extends AbstractService */ public function getAccessTokenEndpoint() { + $tenant = $this->storage->getTenant(); + //return new Uri('https://login.live.com/oauth20_token.srf'); //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/token'); - return new Uri('https://login.microsoftonline.com/'.$this->tenant.'/oauth2/v2.0/token'); + return new Uri('https://login.microsoftonline.com/'.$tenant.'/oauth2/v2.0/token'); } /** @@ -110,6 +120,7 @@ class Microsoft extends AbstractService } elseif (isset($data['error'])) { throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); } + //print $data['access_token'];exit; $token = new StdOAuth2Token(); $token->setAccessToken($data['access_token']); diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index fb8426abc1b..ed856024d63 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -201,13 +201,15 @@ if ($mode == 'setup' && $user->admin) { $i++; if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') { + $keyforprovider = ''; // @BUG This must be set + // Token print '
'.$langs->trans("Token").''; $tokenobj = null; // Dolibarr storage - $storage = new DoliStorage($db, $conf); + $storage = new DoliStorage($db, $conf, $keyforprovider); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME_GOOGLE); } catch (Exception $e) { From 4cf21314105bec6a9af63194d7ef0947945318e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 01:52:28 +0100 Subject: [PATCH 105/580] Enable MS OAuth --- htdocs/core/lib/oauth.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/oauth.lib.php b/htdocs/core/lib/oauth.lib.php index 2074485cd6e..b2e59a9b87a 100644 --- a/htdocs/core/lib/oauth.lib.php +++ b/htdocs/core/lib/oauth.lib.php @@ -32,10 +32,10 @@ if (isModEnabled('stripe')) { $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write', 'returnurl'=>'/core/modules/oauth/stripelive_oauthcallback.php'); } $supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers', 'availablescopes'=>'user,public_repo', 'returnurl'=>'/core/modules/oauth/github_oauthcallback.php'); +$supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,IMAP.AccessAsUser.All,SMTP.Send,Mail.Read,Mail.Send', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php'); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'availablescopes'=>'Standard', 'returnurl'=>'/core/modules/oauth/generic_oauthcallback.php'); // See https://learn.microsoft.com/fr-fr/azure/active-directory/develop/quickstart-register-app#register-an-application - $supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,IMAP.AccessAsUser.All,SMTP.Send,Mail.Read,Mail.Send', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php'); } From 47128f2ccc5efe5d3e4d3733c23b9866c7f44127 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 04:40:13 +0100 Subject: [PATCH 106/580] Debug v17 --- htdocs/admin/emailcollector_card.php | 16 ++++++++++++++++ htdocs/core/lib/oauth.lib.php | 2 +- .../modules/oauth/microsoft_oauthcallback.php | 7 ++++++- .../class/emailcollector.class.php | 4 +++- .../OAuth/Common/Http/Client/StreamClient.php | 1 + .../OAuth/OAuth2/Service/AbstractService.php | 2 ++ .../includes/OAuth/OAuth2/Service/Microsoft.php | 5 +++-- htdocs/includes/webklex/php-imap/src/Client.php | 1 + htdocs/langs/en_US/oauth.lang | 2 +- 9 files changed, 34 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 462839245fa..10e7ea300f8 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -421,10 +421,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //$debugtext = "Host: ".$this->host."
Port: ".$this->port."
Login: ".$this->login."
Password: ".$this->password."
access type: ".$this->acces_type."
oauth service: ".$this->oauth_service."
Max email per collect: ".$this->maxemailpercollect; //dol_syslog($debugtext); + $token = ''; + $storage = new DoliStorage($db, $conf, $keyforprovider); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + $expire = true; // Is token expired or will token expire in the next 30 seconds // if (is_object($tokenobj)) { @@ -439,11 +442,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea ); $serviceFactory = new \OAuth\ServiceFactory(); $oauthname = explode('-', $OAUTH_SERVICENAME); + // ex service is Google-Emails we need only the first part Google $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + // We have to save the token because Google give it only once $refreshtoken = $tokenobj->getRefreshToken(); + //var_dump($tokenobj); $tokenobj = $apiService->refreshAccessToken($tokenobj); + $tokenobj->setRefreshToken($refreshtoken); $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); } @@ -491,6 +498,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } if (!$error) { try { + // To emulate the command connect, you can run + // openssl s_client -crlf -connect outlook.office365.com:993 + // TAG1 AUTHENTICATE XOAUTH2 dXN... + // TO Get debug log, you can set protected $debug = true; in Protocol.php file + // + // A MS bug make this not working ! + // See https://github.com/MicrosoftDocs/office-developer-exchange-docs/issues/100 + // See github.com/MicrosoftDocs/office-developer-exchange-docs/issues/87 + // See github.com/Webklex/php-imap/issues/81 $client->connect(); $f = $client->getFolders(false, $object->source_directory); diff --git a/htdocs/core/lib/oauth.lib.php b/htdocs/core/lib/oauth.lib.php index b2e59a9b87a..8a81d9a80e5 100644 --- a/htdocs/core/lib/oauth.lib.php +++ b/htdocs/core/lib/oauth.lib.php @@ -32,7 +32,7 @@ if (isModEnabled('stripe')) { $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'', 'availablescopes'=>'read_write', 'returnurl'=>'/core/modules/oauth/stripelive_oauthcallback.php'); } $supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers', 'availablescopes'=>'user,public_repo', 'returnurl'=>'/core/modules/oauth/github_oauthcallback.php'); -$supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,IMAP.AccessAsUser.All,SMTP.Send,Mail.Read,Mail.Send', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php'); +$supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,User.Read,https://outlook.office365.com/IMAP.AccessAsUser.All,https://outlook.office365.com/SMTP.Send', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php'); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $supportedoauth2array['OAUTH_OTHER_NAME'] = array('callbackfile' => 'generic', 'picto' => 'generic', 'urlforapp' => 'OAUTH_OTHER_DESC', 'name'=>'Other', 'urlforcredentials'=>'', 'availablescopes'=>'Standard', 'returnurl'=>'/core/modules/oauth/generic_oauthcallback.php'); // See https://learn.microsoft.com/fr-fr/azure/active-directory/develop/quickstart-register-app#register-an-application diff --git a/htdocs/core/modules/oauth/microsoft_oauthcallback.php b/htdocs/core/modules/oauth/microsoft_oauthcallback.php index 4ff573725f3..bf057676cf3 100644 --- a/htdocs/core/modules/oauth/microsoft_oauthcallback.php +++ b/htdocs/core/modules/oauth/microsoft_oauthcallback.php @@ -155,11 +155,16 @@ if (GETPOST('code') || GETPOST('error')) { // We are coming from oauth provi if (GETPOST('error')) { setEventMessages(GETPOST('error').' '.GETPOST('error_description'), null, 'errors'); } else { + //print GETPOST('code');exit; + //$token = $apiService->requestAccessToken(GETPOST('code'), $state); $token = $apiService->requestAccessToken(GETPOST('code')); - //print $token; // Microsoft is a service that does not need state to be stored as second paramater of requestAccessToken + //print $token->getAccessToken().'

'; + //print $token->getExtraParams()['id_token'].'
'; + //print $token->getRefreshToken().'
';exit; + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 2002adafd86..0168d8f86c6 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1082,10 +1082,13 @@ class EmailCollector extends CommonObject //$debugtext = "Host: ".$this->host."
Port: ".$this->port."
Login: ".$this->login."
Password: ".$this->password."
access type: ".$this->acces_type."
oauth service: ".$this->oauth_service."
Max email per collect: ".$this->maxemailpercollect; //dol_syslog($debugtext); + $token = ''; + $storage = new DoliStorage($db, $conf, $keyforprovider); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + $expire = true; // Is token expired or will token expire in the next 30 seconds // if (is_object($tokenobj)) { @@ -1122,7 +1125,6 @@ class EmailCollector extends CommonObject return -1; } - $cm = new ClientManager(); $client = $cm->make([ 'host' => $this->host, diff --git a/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php b/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php index d81fee88202..9849afd4a32 100644 --- a/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php +++ b/htdocs/includes/OAuth/Common/Http/Client/StreamClient.php @@ -57,6 +57,7 @@ class StreamClient extends AbstractClient } $extraHeaders['Content-length'] = 'Content-length: '.strlen($requestBody); + //var_dump($requestBody); var_dump($extraHeaders);var_dump($method);exit; $context = $this->generateStreamContext($requestBody, $extraHeaders, $method); $level = error_reporting(0); diff --git a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php index 0de0219306a..b6f89118d83 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php +++ b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php @@ -223,6 +223,8 @@ abstract class AbstractService extends BaseAbstractService implements ServiceInt $parameters, $this->getExtraOAuthHeaders() ); + //print $responseBody;exit; // We must have a result "{"token_type":"Bearer","scope... + $token = $this->parseAccessTokenResponse($responseBody); $this->storage->storeAccessToken($this->service(), $token); diff --git a/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php b/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php index e94799b81cf..6c3b18b3c0f 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php +++ b/htdocs/includes/OAuth/OAuth2/Service/Microsoft.php @@ -38,8 +38,9 @@ class Microsoft extends AbstractService const SCOPE_APPLICATIONS = 'applications'; const SCOPE_APPLICATIONS_CREATE = 'applications_create'; const SCOPE_IMAP = 'imap'; - const SOCPE_IMAP_ACCESSASUSERALL = 'IMAP.AccessAsUser.All'; - const SOCPE_SMTPSEND = 'SMTP.Send'; + const SOCPE_IMAP_ACCESSASUSERALL = 'https://outlook.office365.com/IMAP.AccessAsUser.All'; + const SOCPE_SMTPSEND = 'https://outlook.office365.com/SMTP.Send'; + const SOCPE_USERREAD = 'User.Read'; const SOCPE_MAILREAD = 'Mail.Read'; const SOCPE_MAILSEND = 'Mail.Send'; diff --git a/htdocs/includes/webklex/php-imap/src/Client.php b/htdocs/includes/webklex/php-imap/src/Client.php index 15944e4c646..85c537f16fa 100755 --- a/htdocs/includes/webklex/php-imap/src/Client.php +++ b/htdocs/includes/webklex/php-imap/src/Client.php @@ -353,6 +353,7 @@ class Client { } catch (Exceptions\RuntimeException $e) { throw new ConnectionFailedException("connection setup failed - run exception", 0, $e); } + $this->authenticate(); return $this; diff --git a/htdocs/langs/en_US/oauth.lang b/htdocs/langs/en_US/oauth.lang index e773c470b30..9d4791a9f63 100644 --- a/htdocs/langs/en_US/oauth.lang +++ b/htdocs/langs/en_US/oauth.lang @@ -31,7 +31,7 @@ OAUTH_GITHUB_SECRET=OAuth GitHub Secret OAUTH_URL_FOR_CREDENTIAL=Go to this page to create or get your OAuth ID and Secret OAUTH_STRIPE_TEST_NAME=OAuth Stripe Test OAUTH_STRIPE_LIVE_NAME=OAuth Stripe Live -OAUTH_ID=OAuth ID +OAUTH_ID=OAuth Client ID OAUTH_SECRET=OAuth secret OAUTH_TENANT=OAuth tenant OAuthProviderAdded=OAuth provider added From b880029ac048e3b3e256fac1baf24f2451348a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 8 Feb 2023 09:58:30 +0100 Subject: [PATCH 107/580] typos in getAttchments() $arrayobject --- htdocs/emailcollector/class/emailcollector.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 53889ef9c07..5d0c92b4c32 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1951,7 +1951,7 @@ class EmailCollector extends CommonObject 'ticket' => array('table' => 'ticket', 'fields' => array('ref'), 'class' => 'ticket/class/ticket.class.php', - 'object' => ' Ticket'), + 'object' => 'Ticket'), 'knowledgemanagement' => array('table' => 'knowledgemanagement_knowledgerecord', 'fields' => array('ref'), 'class' => 'knowledgemanagement/class/knowledgemanagement.class.php', @@ -1969,7 +1969,7 @@ class EmailCollector extends CommonObject 'class' => 'compta/facture/class/facture.class.php', 'object' => 'Facture'), 'fournisseur/facture' => array('table' => 'facture_fourn', - 'fields' => array('ref', ref_client), + 'fields' => array('ref', 'ref_client'), 'class' => 'fourn/class/fournisseur.facture.class.php', 'object' => 'FactureFournisseur'), 'produit' => array('table' => 'product', From 8a0fd114d45aacda94b9cf803bf4a4649d725928 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 8 Feb 2023 10:48:46 +0100 Subject: [PATCH 108/580] FIX bug alias extra in extrafields syntax configuration --- 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 8ac336f84f8..fbd857b0e27 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1233,7 +1233,7 @@ class ExtraFields $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); } //We have to join on extrafield table - if (strpos($InfoFieldList[4], 'extra') !== false) { + if (strpos($InfoFieldList[4], 'extra.') !== false) { $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; } else { From ea68c44d8f67e87ffffa33f67afa193dd1762d23 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 8 Feb 2023 11:00:11 +0100 Subject: [PATCH 109/580] Update ChangeLog --- ChangeLog | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68ce6daabcd..13b5981c8de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,20 +30,20 @@ NEW: #21000 Added columns 'alias_name' on project, supplier invoice, supplier or NEW: #21780 Add pid field to Cronjob class and store PID on job execution NEW: #21395 Added option for dark theme mode in display - color and theme NEW: #21397 added option to auto define barcode numbers for third-parties in barcode module setup -NEW: #21399 +NEW: #21399 add image for event_array NEW: #21442 Enhancement of module builder init NEW: #21654 add bank account number used on invoices for debit -NEW: #22048 Added notes to productlot module +NEW: #22048 added notes to productlot module NEW: #22298 Bank - Add salaries & vat in the tab of planned entries of a bank account -NEW: #22328 -NEW: #22424 +NEW: #22328 OAuth admin +NEW: #22424 online signature for contracts NEW: #22500 member module set up made easier NEW: #22527 projects and thirdparties can be viewed as conversation ("Message" view), like events/agenda. NEW: #22546 can now set user supervisors using mass action in htdocs/user NEW: #22594 can chose if VAT ID is unique or not for third parties NEW: #22622 all partnerships displayed on tab partnership of a thirdparty and member NEW: #22676 massaction for updating product prices -NEW: #22735 Massaction to affect users on projects +NEW: #22735 massaction to affect users on projects NEW: #25594 can chose if VAT ID is unique or not for third parties NEW: #4482 adding js to hide/show advanced option on the export data page @@ -57,27 +57,17 @@ NEW: Add max size send for "backup and link to mail" option NEW: Add method httponly_accessforbidden() NEW: Add more advices into the Setup security page NEW: Add new global variable for keeping the previous signature information on proposale (case of reopen a proposale) -NEW: Add objectLink on expedition -NEW: Add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties NEW: Add option --force on CLI cron_run_jobs.php NEW: Add option "Show price on the generated documents for receptions" -NEW: invoice export : add accounting affectation -NEW: label on products categories filter -NEW: manage no email with thirdparties (better for GDPR) NEW: Manage VAT on all lines on purchases cycle -NEW: On a bank reconciled line, we can modify the bank receipt NEW: parent company column and filter in invoice and order list -NEW: possibility to select scopes with checkbox for Oauth tokens -NEW: private and public note on user, thirdparty and contact list +NEW: private and public note columns on user, thirdparty and contact lists NEW: Public counters feature -NEW: Saved token of OAUTH module are now encrypted into llx_oauth_token NEW: Save one click to select on delivery ack, on emails. NEW: scheduled job to send unpaid invoice reminder can now use the cc and bcc from email template -NEW: experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP) NEW: can substitue project title in mail template NEW: The purge of files can purge only if older than a number of seconds NEW: Update ActionComm type_code on email message ticket -NEW: Finance - VAT - Admin - Add information on deadline day for submission of VAT declaration NEW: Add the target to select attendees of event for emailings NEW: add redirect on action confirm addconsumedline and addproduceline NEW: Add the referrer-policy to "same-origin" by default on all public pages. @@ -87,17 +77,18 @@ NEW: Can enter the unit price including the VAT NEW: Can invoice task time per different services NEW: Can set a commercial discount by entering amount including VAT NEW: Can set start and end dates and comment on button "Activate all services" -NEW: can sort and preselected best supplier price NEW: show date delivery planned on orders linked to company and product NEW: filter on reception dates (from / to) in cheque paiement card -NEW: Accountancy - Add a graphic option to enable lettering function - FPC21 -NEW: Accountancy - Add a way to clean some words when you generate thirdparty accounting account -NEW: Accountancy - Added an option during export to export or not the lettering FPC21 +NEW: Accountancy - add a graphic option to enable lettering function - FPC21 +NEW: Accountancy - add a way to clean some words when you generate thirdparty accounting account +NEW: Accountancy - added an option during export to export or not the lettering FPC21 +NEW: Accountancy - Invoice export : add accounting affectation NEW: Accountancy - Manage supplier deposit with specific account NEW: Accountancy - Model Digitaria - Add a way to clean some words when you generate thirdparty accounting account FPC22 NEW: Agenda - start a simple support of recurrent events on agenda NEW: Bank - add salaries & VAT in tab planned entries +NEW: Bank - on a bank reconciled line, we can modify the bank receipt NEW: Contracts - add a method doAutoRenewContracts that can be used as a cron task NEW: Contracts - default template of contract is not mandatory NEW: Contracts - Manage Position (Rank) on Contract Lines @@ -108,22 +99,29 @@ NEW: EMail - can send an email on scheduled job error NEW: EMail - on a form to send an email, we show all emails of all contacts of object NEW: EMail - add the SMTP header References on ticket email created by email NEW: EMail - add substitution key __SENDEREMAIL_SIGNATURE__ +NEW: EMail - experimental SMTP using PhpImap allowing OAuth2 authentication (need to add option MAIN_IMAP_USE_PHPIMAP) NEW: EMail-Collector - add IMAP port setting NEW: EMail-Collector - add a button "Test collect" -NEW: Export - Add " as enclosure by default for CSV export. Keep removing CR/LF. NEW: Event-Organization - add date event (!= date project) and location on event organization +NEW: Expedition - add objectLink on expedition +NEW: Export - Add " as enclosure by default for CSV export. Keep removing CR/LF. NEW: Extrafields - add badge in admin extrafields setup NEW: Extrafields - can edit property css, cssview, csslist on extrafields NEW: Extrafields - default values in extrafields are not more limited to 255 char. NEW: Extrafields - field price with currency NEW: Extrafields - support IP type to store IP addresses +NEW: Finance - VAT - Admin - Add information on deadline day for submission of VAT declaration NEW: Interventions - enable online signature for interventions -NEW: Invoice - Add french mention on pdf when vat debit option is on +NEW: Invoice - add french mention on PDF when VAT debit option is on NEW: Members - default_lang for members -NEW: Members - Table of membership types +NEW: Members - table of membership types NEW: Members - add free membership amounts at the membership type level +NEW: OAuth - possibility to select scopes with checkbox for OAuth tokens +NEW: OAuth - saved token of OAUTH module are now encrypted into llx_oauth_token NEW: Orders - resize parent company column in order list -NEW: Products supplier price - autofill default supplier VAT +NEW: Products - Categories - label on products categories filter +NEW: Products - Supplier price - autofill default supplier VAT +NEW: Products - Supplier price - can sort and preselected best supplier price NEW: Projects - add author on list NEW: Projects - add thirdparty column to the time list (projet/tasks/time.php) NEW: Proposals - show delivery mode on PDF for proposals @@ -144,8 +142,10 @@ NEW: TakePOS - display currency in TakePOS menu NEW: TakePOS - Header Scroll in TakePOS NEW: TakePOS - Receipt preview in TakePOS setup NEW: TakePOS - support of Stripe Terminal with TakePOS +NEW: Thirdparty - manage no email with thirdparties (better for GDPR) NEW: Thirdparty - set thirdparty type with company modify trigger NEW: Tickets - change filter type on tickets list into a multiselect combo +NEW: Tickets - add oldcopy to Ticket so triggers intercepting TICKET_MODIFY have access to old values of the updated properties NEW: Website - can delete a whole website if disabled NEW: Website - can remove a website template NEW: Website - can set header "Strict-Transport-Security" in web sites. @@ -176,11 +176,16 @@ NEW: Security: add fail2ban rules examples to limit access to /public pages Option / Const for System: NEW: FICHINTER_ALLOW_EXTERNAL_DOWNLOAD +NEW: MAIN_CHECKBOX_LEFT_COLUMN +NEW: MAIN_EMAIL_SUPPORT_ACK +NEW: MAIN_IMAP_USE_PHPIMAP NEW: MAIN_SEARCH_CATEGORY_PRODUCT_ON_LISTS - const to show category customer filter +NEW: PRODUCT_ALLOW_EXTERNAL_DOWNLOAD NEW: PRODUCTBATCH_SHOW_WAREHOUSE_ON_SHIPMENT - showing warehouse on PDF NEW: PRODUIT_DESC_IN_FORM accept - desktop only or +smartphone NEW: PROPAL_BYPASS_VALIDATED_STATUS NEW: PROPAL_NEW_AS_SIGNED +NEW: PROPAL_SKIP_ACCEPT_REFUSE NEW: TIMESPENT_ALWAYS_UPDATE_THM - when it's on we always check current thm of user to update it in task time line Localisation: From 81400b1fc5667f9930ad4b05fa9cd5940b619949 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 8 Feb 2023 11:14:53 +0100 Subject: [PATCH 110/580] Update llx_c_availability.sql add 1-5 days --- htdocs/install/mysql/data/llx_c_availability.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_availability.sql b/htdocs/install/mysql/data/llx_c_availability.sql index b98db76b48e..7768477c5d1 100644 --- a/htdocs/install/mysql/data/llx_c_availability.sql +++ b/htdocs/install/mysql/data/llx_c_availability.sql @@ -33,6 +33,11 @@ -- INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_NOW', 'Immediate', null, 0, 1, 10); +INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_1D', '1 day', 'd', 1, 1, 11); +INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_2D', '2 days', 'd', 2, 1, 12); +INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_3D', '3 days', 'd', 3, 1, 13); +INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_4D', '4 days', 'd', 4, 1, 14); +INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_5D', '5 days', 'd', 5, 1, 15); INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_1W', '1 week', 'w', 1, 1, 20); INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_2W', '2 weeks', 'w', 2, 1, 30); INSERT INTO llx_c_availability (code, label, type_duration, qty, active, position) VALUES ('AV_3W', '3 weeks', 'w', 3, 1, 40); 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 111/580] 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'].''; $key = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; - $value = $conf->global->$key; + $value = getDolGlobalInt($key); print ''; 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 34b4cad448eae6d66fd8e90744d8c5adcc61d1e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 13:18:32 +0100 Subject: [PATCH 112/580] Complete trans --- htdocs/core/modules/modOauth.class.php | 2 +- htdocs/langs/en_US/admin.lang | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index d93a715f1e7..e7c23d30455 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -51,7 +51,7 @@ class modOauth extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) - $this->description = "Enable OAuth authentication"; + $this->description = "Enable OAuth2 authentication"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 46339a7bf6d..f20065556bf 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -700,6 +700,8 @@ Module62000Name=Incoterms Module62000Desc=Add features to manage Incoterms Module63000Name=Resources Module63000Desc=Manage resources (printers, cars, rooms, ...) for allocating to events +Module66000Name=Enable OAuth2 authentication +Module66000Desc=Provide a tool to generate and manage OAuth2 tokens. The token can then be used by some other modules. Module94160Name=Receptions Permission11=Read customer invoices Permission12=Create/modify customer invoices From cdaeaae047025cf05d7e067a9111c1d100e650f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 13:32:15 +0100 Subject: [PATCH 113/580] Fix search on dolistore --- htdocs/admin/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index dc639a4ecf0..953d8f85a68 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1041,7 +1041,7 @@ if ($mode == 'marketplace') { print '
'; - print ''; + print ''; ?> From 6cf792438d5bbd35d45655265b67ba462fdc89ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 13:48:17 +0100 Subject: [PATCH 114/580] Fix permission --- htdocs/core/lib/invoice.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index f4aca8ef9a7..dfe6f78092c 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -281,8 +281,8 @@ function getNumberInvoicesPieChart($mode) { global $conf, $db, $langs, $user; - if (($mode == 'customers' && isModEnabled('facture') && !empty($user->rights->facture->lire)) - || ($mode == 'suppliers' && (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire)) + if (($mode == 'customers' && isModEnabled('facture') && $user->hasRight('facture', 'lire')) + || ($mode == 'suppliers' && (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && $user->hasRight('fournisseur', 'facture', 'lire')) ) { include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; From 7d57cfb767f11fa9307371efccc5114c955fb47f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 14:04:50 +0100 Subject: [PATCH 115/580] Missing doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1b877e2b4b4..189bcd41004 100644 --- a/ChangeLog +++ b/ChangeLog @@ -210,7 +210,7 @@ Following changes may create regressions for some external modules, but were nec * Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES * Rename the substitution for "project label" instead of "project title" in substitution variables * You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object. - +* Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all) ***** ChangeLog for 16.0.4 compared to 16.0.3 ***** From 28c722ef598728c8b9e8c847f287f9bf544a67c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 15:19:00 +0100 Subject: [PATCH 116/580] error message may be overwritten by other error message --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 60de90d819d..bb34fc2e3eb 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -14,7 +14,7 @@ * Copyright (C) 2014 Ion agorria * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2017 Gustavo Novaro - * 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 @@ -1566,7 +1566,7 @@ class Product extends CommonObject } } elseif (isset($this->multilangs[$key])) { if (empty($this->multilangs["$key"]["label"])) { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); + $this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); return -1; } From 98bfba1f461be23fcce1451cd1f275ab82c9020e Mon Sep 17 00:00:00 2001 From: avolani <31508728+avolani@users.noreply.github.com> Date: Wed, 8 Feb 2023 16:20:47 +0100 Subject: [PATCH 117/580] Add missing table_element This allow usage of extrafields logic (still missing table and setup pages) --- htdocs/expensereport/class/expensereport.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index bc7e0f36baa..04c16fc2654 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2680,6 +2680,11 @@ class ExpenseReportLine extends CommonObjectLine * @var DoliDB Database handler. */ public $db; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'expensereport_det'; /** * @var string Error code (or message) From 637603731a3785eadbdd454ae96ecc79ed570b7a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 8 Feb 2023 15:26:10 +0000 Subject: [PATCH 118/580] Fixing style errors. --- htdocs/expensereport/class/expensereport.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 04c16fc2654..6ee3c8e19e7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2680,11 +2680,11 @@ class ExpenseReportLine extends CommonObjectLine * @var DoliDB Database handler. */ public $db; - + /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = 'expensereport_det'; + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'expensereport_det'; /** * @var string Error code (or message) From f35d63cec148ae06928571e85ae9821b03b86a48 Mon Sep 17 00:00:00 2001 From: avolani <31508728+avolani@users.noreply.github.com> Date: Wed, 8 Feb 2023 16:41:06 +0100 Subject: [PATCH 119/580] Clean placeholder of missing related project and products --- htdocs/core/class/commondocgenerator.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 82012400f68..05837331e16 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -538,6 +538,12 @@ abstract class CommonDocGenerator $resarray[$array_key.'_project_description'] = $object->project->description; $resarray[$array_key.'_project_date_start'] = dol_print_date($object->project->date_start, 'day'); $resarray[$array_key.'_project_date_end'] = dol_print_date($object->project->date_end, 'day'); + } else { // empty replacement + $resarray[$array_key.'_project_ref'] =''; + $resarray[$array_key.'_project_title'] = ''; + $resarray[$array_key.'_project_description'] = ''; + $resarray[$array_key.'_project_date_start'] = ''; + $resarray[$array_key.'_project_date_end'] = ''; } // Add vat by rates @@ -701,6 +707,14 @@ abstract class CommonDocGenerator foreach ($tmpproduct->array_options as $key => $label) { $resarray["line_product_".$key] = $label; } + } else { + // Set unused placeholders as blank + $extrafields->fetch_name_optionals_label("product"); + $extralabels = $extrafields->attributes["product"]['label']; + + foreach ($extralabels as $key => $label) { + $resarray['line_product_options_'.$key] = ''; + } } return $resarray; From 38eee02272cbe06ada74cfb7b2d56f6cb7024db1 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 8 Feb 2023 17:34:50 +0100 Subject: [PATCH 120/580] 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 121/580] 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 122/580] 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 a17c7aba7348fa1ed3cc03ee974544f7498c9a7e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 8 Feb 2023 19:25:03 +0100 Subject: [PATCH 123/580] Fix : sall becomes search_all on top menu search also --- 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 1dd9eb35c04..37d018a21ce 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2732,7 +2732,7 @@ function top_menu_search() $buttonList .= '
'; - $searchInput = ''; + $searchInput = ''; $dropDownHtml = ''; From 3f8aaf5cbc3f0f3532a4737e2bf9b97f9d0c674e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 21:30:55 +0100 Subject: [PATCH 124/580] clean code --- .../class/expensereport.class.php | 65 ++++++++++++++----- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 38c39d96b6f..685626ef6ff 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (c) 2018-2021 Frédéric France + * Copyright (c) 2018-2023 Frédéric France * Copyright (C) 2016-2020 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -60,8 +60,16 @@ class ExpenseReport extends CommonObject */ public $picto = 'trip'; + /** + * @var ExpenseReportLine[] array of expensereport lines + */ public $lines = array(); + /** + * @var ExpenseReportLine expensereport lines + */ + public $line; + public $date_debut; public $date_fin; @@ -93,6 +101,15 @@ class ExpenseReport extends CommonObject // Create public $date_create; + + /** + * @var int ID of user creator + */ + public $fk_user_creat; + + /** + * @var int ID of user who reclaim expense report + */ public $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. // Update @@ -107,15 +124,34 @@ class ExpenseReport extends CommonObject // Annulation public $date_cancel; public $detail_cancel; + + /** + * @var int ID of user who cancel expense report + */ public $fk_user_cancel; - public $fk_user_validator; // User that is defined to approve + /** + * @var int User that is defined to approve + */ + public $fk_user_validator; - // Validation - /* @deprecated */ + /** + * Validation date + * @var int + * @deprecated + * @see $date_valid + */ public $datevalid; - public $date_valid; // User making validation + /** + * Validation date + * @var int + */ + public $date_valid; + + /** + * @var int ID of User making validation + */ public $fk_user_valid; public $user_valid_infos; @@ -154,16 +190,15 @@ class ExpenseReport extends CommonObject */ const STATUS_APPROVED = 5; - /** - * Classified refused - */ - const STATUS_REFUSED = 99; - /** * Classified paid. */ const STATUS_CLOSED = 6; + /** + * Classified refused + */ + const STATUS_REFUSED = 99; public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), @@ -434,12 +469,12 @@ class ExpenseReport extends CommonObject $this->fk_statut = 0; // deprecated // Clear fields - $this->fk_user_creat = $user->id; - $this->fk_user_author = $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. - $this->fk_user_valid = ''; + $this->fk_user_creat = $user->id; + $this->fk_user_author = $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. + $this->fk_user_valid = ''; $this->date_create = ''; - $this->date_creation = ''; - $this->date_validation = ''; + $this->date_creation = ''; + $this->date_validation = ''; // Remove link on lines to a joined file if (is_array($this->lines) && count($this->lines) > 0) { From 9fe920b2a925fd5464e54a950c31509c7e156899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 21:45:46 +0100 Subject: [PATCH 125/580] deprecate method send_an_email --- htdocs/adherents/card.php | 6 +++--- htdocs/adherents/class/adherent.class.php | 25 +++++++++++++++++++++++ htdocs/adherents/subscription.php | 2 +- htdocs/projet/class/project.class.php | 7 ++++--- htdocs/public/members/new.php | 2 +- htdocs/public/partnership/new.php | 2 +- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/project/new.php | 2 +- 8 files changed, 37 insertions(+), 11 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index f57bb2e312d..f9a43e47f0f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -674,7 +674,7 @@ if (empty($reshook)) { $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -745,7 +745,7 @@ if (empty($reshook)) { $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -816,7 +816,7 @@ if (empty($reshook)) { $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index a9db33b9980..df7737213a5 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -440,11 +440,36 @@ class Adherent extends CommonObject * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param string $errors_to erros to * @param string $moreinheader Add more html headers + * @deprecated since V18 + * @see sendEmail * @return int <0 if KO, >0 if OK */ public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') { // phpcs:enable + dol_syslog('Warning using deprecated Adherent::send_an_email', LOG_WARNING); + return $this->sendEmail($text, $subject, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, $errors_to, $moreinheader); + } + + /** + * Function sending an email to the current member with the text supplied in parameter. + * + * @param string $text Content of message (not html entities encoded) + * @param string $subject Subject of message + * @param array $filename_list Array of attached files + * @param array $mimetype_list Array of mime types of attached files + * @param array $mimefilename_list Array of public names of attached files + * @param string $addr_cc Email cc + * @param string $addr_bcc Email bcc + * @param int $deliveryreceipt Ask a delivery receipt + * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection + * @param string $errors_to erros to + * @param string $moreinheader Add more html headers + * @since V18 + * @return int <0 if KO, >0 if OK + */ + public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') + { global $conf, $langs; // Detect if message is HTML diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 8c423d53029..004bd7eaf4b 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -405,7 +405,7 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscripti $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader); if ($result < 0) { $errmsg = $object->error; setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 51bae7ab6e9..305cfdd570b 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2314,7 +2314,6 @@ class Project extends CommonObject $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function sending an email to the current member with the text supplied in parameter. * @@ -2329,12 +2328,14 @@ class Project extends CommonObject * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param string $errors_to erros to * @param string $moreinheader Add more html headers + * @since V18 * @return int <0 if KO, >0 if OK */ - public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') + public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') { - // phpcs:enable global $conf, $langs; // TODO EMAIL + + return 1; } } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 943280d6e2d..9ac60d8f823 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -372,7 +372,7 @@ if (empty($reshook) && $action == 'add') { if ($subjecttosend && $texttosend) { $moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); } /*if ($result < 0) { $error++; diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index af2583abece..d5d1dad1d81 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -360,7 +360,7 @@ if (empty($reshook) && $action == 'add') { if ($subjecttosend && $texttosend) { $moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); } } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 4a13de1ef7f..40898f1ff6e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -775,7 +775,7 @@ if ($ispaymentok) { $moreinheader = 'X-Dolibarr-Info: send_an_email by public/payment/paymentok.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, "", $moreinheader); if ($result < 0) { $errmsg = $object->error; diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 726a318c99f..ec891fc3741 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -371,7 +371,7 @@ if (empty($reshook) && $action == 'add') { if ($subjecttosend && $texttosend) { $moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); } /*if ($result < 0) { $error++; From b22d5b3e8adde4b6c6d67b214dfada3edf1bebcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 21:47:11 +0100 Subject: [PATCH 126/580] deprecate method send_an_email --- htdocs/adherents/class/adherent.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index df7737213a5..689309f933c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -448,6 +448,7 @@ class Adherent extends CommonObject { // phpcs:enable dol_syslog('Warning using deprecated Adherent::send_an_email', LOG_WARNING); + return $this->sendEmail($text, $subject, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, $errors_to, $moreinheader); } From 2cdc4406558f597b25877edb71b76de8019fd01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 21:57:07 +0100 Subject: [PATCH 127/580] doc --- htdocs/reception/class/reception.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index e9a89691c88..018d532a363 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2018 Quentin Vial-Gouteyron - * 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 @@ -97,6 +97,12 @@ class Reception extends CommonObject public $date_delivery; // Date delivery planed + /** + * @var integer|string Effective delivery date + * @deprecated + * @see $date_reception + */ + public $date; /** * @var integer|string Effective delivery date @@ -396,8 +402,7 @@ class Reception extends CommonObject $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; $this->date_creation = $this->db->jdate($obj->date_creation); - $this->date = $this->db->jdate($obj->date_reception); // TODO deprecated - $this->date_reception = $this->db->jdate($obj->date_reception); // TODO deprecated + $this->date = $this->db->jdate($obj->date_reception); // TODO deprecated $this->date_reception = $this->db->jdate($obj->date_reception); // Date real $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->model_pdf = $obj->model_pdf; From 2c7a01848c9c5a70d7ebd71473e02946a9a9bb7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 22:12:28 +0100 Subject: [PATCH 128/580] add ajax tooltip on partnership --- .../partnership/class/partnership.class.php | 48 +++++++++++++++---- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index a9645efaae2..a202bdbd284 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -145,6 +145,7 @@ class Partnership extends CommonObject public $last_check_backlink; public $reason_decline_or_cancel; public $fk_soc; + public $fk_member; // END MODULEBUILDER PROPERTIES @@ -938,6 +939,29 @@ class Partnership extends CommonObject return $this->setStatusCommon($user, self::STATUS_APPROVED, $notrigger, 'PARTNERSHIP_REOPEN'); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $langs; + + $langs->load('partnership'); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Partnership").''; + if (isset($this->status)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -957,13 +981,19 @@ class Partnership extends CommonObject } $result = ''; - - $label = img_picto('', $this->picto).' '.$langs->trans("Partnership").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/partnership/partnership_card.php?id='.$this->id; @@ -984,8 +1014,8 @@ class Partnership extends CommonObject $label = $langs->trans("ShowPartnership"); $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.'"' : ''); } @@ -1006,7 +1036,7 @@ class Partnership 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 dc97584f87638d8591664f21023c7b2e31933e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 22:20:46 +0100 Subject: [PATCH 129/580] add ajax tooltip on intervention --- htdocs/fichinter/class/fichinter.class.php | 52 +++++++++++++++------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 66645583216..428f0f0767b 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -770,6 +770,29 @@ class Fichinter extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statuscode, $mode); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('fichinter'); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Intervention").''; + if (isset($this->status)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -784,12 +807,18 @@ class Fichinter extends CommonObject global $conf, $langs, $hookmanager; $result = ''; - - $label = img_picto('', $this->picto).' '.$langs->trans("Intervention").''; - 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 = $langs->trans('Loading'); } - $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id; @@ -810,15 +839,8 @@ class Fichinter extends CommonObject $label = $langs->trans("ShowIntervention"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; - - /* - $hookmanager->initHooks(array('fichinterdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.'"'; } $linkstart = '
picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From 3e7b74557a7e20b9e68603bfcf8153d4be1a4cae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 22:23:40 +0100 Subject: [PATCH 130/580] add ajax tooltip on intervention --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 428f0f0767b..7070f94ab23 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -159,7 +159,7 @@ class Fichinter extends CommonObject public $extraparams = array(); /** - * @var array lines + * @var FichinterLigne[] lines */ public $lines = array(); From c871e844699f4874b6ad4a79cbf4a0820a9769b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2023 22:50:27 +0100 Subject: [PATCH 131/580] Fix fatal error on constant no defined --- htdocs/core/modules/modFckeditor.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index fa3a66c37cc..631dba395fe 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -63,7 +63,7 @@ class modFckeditor extends DolibarrModules $this->config_page_url = array("fckeditor.php"); // Dependencies - $this->disabled = in_array(constant('JS_CKEDITOR'), array('disabled', 'disabled/')); + $this->disabled = (defined('JS_CKEDITOR') && in_array(constant('JS_CKEDITOR'), array('disabled', 'disabled/'))); $this->depends = array(); $this->requiredby = array('modWebsites'); From eee645bb0655bba2512618b139741ef02886ff30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 23:01:04 +0100 Subject: [PATCH 132/580] add ajax tooltip on opensurvey --- htdocs/core/ajax/ajaxtooltip.php | 7 ++- .../class/opensurveysondage.class.php | 44 +++++++++++++++---- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index d10b0f1a43e..60220a221ff 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -41,7 +41,8 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; top_httphead(); -$id = GETPOST('id', 'int'); +// opensurvey as aZ09 id +$id = GETPOST('id', 'aZ09'); $objecttype = GETPOST('objecttype', 'aZ09'); $html = ''; @@ -158,6 +159,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'resource/class'; $module = 'resource'; $myobject = 'dolresource'; +} elseif ($objecttype == 'opensurvey_sondage') { + $classpath = 'opensurvey/class'; + $module = 'opensurvey'; + $myobject = 'opensurveysondage'; } // Generic case for $classfile and $classname diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index f5dadd90f2e..e928c2f3cd6 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -420,6 +420,27 @@ class Opensurveysondage extends CommonObject } } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('opensurvey'); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowSurvey").''; + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + $datas['title'] = '
'.$langs->trans('Title').': '.$this->title; + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -440,11 +461,18 @@ class Opensurveysondage extends CommonObject } $result = ''; - - $label = img_picto('', $this->picto).' '.$langs->trans("ShowSurvey").''; - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref.'
'; - $label .= ''.$langs->trans('Title').': '.$this->title.'
'; + $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 = $langs->trans('Loading'); + } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/opensurvey/card.php?id='.$this->id; @@ -463,8 +491,8 @@ class Opensurveysondage extends CommonObject $label = $langs->trans("ShowMyObject"); $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.'"' : ''); } @@ -475,7 +503,7 @@ class Opensurveysondage extends CommonObject $result .= $linkstart; if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; From de31fb83f0df5c59268362b50213ebd8b11d1771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Feb 2023 23:33:39 +0100 Subject: [PATCH 133/580] fix links --- htdocs/core/lib/hrm.lib.php | 16 ++++++++-------- htdocs/hrm/establishment/info.php | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/hrm.lib.php b/htdocs/core/lib/hrm.lib.php index 5335dc1c75e..706af6bd110 100644 --- a/htdocs/core/lib/hrm.lib.php +++ b/htdocs/core/lib/hrm.lib.php @@ -52,15 +52,15 @@ function establishment_prepare_head($object) $head[$h][2] = 'info'; $h++; - $head[$h][0] = dol_buildpath("/hrm/admin/setup.php", 1); - $head[$h][1] = $langs->trans("Settings"); - $head[$h][2] = 'settings'; - $h++; + // $head[$h][0] = dol_buildpath("/hrm/admin/setup.php", 1); + // $head[$h][1] = $langs->trans("Settings"); + // $head[$h][2] = 'settings'; + // $h++; - $head[$h][0] = dol_buildpath("/hrm/admin/about.php", 1); - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++; + // $head[$h][0] = dol_buildpath("/hrm/admin/about.php", 1); + // $head[$h][1] = $langs->trans("About"); + // $head[$h][2] = 'about'; + // $h++; complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm'); diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php index 3bfbe912279..1a9ba129f10 100644 --- a/htdocs/hrm/establishment/info.php +++ b/htdocs/hrm/establishment/info.php @@ -138,7 +138,7 @@ if ($object->id > 0) { // Object card // ------------------------------------------------------------ - $linkback = '
'.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; /* From 8f2076e83e0183b95446321b3676524397c572d9 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 9 Feb 2023 11:07:30 +0100 Subject: [PATCH 134/580] fix problems in menus for modulebuilder --- htdocs/modulebuilder/index.php | 133 +++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 57 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 6f62e8f142c..916a91ecf61 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -896,6 +896,17 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) { // Init an object if ($dirins && $action == 'initobject' && $module && $objectname) { + // check if module is enabled + if (isModEnabled(strtolower($module))) { + $result = unActivateModule(strtolower($module)); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + if ($result) { + setEventMessages($result, null, 'errors'); + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); + setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); + } + $objectname = ucfirst($objectname); $dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; @@ -1341,43 +1352,31 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { // Regenerate left menu entry in descriptor for $objectname $stringtoadd = " \$this->menu[\$r++]=array( - // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'fk_menu'=>'fk_mainmenu=mymodule', - // This is a Left menu entry 'type'=>'left', 'titre'=>'List MyObject', 'mainmenu'=>'mymodule', 'leftmenu'=>'mymodule_myobject', 'url'=>'/mymodule/myobject_list.php', - // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', 'position'=>1100+\$r, - // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'\$conf->mymodule->enabled', - // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'1', 'target'=>'', - // 0=Menu for internal users, 1=external users, 2=both 'user'=>2, ); \$this->menu[\$r++]=array( - // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject', - // This is a Left menu entry 'type'=>'left', 'titre'=>'New MyObject', 'mainmenu'=>'mymodule', 'leftmenu'=>'mymodule_myobject', 'url'=>'/mymodule/myobject_card.php?action=create', - // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', 'position'=>1100+\$r, - // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'\$conf->mymodule->enabled', - // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'1', 'target'=>'', - // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 );\n"; $stringtoadd = preg_replace('/MyObject/', $objectname, $stringtoadd); @@ -1389,8 +1388,28 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { // TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1 // TODO Avoid duplicate addition - dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); - + // load class and check if menu exist with same object name + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + dol_include_once($pathtofile); + $class = 'mod'.$module; + if (class_exists($class)) { + try { + $moduleobj = new $class($db); + } catch (Exception $e) { + $error++; + dol_print_error($db, $e->getMessage()); + } + } + $menus = $moduleobj->menu; + $counter = 0 ; + foreach ($menus as $menu) { + if ($menu['leftmenu'] == strtolower($module).'_'.strtolower($objectname)) { + $counter++; + } + } + if (!$counter) { + dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($objectname).'*/'.$stringtoadd."\n\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */')); + } // Add module descriptor to list of files to replace "MyObject' string with real name of object. $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; } @@ -1728,6 +1747,16 @@ if ($dirins && $action == 'confirm_deletemodule') { } if ($dirins && $action == 'confirm_deleteobject' && $objectname) { + // check if module is enabled (if it's disabled and send msg event) + if (isModEnabled(strtolower($module))) { + $result = unActivateModule(strtolower($module)); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + if ($result) { + setEventMessages($result, null, 'errors'); + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); + setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); + } if (preg_match('/[^a-z0-9_]/i', $objectname)) { $error++; setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); @@ -1766,53 +1795,43 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { ); //menu for the object selected - $stringtoedit = "\$this->menu[\$r++]=array( - // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=".strtolower($module)."', - // This is a Left menu entry - 'type'=>'left', - 'titre'=>'List ".ucfirst($objectname)."', - 'mainmenu'=>'".strtolower($module)."', - 'leftmenu'=>'".strtolower($module)."_".strtolower($objectname)."', - 'url'=>'/".strtolower($module)."/".strtolower($objectname)."_list.php', - // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'".strtolower($module)."@".strtolower($module)."', - 'position'=>1100+\$r, - // Define condition to show or hide menu entry. Use '\$conf->".strtolower($module)."->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'\$conf->".strtolower($module)."->enabled', - // Use 'perms'=>'\$user->rights->".strtolower($module)."->level1->level2' if you want your menu with a permission rules - 'perms'=>'1', - 'target'=>'', - // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2, - ); - \$this->menu[\$r++]=array( - // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'fk_menu'=>'fk_mainmenu=".strtolower($module).",fk_leftmenu=".strtolower($module)."_".strtolower($objectname)."', - // This is a Left menu entry - 'type'=>'left', - 'titre'=>'New ".ucfirst($objectname)."', - 'mainmenu'=>'".strtolower($module)."', - 'leftmenu'=>'".strtolower($module)."_".strtolower($objectname)."', - 'url'=>'/".strtolower($module)."/".strtolower($objectname)."_card.php?action=create', - // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'langs'=>'".strtolower($module)."@".strtolower($module)."', - 'position'=>1100+\$r, - // Define condition to show or hide menu entry. Use '\$conf->".strtolower($module)."->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected. - 'enabled'=>'\$conf->".strtolower($module)."->enabled', - // Use 'perms'=>'\$user->rights->".strtolower($module)."->level1->level2' if you want your menu with a permission rules - 'perms'=>'1', - 'target'=>'', - // 0=Menu for internal users, 1=external users, 2=both - 'user'=>2 - );"; + // load class and check if menu exist for this object + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + dol_include_once($pathtofile); + $class = 'mod'.$module; + if (class_exists($class)) { + try { + $moduleobj = new $class($db); + } catch (Exception $e) { + $error++; + dol_print_error($db, $e->getMessage()); + } + } + $menus = $moduleobj->menu; $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - $check = dolReplaceInFile($moduledescriptorfile, array($stringtoedit => '')); - if ($check > 0) { - dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($objectname).'*/' => '')); + foreach ($menus as $menu) { + if ($menu['type'] == 'left' && $menu['leftmenu'] == strtolower($module).'_'.strtolower($objectname)) { + $left="\$this->menu[\$r++]=array( + 'fk_menu'=>'".$menu['fk_menu']."', + 'type'=>'".$menu['type']."', + 'titre'=>'".$menu['titre']."', + 'mainmenu'=>'".$menu['mainmenu']."', + 'leftmenu'=>'".$menu['leftmenu']."', + 'url'=>'".$menu['url']."', + 'langs'=>'".$menu['langs']."', + 'position'=>1100+\$r, + 'enabled'=>'".$menu['enabled']."', + 'perms'=>'".$menu['perms']."', + 'target'=>'".$menu['target']."', + 'user'=>".$menu['user'].", + );"; + dolReplaceInFile($moduledescriptorfile, array($left => '')); + } } + // Remarque : "\n" not handling yet + $check = dolReplaceInFile($moduledescriptorfile, array('/*LEFTMENU '.strtoupper($objectname).'*/'."\n" => '',"\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n" => '')); // regenerate permissions and delete them $rights = " From 78c6f12a8aa676b32710609e34122487b5a4dfdd Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 9 Feb 2023 11:40:43 +0100 Subject: [PATCH 135/580] NEW functionality (delete menu manually) in modulebuilder --- htdocs/langs/en_US/modulebuilder.lang | 5 +- htdocs/langs/fr_FR/modulebuilder.lang | 5 +- htdocs/modulebuilder/index.php | 85 +++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 600dfba7227..3c442fcc84a 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -169,4 +169,7 @@ GeneratePermissions=I want to add the rights for this object GeneratePermissionsHelp=generate default rights for this object PermissionDeletedSuccesfuly=Permission has been successfully removed PermissionUpdatedSuccesfuly=Permission has been successfully updated -PermissionAddedSuccesfuly=Permission has been successfully added \ No newline at end of file +PermissionAddedSuccesfuly=Permission has been successfully added +MenuDeletedSuccessfuly=Menu has been successfully deleted +MenuAddedSuccessfuly=Menu has been successfully added +MenuUpdatedSuccessfuly=Menu has been successfully updated \ No newline at end of file diff --git a/htdocs/langs/fr_FR/modulebuilder.lang b/htdocs/langs/fr_FR/modulebuilder.lang index 3c4161941e8..c9c0b9ef1bc 100644 --- a/htdocs/langs/fr_FR/modulebuilder.lang +++ b/htdocs/langs/fr_FR/modulebuilder.lang @@ -169,4 +169,7 @@ GeneratePermissions=Je souhaite ajouter les droits pour cet objet GeneratePermissionsHelp=générer les droits par défault pour cet objet PermissionDeletedSuccesfuly=La permission a été supprimée avec succès PermissionUpdatedSuccesfuly=La permission a été mise à jour avec succès -PermissionAddedSuccesfuly= La permission a été ajoutée avec succès \ No newline at end of file +PermissionAddedSuccesfuly= La permission a été ajoutée avec succès +MenuDeletedSuccessfuly=Menu a été supprimé avec succès +MenuAddedSuccessfuly=Menu a été ajouté avec succès +MenuUpdatedSuccessfuly=Menu a été mise à jour avec succès \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 916a91ecf61..e52985e8c50 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2360,6 +2360,91 @@ if ($action == 'reset' && $user->admin) { exit; } +// delete menu +if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) { + // check if module is enabled + if (isModEnabled(strtolower($module))) { + $result = unActivateModule(strtolower($module)); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + if ($result) { + setEventMessages($result, null, 'errors'); + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); + setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); + } + // load class and check if menu exist + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + dol_include_once($pathtofile); + $class = 'mod'.$module; + if (class_exists($class)) { + try { + $moduleobj = new $class($db); + } catch (Exception $e) { + $error++; + dol_print_error($db, $e->getMessage()); + } + } + + $menus = $moduleobj->menu; + + $key = (int) GETPOST('menukey', 'int'); + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + + + if ($menus[$key]['type'] == 'top') { + $menuTop = " + \$this->menu[\$r++] = array( + 'fk_menu'=>'".$menus[$key]['fk_menu']."', + 'type'=>'".$menus[$key]['type']."', + 'titre'=>'".$menus[$key]['titre']."', + 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'), + 'mainmenu'=>'".$menus[$key]['mainmenu']."', + 'leftmenu'=> '', + 'url'=>'".$menus[$key]['url']."', + 'langs'=>'".$menus[$key]['langs']."', + 'position'=>1000 + \$r, + 'enabled'=>'isModEnabled(\"".strtolower($module)."\")', + 'perms' =>'".$menus[$key]['perms']."', + 'target'=>'".$menus[$key]['target']."', + 'user'=>".$menus[$key]['user'].", + );"; + $check = dolReplaceInFile($moduledescriptorfile, array($menuTop => '',"\t\t".'/*TOPMENU '.strtolower($menus[$key]['titre']).'*/'."\n" => '', '/*END TOPMENU '.strtolower($menus[$key]['titre']).'*/'."\n\t\t" => '')); + } + if ($menus[$key]['type'] == 'left') { + $left="\$this->menu[\$r++]=array( + 'fk_menu'=>'".$menus[$key]['fk_menu']."', + 'type'=>'".$menus[$key]['type']."', + 'titre'=>'".$menus[$key]['titre']."', + 'mainmenu'=>'".$menus[$key]['mainmenu']."', + 'leftmenu'=>'".$menus[$key]['leftmenu']."', + 'url'=>'".$menus[$key]['url']."', + 'langs'=>'".$menus[$key]['langs']."', + 'position'=>1100+\$r, + 'enabled'=>'".$menus[$key]['enabled']."', + 'perms'=>'".$menus[$key]['perms']."', + 'target'=>'".$menus[$key]['target']."', + 'user'=>".$menus[$key]['user'].", + );"; + $check = dolReplaceInFile($moduledescriptorfile, array($left => '')); + + // check if still had menu created when initial object + // if not we delete the comments from file + $menuForObj = 0; + foreach ($menus as $menu) { + if ($menu['leftmenu'] == $menus[$key]['leftmenu']) { + $menuForObj++; + } + } + if ($menuForObj == 1) { + $extractObjName = explode("_", $menus[$key]['leftmenu']); + dolReplaceInFile($moduledescriptorfile, array('/*LEFTMENU '.strtoupper($extractObjName[1]).'*/'."\n" => '','/*END LEFTMENU '.strtoupper($extractObjName[1]).'*/' => '')); + } + } + + setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + exit; +} /* From 01e0503b0f073fa39056f168b8fe6cf049e0cd3e Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 9 Feb 2023 11:52:41 +0100 Subject: [PATCH 136/580] FIX several email sent to the same recipient when adding message from ticket --- htdocs/ticket/class/ticket.class.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index d12df619bb0..122c5ae35ab 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2576,24 +2576,24 @@ class Ticket extends CommonObject $assigned_user = new User($this->db); $assigned_user->fetch($this->fk_user_assign); if (!empty($assigned_user->email)) { - $sendto[] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">"; + $sendto[$assigned_user->email] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">"; } else { $assigned_user_dont_have_email = $assigned_user->getFullName($langs); } } if (empty($sendto)) { if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) { - $sendto[] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; + $sendto[$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; } elseif (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } // Add global email address recipient if (!empty($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) && - !empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) + !empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) ) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } if (!empty($sendto)) { @@ -2677,7 +2677,7 @@ class Ticket extends CommonObject if ($info_sendto['email'] != '') { if (!empty($info_sendto['email'])) { - $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + $sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; } //Contact type @@ -2693,9 +2693,9 @@ class Ticket extends CommonObject $message .= '
'.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$object->track_id.'
'; // Add global email address recipient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } @@ -2755,7 +2755,7 @@ class Ticket extends CommonObject if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) { if (!empty($info_sendto['email'])) { - $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + $sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; } $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; @@ -2775,21 +2775,21 @@ class Ticket extends CommonObject $message .= '
'.$message_signature; if (!empty($object->origin_email)) { - $sendto[] = $object->origin_email; + $sendto[$object->origin_email] = $object->origin_email; } - if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) { + if ($object->fk_soc > 0 && !array_key_exists($object->origin_email, $sendto)) { $object->socid = $object->fk_soc; $object->fetch_thirdparty(); if (!empty($object->thirdparty->email)) { - $sendto[] = $object->thirdparty->email; + $sendto[$object->thirdparty->email] = $object->thirdparty->email; } } // altairis: Add global email address reciepient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } From 45900052e8c8007f88820cc8537ad84520e828cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 13:54:39 +0100 Subject: [PATCH 137/580] Debug v17 --- htdocs/adherents/list.php | 2 +- htdocs/public/members/new.php | 18 +++++------------- htdocs/public/project/new.php | 1 - 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index c2b81860210..64cc4fa8dc4 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("members", "companies")); +$langs->loadLangs(array("members", "companies", "categories")); // Get parameters diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 7c3e5754b23..33bbe59f118 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -34,7 +34,7 @@ * MEMBER_MIN_AMOUNT Minimum amount * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted + * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once registration form has been submitted (hidden option, by default we just show a message on same page or redirect to the payment page) * MEMBER_NEWFORM_FORCETYPE Force type of member * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country @@ -73,11 +73,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Init vars +$backtopage = GETPOST('backtopage', 'alpha'); +$action = GETPOST('action', 'aZ09'); + $errmsg = ''; $num = 0; $error = 0; -$backtopage = GETPOST('backtopage', 'alpha'); -$action = GETPOST('action', 'aZ09'); // Load translation files $langs->loadLangs(array("main", "members", "companies", "install", "other")); @@ -448,15 +449,6 @@ if (empty($reshook) && $action == 'add') { $urlback .= '&entity='.((int) $entity); } } - } - - if (!empty($backtopage)) { - $urlback = $backtopage; - dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); - } elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) { - $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION; - // TODO Make replacement of __AMOUNT__, etc... - dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); } else { $error++; $errmsg .= join('
', $adh->errors); @@ -476,7 +468,7 @@ if (empty($reshook) && $action == 'add') { } // Action called after a submitted was send and member created successfully -// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. +// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to an url, we never go here because a redirect was done to this url. Same if we ask to redirect to the payment page. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 778fc860e90..108f8d13771 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -416,7 +416,6 @@ if (empty($reshook) && $action == 'add') { } // Action called after a submitted was send and member created successfully -// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if (empty($reshook) && $action == 'added') { llxHeaderVierge($langs->trans("NewLeadForm")); From dfda68a63c495ff54e6610418a33e58ddab53a3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 14:30:48 +0100 Subject: [PATCH 138/580] Debug v17 - Online membership subscription of members --- htdocs/adherents/admin/website.php | 10 +++---- htdocs/langs/en_US/members.lang | 3 +- .../public/eventorganization/attendee_new.php | 2 +- htdocs/public/members/new.php | 11 ++++---- htdocs/public/partnership/new.php | 2 +- htdocs/public/payment/newpayment.php | 28 +++++++++---------- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/project/new.php | 2 +- htdocs/public/project/suggestbooth.php | 2 +- htdocs/public/project/suggestconference.php | 2 +- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 08e9f617750..705d7cf426f 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -58,7 +58,7 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') { if ($action == 'update') { $public = GETPOST('MEMBER_ENABLE_PUBLIC'); $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2); - $editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); + $minamount = GETPOST('MEMBER_MIN_AMOUNT'); $publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int'); @@ -66,7 +66,7 @@ if ($action == 'update') { $res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "MEMBER_MIN_AMOUNT", $minamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); if ($forcetype < 0) { @@ -232,11 +232,11 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { print ''; print "\n"; - // Can edit + // Min amount print ''; - print $langs->trans("CanEditAmountDetail"); + print $langs->trans("MinimumAmount"); print ''; - print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); + print ''; print "\n"; // SHow counter of validated members publicly diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 71f01b36739..f8981df17d9 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -206,7 +206,8 @@ SubscriptionsStatistics=Contributions statistics NbOfSubscriptions=Number of contributions AmountOfSubscriptions=Amount collected from contributions TurnoverOrBudget=Turnover (for a company) or Budget (for a foundation) -DefaultAmount=Default amount of contribution +DefaultAmount=Default amount of contribution (used only if no amount is defined at member type level) +MinimumAmount=Minimum amount (used only when contribution amount is free) CanEditAmount=Subscription amount is free CanEditAmountDetail=Visitor can choose/edit amount of its contribution regardless of the member type AmountIsLowerToMinimumNotice=sur un dû total de %s diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index cb4ba38e628..f245b6c10f7 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -686,7 +686,7 @@ print load_fiche_titre($langs->trans("NewRegistration"), '', '', 0, 0, 'center') print '
'; print '
'; -print '
'; +print '
'; // Welcome message diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 33bbe59f118..a121f2cc5a1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -30,7 +30,6 @@ * * Note that you can add following constant to change behaviour of page * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited * MEMBER_MIN_AMOUNT Minimum amount * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) @@ -431,7 +430,7 @@ if (empty($reshook) && $action == 'add') { } if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') { - if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed + if (empty($adht->caneditamount)) { // If edition of amount not allowed // TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT // It is not so important because a test is done on return of payment validation. } @@ -505,7 +504,7 @@ print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center') print '
'; print '
'; -print '
'; +print '
'; if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) { print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."
\n"; } else { @@ -765,7 +764,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; } - if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $caneditamount) { + if ($caneditamount) { print ''; print ' '.$langs->trans("Currency".$conf->currency).' – '; print $amount > 0 ? $langs->trans("AnyAmountWithAdvisedAmount", price($amount, 0, $langs, 1, -1, -1, $conf->currency)): $langs->trans("AnyAmountWithoutAdvisedAmount"); @@ -833,7 +832,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW $i = 0; while ($i < $num) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($result); // Load the member type and information on it print ''; print ''.dol_escape_htmltag($objp->label).''; @@ -843,7 +842,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print ''; print ''; $displayedamount = max(intval($objp->amount), intval(getDolGlobalInt("MEMBER_MIN_AMOUNT"))); - $caneditamount = !empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $objp->caneditamount; + $caneditamount = $objp->caneditamount; if ($objp->subscription) { if ($displayedamount > 0 || !$caneditamount) { print $displayedamount.' '.strtoupper($conf->currency); diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index b6444753eb7..d8e65f18c12 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -544,7 +544,7 @@ print load_fiche_titre($langs->trans("NewPartnershipRequest"), '', '', 0, 0, 'ce print '
'; print '
'; -print '
'; +print '
'; if (!empty($conf->global->PARTNERSHIP_NEWFORM_TEXT)) { print $langs->trans($conf->global->PARTNERSHIP_NEWFORM_TEXT)."
\n"; } else { diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 264ead82877..e3257bd659c 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1633,7 +1633,7 @@ if ($source == 'member' || $source == 'membersubscription') { $amount = max(0, $conf->global->MEMBER_MIN_AMOUNT, $amount); } print ''.price($amount, 1, $langs, 1, -1, -1, $currency).''; // Price with currency - $caneditamount = !empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $adht->caneditamount; + $caneditamount = $adht->caneditamount; $minimumamount = empty($conf->global->MEMBER_MIN_AMOUNT)? $adht->amount : max($conf->global->MEMBER_MIN_AMOUNT, $adht->amount > $amount); if (!$caneditamount && $minimumamount > $amount) { print ' '. $langs->trans("AmountIsLowerToMinimumNotice", price($adht->amount, 1, $langs, 1, -1, -1, $currency)); @@ -1751,13 +1751,13 @@ if ($source == 'donation') { // Amount print ''.$langs->trans("Amount"); if (empty($amount)) { - if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + if (empty($conf->global->DONATION_NEWFORM_AMOUNT)) { print ' ('.$langs->trans("ToComplete"); } - if (!empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) { - print ' - '.$langs->trans("SeeHere").''; + if (!empty($conf->global->DONATION_EXT_URL_SUBSCRIPTION_INFO)) { + print ' - '.$langs->trans("SeeHere").''; } - if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + if (empty($conf->global->DONATION_NEWFORM_AMOUNT)) { print ')'; } } @@ -1767,21 +1767,21 @@ if ($source == 'donation') { $valtoshow = price2num(GETPOST("newamount", 'alpha'), 'MT'); // force default subscription amount to value defined into constant... if (empty($valtoshow)) { - if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { - if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { - $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; + if (!empty($conf->global->DONATION_NEWFORM_EDITAMOUNT)) { + if (!empty($conf->global->DONATION_NEWFORM_AMOUNT)) { + $valtoshow = $conf->global->DONATION_NEWFORM_AMOUNT; } } else { - if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { - $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + if (!empty($conf->global->DONATION_NEWFORM_AMOUNT)) { + $amount = $conf->global->DONATION_NEWFORM_AMOUNT; } } } } if (empty($amount) || !is_numeric($amount)) { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { - $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + if (!empty($conf->global->DONATION_MIN_AMOUNT) && $valtoshow) { + $valtoshow = max($conf->global->DONATION_MIN_AMOUNT, $valtoshow); } print ''; print ''; @@ -1789,8 +1789,8 @@ if ($source == 'donation') { print ' '.$langs->trans("Currency".$currency).''; } else { $valtoshow = $amount; - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { - $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + if (!empty($conf->global->DONATION_MIN_AMOUNT) && $valtoshow) { + $valtoshow = max($conf->global->DONATION_MIN_AMOUNT, $valtoshow); $amount = $valtoshow; } print ''.price($valtoshow, 1, $langs, 1, -1, -1, $currency).''; // Price with currency diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index a82364bcce3..e596fd3d261 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -441,7 +441,7 @@ if ($ispaymentok) { // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { // Security protection: - if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount (if free amount is allowed, no need to check) + if (empty($adht->caneditamount)) { // If we didn't allow members to choose their membership amount (if the amount is allowed in edit mode, no need to check) if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected. $typeid = $object->typeid; diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 108f8d13771..c07062e3284 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -450,7 +450,7 @@ print load_fiche_titre($langs->trans("NewContact"), '', '', 0, 0, 'center'); print '
'; print '
'; -print '
'; +print '
'; if (!empty($conf->global->PROJECT_NEWFORM_TEXT)) { print $langs->trans($conf->global->PROJECT_NEWFORM_TEXT)."
\n"; } else { diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 68e469b6a00..0b2e24716d5 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -564,7 +564,7 @@ print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, 0, 'cen print '
'; print '
'; -print '
'; +print '
'; dol_htmloutput_errors($errmsg); diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 5590b0bf94c..b3418ec9e84 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -497,7 +497,7 @@ print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, print '
'; print '
'; -print '
'; +print '
'; dol_htmloutput_errors($errmsg, $errors); From 4985d8b350e3c01f861c4a8d30997e37fe55e3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 9 Feb 2023 14:34:13 +0100 Subject: [PATCH 139/580] missing translation --- htdocs/langs/en_US/agenda.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 2016172c381..adc9c4177ad 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -177,5 +177,6 @@ ReminderType=Callback type AddReminder=Create an automatic reminder notification for this event ErrorReminderActionCommCreation=Error creating the reminder notification for this event BrowserPush=Browser Popup Notification +Reminders=Reminders ActiveByDefault=Enabled by default Until=until From e83559afb0ab7963a0187dbdcb4f8d5ea89f72fa Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 9 Feb 2023 15:20:07 +0100 Subject: [PATCH 140/580] 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 141/580] 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 3417b633f70255917b075dc12d2c1731497d2d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 9 Feb 2023 15:28:05 +0100 Subject: [PATCH 142/580] fix syntax --- htdocs/modulebuilder/template/admin/setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index dea2a1a596e..b9b5f262f8d 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -160,7 +160,7 @@ $item->helpText = $langs->transnoentities('AnHelpMessage'); //$item->fieldOutputOverride = false; // set this var to override field output -$setupnotempty =+ count($formSetup->items); +$setupnotempty += count($formSetup->items); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); From 0e301988a4ed2089bdc3042e77a8b3383708df88 Mon Sep 17 00:00:00 2001 From: "Esteban L. Castro" <43482256+elcf@users.noreply.github.com> Date: Mon, 6 Feb 2023 18:29:50 -0400 Subject: [PATCH 143/580] 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 d5deec862d0..fd4368b78af 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 b65e3e401449c2706de1b5c2945b0838eba73d69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 15:38:35 +0100 Subject: [PATCH 144/580] Fix all indexes must be named --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 fd4368b78af..ceff2a32f3c 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); diff --git a/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql b/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql index e90cd67e889..d2f699df325 100644 --- a/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql +++ b/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql @@ -13,4 +13,4 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see https://www.gnu.org/licenses/. -ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label); \ No newline at end of file +ALTER TABLE llx_takepos_floor_tables ADD UNIQUE INDEX uk_takepos_floor_tables(entity,label); From 5ae079b0181dfbddf860f48f91161dd64230a61e Mon Sep 17 00:00:00 2001 From: Jean-Patrice Clerc <81645374+jpclerc-beep@users.noreply.github.com> Date: Mon, 6 Feb 2023 21:04:40 +0100 Subject: [PATCH 145/580] Ajout de la ligne pour enregistrer l'email du formulaire --- htdocs/public/project/new.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index c07062e3284..d4d6b4b68b5 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -224,6 +224,7 @@ if (empty($reshook) && $action == 'add') { } else { $thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); } + $thirdparty->email = GETPOST('email'); $thirdparty->address = GETPOST('address'); $thirdparty->zip = GETPOST('zip'); $thirdparty->town = GETPOST('town'); From 04c0272d05c03cb21e288db76c27f4ba2329efab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 15:58:28 +0100 Subject: [PATCH 146/580] Doc --- htdocs/includes/odtphp/odf.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 1a951292f94..0bba0e59345 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -24,10 +24,10 @@ class OdfException extends Exception class Odf { protected $config = array( - 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}', - 'PATH_TO_TMP' => '/tmp' + 'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}', + 'PATH_TO_TMP' => '/tmp' ); protected $file; protected $contentXml; // To store content of content.xml file @@ -152,12 +152,12 @@ class Odf } /** - * Replaces html tags in odt tags and returns a compatible string + * Replaces html tags found into the $value with ODT compatible tags and return the converted compatible string * - * @param string $value Replacement value - * @param bool $encode If true, special XML characters are encoded - * @param string $charset Charset - * @return string + * @param string $value Replacement value + * @param bool $encode If true, special XML characters are encoded + * @param string $charset Charset + * @return string String in ODTsyntax format */ public function convertVarToOdf($value, $encode = true, $charset = 'ISO-8859') { @@ -203,15 +203,18 @@ class Odf } } $this->contentXml = str_replace('', $fonts . '', $this->contentXml); - } else $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "", $value); + } else { + $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "", $value); + } return $convertedValue; } /** * Replaces html tags in with odt tags and returns an odt string - * @param array $tags An array with html tags generated by the getDataFromHtml() function - * @param array $customStyles An array of style defenitions that should be included inside the odt file + * + * @param array $tags An array with html tags generated by the getDataFromHtml() function + * @param array $customStyles An array of style defenitions that should be included inside the odt file * @param array $fontDeclarations An array of font declarations that should be included inside the odt file * @return string */ From 69b690c45e01ec898a3402fed24d282b15f5929a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 15:29:07 +0100 Subject: [PATCH 147/580] 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 148/580] 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 6fb24bfcc78bcc125a31d0ea184fe98ae9e878aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 18:00:25 +0100 Subject: [PATCH 149/580] Add missing index --- .../install/mysql/migration/17.0.0-18.0.0.sql | 11 +++++- .../tables/llx_supplier_proposal.key.sql | 34 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 htdocs/install/mysql/tables/llx_supplier_proposal.key.sql 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 11495748eff..328d6537ae0 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 @@ -70,4 +70,13 @@ ALTER TABLE llx_bank_account ADD COLUMN owner_zip varchar(25); ALTER TABLE llx_bank_account ADD COLUMN owner_town varchar(50); ALTER TABLE llx_bank_account ADD COLUMN owner_country_id integer DEFAULT NULL; - + +ALTER TABLE llx_supplier_proposal ADD UNIQUE INDEX uk_supplier_proposal_ref (ref, entity); + +ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_soc (fk_soc); +ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_user_author (fk_user_author); +ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_user_valid (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); + + diff --git a/htdocs/install/mysql/tables/llx_supplier_proposal.key.sql b/htdocs/install/mysql/tables/llx_supplier_proposal.key.sql new file mode 100644 index 00000000000..350338f833d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_supplier_proposal.key.sql @@ -0,0 +1,34 @@ +-- ============================================================================ +-- Copyright (C) 2023 Laurent Destailleur +-- +-- 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 . +-- +-- ============================================================================ + + +ALTER TABLE llx_supplier_proposal ADD UNIQUE INDEX uk_supplier_proposal_ref (ref, entity); + +ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_soc (fk_soc); +ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_user_author (fk_user_author); +ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_user_valid (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_propal ADD CONSTRAINT fk_propal_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); +--ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +--ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); +--ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_signature FOREIGN KEY (fk_user_signature) REFERENCES llx_user (rowid); +--ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_user_cloture FOREIGN KEY (fk_user_cloture) REFERENCES llx_user (rowid); +--ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid); +--ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid); 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 150/580] 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 151/580] 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 152/580] 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 153/580] 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 154/580] 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 155/580] 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 356b3af6e6c655da151c86e4890a4f668e05f932 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:44:55 +0100 Subject: [PATCH 156/580] css --- htdocs/emailcollector/class/emailcollector.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index ca5b22f3ce3..303749a16ea 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -130,7 +130,7 @@ class EmailCollector extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax200'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'), - 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'csslist'=>'small'), + 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'cssview'=>'small', 'csslist'=>'small tdoverflowmax200'), 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflowmax125'), 'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflowmax50', 'default'=>'993'), 'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default'=>'UTF-8'), @@ -143,7 +143,7 @@ class EmailCollector extends CommonObject 'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>100), 'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1, 'csslist'=>'nowraponall'), 'codelastresult' => array('type'=>'varchar(16)', 'label'=>'CodeLastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>122, 'notnull'=>-1,), - 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1, 'csslist'=>'small tdoverflowmax200'), + 'lastresult' => array('type'=>'varchar(255)', 'label'=>'LastResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>123, 'notnull'=>-1, 'cssview'=>'small', 'csslist'=>'small tdoverflowmax200'), 'datelastok' => array('type'=>'datetime', 'label'=>'DateLastcollectResultOk', 'visible'=>1, 'enabled'=>'$action != "create"', 'position'=>125, 'notnull'=>-1, 'csslist'=>'nowraponall'), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>0, 'enabled'=>1, 'position'=>61, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>0, 'enabled'=>1, 'position'=>62, 'notnull'=>-1,), From 5ef4aa78e9f7a29d0a7bfbcbb01b067a094995f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:16:34 +0100 Subject: [PATCH 157/580] 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 158/580] 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 159/580] 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 97f0f33a4f43773c632c730aadc199c91da6595f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 9 Feb 2023 23:33:39 +0100 Subject: [PATCH 160/580] fix ajax tooltip sometimes stay open --- htdocs/core/js/lib_foot.js.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index b319185909a..963e357199a 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -89,6 +89,7 @@ if (empty($conf->dol_no_mouse_hover)) { $.ajax({ url:"' . dol_buildpath('/core/ajax/ajaxtooltip.php', 1) . '", type: "post", + async: false, data: JSON.parse(params), success: function(response){ // Setting content option From afa344393c19fbc16cd4987604c1502f50a9c282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 9 Feb 2023 23:55:42 +0100 Subject: [PATCH 161/580] add extrafields count in admin eventorganization --- htdocs/core/lib/eventorganization.lib.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/eventorganization.lib.php b/htdocs/core/lib/eventorganization.lib.php index 51ff1f2a90f..09ebc88a0b3 100644 --- a/htdocs/core/lib/eventorganization.lib.php +++ b/htdocs/core/lib/eventorganization.lib.php @@ -1,5 +1,6 @@ + * 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 @@ -28,7 +29,11 @@ */ function eventorganizationAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('actioncomm'); + $extrafields->fetch_name_optionals_label('eventorganization_conferenceorboothattendee'); $langs->load("eventorganization"); @@ -43,11 +48,19 @@ function eventorganizationAdminPrepareHead() $head[$h][0] = DOL_URL_ROOT.'/admin/eventorganization_confbooth_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("EventOrganizationConfOrBooth").")"; + $nbExtrafields = $extrafields->attributes['actioncomm']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'eventorganization_extrafields'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/eventorganization_confboothattendee_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Attendees").")"; + $nbExtrafields = $extrafields->attributes['eventorganization_conferenceorboothattendee']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'conferenceorboothattendee_extrafields'; $h++; From 616b006f2a053d2a589990adb0c0c3f15a353518 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 10:56:55 +0100 Subject: [PATCH 162/580] 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 163/580] 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 164/580] 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 165/580] 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 166/580] 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 167/580] 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 168/580] 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 169/580] 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 731ddf33d87daf2644318ee62ffe63f0273bc8a5 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 10 Feb 2023 11:52:37 +0100 Subject: [PATCH 170/580] Update ChangeLog ChangeLog for 16.0.4: #numbers sorted two lines were double --- ChangeLog | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index db82396ca76..0fe697ccb6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -251,23 +251,24 @@ Following changes may create regressions for some external modules, but were nec FIX: Amount of localtax1 and 2 not correctly save on purchase order (the rate was saved instead) FIX: #20415 FIX: #21280 -FIX: #23008 FIX: #22271 FIX: #22524 FIX: #22837 FIX: #22964 +FIX: #23008 FIX: #23012 FIX: #23019 Impossible to add task times to an existing draft invoice FIX: #23072 +FIX: #23075 FIX: #23087 FIX: #23115 FIX: #23116 +FIX: #23117 FIX: #23281 FIX: #23420 : wrong check on $search_categ value causing FATAL ERROR FIX: Accountancy - Quadra export FIX: add border left on image product when conf activated FIX: Add missing token when deleting template inn order_supplier admin menu -FIX: Amount of localtax1 and 2 not correctly save on purchase order (the FIX: API access for deactivated users FIX: bad selection of barcode numbering module FIX: Can't see all time spent by all user @@ -278,8 +279,6 @@ FIX: Empty FormSetup emailTemplate type IF empty fieldvalue FIX: Errors Handling for CreateFrom Hooks FIX: error with dol_banner_tab, ref is needed FIX: ExpenseReport card was not reloaded after addline -FIX: #23075 -FIX: #23117 FIX: get multicurrency infos of propal when create order from propal with "WORKFLOW_PROPAL_AUTOCREATE_ORDER" conf FIX: Give predictable order to inventory lines FIX: include class multicurrency @@ -287,7 +286,6 @@ FIX: methods declaration (backport fix 67b9a7dc07d708231d12b5e58800334d4a01ef98) FIX: multicurrency_tx and not currency_tx FIX: on public ticket list, only the page 1 was accessible. Other pages were 404 error. FIX: PGSQL Integer type does not have a free lenght -FIX: PGSQL Int type does not have a free lenght FIX: Product list in setup.php in new Module FIX: propal and order stats broken on Tag+User(retricted customer list) FIX: saving of numbering module for jobs From 02475369e638333dfecad09b58e5f84ab7e314a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 12:58:49 +0100 Subject: [PATCH 171/580] 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 172/580] 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 173/580] 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 174/580] 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 175/580] 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 176/580] 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 177/580] 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 178/580] 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 179/580] 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 457e6883e249938eee7ac1d0f1a4164a337fb5ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 15:34:47 +0100 Subject: [PATCH 180/580] 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 181/580] 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 182/580] 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 183/580] 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 8299501800d27661caf468133979f14c91a27c8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:14:32 +0100 Subject: [PATCH 184/580] 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 185/580] 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 a3d32fc7eb8bb0f7c590552aefb8ba43cb0bcfeb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:53:16 +0100 Subject: [PATCH 186/580] 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 187/580] 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 844ee2f9e517ba045c581abb0ca7f50c73f04776 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 10 Feb 2023 18:02:25 +0100 Subject: [PATCH 188/580] New functionality and fix som coherence in initial object & deleteObject --- htdocs/langs/en_US/errors.lang | 4 + htdocs/langs/fr_FR/errors.lang | 5 +- htdocs/modulebuilder/index.php | 436 +++++++++++++++++++++++++++------ 3 files changed, 374 insertions(+), 71 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 54a4b4fb470..5d262f54200 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -305,6 +305,10 @@ ErrorDateOfMovementLowerThanDateOfFileTransmission=The date of the bank transact ErrorTooMuchFileInForm=Too much files in form, the maximum number is %s file(s) ErrorSessionInvalidatedAfterPasswordChange=The session was been invalidated following a change of password, status or dates of validity. Please relogin. ErrorExistingPermission = Permission %s for object %s already exists +ErrorFieldExist=The value for %s already exist +ErrorEqualModule=Module invalid in %s +ErrorFieldValue=Value for %s is incorrect +ErrorCoherenceMenu=%s is required when % equal LEFT # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index cbf69ff2aa8..eddeadde288 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -305,7 +305,10 @@ ErrorDateOfMovementLowerThanDateOfFileTransmission=La date de l'opération banca ErrorTooMuchFileInForm=Trop de fichiers dans le formulaire, le nombre maximum est de %s fichier(s) ErrorExistingPermission = La permission %s pour l'objet %s est dejà existante ErrorSessionInvalidatedAfterPasswordChange=La session a été invalidée suite à un changement de mot de passe, d'état ou de dates de validité. Veuillez vous reconnecter. - +ErrorFieldExist=La valeur pour %s existe déja +ErrorEqualModule=Module invalide pour le champ %s +ErrorFieldValue=La valeur du champ %s est incorrecte +ErrorCoherenceMenu = Le champ %s est requis si le champ %s = LEFT # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Votre paramètre PHP upload_max_filesize (%s) est supérieur au paramètre PHP post_max_size (%s). Ceci n'est pas une configuration cohérente. diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e52985e8c50..e4fe622dd1c 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1356,7 +1356,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { 'type'=>'left', 'titre'=>'List MyObject', 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject', + 'leftmenu'=>'myobject', 'url'=>'/mymodule/myobject_list.php', 'langs'=>'mymodule@mymodule', 'position'=>1100+\$r, @@ -1366,11 +1366,11 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { 'user'=>2, ); \$this->menu[\$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject', + 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', 'type'=>'left', 'titre'=>'New MyObject', 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject', + 'leftmenu'=>'myobject', 'url'=>'/mymodule/myobject_card.php?action=create', 'langs'=>'mymodule@mymodule', 'position'=>1100+\$r, @@ -1403,7 +1403,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { $menus = $moduleobj->menu; $counter = 0 ; foreach ($menus as $menu) { - if ($menu['leftmenu'] == strtolower($module).'_'.strtolower($objectname)) { + if ($menu['leftmenu'] == strtolower($objectname)) { $counter++; } } @@ -1812,7 +1812,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; foreach ($menus as $menu) { - if ($menu['type'] == 'left' && $menu['leftmenu'] == strtolower($module).'_'.strtolower($objectname)) { + if ($menu['type'] == 'left' && $menu['leftmenu'] == strtolower($objectname)) { $left="\$this->menu[\$r++]=array( 'fk_menu'=>'".$menu['fk_menu']."', 'type'=>'".$menu['type']."', @@ -2436,8 +2436,7 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) { } } if ($menuForObj == 1) { - $extractObjName = explode("_", $menus[$key]['leftmenu']); - dolReplaceInFile($moduledescriptorfile, array('/*LEFTMENU '.strtoupper($extractObjName[1]).'*/'."\n" => '','/*END LEFTMENU '.strtoupper($extractObjName[1]).'*/' => '')); + dolReplaceInFile($moduledescriptorfile, array('/*LEFTMENU '.strtoupper($menus[$key]['leftmenu']).'*/'."\n" => '','/*END LEFTMENU '.strtoupper($menus[$key]['leftmenu']).'*/' => '')); } } @@ -2446,6 +2445,194 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) { exit; } +// Add menu in module without initial object +if ($dirins && $action == 'addmenu' && empty($cancel)) { + // check if module is enabled + if (isModEnabled(strtolower($module))) { + $result = unActivateModule(strtolower($module)); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + if ($result) { + setEventMessages($result, null, 'errors'); + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings'); + } + $error = 0; + $dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; + $destdir = $dirins.'/'.strtolower($module); + $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); + $objects = array(); + foreach ($listofobject as $fileobj) { + if (preg_match('/^api_/', $fileobj['name'])) { + continue; + } + if (preg_match('/^actions_/', $fileobj['name'])) { + continue; + } + + $tmpcontent = file_get_contents($fileobj['fullname']); + $reg = array(); + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) { + $objectnameloop = $reg[1]; + $objects[] = $objectnameloop; + } + } + + // load class and check if right exist + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + dol_include_once($pathtofile); + $class = 'mod'.$module; + if (class_exists($class)) { + try { + $moduleobj = new $class($db); + } catch (Exception $e) { + $error++; + dol_print_error($db, $e->getMessage()); + } + } + $menus = $moduleobj->menu; + //verify fields required + if (!GETPOST('type', 'alpha')) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors'); + } + if (!GETPOST('titre', 'alpha')) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Title")), null, 'errors'); + } + if (!GETPOST('user', 'alpha')) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DetailUser")), null, 'errors'); + } + if (!GETPOST('url', 'alpha')) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Url")), null, 'errors'); + } + if (GETPOST('mainmenu') != strtolower($module)) { + $error++; + setEventMessages($langs->trans("ErrorEqualModule", $langs->transnoentities("mainmenu")), null, 'errors'); + } + if (!empty(GETPOST('target'))) { + $targets = array('_blank','_self','_parent','_top',''); + if (!in_array(GETPOST('target'), $targets)) { + $error++; + setEventMessages($langs->trans("ErrorFieldValue", $langs->transnoentities("target")), null, 'errors'); + } + } + if (!empty(GETPOST('perms'))) { + $permssion = array('read','write'); + if (GETPOST('perms') == 1 || GETPOST('perms') == '') { + $perms = 1 ; + } else { + if (!in_array(GETPOST('perms'), $permssion)) { + $error++; + setEventMessages($langs->trans("ErrorFieldValue", $langs->transnoentities("permssion")), null, 'errors'); + } + } + } + + // check if title or url already exist in menus + + foreach ($menus as $menu) { + if (!empty(GETPOST('url')) && GETPOST('url') == $menu['url']) { + $error++; + setEventMessages($langs->trans("ErrorFieldExist", $langs->transnoentities("url")), null, 'errors'); + break; + } + if (strtolower(GETPOST('titre')) == strtolower($menu['titre'])) { + $error++; + setEventMessages($langs->trans("ErrorFieldExist", $langs->transnoentities("titre")), null, 'errors'); + break; + } + } + + + if (GETPOST('type', 'alpha') == 'left' && !empty(GETPOST('lefmenu', 'alpha'))) { + if (!str_contains(GETPOST('leftmenu'), strtolower($module))) { + $error++; + setEventMessages($langs->trans("WarningFieldsMustContains", $langs->transnoentities("leftmenu")), null, 'errors'); + } + } + + if (GETPOST('type', 'alpha') == 'left') { + if (empty(GETPOST('leftmenu') && count($objects) > 0)) { + $error++; + setEventMessages($langs->trans("ErrorCoherenceMenu", $langs->transnoentities("leftmenu"), $langs->transnoentities("type")), null, 'errors'); + } + } + + if (!$error) { + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + + $type = GETPOST('type', 'alpha'); + $fk_menu = GETPOST('fk_type', 'alpha'); + $titre = GETPOST('titre', 'alpha'); + $mainmenu = GETPOST('mainmenu', 'alpha'); + $leftmenu = GETPOST('leftmenu', 'alpha'); + $url = GETPOST('url'); + $user = GETPOST('user', 'int'); + (empty(GETPOST('perms')) && GETPOST('type') == 'top') || GETPOST('perms')==1 ? $perms=1 : $perms = 1; + $target = GETPOST('target', 'alpha'); + + + + if ($type == 'top') { + $menuTop = " + \$this->menu[\$r++] = array( + 'fk_menu'=>'".$fk_menu."', + 'type'=>'".strtolower($type)."', + 'titre'=>'".ucfirst($titre)."', + 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'), + 'mainmenu'=>'".$mainmenu."', + 'leftmenu'=> '".$leftmenu."', + 'url'=>'".$url."', + 'langs'=>'".strtolower($module)."@".strtolower($module)."', + 'position'=>1000 + \$r, + 'enabled'=>'isModEnabled(\"".strtolower($module)."\")', + 'perms' =>'".$perms."', + 'target'=>'".$target."', + 'user'=>".$user.", + );"; + $addTopMenu = dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER TOPMENU */' => '/*TOPMENU '.strtolower($titre).'*/'.$menuTop."\n\t\t".'/*END TOPMENU '.strtolower($titre).'*/'."\n\t\t/* END MODULEBUILDER TOPMENU */")); + } + if ($type == 'left') { + $fk_menu = "fk_mainmenu=".strtolower($module).",fk_leftmenu=".strtolower($leftmenu); + $menuLeft= " + \$this->menu[\$r++]=array( + 'fk_menu'=>'".$fk_menu."', + 'type'=>'".$type."', + 'titre'=>'".ucfirst($titre)."', + 'mainmenu'=>'".strtolower($module)."', + 'leftmenu'=>'".strtolower($leftmenu)."', + 'url'=>'".$url."', + 'langs'=>'".strtolower($module)."@".strtolower($module)."', + 'position'=>1100+\$r, + 'enabled'=>'\$conf->".strtolower($module)."->enabled', + 'perms'=>'".$perms."', + 'target'=>'".$target."', + 'user'=>".$user.", + );"; + + $exist = 0; + foreach ($menus as $menu) { + if (strtolower($menu['leftmenu']) == strtolower($leftmenu)) { + $exist++; + } + } + //var_dump($exist);exit; + if ($exist) { + dolReplaceInFile($moduledescriptorfile, array('/*END LEFTMENU '.strtoupper($leftmenu).'*/' => $menuLeft."\n\t\t".'/*END LEFTMENU '.strtoupper($leftmenu).'*/')); + } else { + $addLeftMenu = dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($leftmenu).'*/'."\n".$menuLeft."\n\t\t".'/*END LEFTMENU '.strtoupper($leftmenu).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */')); + } + } + + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + setEventMessages($langs->trans('MenuAddedSuccesfuly'), null); + exit; + } +} + /* * View @@ -4126,7 +4313,25 @@ if ($module == 'initmodule') { if ($tab == 'menus') { print ''."\n"; $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + $dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; + $destdir = $dirins.'/'.strtolower($module); + $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); + $objects = array(); + foreach ($listofobject as $fileobj) { + if (preg_match('/^api_/', $fileobj['name'])) { + continue; + } + if (preg_match('/^actions_/', $fileobj['name'])) { + continue; + } + $tmpcontent = file_get_contents($fileobj['fullname']); + $reg = array(); + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) { + $objectnameloop = $reg[1]; + $objects[] = $objectnameloop; + } + } $menus = $moduleobj->menu; if ($action != 'editfile' || empty($file)) { @@ -4155,10 +4360,10 @@ if ($module == 'initmodule') { print '
'; - print $langs->trans("AddProjectIntoCategory").'  '; + print $langs->trans("AddObjectIntoCategory").'  '; $form->selectProjects('', 'elemid'); print '
'; print ''; - print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'thsticky '); + print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center'); print_liste_field_titre("mainmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("leftmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("URL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->transnoentitiesnoconv('DetailUrl')); @@ -4167,76 +4372,167 @@ if ($module == 'initmodule') { print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('DetailEnabled')); print_liste_field_titre("Rights", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->trans('DetailRight')); print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->trans('DetailTarget')); - print_liste_field_titre("MenuForUsers", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ', $langs->trans('DetailUser')); + print_liste_field_titre("MenuForUsers", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('DetailUser')); + print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ', $langs->trans('')); + print "\n"; + $r = count($menus)+1; + // for adding menu on module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; if (count($menus)) { $i = 0; foreach ($menus as $menu) { $i++; - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } else { - print $menu['user']; // should not happen - } - print ''; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + print ''; + } print ''; } } else { From c21be771f87ea516ede1f2cd3cebccc8e614a295 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 18:05:05 +0100 Subject: [PATCH 189/580] 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 c692d8e6bab7be9c9056882e4f88519ec6345eb2 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 10 Feb 2023 18:16:18 +0100 Subject: [PATCH 190/580] New functionnality update menu on modulebuilder --- htdocs/modulebuilder/index.php | 98 ++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e4fe622dd1c..299bae1d6ce 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2633,6 +2633,104 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) { } } +// modify a menu +if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && empty(GETPOST('cancel'))) { + $error = 0; + $counter = 0; + // for loading class and the menu wants to modify + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + dol_include_once($pathtofile); + $class = 'mod'.$module; + if (class_exists($class)) { + try { + $moduleobj = new $class($db); + } catch (Exception $e) { + $error++; + dol_print_error($db, $e->getMessage()); + } + } + $menus = $moduleobj->menu; + $key = (int) GETPOST('menukey', 'int'); + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + //get menus info + $menuTomodify = " + \$this->menu[\$r++] = array( + 'fk_menu' =>'".$menus[$key]['fk_menu']."', + 'type' =>'".$menus[$key]['type']."', + 'titre' =>'".$menus[$key]['titre']."', + 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'), + 'mainmenu'=>'".$menus[$key]['mainmenu']."', + 'leftmenu' =>'".$menus[$key]['leftmenu']."', + 'url' =>'".$menus[$key]['url']."', + 'langs'=>'".$menus[$key]['langs']."', + 'position'=>1000 + \$r, + 'enabled'=>'isModEnabled(\"".strtolower($module)."\")', + 'perms' =>'".$menus[$key]['perms']."', + 'target'=>'".$menus[$key]['target']."', + 'user'=>".$menus[$key]['user'].", + );"; + + $fk_menu = GETPOST('fk_type', 'alpha'); + $type = GETPOST('type', 'alpha'); + $titre = GETPOST('titre', 'alpha'); + $mainmenu = GETPOST('mainmenu', 'alpha'); + $leftmenu = GETPOST('leftmenu', 'alpha'); + $url = GETPOST('url', 'alpha'); + $perms = GETPOST('perms', 'alpha'); + $target = GETPOST('target', 'alpha'); + $user = GETPOST('user', 'alpha'); + + if (!$error) { + if ($type == 'top') { + $modifiedMenu = " + \$this->menu[\$r++] = array( + 'fk_menu' =>'".$fk_menu."', + 'type' =>'".$type."', + 'titre' =>'".$titre."', + 'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'), + 'mainmenu'=>'".$menus[$key]['mainmenu']."', + 'leftmenu' =>'".$menus[$key]['leftmenu']."', + 'url' =>'".$url."', + 'langs'=>'".$menus[$key]['langs']."', + 'position'=>1000 + \$r, + 'enabled'=>'".$menus[$key]['enabled']."', + 'perms' =>'".$perms."', + 'target'=>'".$target."', + 'user'=>".$user.", + );"; + + + dolReplaceInFile($moduledescriptorfile, array($menuTomodify => '')); + if (strtolower($titre) != strtolower($menus[$key]['titre'])) { + dolReplaceInFile($moduledescriptorfile, array('/*TOPMENU '.strtolower($menus[$key]['titre']).'*/' => '/*TOPMENU '.strtolower($titre).'*/', '/*END TOPMENU '.strtolower($menus[$key]['titre']).'*/' => '/*END TOPMENU '.strtolower($titre).'*/')); + } + setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null); + } + + if ($type == 'left') { + $modifiedMenu = " + \$this->menu[\$r++] = array( + 'fk_menu' =>'".$fk_menu."', + 'type' =>'".$type."', + 'titre' =>'".$titre."', + 'mainmenu'=>'".$menus[$key]['mainmenu']."', + 'leftmenu' =>'".$menus[$key]['leftmenu']."', + 'url' =>'".$url."', + 'langs'=>'".$menus[$key]['langs']."', + 'position'=>1000 + \$r, + 'enabled'=>'isModEnabled(\"".strtolower($module)."\")', + 'perms' =>'".$perms."', + 'target'=>'".$target."', + 'user'=>'".$user."', + );"; + + dolReplaceInFile($moduledescriptorfile, array($menuTomodify => $modifiedMenu)); + setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null); + } + } + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + //exit; +} /* * View From 211bda455d18e9e4d95d24097fe1b534202e026f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:00:44 +0100 Subject: [PATCH 191/580] 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 192/580] 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 193/580] 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 194/580] 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 195/580] 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 196/580] 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 197/580] 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 0115a631074bc2cb57494d1d51ecdffa241b54ec Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Fri, 10 Feb 2023 19:49:51 +0100 Subject: [PATCH 198/580] 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 7e277aa6ef7d7ec0e4aa4cd03a40f2c4ba6e52e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 21:05:03 +0100 Subject: [PATCH 199/580] sql synta --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 98836dff8cc..67ceaf69446 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1392,8 +1392,8 @@ abstract class CommonObject } $sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email"; $sql .= ", tc.source, tc.element, tc.code, tc.libelle"; - $sql .= " FROM ".$this->db->prefix()."c_type_contact tc"; - $sql .= ", ".$this->db->prefix()."element_contact ec"; + $sql .= " FROM ".$this->db->prefix()."c_type_contact tc,"; + $sql .= " ".$this->db->prefix()."element_contact ec"; if ($source == 'internal') { // internal contact (user) $sql .= " LEFT JOIN ".$this->db->prefix()."user t on ec.fk_socpeople = t.rowid"; } From 17ae12abfdf91ac4e5e5ea78f9cc072fb2953d93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 21:09:20 +0100 Subject: [PATCH 200/580] Fix warning --- htdocs/compta/facture/class/facture.class.php | 4 ++-- htdocs/expedition/card.php | 2 +- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8505af85ce5..dcf43bcf0cb 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3245,7 +3245,7 @@ class Facture extends CommonInvoice $sortorder = 'ASC,ASC,ASC,ASC'; } - $resBatchList = $productbatch->findAllForProduct($productStatic->id, $idwarehouse, (!empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER) ? null : 0), $sortfield, $sortorder); + $resBatchList = $productbatch->findAllForProduct($productStatic->id, $idwarehouse, (getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER') ? null : 0), $sortfield, $sortorder); if (!is_array($resBatchList)) { $error++; $this->error = $this->db->lasterror(); @@ -3288,7 +3288,7 @@ class Facture extends CommonInvoice } if (!$error && $product_qty_remain > 0) { - if ($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER) { + if (getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER')) { // take in the first batch $batch = $batchList[0]; $result = $mouvP->livraison($user, $productStatic->id, $idwarehouse, $product_qty_remain, $this->lines[$i]->subprice, $langs->trans('InvoiceValidatedInDolibarr', $num), '', '', '', $batch->batch); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index a9fcea34440..97e846f3054 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1268,7 +1268,7 @@ if ($action == 'create') { print ''; $stockMin = false; - if (empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { + if (!getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER')) { $stockMin = 0; } print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 1, 0, $line->fk_product, '', 1, 0, array(), 'minwidth200', '', 1, $stockMin, 'stock DESC, e.ref'); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2392962a500..6c491bfc6e0 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -391,7 +391,7 @@ class MouvementStock extends CommonObject // Check if stock is enough when qty is < 0 // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. - if ($movestock && $qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { + if ($movestock && $qty < 0 && !getDolGlobalInt('STOCK_ALLOW_NEGATIVE_TRANSFER')) { if (isModEnabled('productbatch') && $product->hasbatch() && !$skip_batch) { $foundforbatch = 0; $qtyisnotenough = 0; From ba1d3c9d8c6d56c691d4f36054aa446a12184bc5 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Fri, 10 Feb 2023 19:49:51 +0100 Subject: [PATCH 201/580] 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 2484df288cce572f82b8f19fc7294bb4f2efaa34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 23:11:47 +0100 Subject: [PATCH 202/580] css --- htdocs/core/modules/mailings/contacts1.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 9dd6eea0e31..4063b1ef140 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -138,7 +138,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ORDER BY sp.poste"; $resql = $this->db->query($sql); - $s .= ''; $s .= ''; if ($resql) { $num = $this->db->num_rows($resql); @@ -174,7 +174,7 @@ class mailing_contacts1 extends MailingTargets $sql .= " ORDER BY c.label"; $resql = $this->db->query($sql); - $s .= ''; $s .= ''; if ($resql) { $num = $this->db->num_rows($resql); @@ -196,7 +196,7 @@ class mailing_contacts1 extends MailingTargets $s .= '
'; // Add prospect of a particular level - $s .= ''; $sql = "SELECT code, label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; $sql .= " WHERE active > 0"; From 7b546b4140e840ea7202a2bb4ba0bd09f6dd3b3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 00:22:24 +0100 Subject: [PATCH 203/580] Preapre type "datetimegmt" --- htdocs/core/class/commonobject.class.php | 20 +++++++++++-- htdocs/core/class/extrafields.class.php | 38 ++++++++++++++++++------ 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 67ceaf69446..ab4228769e1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2037,7 +2037,7 @@ abstract class CommonObject * @param mixed $value New value * @param string $table To force other table element or element line (should not be used) * @param int $id To force other object id (should not be used) - * @param string $format Data format ('text', 'date'). 'text' is used if not defined + * @param string $format Data format ('text', 'int', 'date'). 'text' is used if not defined * @param string $id_field To force rowid field name. 'rowid' is used if not defined * @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none' * @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY') @@ -2082,6 +2082,8 @@ abstract class CommonObject $sql .= $field." = ".((int) $value); } elseif ($format == 'date') { $sql .= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); + } elseif ($format == 'dategmt') { + $sql .= $field." = ".($value ? "'".$this->db->idate($value, 'gmt')."'" : "null"); } if ($fk_user_field) { @@ -5340,7 +5342,7 @@ abstract class CommonObject $sql .= ", busy"; $sql .= ", mandatory"; $sql .= ") VALUES ("; - $sql .= $resource_id; + $sql .= ((int) $resource_id); $sql .= ", '".$this->db->escape($resource_type)."'"; $sql .= ", '".$this->db->escape($this->id)."'"; $sql .= ", '".$this->db->escape($this->element)."'"; @@ -6325,6 +6327,13 @@ abstract class CommonObject } $new_array_options[$key] = $this->db->idate($this->array_options[$key]); break; + case 'datetimegmt': + // If data is a string instead of a timestamp, we convert it + if (!is_numeric($this->array_options[$key]) || $this->array_options[$key] != intval($this->array_options[$key])) { + $this->array_options[$key] = strtotime($this->array_options[$key]); + } + $new_array_options[$key] = $this->db->idate($this->array_options[$key], 'gmt'); + break; case 'link': $param_list = array_keys($attributeParam['options']); // 0 : ObjectName @@ -6665,6 +6674,13 @@ abstract class CommonObject $this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]); } break; + case 'datetimegmt': + if (empty($this->array_options["options_".$key])) { + $this->array_options["options_".$key] = null; + } else { + $this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key], 'gmt'); + } + break; case 'boolean': if (empty($this->array_options["options_".$key])) { $this->array_options["options_".$key] = null; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8f8a3e54552..71d5dfdb06d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -79,6 +79,7 @@ class ExtraFields 'double'=>'Float', 'date'=>'Date', 'datetime'=>'DateAndTime', + //'datetimegmt'=>'DateAndTimeUTC', 'boolean'=>'Boolean', 'price'=>'ExtrafieldPrice', 'pricecy'=>'ExtrafieldPriceWithCurrency', @@ -979,7 +980,7 @@ class ExtraFields // Add automatic css if ($type == 'date') { $morecss = 'minwidth100imp'; - } elseif ($type == 'datetime' || $type == 'link') { + } elseif ($type == 'datetime' || $type == 'datetimegmt' || $type == 'link') { $morecss = 'minwidth200imp'; } elseif (in_array($type, array('int', 'integer', 'double', 'price'))) { $morecss = 'maxwidth75'; @@ -1031,7 +1032,7 @@ class ExtraFields // TODO Must also support $moreparam $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); } - } elseif (in_array($type, array('datetime'))) { + } elseif (in_array($type, array('datetime', 'datetimegmt'))) { $tmp = explode(',', $size); $newsize = $tmp[0]; $showtime = 1; @@ -1614,6 +1615,11 @@ class ExtraFields if ($value !== '') { $value = dol_print_date($value, 'dayhour', 'tzuserrel'); } + } elseif ($type == 'datetimegmt') { + $showsize = 19; + if ($value !== '') { + $value = dol_print_date($value, 'dayhour', 'gmt'); + } } elseif ($type == 'int') { $showsize = 10; } elseif ($type == 'double') { @@ -1928,7 +1934,7 @@ class ExtraFields $cssstring = ''; - if (in_array($type, array('date', 'datetime'))) { + if (in_array($type, array('date', 'datetime', 'datetimegmt'))) { $cssstring = "center"; } elseif (in_array($type, array('int', 'price', 'double'))) { $cssstring = "right"; @@ -2137,6 +2143,9 @@ class ExtraFields } elseif (in_array($key_type, array('datetime'))) { // Clean parameters $value_key = dol_mktime(GETPOST("options_".$key."hour", 'int'), GETPOST("options_".$key."min", 'int'), GETPOST("options_".$key."sec", 'int'), GETPOST("options_".$key."month", 'int'), GETPOST("options_".$key."day", 'int'), GETPOST("options_".$key."year", 'int'), 'tzuserrel'); + } elseif (in_array($key_type, array('datetimegmt'))) { + // Clean parameters + $value_key = dol_mktime(GETPOST("options_".$key."hour", 'int'), GETPOST("options_".$key."min", 'int'), GETPOST("options_".$key."sec", 'int'), GETPOST("options_".$key."month", 'int'), GETPOST("options_".$key."day", 'int'), GETPOST("options_".$key."year", 'int'), 'gmt'); } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { $value_arr = GETPOST("options_".$key, 'array'); // check if an array if (!empty($value_arr)) { @@ -2228,7 +2237,7 @@ class ExtraFields } else { continue; // Value was not provided, we should not set it. } - } elseif (in_array($key_type, array('datetime'))) { + } elseif (in_array($key_type, array('datetime', 'datetimegmt'))) { $dateparamname_start = $keysuffix . 'options_' . $key . $keyprefix . '_start'; $dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end'; if (GETPOSTISSET($dateparamname_start . 'year') && GETPOSTISSET($dateparamname_end . 'year')) { @@ -2236,13 +2245,24 @@ class ExtraFields $dateparamname_end_hour = GETPOST($dateparamname_end . 'hour', 'int') !='-1' ? GETPOST($dateparamname_end . 'hour', 'int') : '23'; $dateparamname_end_min = GETPOST($dateparamname_end . 'min', 'int') !='-1' ? GETPOST($dateparamname_end . 'min', 'int') : '59'; $dateparamname_end_sec = GETPOST($dateparamname_end . 'sec', 'int') !='-1' ? GETPOST($dateparamname_end . 'sec', 'int') : '59'; - $value_key = array( - 'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'), - 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel') - ); + if ($key_type == 'datetimegmt') { + $value_key = array( + 'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'gmt'), + 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'gmt') + ); + } else { + $value_key = array( + 'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'), + 'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel') + ); + } } elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) { // Clean parameters - $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."sec", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'), 'tzuserrel'); + if ($key_type == 'datetimegmt') { + $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."sec", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'), 'gmt'); + } else { + $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."sec", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'), 'tzuserrel'); + } } else { continue; // Value was not provided, we should not set it. } From 9c706061bea8a5011dd273edee6bd815c3fe49aa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 11 Feb 2023 08:48:09 +0100 Subject: [PATCH 204/580] 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 205/580] 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 206/580] 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 207/580] 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 208/580] 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 ''; + print ''; + print ''; + print ''; + print '
'; - print $i; - print ''; - print dol_escape_htmltag($menu['type']); - print ''; - print dol_escape_htmltag($menu['fk_menu']); - print ''; - print dol_escape_htmltag($menu['titre']); - print ''; - print dol_escape_htmltag($menu['mainmenu']); - print ''; - print !empty($menu['leftmenu']) ? dol_escape_htmltag($menu['leftmenu']) : ''; - print ''; - print dol_escape_htmltag($menu['url']); - print ''; - print dol_escape_htmltag($menu['langs']); - print ''; - print dol_escape_htmltag($menu['position']); - print ''; - print dol_escape_htmltag($menu['enabled']); - print ''; - print dol_escape_htmltag($menu['perms']); - print ''; - print dol_escape_htmltag($menu['target']); - print ''; - if ($menu['user'] == 2) { - print $langs->trans("AllMenus"); - } elseif ($menu['user'] == 0) { - print $langs->trans('Internal'); - } elseif ($menu['user'] == 1) { - print $langs->trans('External'); + $propFk_menu = !empty($menu['fk_menu']) ? $menu['fk_menu'] : GETPOST('fk_menu'); + $propTitre = !empty($menu['titre']) ? $menu['titre'] : GETPOST('titre'); + $propLeftmenu = !empty($menu['leftmenu']) ? $menu['leftmenu'] : GETPOST('leftmenu'); + $propUrl = !empty($menu['url']) ? $menu['url'] : GETPOST('url', 'alpha'); + $propPerms = !empty($menu['perms']) ? $menu['perms'] : GETPOST('perms'); + $propUser = !empty($menu['user']) ? $menu['user'] : GETPOST('user'); + $propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target'); + if ($action == 'editmenu' && GETPOST('menukey', 'int') == ($i-1)) { + print '
'; + print $i; + print ' + + '; + print ''; + print ''; + print '
'; + print ''; + print $i; + print ''; + print dol_escape_htmltag($menu['type']); + print ''; + print dol_escape_htmltag($menu['fk_menu']); + print ''; + print dol_escape_htmltag($menu['titre']); + print ''; + print dol_escape_htmltag($menu['mainmenu']); + print ''; + print dol_escape_htmltag($menu['leftmenu']); + print ''; + print dol_escape_htmltag($menu['url']); + print ''; + print dol_escape_htmltag($menu['langs']); + print ''; + print dol_escape_htmltag($menu['position']); + print ''; + print dol_escape_htmltag($menu['enabled']); + print ''; + print dol_escape_htmltag($menu['perms']); + print ''; + print dol_escape_htmltag($menu['target']); + print ''; + if ($menu['user'] == 2) { + print $langs->trans("AllMenus"); + } elseif ($menu['user'] == 0) { + print $langs->trans('Internal'); + } elseif ($menu['user'] == 1) { + print $langs->trans('External'); + } else { + print $menu['user']; // should not happen + } + print ''; + if ($menu['titre']!= 'Module'.$module.'Name') { + print ''.img_edit().''; + print ''.img_delete().''; + } + 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 209/580] 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 210/580] 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 6f978383cd319f190306375c5d167d6f102dae25 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:29:21 +0100 Subject: [PATCH 211/580] Doc --- dev/setup/apache/virtualhost | 55 +++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/dev/setup/apache/virtualhost b/dev/setup/apache/virtualhost index e8c5f2a8f4b..7eff1859d4f 100644 --- a/dev/setup/apache/virtualhost +++ b/dev/setup/apache/virtualhost @@ -12,6 +12,7 @@ + # The URLs of the web site ServerName myvirtualalias ServerAlias myvirtualalias @@ -23,8 +24,13 @@ AddDefaultCharset UTF-8 - DocumentRoot "/home/.../htdocs" + # Detect if we are using DoliDroid + #SetEnvIf User-Agent DoliDroid dolidroid + + + # The directory and permissions for the web site + DocumentRoot "/home/.../htdocs" AllowOverride None Options -Indexes -MultiViews +FollowSymLinks -ExecCGI @@ -40,39 +46,43 @@ # Leaving /public and /api, /dav, .well_known but also wrappers for document, viewimage and public json/img accessible to everyone AuthType None - Require all granted Satisfy any + Require all granted AuthType None - Require all granted Satisfy any + Require all granted AuthType None - Require all granted Satisfy any + Require all granted AuthType None - Require all granted Satisfy any + Require all granted AuthType None - Require all granted Satisfy any + Require all granted - + + # Log directoves ErrorLog /var/log/apache2/myvirtualalias_error_log TransferLog /var/log/apache2/myvirtualalias_access_log - # Compress returned resources of type php pages, text file export, css and javascript + + # Compress is done on resources of type php pages, text file export, css and javascript AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript - AddType text/javascript .jgz AddEncoding gzip .jgz + + + # Add cach performance directives ExpiresActive On ExpiresByType image/x-icon A2592000 ExpiresByType image/gif A2592000 @@ -83,19 +93,20 @@ ExpiresByType application/x-javascript A2592000 ExpiresByType application/javascript A2592000 - SSLEngine On - # A self-signed (snakeoil) certificate can be created by installing - # the ssl-cert package. See - # /usr/share/doc/apache2.2-common/README.Debian.gz for more info. - # If both key and certificate are stored in the same file, only the - # SSLCertificateFile directive is needed. - #SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem - #SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem - #SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem + # To enable the SSL if the certificate file exists + + SSLEngine On + + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem + SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem + + #RewriteEngine on + #RewriteCond %{SERVER_PORT} ^80$ + #RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] + - #RewriteEngine on - #RewriteCond %{SERVER_PORT} ^80$ - #RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R] - From 695ca086847b3b6a185afa93e897972c93c43d15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:50:40 +0100 Subject: [PATCH 212/580] 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 69a9dc0808e..1ea68780746 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -173,16 +173,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 216c4f02b6378b64bd5e9f3753ac65d002d08c2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:53:56 +0100 Subject: [PATCH 213/580] 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 968720bfdc2ce64cefb06f719442515f58944b68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 14:09:00 +0100 Subject: [PATCH 214/580] Code comment --- htdocs/core/lib/website2.lib.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index c7099e8d2ed..fb4cfa1b520 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -673,10 +673,12 @@ function showWebsiteTemplates(Website $website) /** - * checkPHPCode + * Check a new string containing only php code (including " + * @param string $phpfullcodestring PHP new string. For exemple "" * @return int Error or not */ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) From d0858d8eaaa434a708d538ddef71299907b65e0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 14:55:46 +0100 Subject: [PATCH 215/580] 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 216/580] 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 81ef87cf6d8baacb094dd794fbecba146874f962 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 15:39:16 +0100 Subject: [PATCH 217/580] FIX #huntr5affff95-9a37-4004-bab2-a834b3b61ff7 --- htdocs/core/lib/website2.lib.php | 8 +++++++- test/phpunit/Website.class.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index fb4cfa1b520..768f735fe39 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -718,7 +718,12 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) break; } } - // Check dynamic functions $xxx( + // Deny dynamic functions '${a}(' or '$a[b](' - So we refuse '}(' and '](' + if (preg_match('/[}\]]\(/ims', $phpfullcodestring)) { + $error++; + setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", ']('), null, 'errors'); + } + // Deny dynamic functions $xxx( if (preg_match('/\$[a-z0-9_]+\(/ims', $phpfullcodestring)) { $error++; setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", '$...('), null, 'errors'); @@ -732,6 +737,7 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) if (!$error) { $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT); $allowimportsite = true; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) { $allowimportsite = false; } diff --git a/test/phpunit/Website.class.php b/test/phpunit/Website.class.php index 50d0c16453d..364235bcc41 100644 --- a/test/phpunit/Website.class.php +++ b/test/phpunit/Website.class.php @@ -54,12 +54,17 @@ if (! defined("NOSESSION")) { require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/website.lib.php'; +require_once dirname(__FILE__).'/../../htdocs/core/lib/website2.lib.php'; if (empty($user->id)) { print "Load permissions for admin user nb 1\n"; $user->fetch(1); $user->getrights(); + + if (empty($user->rights->website)) { + $user->rights->website = new stdClass(); + } } $conf->global->MAIN_DISABLE_ALL_MAILS=1; @@ -175,4 +180,28 @@ class WebsiteTest extends PHPUnit\Framework\TestCase // We must found no line (so code should be KO). If we found somethiing, it means there is a SQL injection of the 1=1 $this->assertEquals($res['code'], 'KO'); } + + + /** + * testCheckPHPCode + * + * @return void + */ + public function testCheckPHPCode() + { + global $user; + + // Force permission so this is not the permission that will affect result of checkPHPCode + $user->rights->website->writephp = 1; + + $s = ''; + $result = checkPHPCode('', $s); + print __METHOD__." result checkPHPCode=".$result."\n"; + $this->assertEquals($result, 1, 'checkPHPCode did not detect the string was dangerous'); + + $s = ';").($_^"/"); ?>'; + $result = checkPHPCode('', $s); + print __METHOD__." result checkPHPCode=".$result."\n"; + $this->assertEquals($result, 1, 'checkPHPCode did not detect the string was dangerous'); + } } From 954906ec4835e505806a51527a16e6648f618c0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 16:02:51 +0100 Subject: [PATCH 218/580] Fix $dolibarr_main_restrict_os_commands applies also to antivir command --- htdocs/admin/security_file.php | 38 ++++++++++++++++++++++++---------- htdocs/admin/tools/export.php | 6 ++++-- htdocs/install/step1.php | 2 +- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index c545cc7e0dd..57100155ed3 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -32,10 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page $langs->loadLangs(array('users', 'admin', 'other')); -if (!$user->admin) { - accessforbidden(); -} - $action = GETPOST('action', 'aZ09'); $sortfield = GETPOST('sortfield', 'aZ09'); $sortorder = GETPOST('sortorder', 'aZ09'); @@ -48,6 +44,12 @@ if (empty($sortorder)) { $upload_dir = $conf->admin->dir_temp; +if (!$user->admin) { + accessforbidden(); +} + +$error = 0; + /* * Actions @@ -65,12 +67,26 @@ if ($action == 'updateform') { $antivircommand = dol_string_nospecial($antivircommand, '', array("|", ";", "<", ">", "&")); // Sanitize command $antivirparam = dol_string_nospecial($antivirparam, '', array("|", ";", "<", ">", "&")); // Sanitize params - $res3 = dolibarr_set_const($db, 'MAIN_UPLOAD_DOC', GETPOST('MAIN_UPLOAD_DOC', 'alpha'), 'chaine', 0, '', $conf->entity); - $res4 = dolibarr_set_const($db, "MAIN_UMASK", GETPOST('MAIN_UMASK', 'alpha'), 'chaine', 0, '', $conf->entity); - $res5 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", trim($antivircommand), 'chaine', 0, '', $conf->entity); - $res6 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", trim($antivirparam), 'chaine', 0, '', $conf->entity); - if ($res3 && $res4 && $res5 && $res6) { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + if (!empty($dolibarr_main_restrict_os_commands)) { + $arrayofallowedcommand = explode(',', $dolibarr_main_restrict_os_commands); + $arrayofallowedcommand = array_map('trim', $arrayofallowedcommand); + dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$antivircommand); + $basenamecmddump = basename(str_replace('\\', '/', $antivircommand)); + if (!in_array($basenamecmddump, $arrayofallowedcommand)) { // the provided command $cmddump must be an allowed command + $errormsg = $langs->trans('CommandIsNotInsideAllowedCommands'); + setEventMessages($errormsg, null, 'errors'); + $error++; + } + } + + if (!$error) { + $res3 = dolibarr_set_const($db, 'MAIN_UPLOAD_DOC', GETPOST('MAIN_UPLOAD_DOC', 'alpha'), 'chaine', 0, '', $conf->entity); + $res4 = dolibarr_set_const($db, "MAIN_UMASK", GETPOST('MAIN_UMASK', 'alpha'), 'chaine', 0, '', $conf->entity); + $res5 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", trim($antivircommand), 'chaine', 0, '', $conf->entity); + $res6 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", trim($antivirparam), 'chaine', 0, '', $conf->entity); + if ($res3 && $res4 && $res5 && $res6) { + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + } } } elseif ($action == 'deletefile') { // Delete file @@ -160,7 +176,7 @@ if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); } } -print ''; +print ''; if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { print '
'.$langs->trans("ValueIsForcedBySystem").''; } diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 7a91f8f598c..c9655afb26d 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -123,8 +123,9 @@ if ($what == 'mysql') { if (!empty($dolibarr_main_restrict_os_commands)) { $arrayofallowedcommand = explode(',', $dolibarr_main_restrict_os_commands); + $arrayofallowedcommand = array_map('trim', $arrayofallowedcommand); dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); - $basenamecmddump = basename($cmddump); + $basenamecmddump = basename(str_replace('\\', '/', $cmddump)); if (!in_array($basenamecmddump, $arrayofallowedcommand)) { // the provided command $cmddump must be an allowed command $errormsg = $langs->trans('CommandIsNotInsideAllowedCommands'); } @@ -160,8 +161,9 @@ if ($what == 'postgresql') { if (!empty($dolibarr_main_restrict_os_commands)) { $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); + $arrayofallowedcommand = array_map('trim', $arrayofallowedcommand); dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); - $basenamecmddump=basename($cmddump); + $basenamecmddump = basename(str_replace('\\', '/', $cmddump)); if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command { $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands'); diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 7958012b0a1..4df1370570a 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -908,7 +908,7 @@ function write_conf_file($conffile) fputs($fp, '$dolibarr_main_force_https=\''.$main_force_https.'\';'); fputs($fp, "\n"); - fputs($fp, '$dolibarr_main_restrict_os_commands=\'mysqldump, mysql, pg_dump, pgrestore\';'); + fputs($fp, '$dolibarr_main_restrict_os_commands=\'mysqldump, mysql, pg_dump, pgrestore, clamdscan, clamscan.exe\';'); fputs($fp, "\n"); fputs($fp, '$dolibarr_nocsrfcheck=\'0\';'); From ec45afb05f85913db056888b411fecb0454e4f0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 16:07:39 +0100 Subject: [PATCH 219/580] Fix can clean var --- htdocs/admin/security_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 57100155ed3..5538e0ad952 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -67,7 +67,7 @@ if ($action == 'updateform') { $antivircommand = dol_string_nospecial($antivircommand, '', array("|", ";", "<", ">", "&")); // Sanitize command $antivirparam = dol_string_nospecial($antivirparam, '', array("|", ";", "<", ">", "&")); // Sanitize params - if (!empty($dolibarr_main_restrict_os_commands)) { + if ($antivircommand && !empty($dolibarr_main_restrict_os_commands)) { $arrayofallowedcommand = explode(',', $dolibarr_main_restrict_os_commands); $arrayofallowedcommand = array_map('trim', $arrayofallowedcommand); dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$antivircommand); From 9bf878a635dab70742f2b7e8332b46c9b10f5d86 Mon Sep 17 00:00:00 2001 From: FLIO Date: Sat, 11 Feb 2023 19:23:32 +0100 Subject: [PATCH 220/580] 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 221/580] 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 222/580] 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 223/580] 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 224/580] 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 225/580] 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 226/580] 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 227/580] 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 228/580] 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 229/580] 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 230/580] 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 231/580] 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 232/580] 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 233/580] 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 234/580] 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 235/580] 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 236/580] 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 237/580] 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 238/580] 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 239/580] 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 240/580] 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 241/580] 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 242/580] 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 243/580] 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 244/580] 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 245/580] 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 246/580] [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 247/580] 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 248/580] 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 249/580] 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 250/580] 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 251/580] 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 252/580] 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 253/580] 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 254/580] 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 255/580] 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 256/580] 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 257/580] 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 258/580] 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 259/580] 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 260/580] 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 376/580] 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 377/580] 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 380/580] 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 381/580] 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 382/580] 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 383/580] 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 384/580] 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 385/580] 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 386/580] 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 387/580] 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 388/580] 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 '
'; 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 389/580] 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 390/580] 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 391/580] 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 392/580] 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 393/580] 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 400/580] 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 401/580] 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 402/580] 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 394/580] 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 395/580] 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 396/580] 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 397/580] 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 398/580] 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 399/580] 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 403/580] 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 404/580] 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 406/580] 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 407/580] 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 408/580] 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 409/580] 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 410/580] 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 411/580] 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 412/580] 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 405/580] 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 463/580] 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 464/580] 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 465/580] 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 466/580] 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 467/580] 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 468/580] 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 469/580] 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 470/580] 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 537/580] 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 538/580] 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 539/580] 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 540/580] 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 541/580] 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 471/580] 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 472/580] 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 514/580] 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 515/580] 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 516/580] 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 517/580] 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 518/580] 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 519/580] 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 520/580] 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 521/580] 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 522/580] 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 523/580] 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 524/580] 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 525/580] 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 526/580] 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 527/580] 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 528/580] 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 529/580] 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 530/580] 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 531/580] 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 532/580] 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 533/580] 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 534/580] 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 535/580] 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 536/580] 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 '
'; 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 544/580] 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 545/580] 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 549/580] 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 550/580] 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 551/580] 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 552/580] 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 553/580] 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 554/580] 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 555/580] 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 556/580] 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 557/580] 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 4c6b8d7a20e1fa1ff56ef9a1f19d1d19cb772f39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 22:14:10 +0100 Subject: [PATCH 562/580] 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 563/580] 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 564/580] 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 565/580] 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 566/580] 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 567/580] 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 5f8bff123b8e3d53dea3bb0180fc88c154a5777b Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 24 Feb 2023 11:05:54 +0100 Subject: [PATCH 568/580] 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 569/580] 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 570/580] 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 571/580] 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 2cb3e260f7fdc6be019de07663ded89b6e3f3d04 Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 24 Feb 2023 12:20:39 +0100 Subject: [PATCH 572/580] 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 573/580] 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 fae051deb4eeef7f6ac729c355a3fd577ef2e93c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 15:14:18 +0100 Subject: [PATCH 575/580] 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"; ?>
'.$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 542/580] 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 543/580] 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 546/580] 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 547/580] 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 548/580] 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 558/580] 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 559/580] 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 560/580] 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 561/580] 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 '