From c23fab267c2bbe2a738e53cf22208875abb59eee Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 05:30:17 +0200 Subject: [PATCH 01/36] This commit adds a way to filter projects by checking if selected year is in creation/ending range. The year input is shown after the list, outside the table. It's hidden by default and must be enabled with PROJECT_LIMIT_YEAR_RANGE --- htdocs/core/lib/project.lib.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e44b0dd413c..cad5880beab 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -642,6 +642,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta $sortfield=''; $sortorder=''; + $project_year_filter=0; $title=$langs->trans("Project"); if ($statut == 0) $title=$langs->trans("ProjectDraft"); @@ -681,6 +682,16 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta { $sql.= " AND p.fk_statut = ".$statut; } + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { + $project_year_filter = GETPOST("project_year_filter"); + //Check if empty or invalid year. Wildcard ignores the sql check + if ($project_year_filter != "*") { + if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { // + $project_year_filter = date("Y"); + } + $sql.= " AND (YEAR(p.datec) <= ".$project_year_filter." AND YEAR(p.datee) >= ".$project_year_filter.")"; + } + } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; $sql.= " ORDER BY p.title, p.ref"; @@ -724,6 +735,19 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta { dol_print_error($db); } + print ""; + + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { + //Add the year filter input + print ''; + print ''; + print ''; + print ''; + print '\n"; + print '
'.$langs->trans("Year").'
'; + print ''; + print "
'; + } } From 71a1857b49b9c8d675207c90aeb008e2274381fe Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 16:46:19 +0200 Subject: [PATCH 02/36] Ignore dateo/datee if is a null column --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index cad5880beab..f62d06c6af6 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -689,7 +689,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { // $project_year_filter = date("Y"); } - $sql.= " AND (YEAR(p.datec) <= ".$project_year_filter." AND YEAR(p.datee) >= ".$project_year_filter.")"; + $sql.= " AND (p.datee IS NULL OR YEAR(p.dateo) <= ".$project_year_filter.") AND (p.datee IS NULL OR YEAR(p.datee) >= ".$project_year_filter.")"; } } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; From 68994823dd7738735f848ca9b607f9174b68f8bd Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 18:00:55 +0200 Subject: [PATCH 03/36] Closed projects are greyed out in project selector --- htdocs/core/class/html.formprojet.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4042bb16e31..eafe9d9f166 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -115,12 +115,17 @@ class FormProjets { $disabled=0; $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); - if (! $obj->fk_statut > 0) + if ($obj->fk_statut == 0) { $disabled=1; $labeltoshow.=' - '.$langs->trans("Draft"); } - if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) + else if ($obj->fk_statut == 2) + { + $disabled=1; + $labeltoshow.=' - '.$langs->trans("Closed"); + } + else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled=1; $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); From 9493e252c9ff75b06467a881fe23a5cc25093af7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 15 Sep 2014 09:55:09 +0200 Subject: [PATCH 04/36] add refext into fecth product --- htdocs/product/class/product.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d7bdec82079..e6695b75bc6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1206,6 +1206,7 @@ class Product extends CommonObject $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " datec, tms, import_key, entity, desiredstock"; + $sql.= " ,ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id); else @@ -1277,6 +1278,7 @@ class Product extends CommonObject $this->date_modification = $obj->tms; $this->import_key = $obj->import_key; $this->entity = $obj->entity; + $this->ref_ext = $obj->ref_ext; $this->db->free($resql); From d4bcea07990b8981c076e11f269b7274dcb4aea7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 15 Sep 2014 20:30:03 +0200 Subject: [PATCH 05/36] Correct bank journal --- htdocs/accountancy/journal/bankjournal.php | 51 +++++++++++++--------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f2d5a586b37..82c3a09e20a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -132,7 +132,7 @@ if ($result) { $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); - $cptsociale = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); + $accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); $tabpay = array (); $tabbq = array (); @@ -173,21 +173,26 @@ if ($result) { $tabtype[$obj->rowid] = $links[$key]['type']; - if ($links[$key]['type'] == 'payment') { + if ($links[$key]['type'] == 'payment') + { $paymentstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'payment_supplier') { + } + else if ($links[$key]['type'] == 'payment_supplier') + { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'company') { - + } + else if ($links[$key]['type'] == 'company') + { $societestatic->id = $links[$key]['url_id']; $societestatic->nom = $links[$key]['label']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } else if ($links[$key]['type'] == 'sc') { - + } + else if ($links[$key]['type'] == 'sc') + { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; @@ -196,7 +201,9 @@ if ($result) { if ($reg[1] == 'socialcontribution') $reg[1] = 'SocialContribution'; $chargestatic->lib = $langs->trans($reg[1]); - } else { + } + else + { $chargestatic->lib = $links[$key]['label']; } $chargestatic->ref = $chargestatic->lib; @@ -211,29 +218,33 @@ if ($result) { dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); - if ($resultmid) { + if ($resultmid) + { $objmid = $db->fetch_object($resultmid); $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; } - } else if ($links[$key]['type'] == 'payment_vat') { - + } + else if ($links[$key]['type'] == 'payment_vat') + { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } else if ($links[$key]['type'] == 'payment_salary') { - + } + else if ($links[$key]['type'] == 'payment_salary') + { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cptsociale] += $obj->amount; - } else if ($links[$key]['type'] == 'banktransfert') { - + $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; + } + else if ($links[$key]['type'] == 'banktransfert') + { $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabtp[$obj->rowid][$cpttva] += $obj->amount; } /*else { - $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; + $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; }*/ } $tabbq[$obj->rowid][$compta_bank] += $obj->amount; @@ -477,14 +488,14 @@ if ($action == 'export_csv') { llxHeader('', $langs->trans("BankJournal")); - $nom = $langs->trans("BankJournal"); - $nomlink = ''; + $namereport = $langs->trans("BankJournal"); + $namelink = ''; $periodlink = ''; $exportlink = ''; $builddate = time(); $description = $langs->trans("DescBankJournal") . '
'; $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); - report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); + report_header($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); print ''; From 0f3db1e912ce9159cc837864442d381eeb228015 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 16 Sep 2014 07:21:29 +0200 Subject: [PATCH 06/36] Add more search field in list of cheque deposits --- ChangeLog | 15 +++--- htdocs/compta/paiement/cheque/liste.php | 70 ++++++++++++++++++------- 2 files changed, 58 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index a939cae003b..0d3ef6ab4a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,7 +31,7 @@ For users: shown on main product card. - New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to create an automatic event into agenda. -- New: Add new type of event (when type of events are used, not by default) +- New: Add new type of event (when type of events are used, not by default). - New: Add country into table of thirdparties type. This will allow to provide a list of thirdparty types specific to a country (like argentina that need type A or B). @@ -42,16 +42,17 @@ For users: Differentiate text and img. Use label into quick search form. Use accesskey on form search. -- New: Intervention documents are now available in ECM module -- New: Add attachments on user card + in ECM module +- New: Intervention documents are now available in ECM module. +- New: Add attachments on user card + in ECM module. - New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. -- New: [ task #1204 ] add Numering contrat module free (like leopard in product module) -- New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice -- New: Enable supplier price log table -- New: [ task #1204 ] add a External reference to contract +- New: [ task #1204 ] add Numering contrat module free (like leopard in product module). +- New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice. +- New: Enable supplier price log table. +- New: [ task #1204 ] add a External reference to contract. - New: [ task #1218 ] Can drag and drop an event from calendar to change its day. - New: Optimize size of image static resources. - New: Add hourly and daily amount on user card. Add weekly working hours and salary on user card. +- New: Add more search field in list of cheque deposits. - Upgrade phpexcel lib to 1.7.8 - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem diff --git a/htdocs/compta/paiement/cheque/liste.php b/htdocs/compta/paiement/cheque/liste.php index 474b4531295..cafe8493b71 100644 --- a/htdocs/compta/paiement/cheque/liste.php +++ b/htdocs/compta/paiement/cheque/liste.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -20,12 +21,14 @@ /** * \file htdocs/compta/paiement/cheque/liste.php * \ingroup compta - * \brief Page liste des bordereau de remise de cheque + * \brief Page list of cheque deposits */ require('../../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("banks"); $langs->load("categories"); @@ -44,12 +47,16 @@ $pageprev = $page - 1; $pagenext = $page + 1; $limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="bc.number"; +if (! $sortfield) $sortfield="dp"; +$year=GETPOST("year"); +$month=GETPOST("month"); + +$form=new Form($db); +$formother = new FormOther($db); $checkdepositstatic=new RemiseCheque($db); $accountstatic=new Account($db); - /* * View */ @@ -63,10 +70,25 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE bc.fk_bank_account = ba.rowid"; $sql.= " AND bc.entity = ".$conf->entity; -if (GETPOST('search_montant')) + +// Search criteria +if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int'); +if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int'); +if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount")); +if ($month > 0) { - $sql.=" AND bc.amount=".price2num(GETPOST('search_montant')); + if ($year > 0 && empty($day)) + $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + else if ($year > 0 && ! empty($day)) + $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; + else + $sql.= " AND date_format(bc.date_bordereau, '%m') = '".$month."'"; } +else if ($year > 0) +{ + $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; +} + $sql.= " ORDER BY $sortfield $sortorder"; $sql.= $db->plimit($limit+1, $offset); //print "$sql"; @@ -79,27 +101,35 @@ if ($resql) $i = 0; $params=''; - print_barre_liste($langs->trans("MenuChequeDeposits"), $page, 'liste.php', $params, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num); - print '
'; + print ''; print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"liste.php","bc.number","",$params,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$params,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$params,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NbOfCheques"),"liste.php","bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),"liste.php","bc.amount","",$params,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"liste.php","bc.statut","",$params,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$params,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$params,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$params,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$params,'align="right"',$sortfield,$sortorder); print "\n"; // Lignes des champs de filtre print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; - // Banque + // Bank print ''; - // Nb of cheques + // Number of cheques print ''; - // Montant + // Amount print ''; // Statut From c3b255bce999935b84b922cd62ef98aeaf697d21 Mon Sep 17 00:00:00 2001 From: Cubexed Date: Tue, 16 Sep 2014 15:27:04 +0200 Subject: [PATCH 07/36] Changed sql to be portable --- htdocs/core/lib/project.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f62d06c6af6..7a8f2302c12 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -689,7 +689,8 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { // $project_year_filter = date("Y"); } - $sql.= " AND (p.datee IS NULL OR YEAR(p.dateo) <= ".$project_year_filter.") AND (p.datee IS NULL OR YEAR(p.datee) >= ".$project_year_filter.")"; + $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")"; + $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; } } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; From 28e20f18260da84eb8cbda5dcccb4b2946bcce98 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 16 Sep 2014 20:06:31 +0200 Subject: [PATCH 08/36] typo of link into eldy menu --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 682c00ef77a..9aa38b584d1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -918,7 +918,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Grand livre $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping'); if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); - if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); + if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); // Accountancy journals if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') From 14ab058f34147859f1935ac51ee06bd28f680f98 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:05:57 +0200 Subject: [PATCH 09/36] Add Dunning into compta report --- ChangeLog | 1 + htdocs/compta/dons/class/don.class.php | 22 +++-- htdocs/compta/resultat/clientfourn.php | 124 +++++++++++++++++++++++++ htdocs/compta/resultat/index.php | 79 ++++++++++++++++ htdocs/langs/en_US/donations.lang | 1 + htdocs/langs/fr_FR/donations.lang | 3 +- 6 files changed, 220 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cecbc2b752..fb593d3722c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,7 @@ For users: - New: [ task #1204 ] add a External reference to contract - New: [ task #1204 ] add Numering contrat module free (like leopard in product module) - New: Enable supplier price log table +- New: Add dunning into compta Report For translators: - Update language files. diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index 7751a1138c8..993eda5a0f7 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Florian Henry * * 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 @@ -209,38 +209,42 @@ class Don extends CommonObject */ function check($minimum=0) { + global $langs; + $langs->load('main'); + $langs->load('companies'); + $err = 0; if (dol_strlen(trim($this->societe)) == 0) { if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) { - $error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe."; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); $err++; } } if (dol_strlen(trim($this->address)) == 0) { - $error_string[$err] = "L'adresse saisie est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Address')); $err++; } if (dol_strlen(trim($this->zip)) == 0) { - $error_string[$err] = "Le code postal saisi est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Zip')); $err++; } if (dol_strlen(trim($this->town)) == 0) { - $error_string[$err] = "La ville saisie est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Town')); $err++; } if (dol_strlen(trim($this->email)) == 0) { - $error_string[$err] = "L'email saisi est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('EMail')); $err++; } @@ -252,7 +256,7 @@ class Don extends CommonObject { if (!isset($map[substr($this->amount, $i, 1)] )) { - $error_string[$err] = "Le montant du don contient un/des caractere(s) invalide(s)"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $err++; $amount_invalid = 1; break; @@ -263,14 +267,14 @@ class Don extends CommonObject { if ($this->amount == 0) { - $error_string[$err] = "Le montant du don est null"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $err++; } else { if ($this->amount < $minimum && $minimum > 0) { - $error_string[$err] = "Le montant minimum du don est de $minimum"; + $error_string[$err] = $langs->trans('MinimumAmount',$langs->trans('$minimum')); $err++; } } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 5dcd09814ad..3d72b15804b 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -3,6 +3,8 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry * * 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 @@ -32,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("bills"); +$langs->load("donation"); +$langs->load("salaries"); $date_startmonth=GETPOST('date_startmonth'); $date_startday=GETPOST('date_startday'); @@ -538,6 +542,126 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti print ''; } +/* + * Salaries + */ + +print ''; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; +$sql.= " WHERE p.entity = ".$conf->entity; +if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; + +$sql.= " GROUP BY u.rowid"; +$sql.= " ORDER BY u.firstname"; + +dol_syslog("get payment salaries"); +$result=$db->query($sql); +$subtotal_ht = 0; +$subtotal_ttc = 0; +if ($result) +{ + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht -= $obj->amount; + $total_ttc -= $obj->amount; + $subtotal_ht += $obj->amount; + $subtotal_ttc += $obj->amount; + + $var = !$var; + print ""; + + print "\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''; + print ''; + print ''; + $i++; + } + } + else + { + $var = !$var; + print ""; + print ''; + print ''; + } +} +else +{ + dol_print_error($db); +} +/* + * Dunning +*/ + +print ''; +$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " AND fk_statut=2"; +if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; +$sql.= " GROUP BY p.societe, p.firstname, p.lastname"; +$sql.= " ORDER BY p.societe, p.firstname, p.lastname"; + +dol_syslog("get dunning"); +$result=$db->query($sql); +$subtotal_ht = 0; +$subtotal_ttc = 0; +if ($result) +{ + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht += $obj->amount; + $total_ttc += $obj->amount; + $subtotal_ht -= $obj->amount; + $subtotal_ttc -= $obj->amount; + + $var = !$var; + print ""; + + print "\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''; + print ''; + print ''; + $i++; + } + } + else + { + $var = !$var; + print ""; + print ''; + print ''; + } +} +else +{ + dol_print_error($db); +} +print ''; +if ($modecompta == 'CREANCES-DETTES') + print ''; +print ''; +print ''; /* * VAT diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index c61c8b76e08..17b408af1d6 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -3,6 +3,8 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Florian Henry * * 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 @@ -469,6 +471,83 @@ $parameters["mode"] = $modecompta; $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +/* + * Salaries + */ +$subtotal_ht = 0; +$subtotal_ttc = 0; +$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " GROUP BY p.label, dm"; + +dol_syslog("get social salaries payments"); +$result=$db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; + $encaiss[$obj->dm] += $obj->amount; + + if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; + $decaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } +} +else +{ + dol_print_error($db); +} + +/* + * get dunning paiement +*/ +$subtotal_ht = 0; +$subtotal_ttc = 0; +$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " AND fk_statut=2"; +$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; + +dol_syslog("get social salaries payments"); +$result=$db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; + $decaiss[$obj->dm] += $obj->amount; + + if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; + $encaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } +} +else +{ + dol_print_error($db); +} + /* * Show result array */ diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 728661dfa04..66ddea95a5c 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -30,3 +30,4 @@ SearchADonation=Search a donation DonationRecipient=Donation recipient ThankYou=Thank You IConfirmDonationReception=The recipient declare reception, as a donation, of the following amount +MinimumAmount=Minimum amount is %s diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index 9af7a87a12d..2da59454571 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -37,4 +37,5 @@ IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des d FrenchOptions=Options éligibles en France DONATION_ART200=Les dons ou versements reçus sont éligibles à l'article 200 du CGI DONATION_ART238=Les dons ou versements reçus sont éligibles à l'article 238bis du CGI -DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI \ No newline at end of file +DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI +MinimumAmount=Le montant minimum du don est de %s \ No newline at end of file From 32c777a78bc1a639c1ebef8f0fcc9e41afe348c7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:17:22 +0200 Subject: [PATCH 10/36] Fix bad merge --- htdocs/compta/resultat/clientfourn.php | 4 ++-- htdocs/compta/resultat/index.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 7892704a41c..da30c04d53d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -547,14 +547,14 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti */ print ''; -$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; +$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; $sql.= " WHERE p.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; -$sql.= " GROUP BY u.rowid"; +$sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; dol_syslog("get payment salaries"); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 17b408af1d6..05c3a93e011 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -494,8 +494,8 @@ if ($result) { $obj = $db->fetch_object($result); - if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; - $encaiss[$obj->dm] += $obj->amount; + if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; + $decaiss[$obj->dm] += $obj->amount; if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; $decaiss_ttc[$obj->dm] += $obj->amount; @@ -533,8 +533,8 @@ if ($result) { $obj = $db->fetch_object($result); - if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; - $decaiss[$obj->dm] += $obj->amount; + if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; + $encaiss[$obj->dm] += $obj->amount; if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; $encaiss_ttc[$obj->dm] += $obj->amount; From fc65421b2eda7dea72004ae0d87d0ed2f4f1c99f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:19:07 +0200 Subject: [PATCH 11/36] bad merge --- htdocs/compta/resultat/clientfourn.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index da30c04d53d..1d8a05984e3 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -542,11 +542,12 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti print ''; } + /* * Salaries */ -print ''; +print ''; $sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; @@ -556,7 +557,7 @@ if (! empty($date_start) && ! empty($date_end)) $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; - + dol_syslog("get payment salaries"); $result=$db->query($sql); $subtotal_ht = 0; @@ -579,9 +580,9 @@ if ($result) $var = !$var; print ""; - + print "\n"; - + if ($modecompta == 'CREANCES-DETTES') print ''; print ''; print ''; From 15d680ea4b64c035c9853a8560aea1c4abaa6bc4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Sep 2014 21:19:52 +0200 Subject: [PATCH 12/36] bad mege --- htdocs/compta/resultat/clientfourn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 1d8a05984e3..d55930ef80f 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -554,7 +554,7 @@ $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; $sql.= " WHERE p.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; - + $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; From 5216bbca720928cee778f6df316b78f7652ac54e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 16 Sep 2014 21:31:58 +0200 Subject: [PATCH 13/36] Traduce button --- htdocs/accountancy/bookkeeping/list.php | 4 ++-- htdocs/langs/en_US/accountancy.lang | 1 + htdocs/langs/es_ES/accountancy.lang | 1 + htdocs/langs/fr_FR/accountancy.lang | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index de3bbf5c1db..b0e5096699b 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -137,11 +137,11 @@ else { print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey')); - print '
'; + print ''; print '
'; print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 6745b56daf1..0c1ad62eab2 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -122,6 +122,7 @@ CustomerInvoicePayment=Payment of invoice customer ThirdPartyAccount=Thirdparty account +NewAccountingMvt=New movement NumMvts=Number of movement ListeMvts=List of the movement ErrorDebitCredit=Debit and Credit cannot have a value at the same time diff --git a/htdocs/langs/es_ES/accountancy.lang b/htdocs/langs/es_ES/accountancy.lang index afcb8456a5d..624e2c02291 100644 --- a/htdocs/langs/es_ES/accountancy.lang +++ b/htdocs/langs/es_ES/accountancy.lang @@ -120,6 +120,7 @@ CustomerInvoicePayment=Pago Factura a cliente ThirdPartyAccount=Cuenta tercero +NewAccountingMvt=Nueva movimiento NumMvts=Número de movimiento ListeMvts=Apuntes del movimiento ErrorDebitCredit=Débito y Crédito no pueden terner valor al mismo tiempo diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 72c7475fd1d..8f66eb5319f 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -122,6 +122,7 @@ CustomerInvoicePayment=Règlement de facture client ThirdPartyAccount=Compte tiers +NewAccountingMvt=Nouveau mouvement NumMvts=Numéro de mouvement ListeMvts=Liste du mouvement ErrorDebitCredit=Debit et Credit ne peuvent avoir une valeur en même temps From 9c54dc57dfea2b2f4d3177152f8b9bd5228f11f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 12:31:35 +0200 Subject: [PATCH 14/36] Save some usefull cleaning requests into repair.sql --- htdocs/install/mysql/migration/repair.sql | 28 ++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 224a76cdf73..70fae404149 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -108,14 +108,7 @@ UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps -- VMYSQL DELETE from llx_menu where module = 'margins' and url = '/margin/index.php' and not exists (select * from llx_const where name = 'MAIN_MODULE_MARGIN' or name = 'MAIN_MODULE_MARGINS'); --- Requests to clean old tables or fields - --- DROP TABLE llx_c_methode_commande_fournisseur; --- DROP TABLE llx_c_source; --- DROP TABLE llx_cond_reglement; --- DROP TABLE llx_expedition_methode; --- DROP TABLE llx_product_fournisseur; --- ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur; +ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur; ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur; @@ -155,3 +148,22 @@ UPDATE llx_projet_task SET fk_task_parent = 0 WHERE fk_task_parent = rowid UPDATE llx_actioncomm set fk_user_action = fk_user_done where fk_user_done > 0 and (fk_user_action is null or fk_user_action = 0); UPDATE llx_actioncomm set fk_user_action = fk_user_author where fk_user_author > 0 and (fk_user_action is null or fk_user_action = 0); + +-- Requests to clean old tables or fields + +-- DROP TABLE llx_c_methode_commande_fournisseur; +-- DROP TABLE llx_c_source; +-- DROP TABLE llx_cond_reglement; +-- DROP TABLE llx_expedition_methode; +-- DROP TABLE llx_product_fournisseur; + +-- To replace amount on all invoice and lines when forgetting to apply a 20% vat +-- update llx_facturedet set tva_tx = 20 where tva_tx = 0; +-- update llx_facturedet set total_ht = round(total_ttc / 1.2, 5) where total_ht = total_ttc; +-- update llx_facturedet set total_tva = total_ttc - total_ht where total_vat = 0; +-- update llx_facture set total = round(total_ttc / 1.2, 5) where total_ht = total_ttc; +-- update llx_facture set tva = total_ttc - total where tva = 0; + + + + From fe9e7a0fa951e1ba2945af6728101aa2d5266d97 Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 18:00:55 +0200 Subject: [PATCH 15/36] Revert "Closed projects are greyed out in project selector" This reverts commit 68994823dd7738735f848ca9b607f9174b68f8bd. --- htdocs/core/class/html.formprojet.class.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index eafe9d9f166..4042bb16e31 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -115,17 +115,12 @@ class FormProjets { $disabled=0; $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); - if ($obj->fk_statut == 0) + if (! $obj->fk_statut > 0) { $disabled=1; $labeltoshow.=' - '.$langs->trans("Draft"); } - else if ($obj->fk_statut == 2) - { - $disabled=1; - $labeltoshow.=' - '.$langs->trans("Closed"); - } - else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) + if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled=1; $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); From d225d92c0b48f9937fb753eae301742445748f3b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 17 Sep 2014 16:03:21 +0200 Subject: [PATCH 16/36] Fix: remove hook restriction ! --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2bd3c757e47..8e70f265f2c 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1325,7 +1325,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0,true); // Disable hook for the moment + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } From f18502870705ff76635228da1b3e05cc055604c4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 17 Sep 2014 16:03:21 +0200 Subject: [PATCH 17/36] Fix: remove hook restriction ! --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 917ceaf0e65..67e94ee7af2 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1325,7 +1325,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0,true); // Disable hook for the moment + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } From c15849df2d8640094c7ac5add6307563ed380007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 17 Sep 2014 16:40:35 +0200 Subject: [PATCH 18/36] Fixed typo --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 13edeb168fa..6f70ba71673 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -685,7 +685,7 @@ class FormMail * @param DoliDB $db Database handler * @param string $type_template Get message for key module * @param string $user Use template public or limited to this user - * @para Translate $outputlangs Output lang object + * @param Translate $outputlangs Output lang object * @return array array('topic'=>,'content'=>,..) */ private function getEMailTemplate($db, $type_template, $user, $outputlangs) From f0ebd7721d60185e95b9b403d60185f0b73bcb36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 17:49:39 +0200 Subject: [PATCH 19/36] Fix: Restore sort feature. Still did not see why previous commit is a bug fix of dolibarr bug. --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8e70f265f2c..58422dcda36 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1325,7 +1325,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } From 9cc01635aac0c8e1cb14926acd085c56c49404a0 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:56:53 +0200 Subject: [PATCH 20/36] Add clear search icon on unpaid invoices list --- htdocs/compta/facture/impayees.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 88fa6ebad27..4db7935e69c 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -372,6 +372,17 @@ $search_montant_ht = GETPOST("search_montant_ht"); $search_montant_ttc = GETPOST("search_montant_ttc"); $late = GETPOST("late"); +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_ref=''; + $search_refcustomer=''; + $search_societe=''; + $search_paymentmode=''; + $search_montant_ht=''; + $search_montant_ttc=''; +} + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -571,6 +582,7 @@ if ($resql) print '
'; print ''; if (empty($mode)) { From 3611ac673f97fb5d2367e7cf36a61271fb759851 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:58:11 +0200 Subject: [PATCH 21/36] Add clear search icon on invoices list --- htdocs/compta/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3532125ed8e..f5dbd8186cd 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -327,6 +327,7 @@ if ($resql) print ''; print ''; print '\n"; if ($num > 0) From f6df17bc011ac11a8cd73b3b76c0de50f25b8c58 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:58:37 +0200 Subject: [PATCH 22/36] Add filters on shipment list + delivery informations --- htdocs/expedition/liste.php | 63 +++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php index 29ab105ee91..91eb7056b2c 100644 --- a/htdocs/expedition/liste.php +++ b/htdocs/expedition/liste.php @@ -34,6 +34,10 @@ $expeditionid = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expedition',$expeditionid,''); +$search_ref_exp = GETPOST("search_ref_exp"); +$search_ref_liv = GETPOST('search_ref_liv'); +$search_societe = GETPOST("search_societe"); + $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); @@ -47,6 +51,13 @@ if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="DESC"; $limit = $conf->liste_limit; +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_ref_exp=''; + $search_ref_liv=''; + $search_societe=''; +} /* * View @@ -79,10 +90,9 @@ if ($socid) { $sql.= " AND e.fk_soc = ".$socid; } -if (GETPOST('sf_ref','alpha')) -{ - $sql.= " AND e.ref like '%".$db->escape(GETPOST('sf_ref','alpha'))."%'"; -} +if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); +if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); @@ -94,7 +104,10 @@ if ($resql) $expedition = new Expedition($db); - $param="&socid=$socid"; + $param=""; + if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp; + if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv; + if ($search_societe) $param.= "&search_societe=".$search_societe; print_barre_liste($langs->trans('ListOfSendings'), $page, "liste.php",$param,$sortfield,$sortorder,'',$num); @@ -103,14 +116,44 @@ if ($resql) print '
   '; + print ''; + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year?$year:-1,'year',1, 20, 5); + print ''; + $form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); + print ' '; - print ''; + print ''; print ''; print ''; @@ -124,16 +154,16 @@ if ($resql) // Date print ''.dol_print_date($db->jdate($objp->dp),'day').''; if ($objp->bid) print ''.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.''; else print ' '; print ''.$objp->nbcheque.''.price($objp->amount).'
'.$langs->trans("Salaries").'
 ".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount).''.price(-$obj->amount).'
 '.$langs->trans("None").'
'.$langs->trans("Donation").'
 ".$langs->trans("Donation")." nom."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->nom. " ".$obj->firstname." ".$obj->lastname."'.price($obj->amount).''.price($obj->amount).'
 '.$langs->trans("None").'
'.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
'.$langs->trans("Salaries").'
'.$langs->trans("Salaries").'
'.$langs->trans("Salaries").'
 ".$langs->trans("Salaries")." fk_user."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount).''.price(-$obj->amount).'
 '; print ''; + print ''; print ' '; + print ''; print "
'; print ''; - print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"liste.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),"ship2bill.php","e.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),"ship2bill.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"ship2bill.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); if($conf->livraison_bon->enabled) { - print_liste_field_titre($langs->trans("DateReceived"),"liste.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DeliveryOrder"),"ship2bill.php","e.date_expedition","",$param, '',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateReceived"),"ship2bill.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),"ship2bill.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print "\n"; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + if($conf->livraison_bon->enabled) { + print ''; + } + print ''; + print ''; + + print "\n"; + $var=True; while ($i < min($num,$limit)) From 64fe08253952624a15024e71b30aafc5add94af0 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 17 Sep 2014 17:59:00 +0200 Subject: [PATCH 23/36] New generic functions for search pictos, to be used in every lists --- htdocs/core/lib/functions.lib.php | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2e2bf34a75d..17e9467fb81 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2252,6 +2252,47 @@ function img_phone($titlealt = 'default', $option = 0) return img_picto($titlealt, $img); } +/** + * Show search logo + * + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img + * @return string Retourne tag img + */ +function img_search($titlealt = 'default', $other = '') +{ + global $conf, $langs; + + if ($titlealt == 'default') $titlealt = $langs->trans('Search'); + + $img = img_picto($titlealt, 'search.png', $other, false, 1); + + $input = ''; + + return $input; +} + +/** + * Show search logo + * + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img + * @return string Retourne tag img + */ +function img_searchclear($titlealt = 'default', $other = '') +{ + global $conf, $langs; + + if ($titlealt == 'default') $titlealt = $langs->trans('Search'); + + $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); + + $input = ''; + + return $input; +} /** * Show information for admin users From bfb923f54b009df71352ed4a3f9695f5ac30a986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 08:58:47 +0200 Subject: [PATCH 24/36] Fix: Solve conflict of translation key --- htdocs/fichinter/class/fichinter.class.php | 4 ++-- htdocs/fichinter/fiche.php | 4 ++-- htdocs/langs/en_US/interventions.lang | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index c60d2c9eac4..6aaf29c7ac2 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php'; /** - * Classe des gestion des fiches interventions + * Class to manage interventions */ class Fichinter extends CommonObject { diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 889e584d99a..edd5372471e 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1682,11 +1682,11 @@ else if ($id > 0 || ! empty($ref)) { if ($object->statut != 2) { - print ''; + print ''; } else { - print ''; + print ''; } } } diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 266ce059d8b..17641a0ab3e 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -24,8 +24,8 @@ NameAndSignatureOfInternalContact=Name and signature of intervening : NameAndSignatureOfExternalContact=Name and signature of customer : DocumentModelStandard=Standard document model for interventions InterventionCardsAndInterventionLines=Interventions and lines of interventions -ClassifyBilled=Classify "Billed" -ClassifyUnBilled=Classify "Unbilled" +InterventionClassifyBilled=Classify "Billed" +InterventionClassifyUnBilled=Classify "Unbilled" StatusInterInvoiced=Billed RelatedInterventions=Related interventions ShowIntervention=Show intervention From ae3240bad87f3786648a5d6ab87f6d5d20f717e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 09:24:10 +0200 Subject: [PATCH 25/36] Fix: List of status does not match status into class. --- htdocs/fichinter/list.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f7eb1e49986..4dfb8489c9c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -63,8 +63,9 @@ $search_status=GETPOST('search_status'); */ $form = new Form($db); +$interventionstatic=new Fichinter($db); -llxHeader(); +llxHeader('', $langs->trans("Intervention")); $sql = "SELECT"; @@ -102,8 +103,6 @@ if ($result) { $num = $db->num_rows($result); - $interventionstatic=new Fichinter($db); - $urlparam="&socid=$socid"; print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num); @@ -139,8 +138,8 @@ if ($result) print ''; } print ''; print "\n"; From 736320ba471346766362ab3d35cc49567c3421c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 09:36:47 +0200 Subject: [PATCH 26/36] Fix: Bad property --- htdocs/projet/fiche.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index b87a89181c5..0da67881a09 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -259,8 +259,8 @@ if (empty($reshook)) { $db->commit(); - if (GETPOST('socid','int') > 0) $object->societe->fetch(GETPOST('socid','int')); - else unset($object->societe); + if (GETPOST('socid','int') > 0) $object->thirdparty->fetch(GETPOST('socid','int')); + else unset($object->thirdparty); } } @@ -488,7 +488,6 @@ else * Show or edit */ - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); $res=$object->fetch_optionals($object->id,$extralabels); // To verify role of users @@ -562,7 +561,7 @@ else // Customer print ''; @@ -633,7 +632,7 @@ else // Third party print ''; From ab83e22a127c5986b1829035429d2f59b47b7d75 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 18 Sep 2014 09:57:13 +0200 Subject: [PATCH 27/36] Fix: Invoices payments may be older than invoices --- ChangeLog | 1 + htdocs/compta/paiement.php | 4 ++-- htdocs/fourn/facture/paiement.php | 4 ++-- htdocs/langs/en_US/errors.lang | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4b334c542a..b4331635592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ For users: - Fix: Must unaccent strings into SEPA file. - Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: cents for indian ruppes are calle paisa and paise. +- Fix: Invoices payments may be older than invoices. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 008721ef018..3aafa1c165b 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -108,8 +108,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye if ($datepaye && ($datepaye < $tmpinvoice->date)) { $langs->load("errors"); - $error++; - setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors'); + //$error++; + setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings'); } } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 7b443bf15c0..bb84e279ba9 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -105,8 +105,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye if ($datepaye && ($datepaye < $tmpinvoice->date)) { $langs->load("errors"); - $error++; - setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors'); + //$error++; + setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings'); } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index b874ef58f07..bbaa010bfbb 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -133,7 +133,6 @@ ErrorPHPNeedModule=Error, your PHP must have module %s installed to use t ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s ErrorWarehouseMustDiffers=Source and target warehouses must differs ErrorBadFormat=Bad format! -ErrorPaymentDateLowerThanInvoiceDate=Payment date (%s) cant' be before invoice date (%s) for invoice %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, this member is not yet linked to any thirdparty. Link member to an existing third party or create a new thirdparty before creating subscription with invoice. ErrorThereIsSomeDeliveries=Error, there is some deliveries linked to this shipment. Deletion refused. @@ -153,4 +152,5 @@ WarningCloseAlways=Warning, closing is done even if amount differs between sourc WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). WarningNotRelevant=Irrelevant operation for this dataset -WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. \ No newline at end of file +WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. +WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s. \ No newline at end of file From 9379e28a94bd0874bb2a5f2d63a0ba7a6a048f8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 09:59:29 +0200 Subject: [PATCH 28/36] Perf: Avoid duplicate load of project --- htdocs/projet/contact.php | 142 +++++++++++++++++------------------- htdocs/projet/document.php | 8 +- htdocs/projet/element.php | 15 ++-- htdocs/projet/fiche.php | 5 +- htdocs/projet/ganttview.php | 11 +-- htdocs/projet/note.php | 127 ++++++++++++++++---------------- htdocs/projet/tasks.php | 14 ++-- 7 files changed, 153 insertions(+), 169 deletions(-) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index f4815c936f9..f359f789c3f 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -41,9 +41,10 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $object->fetch(0,$ref); + $object->fetch($id,$ref); + $object->fetch_thirdparty(); $id=$object->id; } @@ -140,82 +141,73 @@ $userstatic=new User($db); if ($id > 0 || ! empty($ref)) { - if ( $object->fetch($id,$ref) > 0) + // To verify role of users + //$userAccess = $object->restrictedProjectArea($user,'read'); + $userWrite = $object->restrictedProjectArea($user,'write'); + //$userDelete = $object->restrictedProjectArea($user,'delete'); + //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; + + $head = project_prepare_head($object); + dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); + + + /* + * Projet synthese pour rappel + */ + print '
'; + print ''; + print ''; + print ''; + print ' '; + print ''; + print ' '; + // Développé dans la 3.7 + //print img_search(); + //print img_searchclear(); + print ''; + print ''; + print ''; + print ''.$langs->trans("All").' / '.$langs->trans("None").''; + print '
 '; - $liststatus=array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Validated"), '2'=>$langs->trans("Billed")); - print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1); + $liststatus=$interventionstatic->statuts_short; + print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1); print ''; print '
'.$langs->trans("ThirdParty").''; - $text=$form->select_company($object->societe->id,'socid','',1,1); + $text=$form->select_company($object->thirdparty->id,'socid','',1,1); $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); print '
'.$langs->trans("ThirdParty").''; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); else print' '; print '
'; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Label + print ''; + + // Customer + print ""; + print ''; + + // Visibility + print ''; + + // Statut + print ''; + + // Date start + print ''; + + // Date end + print ''; + + print "
'.$langs->trans('Ref').''; + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) { - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - - // To verify role of users - //$userAccess = $object->restrictedProjectArea($user,'read'); - $userWrite = $object->restrictedProjectArea($user,'write'); - //$userDelete = $object->restrictedProjectArea($user,'delete'); - //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; - - $head = project_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); - - - /* - * Projet synthese pour rappel - */ - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Label - print ''; - - // Customer - print ""; - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print "
'.$langs->trans('Ref').''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); - $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans("Label").''.$object->title.'
".$langs->trans("ThirdParty")."'; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
"; - - print ''; - - // Contacts lines (modules that overwrite templates must declare this into descriptor) - $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); - foreach($dirtpls as $reldir) - { - $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); - if ($res) break; - } + $objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - else + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + print '
'.$langs->trans("Label").''.$object->title.'
".$langs->trans("ThirdParty")."'; + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); + else print ' '; + print '
'.$langs->trans("Visibility").''; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'day'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'day'); + print '
"; + + print ''; + + // Contacts lines (modules that overwrite templates must declare this into descriptor) + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) { - print "ErrorRecordNotFound"; + $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); + if ($res) break; } } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index d40682d7ce6..611fc314481 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -46,9 +46,9 @@ if ($user->societe_id > 0) $socid=$user->societe_id; $result=restrictedArea($user,'projet',$id,''); $object = new Project($db); -$object->fetch($id,$ref); -if ($object->id > 0) +if ($id > 0 || ! empty($ref)) { + $object->fetch($id,$ref); $object->fetch_thirdparty(); $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); } @@ -85,8 +85,6 @@ if ($object->id > 0) { $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $object->restrictedProjectArea($user,'write'); @@ -124,7 +122,7 @@ if ($object->id > 0) // Company print ''.$langs->trans("ThirdParty").''; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index abdf6f81b5b..b5a1d089c96 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -61,12 +61,17 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $project = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $project->fetch(0,$ref); + $project->fetch($id,$ref); + $project->fetch_thirdparty(); $projectid=$project->id; -}else { +} +else +{ $project->fetch($projectid); + $project->fetch_thirdparty(); + $projectid=$project->id; } // Security check @@ -87,10 +92,6 @@ $formproject=new FormProjets($db); $userstatic=new User($db); -$project = new Project($db); -$project->fetch($projectid,$ref); -$project->fetch_thirdparty(); - // To verify role of users $userAccess = $project->restrictedProjectArea($user); diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 0da67881a09..1fe3d91346d 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -49,10 +49,11 @@ $hookmanager->initHooks(array('projectcard')); $object = new Project($db); $extrafields = new ExtraFields($db); -$object->fetch($id,$ref); -if ($object->id > 0) +if ($id > 0 || ! empty($ref)) { + $object->fetch($id,$ref); $object->fetch_thirdparty(); + $id=$object->id; } // Security check diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 79d302addd3..0c06c30ba57 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -38,9 +38,10 @@ $mine = ($mode == 'mine' ? 1 : 0); //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $object->fetch(0,$ref); + $object->fetch($id,$ref); + $object->fetch_thirdparty(); $id=$object->id; } @@ -69,7 +70,6 @@ $formother=new FormOther($db); $userstatic=new User($db); $companystatic=new Societe($db); $task = new Task($db); -$object = new Project($db); $arrayofcss=array('/includes/jsgantt/jsgantt.css'); @@ -86,9 +86,6 @@ llxHeader("",$langs->trans("Tasks"),$help_url,'',0,0,$arrayofjs,$arrayofcss); if ($id > 0 || ! empty($ref)) { - $object->fetch($id,$ref); - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $object->restrictedProjectArea($user,'write'); @@ -123,7 +120,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$object->title.''; print ''.$langs->trans("ThirdParty").''; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print ''; print ''; diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 493141cbe95..a086f632a36 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -36,9 +36,10 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $object->fetch(0,$ref); + $object->fetch($id,$ref); + $object->fetch_thirdparty(); $id=$object->id; } @@ -66,77 +67,71 @@ llxHeader("",$langs->trans("Project"),$help_url); $form = new Form($db); $userstatic=new User($db); -$object = new Project($db); $now=dol_now(); if ($id > 0 || ! empty($ref)) { - if ($object->fetch($id, $ref)) + // To verify role of users + //$userAccess = $object->restrictedProjectArea($user,'read'); + $userWrite = $object->restrictedProjectArea($user,'write'); + //$userDelete = $object->restrictedProjectArea($user,'delete'); + //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; + + $head = project_prepare_head($object); + dol_fiche_head($head, 'notes', $langs->trans('Project'), 0, ($object->public?'projectpub':'project')); + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Label + print ''; + + // Third party + print ''; + + // Visibility + print ''; + + // Statut + print ''; + + // Date start + print ''; + + // Date end + print ''; + + print "
'.$langs->trans("Ref").''; + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) { - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - - // To verify role of users - //$userAccess = $object->restrictedProjectArea($user,'read'); - $userWrite = $object->restrictedProjectArea($user,'write'); - //$userDelete = $object->restrictedProjectArea($user,'delete'); - //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; - - $head = project_prepare_head($object); - dol_fiche_head($head, 'notes', $langs->trans('Project'), 0, ($object->public?'projectpub':'project')); - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Label - print ''; - - // Third party - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print "
'.$langs->trans("Ref").''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); - $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); - else print' '; - print '
'.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
"; - - print '
'; - - $colwidth=30; - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - - dol_fiche_end();; + $projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); + $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; } + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); + print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); + else print' '; + print '
'.$langs->trans("Visibility").''; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'day'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'day'); + print '
"; + + print '
'; + + $colwidth=30; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + dol_fiche_end();; } llxFooter(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index f72b8c6963d..994779fcac9 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -47,7 +47,7 @@ $object = new Project($db); $taskstatic = new Task($db); $extrafields_project = new ExtraFields($db); $extrafields_task = new ExtraFields($db); -if ($id > 0 || $ref) +if ($id > 0 || ! empty($ref)) { $object->fetch($id,$ref); $id=$object->id; @@ -130,8 +130,8 @@ if ($action == 'createtask' && $user->rights->projet->creer) if ($taskid > 0) { $result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal'); - } - else + } + else { setEventMessage($task->error,'errors'); setEventMessage($task->errors,'errors'); @@ -183,7 +183,7 @@ llxHeader("",$langs->trans("Tasks"),$help_url); if ($id > 0 || ! empty($ref)) { $object->fetch($id, $ref); - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); + $object->fetch_thirdparty(); $res=$object->fetch_optionals($object->id,$extralabels_projet); @@ -198,7 +198,7 @@ if ($id > 0 || ! empty($ref)) $head=project_prepare_head($object); dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project')); - + $param=($mode=='mine'?'&mode=mine':''); print ''; @@ -221,7 +221,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; @@ -259,7 +259,7 @@ if ($id > 0 || ! empty($ref)) } -if ($action == 'create' && $user->rights->projet->creer && (empty($object->societe->id) || $userWrite > 0)) +if ($action == 'create' && $user->rights->projet->creer && (empty($object->thirdparty->id) || $userWrite > 0)) { if ($id > 0 || ! empty($ref)) print '
'; From 039105a3f1ac80632b5478fefbcba51d874d20b3 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 18 Sep 2014 10:02:03 +0200 Subject: [PATCH 29/36] Fix: Invoices payments may be older than invoices. fr and es trans --- htdocs/langs/es_ES/errors.lang | 2 +- htdocs/langs/fr_FR/errors.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index 34c6c689043..19c12805da2 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -133,7 +133,6 @@ ErrorPHPNeedModule=Error, su PHP debe tener instalado el módulo %s para ErrorOpenIDSetupNotComplete=Ha configurado Dolibarr para aceptar la autentificación OpenID, pero la URL del servicio OpenID no se encuentra definida en la constante %s ErrorWarehouseMustDiffers=El almacén de origen y destino deben de ser diferentes ErrorBadFormat=¡El formato es erróneo! -ErrorPaymentDateLowerThanInvoiceDate=La fecha de pago (%s) no puede ser anterior a la fecha (%s) de la factura %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, este miembro aún no está enlazado a un tercero. Enlace el miembro a un tercero existente o cree un tercero nuevo antes de crear la suscripción con la factura. ErrorThereIsSomeDeliveries=Error, hay entregas vinculadas a este envío. No se puede eliminar. @@ -154,3 +153,4 @@ WarningUsingThisBoxSlowDown=Atención, el uso de este panel provoca serias ralen WarningClickToDialUserSetupNotComplete=La configuración de ClickToDial para su cuenta de usuario no está completa (vea la pestaña ClickToDial en su ficha de usuario) WarningNotRelevant=Operación irrelevante para este conjunto de datos WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Funcionalidad desactivada cuando la configuración de visualización es optimizada para personas ciegas o navegadores de texto. +WarningPaymentDateLowerThanInvoiceDate=La fecha de pago (%s) es anterior a la fecha (%s) de la factura %s. \ No newline at end of file diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 3cd8609a047..954a83375b9 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -133,7 +133,6 @@ ErrorPHPNeedModule=Erreur, votre PHP doit avoir le module %s installé po ErrorOpenIDSetupNotComplete=Vous avez configuré Dolibarr pour accepter l'authentication OpenID, mais l'URL du service OpenID n'est pas défini dans la constante %s ErrorWarehouseMustDiffers=Les entrepôts source et destination doivent être différents ErrorBadFormat=Mauvais format -ErrorPaymentDateLowerThanInvoiceDate=La date de paiement (%s) ne peut être inférieure à la date de facturaction (%s) de la facture %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Erreur, cet adhérent n'est lié à aucun tiers. Lier l'adhérent à un tiers existant ou créer un nouveau tiers pour le lier avant de créer l'adhésion avec facture. ErrorThereIsSomeDeliveries=Erreur, il y a des bordereaux de réception liées à ces expéditions. La suppression est refusée. @@ -154,3 +153,4 @@ WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de WarningClickToDialUserSetupNotComplete=La configuration ClickToDial pour votre compte utilisateur n'est pas complète (voir l'onglet ClickToDial sur votre fiche utilisateur) WarningNotRelevant=Opération non pertinente pour cet ensemble de données WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Fonction désactivé quand l'affichage est en mode optimisé pour les personnes aveugles ou les navigateurs textes. +WarningPaymentDateLowerThanInvoiceDate=La date de paiement (%s) est inférieure à la date de facturaction (%s) de la facture %s. From 015b0d80361207ef45fe9b916ec5f2b4f5d0f465 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 10:05:37 +0200 Subject: [PATCH 30/36] Fix: Bad calculation of total Fix: Warning message not translated --- htdocs/.gitignore | 1 + htdocs/core/lib/project.lib.php | 51 +++++++++++++++++++++------------ htdocs/langs/en_US/errors.lang | 2 ++ htdocs/projet/index.php | 5 ++-- htdocs/projet/tasks/index.php | 3 +- 5 files changed, 41 insertions(+), 21 deletions(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index a4ebd2bb7c7..e7d542c9320 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -2,6 +2,7 @@ /custom* /extensions* /nltechno* +/teclib* /bootstrap* /google* /multicompany* diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 1dccb2c2456..3062fe1783a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -228,7 +228,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $numlines=count($lines); - $total=0; + // We declare counter as global because we want to edit them into recursive call + global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned; + if ($level == 0) + { + $total_projectlinesa_spent=0; + $total_projectlinesa_planned=0; + $total_projectlinesa_spent_if_planned=0; + } for ($i = 0 ; $i < $numlines ; $i++) { @@ -293,8 +300,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($showproject) { + // Project ref print "'; print ''; @@ -407,10 +416,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; print ''; print ''; + print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; if ($addordertick) print ''; print ''; } @@ -459,7 +474,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) { print "\n"; - + // Project print ""; - + // Ref print ''; - + // Label task print "\n"; - + // Date start print ''; - + // Date end print ''; - + // Planned Workload print ''; - + // Progress declared % print ''; - + // Time spent print '\n"; - + $disabledproject=1;$disabledtask=1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); @@ -534,7 +549,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr { $disabledtask=1; } - + print ''; - + print "\n"; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4e020ab3ae0..d98fa1756eb 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -146,3 +146,5 @@ WarningCloseAlways=Warning, closing is done even if amount differs between sourc WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). WarningNotRelevant=Irrelevant operation for this dataset +WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters + diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index a4b71c62393..97c0851d910 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -164,9 +164,10 @@ if ( $resql ) if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { -/* print ''; +/* $langs->load("errors"); + print ''; print '';*/ } else diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index a798157dd11..e9fa7c6522a 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -121,9 +121,10 @@ print "\n"; if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { + $langs->load("errors"); print ''; print ''; } else From 90edd96646e7f6930273ae6a5c541ad4f65cdcdd Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 18 Sep 2014 09:57:13 +0200 Subject: [PATCH 31/36] Fix: Invoices payments may be older than invoices --- ChangeLog | 1 + htdocs/compta/paiement.php | 4 ++-- htdocs/fourn/facture/paiement.php | 4 ++-- htdocs/langs/en_US/errors.lang | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71b895b3645..49fb3fcfa68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -138,6 +138,7 @@ For users: - Fix: Must unaccent strings into SEPA file. - Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: cents for indian ruppes are calle paisa and paise. +- Fix: Invoices payments may be older than invoices. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index e7d11fb1b99..58bc8734c72 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -109,8 +109,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye if ($datepaye && ($datepaye < $tmpinvoice->date)) { $langs->load("errors"); - $error++; - setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors'); + //$error++; + setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings'); } } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index c66a03382de..a93ac142e9a 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -106,8 +106,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye if ($datepaye && ($datepaye < $tmpinvoice->date)) { $langs->load("errors"); - $error++; - setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors'); + //$error++; + setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings'); } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 89404614db5..8e76eefaa8d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -133,7 +133,6 @@ ErrorPHPNeedModule=Error, your PHP must have module %s installed to use t ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s ErrorWarehouseMustDiffers=Source and target warehouses must differs ErrorBadFormat=Bad format! -ErrorPaymentDateLowerThanInvoiceDate=Payment date (%s) cant' be before invoice date (%s) for invoice %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, this member is not yet linked to any thirdparty. Link member to an existing third party or create a new thirdparty before creating subscription with invoice. ErrorThereIsSomeDeliveries=Error, there is some deliveries linked to this shipment. Deletion refused. ErrorCantDeletePaymentReconciliated=Can't delete a payment that had generated a bank transaction that was conciliated @@ -155,4 +154,5 @@ WarningCloseAlways=Warning, closing is done even if amount differs between sourc WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). WarningNotRelevant=Irrelevant operation for this dataset -WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. \ No newline at end of file +WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. +WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s. From 5a14a44100ad56238381f552480d1d9d94f4c0d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 11:13:23 +0200 Subject: [PATCH 32/36] Doxygen --- htdocs/core/class/commondocgenerator.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 882e0780ed4..256e9b074e4 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -27,8 +27,7 @@ /** - * \class CommonDocGenerator - * \brief Parent class for documents generators + * Parent class for documents generators */ abstract class CommonDocGenerator { From 65a69d3019f6c81dcd9481780c23780d4e176d76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 16:50:16 +0200 Subject: [PATCH 33/36] Fix: Bad field --- htdocs/compta/deplacement/class/deplacementstats.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index 196ae560cbe..c87b4ea033f 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -77,7 +77,7 @@ class DeplacementStats extends Stats */ function getNbByYear() { - $sql = "SELECT YEAR(datef) as dm, count(*)"; + $sql = "SELECT YEAR(dated) as dm, count(*)"; $sql.= " FROM ".$this->from; $sql.= " GROUP BY dm DESC"; $sql.= " WHERE ".$this->where; From 49db9d13046baedabf889bd7d0105f0627972392 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 17:12:51 +0200 Subject: [PATCH 34/36] Fix: Avoid explode when separator : is not. --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2e2bf34a75d..886e78730cc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1841,7 +1841,8 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ if ($srconly) return $fullpathpicto; else { - $tmparray=explode(':',$titlealt); + $tmparray=array(0=>$titlealt); + if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB $title=$tmparray[0]; $alt=empty($tmparray[1])?'':$tmparray[1]; return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup From f2acb048cc42d19626d2a2db37ad4ab272415d4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 18:02:22 +0200 Subject: [PATCH 35/36] Qual: Uniformize fields name. --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 3 +++ htdocs/install/mysql/tables/llx_fichinter.sql | 1 + 2 files changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index e6b8e526bf2..635154768bb 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -20,6 +20,9 @@ +ALTER TABLE llx_fichinter ADD COLUMN ref_ext varchar(255); + + -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B) ALTER TABLE llx_c_typent ADD COLUMN fk_country integer NULL AFTER libelle; diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index b2397b2d2c3..242710a0993 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -24,6 +24,7 @@ create table llx_fichinter fk_projet integer DEFAULT 0, -- projet auquel est rattache la fiche fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche ref varchar(30) NOT NULL, -- number + ref_ext varchar(255), entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, datec datetime, -- date de creation From 2b602e7b5ad8e073396751ddbf273068bb870267 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 18:46:00 +0200 Subject: [PATCH 36/36] Qual: Uniformize param names. contactidp -> contactid --- htdocs/comm/propal.php | 25 +++++++++++++++---------- htdocs/commande/fiche.php | 8 ++++---- htdocs/core/class/html.form.class.php | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index bd95e5a67e4..9c5ffd03234 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -66,6 +66,7 @@ $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); $lineid = GETPOST('lineid', 'int'); +$contactid = GETPOST('contactid','int'); // PDF $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -76,8 +77,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co $NBLINES = 4; // Security check -if (! empty($user->societe_id)) - $socid = $user->societe_id; +if (! empty($user->societe_id)) $socid = $user->societe_id; $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); @@ -261,7 +261,7 @@ else if ($action == 'add' && $user->rights->propal->creer) { $object->remise_percent = GETPOST('remise_percent'); $object->remise_absolue = GETPOST('remise_absolue'); $object->socid = GETPOST('socid'); - $object->contactid = GETPOST('contactidp'); + $object->contactid = GETPOST('contactid'); $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated @@ -285,7 +285,7 @@ else if ($action == 'add' && $user->rights->propal->creer) { $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->contactid = GETPOST('contactidp'); + $object->contactid = GETPOST('contactid'); $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated @@ -450,9 +450,9 @@ else if ($action == 'add' && $user->rights->propal->creer) { if ($id > 0) { // Insertion contact par defaut si defini - if (GETPOST('contactidp') > 0) + if (GETPOST('contactid') > 0) { - $result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external'); + $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); if ($result < 0) { $error++; @@ -1256,7 +1256,8 @@ $companystatic = new Societe($db); $now = dol_now(); // Add new proposal -if ($action == 'create') { +if ($action == 'create') +{ print_fiche_titre($langs->trans("NewProp")); $soc = new Societe($db); @@ -1356,12 +1357,16 @@ if ($action == 'create') { } print '' . "\n"; - // Contacts - if ($socid > 0) { + // Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice. + if ($socid > 0) + { print "'; + } + if ($socid > 0) + { // Ligne info remises tiers print ''; // Ligne info remises tiers diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7dfe2b3e7d3..5cf872eb3d8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3344,7 +3344,7 @@ class Form * @param string $htmlname Nom du formulaire select * @return void */ - function form_contacts($page, $societe, $selected='', $htmlname='contactidp') + function form_contacts($page, $societe, $selected='', $htmlname='contactid') { global $langs, $conf;
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print '
"; - //var_dump($taskrole); if ($showlineingray) print ''; $projectstatic->id=$lines[$i]->fk_project; $projectstatic->ref=$lines[$i]->projectref; @@ -390,7 +397,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $level++; if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick); $level--; - $total += $lines[$i]->duration; + $total_projectlinesa_spent += $lines[$i]->duration; + $total_projectlinesa_planned += $lines[$i]->planned_workload; + if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; } } else @@ -399,7 +408,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } - if ($total>0 && $level==0) + if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0) { print '
'.$langs->trans("Total").''; + print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); + print ''.convertSecondToTime($total, 'allhourmin').''; + print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); + print ''; + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent_if_planned / $total_projectlinesa_planned,2).' %'; + print '
"; $projectstatic->id=$lines[$i]->fk_project; @@ -468,14 +483,14 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr $projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]; print $projectstatic->getNomUrl(1); print "'; $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->id; print $taskstatic->getNomUrl(1); print '"; for ($k = 0 ; $k < $level ; $k++) @@ -486,28 +501,28 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr $taskstatic->ref=$lines[$i]->label; print $taskstatic->getNomUrl(0); print "'; print dol_print_date($lines[$i]->date_start,'dayhour'); print ''; print dol_print_date($lines[$i]->date_end,'dayhour'); print ''; if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); else print '--:--'; print ''; print $lines[$i]->progress.' %'; print ''; if ($lines[$i]->duration) @@ -518,7 +533,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr } else print '--:--'; print "'; $s =$form->select_date('',$lines[$i]->id,'','','',"addtime",1,0,1,$disabledtask); $s.='   '; @@ -546,7 +561,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); print '
'; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print '
'; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print '
" . $langs->trans("DefaultContact") . ''; - $form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist); + $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); print '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index d73a4c068e1..f05f516e188 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -233,7 +233,7 @@ else if ($action == 'add' && $user->rights->commande->creer) { $object->date_livraison = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); - $object->contactid = GETPOST('contactidp'); + $object->contactid = GETPOST('contactid'); // If creation from another object of another module (Example: origin=propal, originid=1) if (! empty($origin) && ! empty($originid)) { @@ -383,8 +383,8 @@ else if ($action == 'add' && $user->rights->commande->creer) { // Insert default contacts if defined if ($object_id > 0) { - if (GETPOST('contactidp')) { - $result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external'); + if (GETPOST('contactid')) { + $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); if ($result < 0) { setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); $error ++; @@ -1481,7 +1481,7 @@ if ($action == 'create' && $user->rights->commande->creer) { */ if ($socid > 0) { print "
" . $langs->trans("DefaultContact") . ''; - $form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist); + $form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist); print '