From cc20a9d1d580a8b18bd23f631719ab2bce27df48 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2018 16:13:12 +0100 Subject: [PATCH 1/5] FIX #8079 --- htdocs/compta/bank/bankentries_list.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 380392c6805..78e95180dc5 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -924,6 +924,7 @@ if ($resql) $balance = 0; // For balance $balancecalculated = false; + $posconciliatecol = 0; // Loop on each record $sign = 1; @@ -1347,7 +1348,11 @@ if ($resql) } } print ''; - if (! $i) $totalarray['nbfield']++; + if (! $i) + { + $totalarray['nbfield']++; + $posconciliatecol = $totalarray['nbfield']; + } } if (! empty($arrayfields['b.conciliated']['checked'])) @@ -1430,6 +1435,12 @@ if ($resql) } elseif ($totalarray['totaldebfield'] == $i) print ''.price(-1 * $totalarray['totaldeb']).''; elseif ($totalarray['totalcredfield'] == $i) print ''.price($totalarray['totalcred']).''; + elseif ($i == $posconciliatecol) + { + print ''; + if ($user->rights->banque->consolidate && $action == 'reconcile') print ''; + print ''; + } else print ''; } print ''; From a200a7f149d733a8ab7e0e9062fa2f1854ea59cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2018 16:41:50 +0100 Subject: [PATCH 2/5] Fix look and feel v7 --- htdocs/compta/bank/bankentries_list.php | 56 +++++++++++++++---------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 78e95180dc5..c6baf1c47f1 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -383,12 +383,14 @@ if (dol_strlen($search_dv_start) > 0) $param .= '&search_start_dvmonth=' . GETPO if (dol_strlen($search_dv_end) > 0) $param .= '&search_end_dvmonth=' . GETPOST('search_end_dvmonth', 'int') . '&search_end_dvday=' . GETPOST('search_end_dvday', 'int') . '&search_end_dvyear=' . GETPOST('search_end_dvyear', 'int'); if ($search_req_nb) $param.='&req_nb='.urlencode($search_req_nb); if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty")); -if ($optioncss != '') $param.='&optioncss='.$optioncss; +if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $options = array(); +$buttonreconcile = ''; + if ($id > 0 || ! empty($ref)) { $title = $langs->trans("FinancialAccount").' - '.$langs->trans("Transactions"); @@ -420,18 +422,19 @@ if ($id > 0 || ! empty($ref)) if ($action != 'reconcile') { - print '
'; + //print '
'; - if ($object->canBeConciliated() > 0) { + if ($object->canBeConciliated() > 0) + { // If not cash account and can be reconciliate if ($user->rights->banque->consolidate) { - print ''.$langs->trans("Conciliate").''; + $buttonreconcile = ''.$langs->trans("Conciliate").''; } else { - print ''.$langs->trans("Conciliate").''; + $buttonreconcile = ''.$langs->trans("Conciliate").''; } } - print '
'; + //print '
'; } } else @@ -585,7 +588,7 @@ if ($resql) $nbmax=15; // We accept to show last 15 receipts (so we can have more than one year) $liste=""; $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; - $sql.= " WHERE fk_account=".$id." AND num_releve IS NOT NULL"; + $sql.= " WHERE fk_account=".$object->id." AND num_releve IS NOT NULL"; $sql.= $db->order("num_releve","DESC"); $sql.= $db->plimit($nbmax+1); print '

'; @@ -614,17 +617,17 @@ if ($resql) { dol_print_error($db); } - /** - * Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) - */ - if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) { - print ' - - '; - } - print '

'; + + // Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) + if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) + { + print ' + + '; + } + print '

'; } // Form to add a transaction with no invoice @@ -721,11 +724,6 @@ if ($resql) // Title $bankcateg=new BankCateg($db); - $morehtml='
'; - $morehtml.= ' "; // ' Page '; - $morehtml.=''; - $morehtml.='/'.$nbtotalofpages.' '; - $morehtml.='
'; $addbutton = ''; if ($action != 'addline' && $action != 'reconcile') @@ -754,6 +752,18 @@ if ($resql) $addbutton = ''.$langs->trans("AddBankRecord").''; } } + + $morehtml='
'; + $morehtml.= ' "; // ' Page '; + $morehtml.=''; + $morehtml.='/'.$nbtotalofpages.' '; + $morehtml.='
'; + + if ($action != 'addline' && $action != 'reconcile') + { + $morehtml.=$buttonreconcile; + } + $morehtml.=$addbutton; $picto='title_bank'; From 19a0f552c9c944355f78c1f49ee86fe61e98e023 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2018 16:49:28 +0100 Subject: [PATCH 3/5] Fix td balance --- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/langs/en_US/errors.lang | 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 c6baf1c47f1..692df2fcb22 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1022,7 +1022,7 @@ if ($resql) print ''; print price(price2num($balance, 'MT'), 1, $langs); print ''; - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index e51bdfc1be0..e4ecb9f5af8 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -73,7 +73,7 @@ ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete. ErrorLDAPMakeManualTest=A .ldif file has been generated in directory %s. Try to load it manually from command line to have more information on errors. ErrorCantSaveADoneUserWithZeroPercentage=Can't save an action with "statut not started" if field "done by" is also filled. ErrorRefAlreadyExists=Ref used for creation already exists. -ErrorPleaseTypeBankTransactionReportName=Please type bank statement name where entry is reported (Format YYYYMM or YYYYMMDD) +ErrorPleaseTypeBankTransactionReportName=Please ennter the bank statement name where the entry has to be reported (Format YYYYMM or YYYYMMDD) ErrorRecordHasChildren=Failed to delete record since it has some childs. ErrorRecordHasAtLeastOneChildOfType=Object has at least one child of type %s ErrorRecordIsUsedCantDelete=Can't delete record. It is already used or included into other object. From b5c12b346c7ee21a840fc7d5a8956dd1088af1a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2018 16:50:43 +0100 Subject: [PATCH 4/5] Fix typo --- htdocs/langs/en_US/errors.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index e4ecb9f5af8..4ed104af7df 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -73,7 +73,7 @@ ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete. ErrorLDAPMakeManualTest=A .ldif file has been generated in directory %s. Try to load it manually from command line to have more information on errors. ErrorCantSaveADoneUserWithZeroPercentage=Can't save an action with "statut not started" if field "done by" is also filled. ErrorRefAlreadyExists=Ref used for creation already exists. -ErrorPleaseTypeBankTransactionReportName=Please ennter the bank statement name where the entry has to be reported (Format YYYYMM or YYYYMMDD) +ErrorPleaseTypeBankTransactionReportName=Please enter the bank statement name where the entry has to be reported (Format YYYYMM or YYYYMMDD) ErrorRecordHasChildren=Failed to delete record since it has some childs. ErrorRecordHasAtLeastOneChildOfType=Object has at least one child of type %s ErrorRecordIsUsedCantDelete=Can't delete record. It is already used or included into other object. From d10d9f0fb24f0fe8a5f1710252229c6ea07d86e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Feb 2018 17:22:07 +0100 Subject: [PATCH 5/5] Fix scrutinizer --- htdocs/compta/paiement/class/paiement.class.php | 2 +- htdocs/compta/tva/class/tva.class.php | 3 ++- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/fichinter/class/api_interventions.class.php | 1 + htdocs/societe/class/api_thirdparties.class.php | 2 ++ htdocs/societe/class/societe.class.php | 2 +- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index fdcfc89c4e0..95c366dff0d 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1047,7 +1047,7 @@ class Paiement extends CommonObject */ function getNomUrl($withpicto=0, $option='', $mode='withlistofinvoices', $notooltip=0) { - global $langs; + global $conf, $langs; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 689e5d8fed3..187d21cb0a6 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -652,9 +652,10 @@ class Tva extends CommonObject * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option link option * @param int $notooltip 1=Disable tooltip + * @param string $morecss More CSS * @return string Chaine with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0) + function getNomUrl($withpicto=0, $option='', $notooltip=0, morecss='') { global $langs, $conf; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e3900d2d89e..9e6b5e4aeb1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1205,7 +1205,7 @@ class Contrat extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user, $notrigger=0) { global $conf, $langs; $error=0; diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 23073737d7e..2cfe14c7197 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -162,6 +162,7 @@ class Interventions extends DolibarrApi { $num = $db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); + $i = 0; while ($i < $min) { $obj = $db->fetch_object($result); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 35301b06a07..7326d99e2b7 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -261,6 +261,8 @@ class Thirdparties extends DolibarrApi { global $db, $hookmanager; + $error = 0; + if ($id == $idtodelete) { throw new RestException(400, 'Try to merge a thirdparty into itself'); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 44e95f4159b..381f50ae218 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3780,7 +3780,7 @@ class Societe extends CommonObject */ public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { - if ($origin_id == $id) + if ($origin_id == $dest_id) { dol_syslog('Error: Try to merge a thirdparty into itself'); return false;