diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 78c4aa4c7db..34c409c3d32 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3739,8 +3739,8 @@ class Commande extends CommonOrder /** * getTooltipContentArray + * * @param array $params params to construct tooltip data - * @since v18 * @return array */ public function getTooltipContentArray($params) diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index bfb99e34de4..f2c1cba7aad 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -37,7 +37,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modSalaries extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index a8ed7652d9d..79adb9bff9b 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -726,16 +726,102 @@ class PaymentSalary extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $maxlen Longueur max libelle - * @return string Chaine avec URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $maxlen Longueur max libelle + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string Chaine avec URL */ - public function getNomUrl($withpicto = 0, $maxlen = 0) + public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $langs; + global $conf, $langs, $hookmanager; + + $option = ''; + + if (!empty($conf->dol_no_mouse_hover)) { + $notooltip = 1; // Force disable tooltips + } $result = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element.($this->module ? '@'.$this->module : ''), + //'option' => $option, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"'; + $label = ''; + } else { + $label = implode($this->getTooltipContentArray($params)); + } + $url = DOL_URL_ROOT.'/salaries/payment_salary/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 ($url && $add_save_lastsearch_values) { + $url .= '&save_lastsearch_values=1'; + } + } + + $linkclose = ''; + if (empty($notooltip)) { + if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { + $label = $langs->trans("SalaryPayment"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; + } else { + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } + + if ($option == 'nolink' || empty($url)) { + $linkstart = ''; + if ($option == 'nolink' || empty($url)) { + $linkend = ''; + } else { + $linkend = ''; + } + + $result .= $linkstart; + + if (empty($this->showphoto_on_popup)) { + if ($withpicto) { + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (($withpicto != 2) ? 'class="paddingright"' : ''), 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)) : ''); + + global $action, $hookmanager; + $hookmanager->initHooks(array($this->element.'dao')); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } + + /* if (empty($this->ref)) $this->ref = $this->lib; $label = img_picto('', $this->picto).' '.$langs->trans("SalaryPayment").''; @@ -761,10 +847,44 @@ class PaymentSalary extends CommonObject if ($withpicto) $result .= ($link.img_object($label, 'payment', 'class="classfortooltip"').$linkend); if ($withpicto != 2) $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend; } - + */ return $result; } + /** + * getTooltipContentArray + * + * @param array $params params to construct tooltip data + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs, $user; + + $langs->load('salaries'); + $datas = []; + + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + return ['optimize' => $langs->trans("SalaryPayment")]; + } + + if ($user->hasRight('salaries', 'read')) { + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("SalaryPayment").''; + if (isset($this->status)) { + $datas['status'] = ' '.$this->getLibStatut(5); + } + $datas['Ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + if (!empty($this->total_ttc)) { + $datas['AmountTTC'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->datep)) { + $datas['Date'] = '
'.$langs->trans('Date').': '.dol_print_date($this->datep, 'day'); + } + } + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 9e8239a4791..71d93fb72ff 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -418,6 +418,13 @@ print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} // Ref print ''; // Type -print ''; // Chq number -print ''; +print ''; if (isModEnabled("banque")) { // Bank transaction - print ''; // Account @@ -482,10 +489,12 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''."\n"; $totalarray = array(); @@ -503,7 +512,7 @@ print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "s.rowid", "", $para $totalarray['nbfield']++; print_liste_field_titre("Salary", $_SERVER["PHP_SELF"], "sal.rowid", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; -print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder); +print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "sal.dateep", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; @@ -511,7 +520,7 @@ print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", $totalarray['nbfield']++; print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder); $totalarray['nbfield']++; -print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "pst.code", "", $param, 'class="left"', $sortfield, $sortorder); +print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "pst.code", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "s.num_payment", "", $param, '', $sortfield, $sortorder, '', 'ChequeOrTransferNumber'); $totalarray['nbfield']++; @@ -573,6 +582,7 @@ while ($i < $imaxinloop) { $userstatic->email = $obj->email; $userstatic->socid = $obj->fk_soc; $userstatic->statut = $obj->status; + $userstatic->status = $obj->status; $salstatic->id = $obj->id_salary; $salstatic->ref = $obj->id_salary; @@ -603,14 +613,25 @@ while ($i < $imaxinloop) { } else { // Show here line of result print ''; - // Ref - print "\n"; - if (!$i) { - $totalarray['nbfield']++; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - // Date payment - print '\n"; + // Ref + print "\n"; if (!$i) { $totalarray['nbfield']++; } @@ -727,18 +748,21 @@ while ($i < $imaxinloop) { $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Action column - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; } print ''."\n"; @@ -759,7 +783,7 @@ if ($num == 0) { } }*/ $colspan = 12; - print ''; + print ''; }
'; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; print ''; @@ -454,16 +461,16 @@ print ''; print ''; print ''; +print ''; print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, '', 1); print ''; - print ''; + print ''; + print ''; print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
".$paymentsalstatic->getNomUrl(1)."'; + 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($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''.dol_print_date($db->jdate($obj->datep), 'dayhour', 'tzuserrel')."".$paymentsalstatic->getNomUrl(1)."'; - 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($object->id, $arrayofselected)) { - $selected = 1; + if (!getDolGlobalString('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($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'.$langs->trans("NoRecordFound").'
'.$langs->trans("NoRecordFound").'