From c23fab267c2bbe2a738e53cf22208875abb59eee Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 05:30:17 +0200 Subject: [PATCH 01/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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/63] 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 144da16391a1e9e2e6c2d1f10c308133c6638071 Mon Sep 17 00:00:00 2001 From: braito4 Date: Tue, 16 Sep 2014 19:42:11 +0200 Subject: [PATCH 08/63] Missing date_start, date_end in webserver server_invoice.php --- htdocs/webservices/server_invoice.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index c79c862146c..c59544aa3f8 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -537,6 +537,8 @@ function createInvoice($authentication,$invoice) $newline->total_ht=$line['total_net']; $newline->total_tva=$line['total_vat']; $newline->total_ttc=$line['total']; + $newline->date_start=dol_stringtotime($line['date_start']); + $newline->date_end=dol_stringtotime($line['date_end']); $newline->fk_product=$line['product_id']; $newobject->lines[]=$newline; } From 28e20f18260da84eb8cbda5dcccb4b2946bcce98 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 16 Sep 2014 20:06:31 +0200 Subject: [PATCH 09/63] 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 10/63] 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 11/63] 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 12/63] 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 13/63] 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 b9954f5b2b041aaa5b19e918bf5925b0b5404be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 16 Sep 2014 15:17:43 +0200 Subject: [PATCH 14/63] PHP 5.6 compatibility $HTTP_RAW_POST_DATA is now DEPRECATED Replaced all usages by the recommended file_get_contents("php://input") --- dev/skeletons/skeleton_webservice_server.php | 3 +-- htdocs/webservices/server_actioncomm.php | 2 +- htdocs/webservices/server_category.php | 4 +--- htdocs/webservices/server_contact.php | 4 ++-- htdocs/webservices/server_invoice.php | 4 +--- htdocs/webservices/server_order.php | 4 +--- htdocs/webservices/server_other.php | 3 +-- htdocs/webservices/server_productorservice.php | 5 +---- htdocs/webservices/server_supplier_invoice.php | 4 +--- htdocs/webservices/server_thirdparty.php | 2 +- htdocs/webservices/server_user.php | 4 +--- 11 files changed, 12 insertions(+), 27 deletions(-) diff --git a/dev/skeletons/skeleton_webservice_server.php b/dev/skeletons/skeleton_webservice_server.php index 278057fd4f6..52bb46455cb 100644 --- a/dev/skeletons/skeleton_webservice_server.php +++ b/dev/skeletons/skeleton_webservice_server.php @@ -269,5 +269,4 @@ function createSkeleton($authentication,$skeleton) } // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index dfc0aac590a..d5d9c45fa36 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -590,4 +590,4 @@ function updateActionComm($authentication,$actioncomm) } // Return the results. -$server->service($HTTP_RAW_POST_DATA); +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 1b85c677175..3c723947764 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -298,7 +298,5 @@ function getCategory($authentication,$id) return $objectresp; } - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 672f90a7bd1..f42c270fa42 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -712,6 +712,6 @@ function updateContact($authentication,$contact) return $objectresp; } -// Return the results. -$server->service($HTTP_RAW_POST_DATA); +// Return the results. +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index e8c6f166890..d0f3e589f25 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -587,7 +587,5 @@ function createInvoice($authentication,$invoice) return $objectresp; } - // Return the results. -$server->service((isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:'')); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index d70725b468f..387ed548506 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -798,7 +798,5 @@ function validOrder($authentication,$id='') return $objectresp; } - // Return the results. -$server->service((isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:'')); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 0e3caa512c6..ba948d463ea 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -321,5 +321,4 @@ function getDocument($authentication, $modulepart, $file, $refname='') } // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 3e50060660c..ffe25f8e3e8 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -1019,8 +1019,5 @@ function getProductsForCategory($authentication,$id,$lang='') return $objectresp; } - - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index c6697980a12..fea871ac077 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -457,7 +457,5 @@ function getSupplierInvoicesForThirdParty($authentication,$idthirdparty) return $objectresp; } - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 645e120a101..301511e0115 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -728,4 +728,4 @@ function getListOfThirdParties($authentication,$filterthirdparty) } // Return the results. -$server->service($HTTP_RAW_POST_DATA); +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 96fcde097b2..4fb5cc81e8c 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -753,7 +753,5 @@ function setUserPassword($authentication,$shortuser) { return $objectresp; } - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); From 5216bbca720928cee778f6df316b78f7652ac54e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 16 Sep 2014 21:31:58 +0200 Subject: [PATCH 15/63] 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 a83479618188d00b43e52a5fc376b5130c6b71e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 01:12:59 +0200 Subject: [PATCH 16/63] New: Content of predefined email come firstly from table llx_c_email_template, then translation key. --- ChangeLog | 18 ++-- htdocs/core/class/html.formmail.class.php | 116 ++++++++++++++++------ 2 files changed, 95 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f07b3dc1de..02fc78640df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,6 +52,7 @@ For users: - 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: Content of predefined email come firstly from table llx_c_email_template, then translation key. - 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 @@ -79,7 +80,6 @@ New experimental module: Ari Elbaz Florian Henry Juanjo Menent - And to the contributors : Jeff Info 2000 euros Nord Anim 120 euros @@ -95,25 +95,25 @@ For developers: - New: Add a css style "cursorpointer". - New: Select list of users can return user into hierarchy. - New: getBrowserInfo can return type of layout of browser (classic/phone/tablet) -- New: Add hook "searchAgendaFrom". +- New: Add hook "searchAgendaFrom" and "beforePDFCreation". - New: Add trigger DON_UPDATE, DON_DELETE - New: Add country iso code on 3 chars into table of countries. - Qual: Removed hard coded rowid into data init of table llx_c_action_trigger. - LINEBILL_DELETE, LINK_DELETE, ORDER_SUPPLIER_DELETE, RESOURCE_DELETE trigger called before SQL delete - New: [ Task #1481 ] Add trigger BILL_SUPPLIER_UPDATE. - New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE. -- New: Added hook "formConfirm" and "doActions" for supplier invoice card -- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card -- New: renamed table llx_c_pays to llx_c_country & libelle field to label -- Qual: Renamed table llx_c_civilite into llx_c_civility - field civilite into label in the same table +- New: Added hook "formConfirm" and "doActions" for supplier invoice card. +- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card. +- New: renamed table llx_c_pays to llx_c_country & libelle field to label. +- Qual: Renamed table llx_c_civilite into llx_c_civility, + field civilite into label in the same table, and field civilite into civility in other table -WARNING: Following change may create regression for some external modules, but was necessary to make +WARNING: Following changes may create regression for some external modules, but was necessary to make Dolibarr better: - Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php -- Some field into database wwere renamed from "libelle" to "label". +- Some field into database were renamed from "libelle" to "label". - Table llx_c_pays were renamed into llx_c_country. - Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 261754801a9..13edeb168fa 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -250,6 +250,21 @@ class FormMail if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels']; + if (! empty($newlang)) + { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('other'); + } + + // Get message template + $arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs); + + $out.= "\n\n"; if ($this->withform == 1) { @@ -439,7 +454,7 @@ class FormMail } $out.= "\n"; } - + // CCC if (! empty($this->withtoccc) || is_array($this->withtoccc)) { @@ -492,19 +507,23 @@ class FormMail // Topic if (! empty($this->withtopic)) { - $this->withtopic=make_substitutions($this->withtopic,$this->substit); + $defaulttopic=""; + if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic']; + elseif (! is_numeric($this->withtopic)) $defaulttopic=$this->withtopic; + + $defaulttopic=make_substitutions($defaulttopic,$this->substit); $out.= '
'; $out.= ''; $out.= '\n"; } @@ -563,31 +582,8 @@ class FormMail if (! empty($this->withbody)) { $defaultmessage=""; - - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $this->param['langsmodels']; - - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outputlangs->load('other'); - } - - - // TODO A partir du type, proposer liste de messages dans table llx_c_email_template - if ($this->param["models"]=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); } - elseif ($this->param["models"]=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } - elseif ($this->param["models"]=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); } - elseif ($this->param["models"]=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); } - elseif ($this->param["models"]=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); } - elseif ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } - elseif ($this->param["models"]=='shipping_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendShipping"); } - elseif ($this->param["models"]=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } - elseif ($this->param["models"]=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } - elseif (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; } + if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) $defaultmessage=$arraydefaultmessage['content']; + elseif (! is_numeric($this->withbody)) $defaultmessage=$this->withbody; // Complete substitution array if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) @@ -679,5 +675,65 @@ class FormMail return $out; } } + + + + /** + * Return template of email + * Search into table c_email_template + * + * @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 + * @return array array('topic'=>,'content'=>,..) + */ + private function getEMailTemplate($db, $type_template, $user, $outputlangs) + { + $ret=array(); + + $sql = "SELECT topic, content"; + $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; + $sql.= " WHERE type_template='".$db->escape($type_template)."'"; + $sql.= " AND entity IN (".getEntity("c_email_templates").")"; + $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; + // TODO Add field and where filter on language code + //print $sql; + + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + $ret['topic']=$obj->topic; + $ret['content']=$obj->content; + } + else + { + $defaultmessage=''; + if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); } + elseif ($type_template=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } + elseif ($type_template=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); } + elseif ($type_template=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); } + elseif ($type_template=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); } + elseif ($type_template=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } + elseif ($type_template=='shipping_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendShipping"); } + elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } + elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } + + $ret['topic']=''; + $ret['content']=$defaultmessage; + } + + $db->free($resql); + return $ret; + } + else + { + dol_print_error($db); + return -1; + } + } } From 9c54dc57dfea2b2f4d3177152f8b9bd5228f11f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 12:31:35 +0200 Subject: [PATCH 17/63] 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 d976a5575b633a42306eecee2629277cc5402d68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 14:36:04 +0200 Subject: [PATCH 18/63] New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. --- ChangeLog | 2 + .../modules/facture/doc/pdf_crabe.modules.php | 96 +++++++++++++++---- .../modules/propale/doc/pdf_azur.modules.php | 30 +++--- 3 files changed, 98 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02fc78640df..71b895b3645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,8 @@ For users: - 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: Content of predefined email come firstly from table llx_c_email_template, then translation key. +- New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture + onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. - 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/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index f7f9c561e01..8a8ab5fa89e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -153,6 +153,36 @@ class pdf_crabe extends ModelePDFFactures $outputlangs->load("bills"); $outputlangs->load("products"); + $nblignes = count($object->lines); + + // Loop on each lines to detect if there is at least one image to show + $realpatharray=array(); + if (! empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) + { + for ($i = 0 ; $i < $nblignes ; $i++) + { + if (empty($object->lines[$i]->fk_product)) continue; + + $objphoto = new Product($this->db); + $objphoto->fetch($object->lines[$i]->fk_product); + + $pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/"; + $dir = $conf->product->dir_output.'/'.$pdir; + + $realpath=''; + foreach ($objphoto->liste_photos($dir,1) as $key => $obj) + { + $filename=$obj['photo']; + //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; + $realpath = $dir.$filename; + break; + } + + if ($realpath) $realpatharray[$i]=$realpath; + } + } + if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; + if ($conf->facture->dir_output) { $object->fetch_thirdparty(); @@ -195,9 +225,8 @@ class pdf_crabe extends ModelePDFFactures global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - $nblignes = count($object->lines); - - $pdf=pdf_getInstance($this->format); + // Create pdf instance + $pdf=pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page @@ -309,17 +338,43 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); + // Define size of image if we need it + $imglinesize=array(); + if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); + $showpricebeforepagebreak=1; + $posYAfterImage=0; + $posYAfterDescription=0; + + // We start with Photo of product line + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + { + $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposbefore+1); + + $curY = $tab_top_newpage; + $showpricebeforepagebreak=0; + } + + if (isset($imglinesize['width']) && isset($imglinesize['height'])) + { + $curX = $this->posxpicture-1; + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + // $pdf->Image does not increase value return by getY, so we save it manually + $posYAfterImage=$curY+$imglinesize['height']; + } + // Description of product line $curX = $this->posxdesc-1; - $showpricebeforepagebreak=1; - $pdf->startTransaction(); - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { @@ -327,7 +382,7 @@ class pdf_crabe extends ModelePDFFactures $pageposafter=$pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; @@ -351,14 +406,15 @@ class pdf_crabe extends ModelePDFFactures { $pdf->commitTransaction(); } - + $posYAfterDescription=$pdf->GetY(); + $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - // We suppose that a too long description is moved completely on next page + // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } @@ -430,6 +486,8 @@ class pdf_crabe extends ModelePDFFactures if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; $this->tva[$vatrate] += $tvaligne; + if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; + // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { @@ -512,11 +570,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->Output($file,'F'); // Add pdfgeneration hook - if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); - } $hookmanager->initHooks(array('pdfgeneration')); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; @@ -894,7 +947,7 @@ class pdf_crabe extends ModelePDFFactures //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; + if (in_array((string) $localtax_type, array('1','3','5'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -927,7 +980,7 @@ class pdf_crabe extends ModelePDFFactures //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; + if (in_array((string) $localtax_type, array('1','3','5'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -1121,7 +1174,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); - // Fin $pdf->SetFont('','', $default_font_size - 1); $pdf->SetTextColor(0,0,0); } @@ -1180,6 +1232,16 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } + if (! empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) + { + $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + //$pdf->SetXY($this->posxpicture-1, $tab_top+1); + //$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C'); + } + } + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index e02a6b7e27e..f1871c175a6 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -205,7 +205,7 @@ class pdf_azur extends ModelePDFPropales { if (dol_mkdir($dir) < 0) { - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); return 0; } } @@ -383,6 +383,7 @@ class pdf_azur extends ModelePDFPropales $pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY(); + //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page @@ -551,12 +552,11 @@ class pdf_azur extends ModelePDFPropales $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - //$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); // Affiche zone versements /* - if ($deja_regle) + if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } @@ -729,20 +729,22 @@ class pdf_azur extends ModelePDFPropales // Si mode reglement non force ou si force a CHQ if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { + $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); + if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); $account->fetch($conf->global->FACTURE_CHQ_NUMBER); $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','B', $default_font_size - 3); + $pdf->SetFont('','B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); $posy=$pdf->GetY()+1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); + $pdf->SetFont('','', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); $posy=$pdf->GetY()+2; } @@ -750,14 +752,14 @@ class pdf_azur extends ModelePDFPropales if ($conf->global->FACTURE_CHQ_NUMBER == -1) { $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','B', $default_font_size - 3); + $pdf->SetFont('','B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); $posy=$pdf->GetY()+1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); + $pdf->SetFont('','', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } @@ -768,10 +770,11 @@ class pdf_azur extends ModelePDFPropales // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { - if (! empty($conf->global->FACTURE_RIB_NUMBER)) + if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) { + $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); $account = new Account($this->db); - $account->fetch($conf->global->FACTURE_RIB_NUMBER); + $account->fetch($bankid); $curx=$this->marge_gauche; $cury=$posy; @@ -971,6 +974,7 @@ class pdf_azur extends ModelePDFPropales foreach( $localtax_rate as $tvakey => $tvaval ) { + // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1091,7 +1095,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 6, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } $pdf->SetDrawColor(128,128,128); @@ -1102,7 +1106,7 @@ class pdf_azur extends ModelePDFPropales if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); // line prend une position y en 2eme param et 4eme param + $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); @@ -1235,11 +1239,11 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); $posy+=1; - $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetFont('','', $default_font_size - 2); if ($object->ref_client) { - $posy+=5; + $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); From 900cdd5368137c600992e5c4180f5b87377a0275 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 15:24:01 +0200 Subject: [PATCH 19/63] Qual: Removed duplicate page. --- htdocs/core/menus/init_menu_auguria.sql | 1 - htdocs/core/menus/standard/eldy.lib.php | 1 - htdocs/product/stock/liste.php | 82 ++++++++++++++++++------- htdocs/product/stock/massstockmove.php | 2 +- htdocs/product/stock/valo.php | 37 +++++------ 5 files changed, 81 insertions(+), 42 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index af5473ef3e2..36291883755 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -102,7 +102,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/fiche.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/liste.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3103__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/valo.php', 'EnhancedValue', 1, 'stocks', '$user->rights->stock->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 682c00ef77a..aff002e9585 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1068,7 +1068,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Stocks"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock'); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/fiche.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire); - if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index a639bd86239..04a9c03aa59 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/liste.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -20,7 +20,7 @@ /** * \file htdocs/product/stock/liste.php * \ingroup stock - * \brief Page liste des stocks + * \brief Page with warehouse and stock value */ require '../../main.inc.php'; @@ -44,18 +44,32 @@ if ($page < 0) $page = 0; $limit = $conf->liste_limit; $offset = $limit * $page; +$year = strftime("%Y",time()); -$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; + +/* + * View + */ + +$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; +$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $sql.= " WHERE e.entity = ".$conf->entity; if ($sref) { - $sql.= " AND e.label like '%".$db->escape($sref)."%'"; + $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; } if ($sall) { - $sql.= " AND (e.description like '%".$db->escape($sall)."%' OR e.lieu like '%".$db->escape($sall)."%' OR e.address like '%".$db->escape($sall)."%' OR e.town like '%".$db->escape($sall)."%')"; + $sql.= " AND (e.label LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.description LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.address LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.town LIKE '%".$db->escape($sall)."%')"; } +$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -69,31 +83,57 @@ if ($result) $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("ListOfWarehouses"),$help_url); - print_barre_liste($langs->trans("ListOfWarehouses"), $page, "liste.php", "", $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num); 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).'
'.$langs->trans("MailTopic").''; if ($this->withtopicreadonly) { - $out.= $this->withtopic; - $out.= ''; + $out.= $defaulttopic; + $out.= ''; } else { - $out.= 'withtopic)?'':$this->withtopic)) .'" />'; + $out.= ''; } $out.= "
'; print ""; - print_liste_field_titre($langs->trans("Ref"),"liste.php", "e.label","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LocationSummary"),"liste.php", "e.lieu","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"liste.php", "e.statut",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); print "\n"; - if ($num) { + if ($num) + { $entrepot=new Entrepot($db); - - $var=True; + $total = $totalsell = 0; + $var=false; while ($i < min($num,$limit)) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; - print ''; - print ''; - print ''; - print "\n"; - $i++; + print ""; + print ''; + // Location + print ''; + // PMP value + print ''; + // Selling value + print ''; + // Status + print ''; + print "\n"; + + $total += price2num($objp->estimatedvalue,'MU'); + $totalsell += price2num($objp->sellvalue,'MU'); + + $var=!$var; + $i++; } + + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; } $db->free($result); @@ -107,6 +147,6 @@ else } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 40fff978bf9..87fec698274 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -339,7 +339,7 @@ print '
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.''.$entrepot->LibStatut($objp->statut,5).'
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.''; + if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'),1); + else print ''; + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue,'MT'),1); + else print $langs->trans("Variable"); + print ''.$entrepot->LibStatut($objp->statut,5).'
'.$langs->trans("Total").''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).''.price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency).' 
'; print ''; print ''; print ''; -print '
'; +print '
'; print '
'; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 17e23fef009..03c779c0991 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -31,12 +31,12 @@ $langs->load("stocks"); // Security check $result=restrictedArea($user,'stock'); -$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; -$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"]; -$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; +$sref=GETPOST("sref");; +$snom=GETPOST("snom"); +$sall=GETPOST("sall"); -$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; -$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; +$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder"); if (! $sortfield) $sortfield="e.label"; if (! $sortorder) $sortorder="ASC"; $page = $_GET["page"]; @@ -51,8 +51,7 @@ $year = strftime("%Y",time()); * View */ -// Affichage valorisation par entrepot -$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu,"; +$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; $sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; @@ -60,7 +59,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $sql.= " WHERE e.entity = ".$conf->entity; if ($sref) { - $sql.= " AND e.ref LIKE '%".$sref."%'"; + $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; } if ($sall) { @@ -70,7 +69,7 @@ if ($sall) $sql.= " OR e.address LIKE '%".$db->escape($sall)."%'"; $sql.= " OR e.town LIKE '%".$db->escape($sall)."%')"; } -$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu"; +$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); @@ -84,15 +83,15 @@ if ($result) $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("EnhancedValueOfWarehouses"),$help_url); - print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, "valo.php", "", $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num); print ''; print ""; - print_liste_field_titre($langs->trans("Ref"),"valo.php", "e.label","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LocationSummary"),"valo.php", "e.lieu","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValue"),"valo.php", "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValueSell"),"", "",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"valo.php", "e.statut",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("LocationSummary"), $_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); print "\n"; if ($num) @@ -104,7 +103,7 @@ if ($result) { $objp = $db->fetch_object($result); print ""; - print ''; + print ''; print ''; // PMP value print '\n"; } + $db->free($result); + print "
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.''.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.''; @@ -133,20 +132,22 @@ if ($result) print "
"; print '
'; $file='entrepot-'.$year.'.png'; - if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file)) + if (file_exists($conf->stock->dir_temp.'/'.$file)) { $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file; print ''; } $file='entrepot-'.($year-1).'.png'; - if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file)) + if (file_exists($conf->stock->dir_temp.'/'.$file)) { $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file; print '
'; From fe9e7a0fa951e1ba2945af6728101aa2d5266d97 Mon Sep 17 00:00:00 2001 From: Cubexed Date: Fri, 12 Sep 2014 18:00:55 +0200 Subject: [PATCH 20/63] 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 21/63] 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 22/63] 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 099daf42965bb778217422db26ed48cf79239b5a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 17 Sep 2014 16:03:21 +0200 Subject: [PATCH 23/63] 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 fdb5a26109e..2b145ffc830 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1326,7 +1326,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 24/63] 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 de6e1c50366ca6532175d4f0774436ce3c7e3da1 Mon Sep 17 00:00:00 2001 From: Drosis Nikos Date: Wed, 17 Sep 2014 18:01:59 +0300 Subject: [PATCH 25/63] Correct view greek language in PDF --- 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 67e94ee7af2..494b06f09da 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1220,7 +1220,7 @@ function dol_print_reduction($reduction,$langs) $string = ''; if ($reduction == 100) { - $string = $langs->trans("Offered"); + $string = $langs->transnoentities("Offered"); } else { From a41dc3acd9ff9a4b3b8ce0786185cdc2f327c0f6 Mon Sep 17 00:00:00 2001 From: Drosis Nikos Date: Wed, 17 Sep 2014 18:06:31 +0300 Subject: [PATCH 26/63] Correct view greek language --- htdocs/societe/consumption.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index bedc41e2446..a22a49e35eb 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -246,7 +246,7 @@ $typeElementString = $form->selectarray("type_element",$elementTypeArray,GETPOST $button = ''; $param="&sref=".$sref."&month=".$month."&year=".$year."&sprod_fulldescr=".$sprod_fulldescr."&socid=".$socid."&type_element=".$type_element; -print_barre_liste($langs->trans('ProductsIntoElements', $typeElementString.' '.$button), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); +print_barre_liste($langs->transnoentitiesnoconv('ProductsIntoElements', $typeElementString.' '.$button), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); if ($sql_select) { From 12ae55248630575746a79c4c9a649a4f99306e90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 17:38:07 +0200 Subject: [PATCH 27/63] Fix: Option to make pg_dump/restore --- htdocs/admin/tools/dolibarr_export.php | 23 ++++++++++++++--------- htdocs/admin/tools/dolibarr_import.php | 5 ++++- htdocs/admin/tools/export.php | 6 ++++-- htdocs/core/db/pgsql.class.php | 11 +++++++---- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 74037147760..9d5317fdd88 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -366,9 +366,11 @@ print $langs->trans("BackupDescY").'

'; id="filename_template" value="" />

@@ -376,16 +378,19 @@ echo $file; array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")), - 'gz' => array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")), -); +$compression=array(); if ($label == 'MySQL') { -// $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function + $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")); + $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); + // $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function $compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2")); } - +else +{ + $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("Default")); + $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); +} // Show compression choices print '
'; diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index d66df365afa..0cd1ae19fa9 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -94,7 +94,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'

'; ?>
/> - +
trans("ImportPostgreSqlDesc"); print '
'; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 57fbb045a02..203776bc7f9 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -289,7 +289,9 @@ if ($what == 'postgresql') if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command); // Use quotes on command //$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass); - $param=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host; + //$param="-F c"; + $param="-F p"; + $param.=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host; $param.=" -U ".$dolibarr_main_db_user; if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port; if (GETPOST("sql_compat") && GETPOST("sql_compat") == 'ANSI') $param.=" --disable-dollar-quoting"; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 6593b2d896b..25263deee46 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1209,11 +1209,14 @@ class DoliDBPgsql extends DoliDB */ function getPathOfRestore() { - $fullpathofdump='/pathtopgrestore/pg_restore'; + //$tool='pg_restore'; + $tool='psql'; - if (file_exists('/usr/bin/pg_restore')) + $fullpathofdump='/pathtopgrestore/'.$tool; + + if (file_exists('/usr/bin/'.$tool)) { - $fullpathofdump='/usr/bin/pg_restore'; + $fullpathofdump='/usr/bin/'.$tool; } else { @@ -1223,7 +1226,7 @@ class DoliDBPgsql extends DoliDB { $liste=$this->fetch_array($resql); $basedir=$liste['data_directory']; - $fullpathofdump=preg_replace('/data$/','bin',$basedir).'/pg_restore'; + $fullpathofdump=preg_replace('/data$/','bin',$basedir).'/'.$tool; } } From f0ebd7721d60185e95b9b403d60185f0b73bcb36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Sep 2014 17:49:39 +0200 Subject: [PATCH 28/63] 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 29/63] 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 ''; print ''; + 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 30/63] 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 ''; + 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 31/63] 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_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 32/63] 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 47d423aae490072b4e85dcb3eee78ca3b33cfbe2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 00:21:25 +0200 Subject: [PATCH 33/63] Fix: Minor fix into intervention card --- .../core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- htdocs/societe/class/societe.class.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 4a1915b0a34..be1d81ed1d2 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -82,7 +82,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->option_modereg = 0; // Affiche mode reglement $this->option_condreg = 0; // Affiche conditions reglement $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 0; // Dispo en plusieurs langues + $this->option_multilang = 1; // Dispo en plusieurs langues $this->option_draft_watermark = 1; //Support add of a watermark on drafts // Get source company diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 72558da58bb..cfd37436b72 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1840,12 +1840,18 @@ class Societe extends CommonObject $nump = $this->db->num_rows($resql); if ($nump) { + $sepa="("; $sepb=")"; + if ($mode == 'email') + { + $sepa="<"; $sepb=">"; + } $i = 0; while ($i < $nump) { $obj = $this->db->fetch_object($resql); if ($mode == 'email') $property=$obj->email; else if ($mode == 'mobile') $property=$obj->phone_mobile; + else $property=$obj->$mode; // Show all contact. If hidedisabled is 1, showonly contacts with status = 1 if ($obj->statut == 1 || empty($hidedisabled)) @@ -1858,11 +1864,11 @@ class Societe extends CommonObject if (!empty($obj->poste)) { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." <".$property.">"; + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname)).($obj->poste?" - ".$obj->poste:"").(($mode != 'poste' && $property)?" ".$sepa.$property.$sepb:''); } else { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname)).(($mode != 'poste' && $property)?" ".$sepa.$property.$sepb:''); } } $i++; From ba6748342194fd2cfd3e6db19ac643b8eff218f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 00:48:53 +0200 Subject: [PATCH 34/63] Fix: too much field into list when option FICHINTER_DISABLE_DETAILS is on. --- htdocs/fichinter/list.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index cb343627959..f7eb1e49986 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -114,9 +114,9 @@ if ($result) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],''); if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + print_liste_field_titre('',$_SERVER["PHP_SELF"],''); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$urlparam,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); } @@ -131,9 +131,10 @@ if ($result) print ''; - print ''; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + // Desc of line + print ''; print ''; print ''; } @@ -166,9 +167,9 @@ if ($result) print $companystatic->getNomUrl(1,'',44); print ''; print ''; - print ''; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + print ''; print '\n"; print ''; } From fac24889f653821f827562ea578ce9d58114b31e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 01:19:46 +0200 Subject: [PATCH 35/63] Sync french --- htdocs/langs/fr_FR/admin.lang | 2 ++ htdocs/langs/fr_FR/agenda.lang | 11 ++++++----- htdocs/langs/fr_FR/dict.lang | 6 ++---- htdocs/langs/fr_FR/main.lang | 2 +- htdocs/langs/fr_FR/salaries.lang | 4 ++++ htdocs/langs/fr_FR/users.lang | 1 + 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 7eed1bce332..8fa7ed80885 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -45,6 +45,8 @@ ErrorModuleRequireDolibarrVersion=Erreur, ce module requiert une version %s ou s ErrorDecimalLargerThanAreForbidden=Erreur, les précisions supérieures à %s ne sont pas prises en charge. DictionarySetup=Dictionnaires Dictionary=Dictionnaires +Chartofaccounts=Chart of accounts +Fiscalyear=Fiscal years ErrorReservedTypeSystemSystemAuto=Erreur, les valeurs 'system' et 'systemauto' sont réservées. Vous pouvez utiliser la valeur 'user' pour ajouter vos propres enregistrements ErrorCodeCantContainZero=Erreur, le code ne peut contenir la valeur 0 DisableJavascript=Désactive les fonctions Javascript et Ajax (Recommandé pour les personnes aveugles ou navigateurs text). diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index f33ada9956c..43a7a2faf11 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -2,11 +2,11 @@ IdAgenda=ID évènement Actions=Événements ActionsArea=Espace événements (actions et tâches) -Agenda= Agenda -Agendas= Agendas -Calendar= Calendrier -Calendars= Calendriers -LocalAgenda=Calendrier local +Agenda=Agenda +Agendas=Agendas +Calendar=Calendrier +Calendars=Calendriers +LocalAgenda=Calendrier interne AffectedTo=Affecté à DoneBy=Réalisé par Event=Evénement @@ -88,3 +88,4 @@ ExtSiteUrlAgenda=URL d'accès au fichier ical ExtSiteNoLabel=Aucune description WorkingTimeRange=Plage d'heures travaillées WorkingDaysRange=Plage de jours travaillés +AddEvent=Créer événement diff --git a/htdocs/langs/fr_FR/dict.lang b/htdocs/langs/fr_FR/dict.lang index eb8a65ed46c..cb3260e6108 100644 --- a/htdocs/langs/fr_FR/dict.lang +++ b/htdocs/langs/fr_FR/dict.lang @@ -253,7 +253,6 @@ CivilityMR=Monsieur CivilityMLE=Mademoiselle CivilityMTRE=Maître CivilityDR=Docteur - ##### Currencies ##### Currencyeuros=Euros CurrencyAUD=Dollars Aus. @@ -290,10 +289,10 @@ CurrencyXOF=Francs CFA BCEAO CurrencySingXOF=Franc CFA BCEAO CurrencyXPF=Francs CFP CurrencySingXPF=Franc CFP - CurrencyCentSingEUR=centime +CurrencyCentINR=paisa +CurrencyCentSingINR=paise CurrencyThousandthSingTND=millime - #### Input reasons ##### DemandReasonTypeSRC_INTE=Internet DemandReasonTypeSRC_CAMP_MAIL=Campagne Publipostage @@ -306,7 +305,6 @@ DemandReasonTypeSRC_WOM=Bouche à oreille DemandReasonTypeSRC_PARTNER=Partenaire DemandReasonTypeSRC_EMPLOYEE=Employé DemandReasonTypeSRC_SPONSORING=Parrainage/Sponsoring - #### Paper formats #### PaperFormatEU4A0=Format 4A0 PaperFormatEU2A0=Format 2A0 diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 7d89d6f833c..08cc727600a 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -645,7 +645,7 @@ OptionalFieldsSetup=Configuration des attributs complémentaires URLPhoto=URL de la photo/logo SetLinkToThirdParty=Lier vers un autre tiers CreateDraft=Créer brouillon -SetToDraft=Repasser en brouillon +SetToDraft=Back to draft ClickToEdit=Cliquer ici pour éditer ObjectDeleted=Objet %s supprimé ByCountry=Par pays diff --git a/htdocs/langs/fr_FR/salaries.lang b/htdocs/langs/fr_FR/salaries.lang index 34b7e1cbb9c..c76f03c8d9f 100644 --- a/htdocs/langs/fr_FR/salaries.lang +++ b/htdocs/langs/fr_FR/salaries.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - users +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Code comptable pour les paiements des salaires +SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Code comptable pour les charges financières Salary=Salaires Salaries=Salaires Employee=Employé @@ -6,3 +8,5 @@ NewSalaryPayment=Nouveau règlement de salaire SalaryPayment=Règlement salaire SalariesPayments=Règlements des salaires ShowSalaryPayment=Afficher règlement de salaire +THM=Tarif horaire moyen +TJM=Tarif journalier moyen diff --git a/htdocs/langs/fr_FR/users.lang b/htdocs/langs/fr_FR/users.lang index 834d63cadd5..447f5b661f8 100644 --- a/htdocs/langs/fr_FR/users.lang +++ b/htdocs/langs/fr_FR/users.lang @@ -119,3 +119,4 @@ HierarchicView=Vue hiérarchique UseTypeFieldToChange=Modifier le champ Type pour changer OpenIDURL=URL OpenID LoginUsingOpenID=Se connecter par OpenID +WeeklyHours=Heures de travail hebdomadaires From dfa071e0936113013f0b04f28ebb6df86f9b8d87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 01:43:50 +0200 Subject: [PATCH 36/63] Fix: Are description too large --- htdocs/comm/action/class/actioncomm.class.php | 20 ++++++++++--------- .../fichinter/doc/pdf_soleil.modules.php | 17 ++++++++++------ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index aa71db608fc..393082f3427 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -52,7 +52,7 @@ class ActionComm extends CommonObject var $datep; // Date action start (datep) var $datef; // Date action end (datep2) - var $durationp = -1; // -1=Unkown duration + var $durationp = -1; // -1=Unkown duration // deprecated var $fulldayevent = 0; // 1=Event on full day var $punctual = 1; // Milestone var $percentage; // Percentage @@ -122,7 +122,7 @@ class ActionComm extends CommonObject if (empty($this->transparency)) $this->transparency = 0; if ($this->percentage > 100) $this->percentage = 100; //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; - if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep); + if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep); // deprecated //if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date); if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep; //if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date; @@ -167,7 +167,7 @@ class ActionComm extends CommonObject $sql.= "(datec,"; $sql.= "datep,"; $sql.= "datep2,"; - $sql.= "durationp,"; + $sql.= "durationp,"; // deprecated $sql.= "fk_action,"; $sql.= "code,"; $sql.= "fk_soc,"; @@ -186,7 +186,7 @@ class ActionComm extends CommonObject $sql.= "'".$this->db->idate($now)."',"; $sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").","; $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; - $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; + $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; // deprecated $sql.= (isset($this->type_id)?$this->type_id:"null").","; $sql.= (isset($this->code)?" '".$this->code."'":"null").","; $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").","; @@ -269,8 +269,8 @@ class ActionComm extends CommonObject $sql.= " a.ref_ext,"; $sql.= " a.datep,"; $sql.= " a.datep2,"; + $sql.= " a.durationp,"; // deprecated $sql.= " a.datec,"; - $sql.= " a.durationp,"; $sql.= " a.tms as datem,"; $sql.= " a.code, a.label, a.note,"; $sql.= " a.fk_soc,"; @@ -311,6 +311,7 @@ class ActionComm extends CommonObject $this->label = $obj->label; $this->datep = $this->db->jdate($obj->datep); $this->datef = $this->db->jdate($obj->datep2); + $this->durationp = $this->durationp; // deprecated $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -434,7 +435,7 @@ class ActionComm extends CommonObject if (empty($this->fulldayevent)) $this->fulldayevent = 0; if ($this->percentage > 100) $this->percentage = 100; //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; - if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep); + if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep); // deprecated //if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date); if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep; //if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date; @@ -455,6 +456,7 @@ class ActionComm extends CommonObject $sql.= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'":"null"); $sql.= ", datep = ".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null'); + $sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated $sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null"); $sql.= ", fk_soc =". ($this->societe->id > 0 ? "'".$this->societe->id."'":"null"); $sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null"); @@ -857,7 +859,7 @@ class ActionComm extends CommonObject $sql = "SELECT a.id,"; $sql.= " a.datep,"; // Start $sql.= " a.datep2,"; // End - $sql.= " a.durationp,"; + $sql.= " a.durationp,"; // deprecated $sql.= " a.datec, a.tms as datem,"; $sql.= " a.label, a.code, a.note, a.fk_action as type_id,"; $sql.= " a.fk_soc,"; @@ -934,12 +936,12 @@ class ActionComm extends CommonObject $event['type']=$type; $datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); $dateend=$this->db->jdate($obj->datep2)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); - $duration=$obj->durationp; + $duration=($datestart && $dateend)?($dateend - $datestart):0; $event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":""); $event['desc']=$obj->note; $event['startdate']=$datestart; - $event['duration']=$duration; // Not required with type 'journal' $event['enddate']=$dateend; // Not required with type 'journal' + $event['duration']=$duration; // Not required with type 'journal' $event['author']=dolGetFirstLastname($obj->firstname, $obj->lastname); $event['priority']=$obj->priority; $event['fulldayevent']=$obj->fulldayevent; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index be1d81ed1d2..fa2e3c85c06 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -222,22 +222,22 @@ class pdf_soleil extends ModelePDFFicheinter $nexY = $tab_top + 7; $pdf->SetXY($this->marge_gauche, $tab_top); - $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); - $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); + $pdf->MultiCell(190,5,$outputlangs->transnoentities("Description"),0,'L',0); + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur-$this->marge_droite, $tab_top + 5); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche, $tab_top + 8); + $pdf->SetXY($this->marge_gauche, $tab_top + 5); $text=$object->description; if ($object->duree > 0) { - $totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); + $totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; } $desc=dol_htmlentitiesbr($text,1); //print $outputlangs->convToOutputCharset($desc); exit; - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); + $pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); $nexY = $pdf->GetY(); $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); @@ -262,7 +262,12 @@ class pdf_soleil extends ModelePDFFicheinter $pageposbefore=$pdf->getPage(); // Description of product line - $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; + $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); + if ($objectligne->duration > 0) + { + $txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration); + } + $txt=''.dol_htmlentitiesbr($txt,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); From bfb923f54b009df71352ed4a3f9695f5ac30a986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 08:58:47 +0200 Subject: [PATCH 37/63] 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 38/63] 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 39/63] 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 40/63] 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 41/63] 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 '
'; print ''; print '    '.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).' '; - $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 42/63] 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 43/63] 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 44/63] 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 45/63] 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 46/63] 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 47/63] 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 48/63] 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 49/63] 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; From 3a38153889907238094121a24f56bd306dcf3ac0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Sep 2014 22:42:43 +0200 Subject: [PATCH 50/63] Typo error --- build/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/debian/control b/build/debian/control index f4f9e12aa58..fc0cee30319 100755 --- a/build/debian/control +++ b/build/debian/control @@ -68,4 +68,4 @@ Description: Web based software to manage a company or foundation PDF exports, And a lot more modules... . - You can also add third parties external modules or develop yours. + You can also add external modules from third parties or develop yours. From d16a1e587e1cf72c6fe586d7919eb7d95daf521d Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 19 Sep 2014 09:04:45 +0200 Subject: [PATCH 51/63] Trad: Syncro es_ES from transifex --- htdocs/langs/es_ES/admin.lang | 2 ++ htdocs/langs/es_ES/agenda.lang | 13 +++++++------ htdocs/langs/es_ES/dict.lang | 6 ++---- htdocs/langs/es_ES/main.lang | 1 + htdocs/langs/es_ES/salaries.lang | 4 ++++ htdocs/langs/es_ES/users.lang | 1 + 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 6d136f38157..7e07827309a 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -45,6 +45,8 @@ ErrorModuleRequireDolibarrVersion=Error, este módulo requiere una versión %s o ErrorDecimalLargerThanAreForbidden=Error, las precisiones superiores a %s no están soportadas. DictionarySetup=Diccionarios Dictionary=Diccionarios +Chartofaccounts=Plan contable +Fiscalyear=Años fiscales ErrorReservedTypeSystemSystemAuto=El uso del tipo 'system' y 'systemauto' está reservado. Puede utilizar 'user' como valor para añadir su propio registro ErrorCodeCantContainZero=El código no puede contener el valor 0 DisableJavascript=Deshabilitar Javascript y funciones Ajax (Recomendado para personas ciegas o navegadores de texto) diff --git a/htdocs/langs/es_ES/agenda.lang b/htdocs/langs/es_ES/agenda.lang index 2bc22e55b67..b3aa4a58375 100644 --- a/htdocs/langs/es_ES/agenda.lang +++ b/htdocs/langs/es_ES/agenda.lang @@ -2,11 +2,11 @@ IdAgenda=ID de evento Actions=Eventos ActionsArea=Área de eventos (acciones y tareas) -Agenda= Agenda -Agendas= Agendas -Calendar= Calendario -Calendars= Calendarios -LocalAgenda=Calendario local +Agenda=Agenda +Agendas=Agendas +Calendar=Calendario +Calendars=Calendarios +LocalAgenda=Calendario interno AffectedTo=Asignada a DoneBy=Realizado por Event=Evento @@ -22,7 +22,7 @@ MenuToDoActions=Eventos incompletos MenuDoneActions=Eventos terminados MenuToDoMyActions=Mis eventos incompletos MenuDoneMyActions=Mis eventos terminados -ListOfEvents=Listado de eventos Dolibarr +ListOfEvents=Listado de eventos (calendario interno) ActionsAskedBy=Eventos registrados por ActionsToDoBy=Eventos asignados a ActionsDoneBy=Eventos realizados por @@ -88,3 +88,4 @@ ExtSiteUrlAgenda=Url de acceso al archivo .ical ExtSiteNoLabel=Sin descripción WorkingTimeRange=Rango temporal WorkingDaysRange=Rango diario +AddEvent=Crear evento diff --git a/htdocs/langs/es_ES/dict.lang b/htdocs/langs/es_ES/dict.lang index 7b440d71211..42c6d967657 100644 --- a/htdocs/langs/es_ES/dict.lang +++ b/htdocs/langs/es_ES/dict.lang @@ -253,7 +253,6 @@ CivilityMR=Señor CivilityMLE=Señorita CivilityMTRE=Don CivilityDR=Doctor - ##### Currencies ##### Currencyeuros=Euros CurrencyAUD=Dólares Aus. @@ -290,10 +289,10 @@ CurrencyXOF=Francos CFA BCEAO CurrencySingXOF=Franco CFA BCEAO CurrencyXPF=Francos CFP CurrencySingXPF=Franco CFP - CurrencyCentSingEUR=céntimo +CurrencyCentINR=paisa +CurrencyCentSingINR=paise CurrencyThousandthSingTND=milésimo - #### Input reasons ##### DemandReasonTypeSRC_INTE=Internet DemandReasonTypeSRC_CAMP_MAIL=Campaña correo @@ -306,7 +305,6 @@ DemandReasonTypeSRC_WOM=Boca a boca DemandReasonTypeSRC_PARTNER=Socio DemandReasonTypeSRC_EMPLOYEE=Empleado DemandReasonTypeSRC_SPONSORING=Patrocinador - #### Paper formats #### PaperFormatEU4A0=Formato 4A0 PaperFormatEU2A0=Formato 2A0 diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 7764545ed0a..d92caea7ab2 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -645,6 +645,7 @@ OptionalFieldsSetup=Configuración de los atributos opcionales URLPhoto=Url de la foto/logo SetLinkToThirdParty=Vincular a otro tercero CreateDraft=Crear borrador +SetToDraft=Volver a borrador ClickToEdit=Clic para editar ObjectDeleted=Objeto %s eliminado ByCountry=Par país diff --git a/htdocs/langs/es_ES/salaries.lang b/htdocs/langs/es_ES/salaries.lang index bc4079feb21..c8e3707d5df 100644 --- a/htdocs/langs/es_ES/salaries.lang +++ b/htdocs/langs/es_ES/salaries.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - users +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Código contable pago de salarios +SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Código contable cargas financieras Salary=Salario Salaries=Salarios Employee=Empleado @@ -6,3 +8,5 @@ NewSalaryPayment=Nuevo pago SalaryPayment=Pago de salario SalariesPayments=Pagos de salarios ShowSalaryPayment=Ver pago +THM=Precio medio por hora +TJM=Precio medio por día diff --git a/htdocs/langs/es_ES/users.lang b/htdocs/langs/es_ES/users.lang index 37851adb724..65b6d8ed0a0 100644 --- a/htdocs/langs/es_ES/users.lang +++ b/htdocs/langs/es_ES/users.lang @@ -119,3 +119,4 @@ HierarchicView=Vista jerárquica UseTypeFieldToChange=Modificar el campo Tipo para cambiar OpenIDURL=Dirección OpenID LoginUsingOpenID=Usar OpenID para iniciar sesión +WeeklyHours=Horas semanales From c87e28d5f959b52e367a4ee4cda0d78613cca89e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 19 Sep 2014 09:57:35 +0200 Subject: [PATCH 52/63] - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line --- ChangeLog | 1 + htdocs/fourn/facture/fiche.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4331635592..079219e6c7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ For users: - 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. +- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index d60059cd17f..98522e21342 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -517,11 +517,11 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) } - $localtax1tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); - $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); + $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); if ($result >= 0) { unset($_POST['label']); @@ -617,13 +617,13 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); $npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); - $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); $type = $productsupplier->type; // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) - $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); + $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == -2 || $idprod == 0) { @@ -662,7 +662,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $price_base_type = 'HT'; //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + $result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else { @@ -670,7 +670,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $ht = $ttc / (1 + ($tva_tx / 100)); $price_base_type = 'HT'; //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 - $result=$object->addline($product_desc, $ht, $tva_tx,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + $result=$object->addline($product_desc, $ht, $tva_tx,$localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } } From e39373ed9acb288f66f808f06e397bd1d91b1440 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 19 Sep 2014 09:57:35 +0200 Subject: [PATCH 53/63] - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line --- ChangeLog | 1 + htdocs/fourn/facture/fiche.php | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24e22202555..531c4802c61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -141,6 +141,7 @@ For users: - 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. +- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 9d20c2b9722..49518bdb1e6 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -526,11 +526,11 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) } - $localtax1tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); - $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); + $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); if ($result >= 0) { unset($_POST['label']); @@ -626,13 +626,13 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); $npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); - $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); $type = $productsupplier->type; // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) - $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); + $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == -2 || $idprod == 0) { From f9976bdb6af11cc2c1518ee8f55f1bbc29d358eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Sep 2014 11:03:07 +0200 Subject: [PATCH 54/63] Qual: Uniformize field names. --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 7 +++++++ htdocs/install/mysql/tables/llx_commande.sql | 7 ++++--- htdocs/install/mysql/tables/llx_commande_fournisseur.sql | 9 +++++---- htdocs/install/mysql/tables/llx_facture.sql | 5 +++-- htdocs/install/mysql/tables/llx_facture_fourn.sql | 5 +++-- htdocs/install/mysql/tables/llx_fichinter.sql | 7 ++++--- htdocs/install/mysql/tables/llx_product.sql | 5 +++-- htdocs/install/mysql/tables/llx_propal.sql | 7 ++++--- 8 files changed, 33 insertions(+), 19 deletions(-) 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 635154768bb..229f2dee541 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 @@ -19,6 +19,13 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +ALTER TABLE llx_propal ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_commande ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_facture ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_product ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_fichinter ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_facture_fourn ADD COLUMN fk_user_modif integer after fk_user_author; ALTER TABLE llx_fichinter ADD COLUMN ref_ext varchar(255); diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 3cf3fdac226..90e8fd7af71 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -36,9 +36,10 @@ create table llx_commande date_valid datetime, -- date de validation date_cloture datetime, -- date de cloture date_commande date, -- date de la commande - fk_user_author integer, -- createur de la commande - fk_user_valid integer, -- valideur de la commande - fk_user_cloture integer, -- auteur cloture + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating + fk_user_cloture integer, -- user closing source smallint, fk_statut smallint default 0, amount_ht real default 0, diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index d8076c1c06c..2ecf9e10442 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -30,16 +30,17 @@ create table llx_commande_fournisseur ref_supplier varchar(30), fk_soc integer NOT NULL, - fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande + fk_projet integer DEFAULT 0, -- project id tms timestamp, date_creation datetime, -- date de creation date_valid datetime, -- date de validation date_approve datetime, -- date de approve date_commande date, -- date de la commande - fk_user_author integer, -- createur de la commande - fk_user_valid integer, -- valideur de la commande - fk_user_approve integer, -- auteur approve + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating + fk_user_approve integer, -- user approving source smallint NOT NULL, fk_statut smallint default 0, amount_ht real default 0, diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 2522ee7a73e..433bef887f1 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -56,8 +56,9 @@ create table llx_facture fk_statut smallint DEFAULT 0 NOT NULL, - fk_user_author integer, -- createur de la facture - fk_user_valid integer, -- valideur de la facture + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating fk_facture_source integer, -- facture origine si facture avoir fk_projet integer DEFAULT NULL, -- projet auquel est associee la facture diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index 2bb85f8400e..3a71c2455aa 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -52,8 +52,9 @@ create table llx_facture_fourn fk_statut smallint DEFAULT 0 NOT NULL, - fk_user_author integer, -- createur de la facture - fk_user_valid integer, -- valideur de la facture + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating fk_facture_source integer, -- facture origine si facture avoir fk_projet integer, -- projet auquel est associee la facture diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 242710a0993..58f953c7196 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -29,9 +29,10 @@ create table llx_fichinter tms timestamp, datec datetime, -- date de creation date_valid datetime, -- date de validation - datei date, -- date de livraison du bon d'intervention - fk_user_author integer, -- createur de la fiche - fk_user_valid integer, -- valideur de la fiche + datei date, -- date de livraison du bon d'intervention + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- valideur de la fiche fk_statut smallint DEFAULT 0, duree real, -- duree totale de l'intervention description text, diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 0ab9a24785c..e9703fc90cf 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -48,8 +48,9 @@ create table llx_product recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT localtax1_tx double(6,3) DEFAULT 0, -- Spanish local VAT 1 localtax2_tx double(6,3) DEFAULT 0, -- Spanish local VAT 2 - fk_user_author integer DEFAULT NULL, - tosell tinyint DEFAULT 1, -- Product you sell + fk_user_author integer DEFAULT NULL, -- user making creation + fk_user_modif integer, -- user making last change + tosell tinyint DEFAULT 1, -- Product you sell tobuy tinyint DEFAULT 1, -- Product you buy tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch or eat-by management fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module) diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index c9ab3ecd138..90996073021 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -38,9 +38,10 @@ create table llx_propal fin_validite datetime, -- date de fin de validite date_valid datetime, -- date de validation date_cloture datetime, -- date de cloture - fk_user_author integer, -- createur de la propale - fk_user_valid integer, -- valideur de la propale - fk_user_cloture integer, -- cloture de la propale signee ou non signee + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating + fk_user_cloture integer, -- user closing (signed or not) fk_statut smallint DEFAULT 0 NOT NULL, price real DEFAULT 0, -- (obsolete) remise_percent real DEFAULT 0, -- remise globale relative en pourcent (obsolete) From 7e491c479c89bb99b4ccd410d37a82ee3875bd76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Sep 2014 11:24:47 +0200 Subject: [PATCH 55/63] Add accountancy language file --- .tx/config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.tx/config b/.tx/config index fcd276390ee..a89b56c1013 100644 --- a/.tx/config +++ b/.tx/config @@ -2,6 +2,12 @@ host = https://www.transifex.com lang_map = uz: uz_UZ +[dolibarr.accountancy] +file_filter = htdocs/langs//accountancy.lang +source_file = htdocs/langs/en_US/accountancy.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.admin] file_filter = htdocs/langs//admin.lang source_file = htdocs/langs/en_US/admin.lang From ca3c5d951319be22d5a10b5714358d535867f9c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Sep 2014 14:36:55 +0200 Subject: [PATCH 56/63] Fix: invalid list of params Fix: loading of sql menu --- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/admin/menus/index.php | 4 ++-- htdocs/compta/bank/rappro.php | 6 ++++-- htdocs/core/lib/functions.lib.php | 18 ++++++++++-------- htdocs/core/menus/init_menu_auguria.sql | 20 ++++++++++---------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index c3fdd1176a1..6ddae4e4a33 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -276,7 +276,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $db->begin(); // Create subscription - $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $option); + $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); if ($crowid <= 0) { $error++; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index a866ecd9a70..215f2eae069 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -324,8 +324,8 @@ if ($conf->use_javascript_ajax) '   '.$titre.''. '
'.$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 '
'. ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. - ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. + ''.img_edit_add('default').' '. + ''.img_delete('default').' '. ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. '
' ); diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php index 37c27afc0b6..293c12df422 100644 --- a/htdocs/compta/bank/rappro.php +++ b/htdocs/compta/bank/rappro.php @@ -263,11 +263,13 @@ if ($resql) { print ''; print ''.dol_print_date($db->jdate($objp->dv),"day").""; - print '   '; + print '  '; + print ''; print ''; print img_edit_remove() . " "; print ''; - print img_edit_add() .""; + print img_edit_add() .""; + print ''; print ''; } else diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20b030a9226..c7b8de5a461 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1940,29 +1940,31 @@ function img_pdf($titlealt = 'default', $size = 3) * Show 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 Return tag img */ -function img_edit_add($titlealt = 'default') +function img_edit_add($titlealt = 'default', $other = '') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Add'); - return img_picto($titlealt, 'edit_add.png'); + return img_picto($titlealt, 'edit_add.png', $other); } /** * Show 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 Return tag img */ -function img_edit_remove($titlealt = 'default') +function img_edit_remove($titlealt = 'default', $other='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Remove'); - return img_picto($titlealt, 'edit_remove.png'); + return img_picto($titlealt, 'edit_remove.png', $other); } /** @@ -2265,9 +2267,9 @@ 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 = ''; @@ -2286,9 +2288,9 @@ 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 = ''; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 36291883755..210fe8d647e 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -39,22 +39,22 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Home - Sytem info insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 208__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/browser.php?leftmenu=admintools', 'InfoBrowser', 1, 'admin', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 210__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/database.php?leftmenu=admintools', 'InfoDatabase', 1, 'admin', '', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 301__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_export.php?leftmenu=admintools', 'Backup', 1, 'admin', '', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 302__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_import.php?leftmenu=admintools', 'Restore', 1, 'admin', '', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 305__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/update.php?leftmenu=admintools', 'MenuUpgrade', 1, 'admin', '', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 304__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 308__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listsessions.php?leftmenu=admintools', 'Sessions', 1, 'admin', '', '', 2, 11, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 309__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 310__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__); -- Home - Menu users and groups insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__); From ee4d697172bbf95b013cee30e3a2cc36eafe6fae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Sep 2014 14:57:31 +0200 Subject: [PATCH 57/63] Fix several bugs reported by scrutinizer --- htdocs/admin/prelevement.php | 2 +- htdocs/admin/triggers.php | 2 +- .../admin/categorie_extrafields.php | 2 +- htdocs/categories/categorie.php | 4 +- htdocs/comm/action/class/actioncomm.class.php | 7 +- htdocs/comm/fiche.php | 4 +- htdocs/compta/bank/class/account.class.php | 6 +- htdocs/compta/bank/fiche.php | 10 +-- .../deplacement/class/deplacement.class.php | 7 +- htdocs/compta/deplacement/document.php | 2 +- htdocs/compta/facture.php | 64 ++++++++++++------- htdocs/compta/paiement/info.php | 6 +- htdocs/core/class/html.form.class.php | 2 +- .../install/mysql/migration/3.6.0-3.7.0.sql | 3 + .../install/mysql/tables/llx_bank_account.sql | 2 + 15 files changed, 78 insertions(+), 45 deletions(-) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 2247df9493e..6094bb7e4f1 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -55,7 +55,7 @@ if ($action == "set") if (! $res > 0) $error++; $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int'); - $account = new Account($db, $id); + $account = new Account($db); if($account->fetch($id)>0) { diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index fc9d0489e9a..85139b56ba9 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -50,7 +50,7 @@ print "
\n"; $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/'; $interfaces = new Interfaces($db); -$triggers = $interfaces->getTriggersList(0,'priority'); +$triggers = $interfaces->getTriggersList(); print ' diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 2da54e77712..712f60f25cd 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -65,7 +65,7 @@ llxHeader('',$langs->trans("Categories"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'setup'); -$head = categoriesadmin_prepare_head(null); +$head = categoriesadmin_prepare_head(); dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category'); diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 7f8ceac853e..e68d2e416f8 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -396,7 +396,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Member")); - $head=member_prepare_head($member, $user); + $head=member_prepare_head($member); $titre=$langs->trans("Member"); $picto='user'; dol_fiche_head($head, 'category', $titre,0,$picto); @@ -471,7 +471,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Contact")); - $head=contact_prepare_head($object, $user); + $head=contact_prepare_head($object); $titre=$langs->trans("ContactsAddresses"); $picto='contact'; dol_fiche_head($head, 'category', $titre,0,$picto); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 393082f3427..434cc92dcb6 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -258,9 +258,10 @@ class ActionComm extends CommonObject * Load object from database * * @param int $id Id of action to get + * @param string $ref Ref of action to get * @return int <0 if KO, >0 if OK */ - function fetch($id) + function fetch($id, $ref='') { global $langs; @@ -286,7 +287,9 @@ class ActionComm extends CommonObject $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; + $sql.= " WHERE a.fk_action=c.id"; + if ($ref) $sql.= " AND a.id=".$ref; // No field ref, we use id + else $sql.= " AND a.id=".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 76176930da3..524901336a7 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -327,11 +327,11 @@ if ($id > 0) print '"; print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4ca6175d785..40bfbe6490d 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -338,9 +338,10 @@ class Account extends CommonObject /** * Create bank account into database * + * @param User $user Object user making creation * @return int < 0 if KO, > 0 if OK */ - function create() + function create($user='') { global $langs,$conf; @@ -665,10 +666,9 @@ class Account extends CommonObject return 1; } else - { + { return 0; } - $this->db->free($result); } else { diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index c118186df27..770f2afd2ef 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -102,7 +102,7 @@ if ($_POST["action"] == 'add') if (! $error) { - $id = $account->create($user->id); + $id = $account->create($user); if ($id > 0) { $_GET["id"]=$id; // Force chargement page en mode visu @@ -306,7 +306,7 @@ if ($action == 'create') $doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print ''; - + print '
'; if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'cond_reglement_id',-1,1); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id',1); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none'); } print "
'; print '
'; @@ -510,7 +510,7 @@ else $account->fetch(GETPOST('id','int')); print_fiche_titre($langs->trans("EditFinancialAccount")); - + if ($conf->use_javascript_ajax) { print "\n".''; - + /* * Show result array */ print '

'; - + $i = 0; print ""; print ""; @@ -397,21 +397,21 @@ if ($action == 'export_csv') { print ""; print ""; print "\n"; - + $var = true; $r = ''; - + $invoicestatic = new FactureFournisseur($db); $companystatic = new Fournisseur($db); - + foreach ( $tabfac as $key => $val ) { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); - + $date = dol_print_date($db->jdate($val["date"]), 'day'); - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { @@ -441,16 +441,16 @@ if ($action == 'export_csv') { } } print ""; - + // Third party // print ""; print ""; print ""; - + foreach ( $tabttc[$key] as $k => $mt ) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - + print ""; } print ""; - + $var = ! $var; } - + print "
" . $langs->trans("Account") . "" . $langs->trans("Type") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . "
".$conf->global->COMPTA_JOURNAL_BUY."" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accounta($k); print "" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')'; @@ -459,12 +459,12 @@ if ($action == 'export_csv') { print '' . ($mt >= 0 ? price($mt) : '') . "
"; - + // End of page llxFooter(); } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 587a0d387a4..79444fbca60 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -90,11 +90,11 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, "; $sql .= " ct.accountancy_code_sell as account_tva"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet fd"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "facture f ON f.rowid = fd.fk_facture"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc"; +$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; $sql .= " WHERE fd.fk_code_ventilation > 0 "; if (! empty($conf->multicompany->enabled)) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 434cc92dcb6..4fe49999111 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -57,12 +57,14 @@ class ActionComm extends CommonObject var $punctual = 1; // Milestone var $percentage; // Percentage var $location; // Location + var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) var $priority; // Small int (0 By default) var $note; // Description - var $usertodo; // Object user that must do action - var $userdone; // Object user that did action + var $userassigned; // Array of user ids + var $usertodo; // Object user of owner + var $userdone; // Object user that did action (deprecated) var $societe; // Company linked to action (optional) var $contact; // Contact linked to action (optional) @@ -89,10 +91,10 @@ class ActionComm extends CommonObject { $this->db = $db; - $this->author = new stdClass(); - $this->usermod = new stdClass(); - $this->usertodo = new stdClass(); - $this->userdone = new stdClass(); + //$this->author = new stdClass(); + //$this->usermod = new stdClass(); + //$this->usertodo = new stdClass(); + //$this->userdone = new stdClass(); $this->societe = new stdClass(); $this->contact = new stdClass(); } diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 27be46bd9e1..929600512c7 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent @@ -87,20 +87,37 @@ $hookmanager->initHooks(array('actioncard')); * Actions */ -if (GETPOST('addassignedtouser')) +// Remove user to assigned list +if (! empty($_POST['removedassigned'])) +{ + $idtoremove=$_POST['removedassigned']; + if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1); + else $tmpassigneduserids=array(); + unset($tmpassigneduserids[$idtoremove]); + //var_dump($_POST['removedassigned']);exit; + $_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids); + $donotclearsession=1; + if ($action == 'add') $action = 'create'; + if ($action == 'update') $action = 'edit'; +} + +// Add user to assigned list +if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) { // Add a new user if (GETPOST('affectedto') > 0) { $assignedtouser=array(); - if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); + if (! empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); $assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1); $_SESSION['assignedtouser']=dol_json_encode($assignedtouser); } $donotclearsession=1; - $action='create'; + if ($action == 'add') $action = 'create'; + if ($action == 'update') $action = 'edit'; } -// Add action + +// Add event if ($action == 'add') { $error=0; @@ -131,22 +148,22 @@ if ($action == 'add') // Check parameters if (! $datef && $percentage == 100) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label')) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors'); } // Initialisation objet cactioncomm - if (! GETPOST('actioncode')) + if (! GETPOST('actioncode') > 0) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); } @@ -161,7 +178,6 @@ if ($action == 'add') $object->priority = GETPOST("priority")?GETPOST("priority"):0; $object->fulldayevent = (! empty($fulldayevent)?1:0); $object->location = GETPOST("location"); - $object->transparency = (GETPOST("transparency")=='on'?1:0); $object->label = trim(GETPOST('label')); $object->fk_element = GETPOST("fk_element"); $object->elementtype = GETPOST("elementtype"); @@ -186,18 +202,35 @@ if ($action == 'add') $object->percentage = $percentage; $object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; - $usertodo=new User($db); - if ($_POST["affectedto"] > 0) + $listofuserid=dol_json_decode($_SESSION['assignedtouser']); + $i=0; + foreach($listofuserid as $key => $value) { - $usertodo->fetch($_POST["affectedto"]); + if ($i == 0) // First entry + { + $usertodo=new User($db); + if ($key > 0) + { + $usertodo->fetch($key); + } + $object->usertodo = $usertodo; + $object->transparency = (GETPOST("transparency")=='on'?1:0); + } + + $object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0)); + + $i++; } - $object->usertodo = $usertodo; - $userdone=new User($db); - if ($_POST["doneby"] > 0) + + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { - $userdone->fetch($_POST["doneby"]); + $userdone=new User($db); + if ($_POST["doneby"] > 0) + { + $userdone->fetch($_POST["doneby"]); + } + $object->userdone = $userdone; } - $object->userdone = $userdone; $object->note = trim($_POST["note"]); if (isset($_POST["contactid"])) $object->contact = $contact; @@ -214,16 +247,22 @@ if ($action == 'add') if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; // Check parameters + if (empty($object->usertodo)) + { + $error++; $donotclearsession=1; + $action = 'create'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); + } if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (! GETPOST('apyear') && ! GETPOST('adyear')) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); } @@ -265,42 +304,14 @@ if ($action == 'add') $langs->load("errors"); $error=$langs->trans($object->error); setEventMessage($error,'errors'); - $action = 'create'; + $action = 'create'; $donotclearsession=1; } } else { $db->rollback(); - $langs->load("errors"); - - if (! empty($object->error)) setEventMessage($langs->trans($object->error), 'errors'); - if (count($object->errors)) setEventMessage($object->errors, 'errors'); - - $action = 'create'; - } - } -} - -/* - * Action suppression de l'action - */ -if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') -{ - $object->fetch($id); - - if ($user->rights->agenda->myactions->delete - || $user->rights->agenda->allactions->delete) - { - $result=$object->delete(); - - if ($result >= 0) - { - header("Location: index.php"); - exit; - } - else - { - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create'; $donotclearsession=1; } } } @@ -348,25 +359,59 @@ if ($action == 'update') if (! $datef && $percentage == 100) { - $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")); + $error++; $donotclearsession=1; + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),$object->errors,'errors'); $action = 'edit'; } // Users - $usertodo=new User($db); - if ($_POST["affectedto"]) + $listofuserid=dol_json_decode($_SESSION['assignedtouser']); + $i=0; + foreach($listofuserid as $key => $value) { - $usertodo->fetch($_POST["affectedto"]); - } - $object->usertodo = $usertodo; - $object->transparency=(GETPOST("transparency")=='on'?1:0); + if ($i == 0) // First entry + { + $usertodo=new User($db); + if ($key > 0) + { + $usertodo->fetch($key); + } + $object->usertodo = $usertodo; + $object->transparency=(GETPOST("transparency")=='on'?1:0); + } - $userdone=new User($db); - if ($_POST["doneby"]) - { - $userdone->fetch($_POST["doneby"]); + $object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0)); + + $i++; + } + + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) + { + $userdone=new User($db); + if ($_POST["doneby"]) + { + $userdone->fetch($_POST["doneby"]); + } + $object->userdone = $userdone; + } + + // Check parameters + if (! GETPOST('actioncode') > 0) + { + $error++; $donotclearsession=1; + $action = 'edit'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + } + else + { + $result=$cactioncomm->fetch(GETPOST('actioncode')); + } + if (empty($object->usertodo)) + { + $error++; $donotclearsession=1; + $action = 'edit'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); } - $object->userdone = $userdone; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -383,17 +428,13 @@ if ($action == 'update') } else { + setEventMessages($object->error,$object->errors,'errors'); $db->rollback(); } } } - if ($result < 0) - { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); - } - else + if (! $error) { if (! empty($backtopage)) { @@ -403,6 +444,30 @@ if ($action == 'update') } } +/* + * delete event + */ +if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') +{ + $object->fetch($id); + + if ($user->rights->agenda->myactions->delete + || $user->rights->agenda->allactions->delete) + { + $result=$object->delete(); + + if ($result >= 0) + { + header("Location: index.php"); + exit; + } + else + { + setEventMessages($object->error,$object->errors,'errors'); + } + } +} + /* * Action move update, used when user move an event in calendar by drag'n drop */ @@ -576,15 +641,14 @@ if ($action == 'create') print ''.$langs->trans("Location").''; // Assigned to - $var=false; print ''.$langs->trans("ActionAffectedTo").''; if (empty($donotclearsession)) { $assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id); $_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1))); } - //print $form->select_dolusers_forevent('affectedto',1); - print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); + print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1); + //print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); print ''; print ''; @@ -599,7 +663,7 @@ if ($action == 'create') print ''; // Realised by - if ($conf->global->AGENDA_ENABLE_DONEBY) + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print ''.$langs->trans("ActionDoneBy").''; print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1); @@ -704,11 +768,6 @@ if ($action == 'create') // View or edit if ($id > 0) { - if ($error) - { - dol_htmloutput_errors($error); - } - $result=$object->fetch($id); $object->fetch_optionals($id,$extralabels); @@ -833,7 +892,14 @@ if ($id > 0) // Assigned to print ''.$langs->trans("ActionAffectedTo").''; - print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1); + $listofuserid=array(); + if (empty($donotclearsession)) + { + if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency); + $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + } + print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1); + //print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1); print ''; print '

'; @@ -844,7 +910,7 @@ if ($id > 0) print ''; // Realised by - if ($conf->global->AGENDA_ENABLE_DONEBY) + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print '
'.$langs->trans("ActionDoneBy").''; print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c46f48ed1c6..c4b548c7e81 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -484,7 +484,7 @@ class Facture extends CommonInvoice // Call trigger $result=$this->call_trigger('BILL_CREATE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers if (! $error) @@ -593,8 +593,8 @@ class Facture extends CommonInvoice // Load source object $objFrom = dol_clone($this); - - + + // Change socid if needed if (! empty($socid) && $socid != $this->socid) @@ -637,7 +637,7 @@ class Facture extends CommonInvoice unset($this->products[$i]); // Tant que products encore utilise } } - + // Create clone $result=$this->create($user); if ($result < 0) $error++; @@ -645,7 +645,7 @@ class Facture extends CommonInvoice // copy internal contacts if ($this->copy_linked_contact($objFrom, 'internal') < 0) $error++; - + // copy external contacts if same company elseif ($objFrom->socid == $this->socid) { @@ -667,7 +667,7 @@ class Facture extends CommonInvoice // Call trigger $result=$this->call_trigger('BILL_CLONE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -1108,7 +1108,7 @@ class Facture extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_MODIFY',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } } @@ -1266,7 +1266,7 @@ class Facture extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_DELETE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } @@ -1438,7 +1438,7 @@ class Facture extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_PAYED',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } else @@ -1490,7 +1490,7 @@ class Facture extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_UNPAYED',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers } else @@ -1554,7 +1554,7 @@ class Facture extends CommonInvoice // Call trigger $result=$this->call_trigger('BILL_CANCEL',$user); if ($result < 0) - { + { $this->db->rollback(); return -1; } @@ -1768,11 +1768,11 @@ class Facture extends CommonInvoice { // Call trigger $result=$this->call_trigger('BILL_VALIDATE',$user); - if ($result < 0) $error++; - //TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail + if ($result < 0) $error++; + //TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail // End call triggers } - + // Set new ref and define current statut if (! $error) { @@ -1856,7 +1856,7 @@ class Facture extends CommonInvoice $this->statut = 0; // Call trigger $result=$this->call_trigger('BILL_UNVALIDATE',$user); - if ($result < 0) + if ($result < 0) { $error++; $this->statut=$old_statut; @@ -3164,7 +3164,7 @@ class Facture extends CommonInvoice $sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,'; $sql.= ' p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON l.fk_product=p.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; $sql.= ' WHERE l.fk_facture = '.$this->id; $sql.= ' ORDER BY l.rang ASC, l.rowid'; @@ -3550,7 +3550,7 @@ class FactureLigne extends CommonInvoiceLine // Call trigger $result=$this->call_trigger('LINEBILL_INSERT',$user); if ($result < 0) - { + { $this->db->rollback(); return -2; } @@ -3661,7 +3661,7 @@ class FactureLigne extends CommonInvoiceLine { // Call trigger $result=$this->call_trigger('LINEBILL_UPDATE',$user); - if ($result < 0) + if ($result < 0) { $this->db->rollback(); return -2; @@ -3691,7 +3691,7 @@ class FactureLigne extends CommonInvoiceLine $error=0; $this->db->begin(); - + // Call trigger $result=$this->call_trigger('LINEBILL_DELETE',$user); if ($result < 0) @@ -3700,7 +3700,7 @@ class FactureLigne extends CommonInvoiceLine return -1; } // End call triggers - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 81ceeb6f39d..169fb32010a 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -104,11 +104,11 @@ $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_t $sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,"; $sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,"; $sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly"; -$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; -$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn"; -$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ; +$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva as ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; +$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; +$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc" ; $sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; else $sql.= " AND f.type IN (0,1,2,3)"; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 6e65446bdda..f90add66b54 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -105,10 +105,10 @@ $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; $sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly"; -$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; -$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; -$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc"; +$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; +$sql.= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; +$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.fk_statut > 0"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 153ff769eb6..331705f0b3f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1289,7 +1289,7 @@ class Form * @return string HTML select string * @see select_dolgroups */ - function select_dolusers_forevent($htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='') + function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='') { global $conf,$user,$langs; @@ -1297,18 +1297,24 @@ class Form // Method with no ajax //$out.=''; - $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); - $out.=''; + $out.=''; + $out.=''; + $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); + $out.=''; $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); if (count($assignedtouser)) $out.='
'; + $i=0; foreach($assignedtouser as $key => $value) { $userstatic->fetch($key); $out.=$userstatic->getNomUrl(1); + if ($i == 0) $out.=' ('.$langs->trans("Owner").')'; + $out.=' '; //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); $out.='
'; + $i++; } //$out.=''; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 78d4cc55a4e..9d1c138bc5f 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -186,12 +186,12 @@ class Entrepot extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete", LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete", LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); if ($resql1 && $resql2) @@ -202,8 +202,8 @@ class Entrepot extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); - // Update denormalized fields because we change content of produt_stock - $sql = "UPDATE ".MAIN_DB_PREFIX."product p SET p.stock= (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)"; + // Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql + $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); @@ -217,7 +217,7 @@ class Entrepot extends CommonObject { $this->db->rollback(); $this->error=$this->db->lasterror(); - return -1; + return -2; } } else @@ -540,7 +540,7 @@ class Entrepot extends CommonObject $this->description = 'WAREHOUSE SPECIMEN '.dol_print_date($now,'dayhourlog'); $this->statut=1; $this->specimen=1; - + $this->lieu='Location test'; $this->address='21 jump street'; $this->zip='99999'; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 86e930d8cf1..1155ef6cb40 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -261,7 +261,7 @@ else // Country print '
'.$langs->trans('Country').''; - if (! empty($object->country_code)) + if (! empty($object->country_code)) { $img=picto_from_langcode($object->country_code); print ($img?$img.' ':''); @@ -339,14 +339,14 @@ else print "id."\">".$langs->trans("Modify").""; else print "".$langs->trans("Modify").""; - + if ($user->rights->stock->supprimer) print "id."\">".$langs->trans("Delete").""; else print "".$langs->trans("Delete").""; } } - + print ""; @@ -375,7 +375,7 @@ else $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,"; $sql.= " ps.pmp, ps.reel as value"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_product = p.rowid"; $sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) $sql.= " AND ps.fk_entrepot = ".$object->id; diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index d8dda85f2fc..a8a554ca25d 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -123,14 +123,21 @@ class AllTests require_once dirname(__FILE__).'/DiscountTest.php'; $suite->addTestSuite('DiscountTest'); + require_once dirname(__FILE__).'/ContratTest.php'; + $suite->addTestSuite('ContratTest'); + + require_once dirname(__FILE__).'/FichinterTest.php'; + $suite->addTestSuite('FichinterTest'); + + require_once dirname(__FILE__).'/PropalTest.php'; + $suite->addTestSuite('PropalTest'); + require_once dirname(__FILE__).'/CommandeTest.php'; $suite->addTestSuite('CommandeTest'); require_once dirname(__FILE__).'/CommandeFournisseurTest.php'; $suite->addTestSuite('CommandeFournisseurTest'); - require_once dirname(__FILE__).'/ContratTest.php'; - $suite->addTestSuite('ContratTest'); require_once dirname(__FILE__).'/FactureTest.php'; $suite->addTestSuite('FactureTest'); require_once dirname(__FILE__).'/FactureRecTest.php'; @@ -139,8 +146,7 @@ class AllTests $suite->addTestSuite('FactureTestRounding'); require_once dirname(__FILE__).'/FactureFournisseurTest.php'; $suite->addTestSuite('FactureFournisseurTest'); - require_once dirname(__FILE__).'/PropalTest.php'; - $suite->addTestSuite('PropalTest'); + require_once dirname(__FILE__).'/UserTest.php'; $suite->addTestSuite('UserTest'); require_once dirname(__FILE__).'/UserGroupTest.php'; From b252680346ff09bde6b8e6d8443f0b76d1ce23e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Sep 2014 01:10:55 +0200 Subject: [PATCH 62/63] Add phpunit for interventions --- test/phpunit/FichInterTest.php | 244 +++++++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 test/phpunit/FichInterTest.php diff --git a/test/phpunit/FichInterTest.php b/test/phpunit/FichInterTest.php new file mode 100644 index 00000000000..96366af85a9 --- /dev/null +++ b/test/phpunit/FichInterTest.php @@ -0,0 +1,244 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file test/phpunit/FichinterTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/fichinter/class/fichinter.class.php'; + +if (empty($user->id)) +{ + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class FichinterTest extends PHPUnit_Framework_TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return ContratTest + */ + function __construct() + { + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testFichinterCreate + * + * @return int + */ + public function testFichinterCreate() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); + + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $result; + } + + /** + * testFichinterFetch + * + * @param int $id Id of intervention + * @return int + * + * @depends testFichinterCreate + * The depends says test is run only if previous is ok + */ + public function testFichinterFetch($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $result=$localobject->fetch($id); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $localobject; + } + + /** + * testFichinterValid + * + * @param Fichinter $localobject Intervention + * @return int + * + * @depends testFichinterFetch + * The depends says test is run only if previous is ok + */ + public function testFichinterValid($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=$localobject->setValid($user); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + + $this->assertLessThan($result, 0); + return $localobject; + } + + /** + * testFichinterValid + * + * @param Object $localobject Object intervention + * @return int + * + * @depends testFichinterValid + * The depends says test is run only if previous is ok + */ + public function testFichinterOther($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + $localobject->info($localobject->id); + print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n"; + $this->assertNotEquals($localobject->date_creation, ''); + + return $localobject->id; + } + + /** + * testFichinterDelete + * + * @param int $id Id of intervention + * @return int + * + * @depends testFichinterOther + * The depends says test is run only if previous is ok + */ + public function testFichinterDelete($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; + } + +} From cf7973d0fa418d1ec92870d7150e91e857214a25 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Sep 2014 01:26:53 +0200 Subject: [PATCH 63/63] Doxygen --- htdocs/core/class/html.form.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 331705f0b3f..0b870775d69 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1276,6 +1276,7 @@ class Form /** * Return select list of users. Selected users are stored into session. * + * @param string $action Value for $action * @param string $htmlname Field name in form * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue * @param array $exclude Array list of users id to exclude