From 8202a67e4ea4cb55081a7d7954b8728c4a4139d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Dec 2019 23:15:56 +0100 Subject: [PATCH] Fix look and feel v11 --- htdocs/compta/bank/transfer.php | 4 +- htdocs/compta/bank/various_payment/card.php | 2 +- .../compta/bank/various_payment/document.php | 2 +- .../sociales/class/chargesociales.class.php | 52 ++++++----------- htdocs/loan/class/loan.class.php | 58 +++++++------------ htdocs/loan/list.php | 27 +++++---- htdocs/loan/schedule.php | 32 +++++----- 7 files changed, 81 insertions(+), 96 deletions(-) diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index dbceabf642e..2a32e173d3b 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry @@ -238,6 +238,7 @@ print ''; print ''; +print '
'; print ''; print ''; print ''; @@ -261,6 +262,7 @@ print ''; print "
'.$langs->trans("TransferFrom").''.$langs->trans("TransferTo").''.$langs->trans("Date").''.$langs->trans("Description").''.$langs->trans("Amount").'
"; +print '
'; print '
'; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index f4a88f8eba2..2db276ebbbe 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -456,7 +456,7 @@ if ($id) print '
'; print '
'; - print ''; + print '
'; // Label print ''; diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 2a56122d6f3..37ff26b0b4b 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -134,7 +134,7 @@ if ($object->id) print '
'.$langs->trans("Label").''.$object->label.'
'; - print ''; + print ''; print ''; print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index fecc5a96aa1..5bb218d46cd 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -108,6 +108,10 @@ class ChargeSociales extends CommonObject public $fk_project; + const STATUS_UNPAID = 0; + const STATUS_PAID = 1; + + /** * Constructor * @@ -495,43 +499,23 @@ class ChargeSociales extends CommonObject // Load translation files required by the page $langs->loadLangs(array("customers","bills")); - if ($mode == 0 || $mode == 1) + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - if ($status == 0) return $langs->trans("Unpaid"); - elseif ($status == 1) return $langs->trans("Paid"); - } - elseif ($mode == 2) - { - if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); - } - elseif ($mode == 3) - { - if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6'); - } - elseif ($mode == 4) - { - if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); - } - elseif ($mode == 5) - { - if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); - } - elseif ($mode == 6) - { - if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + global $langs; + //$langs->load("mymodule"); + $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid'); + $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid'); + if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft'); + $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled'); + if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); } - else return "Error, mode/status not found"; + $statusType = 'status1'; + if ($status == 0 && $alreadypaid > 0) $statusType = 'status3'; + if ($status == 1) $statusType = 'status6'; + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 427217bec10..6a724db9d87 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -105,6 +105,10 @@ class Loan extends CommonObject public $fk_project; + const STATUS_UNPAID = 0; + const STATUS_PAID = 1; + + /** * Constructor * @@ -425,47 +429,29 @@ class Loan extends CommonObject */ public function LibStatut($status, $mode = 0, $alreadypaid = -1) { - // phpcs:enable + // phpcs:enable global $langs; - $langs->loadLangs(array("customers", "bills")); - if ($mode == 0 || $mode == 1) + // Load translation files required by the page + $langs->loadLangs(array("customers","bills")); + + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - if ($status == 0) return $langs->trans("Unpaid"); - elseif ($status == 1) return $langs->trans("Paid"); - } - elseif ($mode == 2) - { - if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); - } - elseif ($mode == 3) - { - if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6'); - } - elseif ($mode == 4) - { - if ($status == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - elseif ($status == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); - elseif ($status == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); - } - elseif ($mode == 5) - { - if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); - } - elseif ($mode == 6) - { - if ($status == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - elseif ($status == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); - elseif ($status == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + global $langs; + //$langs->load("mymodule"); + $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid'); + $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid'); + if ($status == 0 && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Draft'); + $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Enabled'); + if ($status == 0 && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); } - else return "Error, mode/status not found"; + $statusType = 'status1'; + if ($status == 0 && $alreadypaid > 0) $statusType = 'status3'; + if ($status == 1) $statusType = 'status6'; + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index a8192155b63..d1a01cd11b1 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -49,7 +49,8 @@ if (!$sortorder) $sortorder = "DESC"; $search_ref = GETPOST('search_ref', 'int'); $search_label = GETPOST('search_label', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); -$filtre = GETPOST("filtre"); + +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); // Purge search criteria @@ -77,10 +78,6 @@ $sql .= " WHERE l.entity = ".$conf->entity; if ($search_amount) $sql .= natural_search("l.capital", $search_amount, 1); if ($search_ref) $sql .= " AND l.rowid = ".$db->escape($search_ref); if ($search_label) $sql .= natural_search("l.label", $search_label); -if ($filtre) { - $filtre = str_replace(":", "=", $filtre); - $sql .= " AND ".$filtre; -} $sql .= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend"; $sql .= $db->order($sortfield, $sortorder); @@ -108,10 +105,10 @@ if ($resql) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($search_ref) $param.="&search_ref=".urlencode($search_ref); - if ($search_label) $param.="&search_label=".urlencode($search_user); - if ($search_amount) $param.="&search_amount=".urlencode($search_amount_ht); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_ref) $param.="&search_ref=".urlencode($search_ref); + if ($search_label) $param.="&search_label=".urlencode($search_label); + if ($search_amount) $param.="&search_amount=".urlencode($search_amount); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); $newcardbutton=''; if ($user->rights->loan->write) @@ -130,6 +127,8 @@ if ($resql) print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, $newcardbutton, '', $limit); + $moreforfilter = ''; + print '
'; print ''."\n"; @@ -157,7 +156,7 @@ if ($resql) print_liste_field_titre(''); print "\n"; - while ($i < min($num, $limit)) + while ($i < ($limit ? min($num, $limit) : $num)) { $obj = $db->fetch_object($resql); $loan_static->id = $obj->rowid; @@ -190,6 +189,14 @@ if ($resql) $i++; } + // If no record found + if ($num == 0) + { + $colspan = 7; + //foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + print ''; + } + print "
'.$langs->trans("NoRecordFound").'
"; print '
'; print "\n"; diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 4410e598204..a951b9c9b0f 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -48,17 +48,17 @@ $linkback = ''; // 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, 0, 'string', '', 0, 1); +$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1); // Project if (!empty($conf->projet->enabled)) { $langs->loadLangs(array("projects")); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'.$langs->trans('Project').' : '; if ($user->rights->loan->write) { if ($action != 'classify') - $morehtmlref .= '
'.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + //$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); $morehtmlref .= '
'; @@ -83,6 +83,9 @@ if (!empty($conf->projet->enabled)) } } $morehtmlref .= '
'; + +$morehtmlright = ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); if ($action == 'createecheancier') { @@ -140,8 +143,6 @@ if ($action == 'updateecheancier') { $echeance = new LoanSchedule($db); $echeance->fetchAll($object->id); -$var = !$var; - ?>