From c362e7cf2dc6c104213469446737480faaca09a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 17:10:07 +0100 Subject: [PATCH 01/41] FIX #6043 - Payment mode not visible on supplier invoice list --- htdocs/fourn/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 47841195c83..89dfb083ea0 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -247,9 +247,9 @@ llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:Factur $sql = "SELECT"; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite,"; +$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement,"; $sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; -$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql.= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,"; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " p.rowid as project_id, p.ref as project_ref"; From 8b569f9dfe7550844be487fe17f6f7de4b75266a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 17:17:29 +0100 Subject: [PATCH 02/41] Try a fix for #6024 --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2acb57665a6..2a1f1dab8bc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1765,7 +1765,7 @@ else print ''; $paymentstatic->id=$objp->rowid; $paymentstatic->datepaye=$db->jdate($objp->dp); - $paymentstatic->ref=$objp->ref; + $paymentstatic->ref=($objp->ref ? $objp->ref : $objp->rowid); $paymentstatic->num_paiement=$objp->num_paiement; $paymentstatic->payment_code=$objp->payment_code; print $paymentstatic->getNomUrl(1); From 044c4bda3b66629c02ceca34dd9cc48fd595ce57 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 28 Nov 2016 06:53:34 +0100 Subject: [PATCH 03/41] Fix: Expense report return empty date field --- htdocs/expensereport/list.php | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 6f71bd77ce6..2752d04644e 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -192,7 +192,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,"; -$sql.= " d.date_debut, d.date_fin, d.date_valid,"; +$sql.= " d.date_debut, d.date_fin, d.date_valid, d.date_create, d.tms as date_modif,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.statut, u.photo"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); @@ -290,7 +290,7 @@ if ($resql) $num = $db->num_rows($resql); $arrayofselected=is_array($toselect)?$toselect:array(); - + $param=""; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; @@ -308,7 +308,7 @@ if ($resql) $tmpkey=preg_replace('/search_options_/','',$key); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - + // List of mass actions available $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), @@ -317,7 +317,7 @@ if ($resql) if ($user->rights->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($massaction == 'presend') $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - + print '
'."\n"; if ($optioncss != '') print ''; print ''; @@ -334,9 +334,9 @@ if ($resql) foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + $moreforfilter=''; - + $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; @@ -348,10 +348,10 @@ if ($resql) print $moreforfilter; print ''; } - + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + print '
'; print ''."\n"; print ""; @@ -493,10 +493,10 @@ if ($resql) $total_total_ht = 0; $total_total_ttc = 0; $total_total_tva = 0; - + $expensereportstatic=new ExpenseReport($db); $usertmp = new User($db); - + if ($num > 0) { $i=0; @@ -512,6 +512,8 @@ if ($resql) $expensereportstatic->valid=$obj->date_valid; $expensereportstatic->date_debut=$obj->date_debut; $expensereportstatic->date_fin=$obj->date_fin; + $expensereportstatic->date_create=$obj->date_create; + $expensereportstatic->date_modif=$obj->date_modif; $var=!$var; print ""; @@ -594,7 +596,7 @@ if ($resql) if (! empty($arrayfields['d.datec']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } @@ -602,7 +604,7 @@ if ($resql) if (! empty($arrayfields['d.tms']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } @@ -657,18 +659,18 @@ if ($resql) } print ''; } - + $db->free($resql); - + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - + print '
'; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); + print dol_print_date($db->jdate($obj->date_create), 'dayhour'); print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); + print dol_print_date($db->jdate($obj->date_modif), 'dayhour'); print '
'."\n"; print '
'; - + print '
'."\n"; - + /* if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { From 8002187912939c4b5de3b3f4fe690541866c0d5b Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 28 Nov 2016 10:34:03 +0100 Subject: [PATCH 04/41] Enabling ficheintertoprocess --- htdocs/fichinter/index.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 6319acbd873..54392795f13 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -280,8 +280,8 @@ else dol_print_error($db); /* * interventions to process */ -/* -if (! empty($conf->fichinter->enabled)) + +if (! empty($conf->ficheinter->enabled)) { $sql = "SELECT f.rowid, f.ref, f.fk_statut, s.nom as name, s.rowid as socid"; $sql.=" FROM ".MAIN_DB_PREFIX."fichinter as f"; @@ -348,9 +348,6 @@ if (! empty($conf->fichinter->enabled)) } else dol_print_error($db); } -*/ - - print ''; From 5e5ce0043eb4c6b691dbd168b6a3c02f3d321256 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 12:03:33 +0100 Subject: [PATCH 05/41] Debug module ECM. --- htdocs/core/class/html.formfile.class.php | 9 ++-- htdocs/ecm/docfile.php | 50 ++++++++++++++++------- htdocs/ecm/docmine.php | 6 +-- htdocs/langs/en_US/main.lang | 2 + 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index dadc470e273..b55d2ee9c21 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -935,7 +935,8 @@ class FormFile print ''; print ''; } - print ''; + print '
'."\n"; + print ''; print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); @@ -971,6 +972,7 @@ class FormFile $editline=0; + print ''."\n"; print ''; print '
'; @@ -1131,7 +1133,7 @@ class FormFile // Show list of documents if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; - print ''; + print '
'."\n"; print ''; $sortref="fullname"; if ($modulepart == 'invoice_supplier') $sortref='level1name'; @@ -1140,7 +1142,7 @@ class FormFile print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre('','',''); - print ''; + print ''."\n"; // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'company') @@ -1276,6 +1278,7 @@ class FormFile if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files $var=!$var; + print ''."\n"; print ''; print '"; print ''; print ''; -print ''; print ''; print ''; From 711961ed1825407064125ad918a341f527e773ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 17:24:40 +0100 Subject: [PATCH 24/41] Fix missing translation --- htdocs/admin/ihm.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 3147538c8fe..1a9ad5f317a 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -38,6 +38,7 @@ $langs->load("products"); $langs->load("members"); $langs->load("projects"); $langs->load("hrm"); +$langs->load("agenda"); if (! $user->admin) accessforbidden(); From bd8f923cee87e94784f651e1e45eaeae2e546d2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 22:41:47 +0100 Subject: [PATCH 25/41] Several fixes in filter on lists --- dev/skeletons/skeleton_list.php | 2 +- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/fiscalyear.php | 2 +- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- .../accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/accountancy/bookkeeping/listbyyear.php | 2 +- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/adherents/list.php | 2 +- htdocs/adherents/subscription/list.php | 2 +- htdocs/adherents/type.php | 2 +- .../categories/class/api_categories.class.php | 2 +- .../class/api_deprecated_category.class.php | 4 +- htdocs/comm/action/listactions.php | 2 +- htdocs/comm/action/rapport/index.php | 2 +- htdocs/comm/mailing/cibles.php | 2 +- htdocs/comm/propal/list.php | 2 +- .../class/api_deprecated_commande.class.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/bank/bankentries.php | 2 +- htdocs/compta/bank/index.php | 2 +- .../class/api_deprecated_invoice.class.php | 2 +- htdocs/compta/facture/fiche-rec.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/contact/list.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/core/class/html.formpropal.class.php | 4 +- htdocs/core/lib/functions.lib.php | 4 +- htdocs/cron/list.php | 2 +- htdocs/don/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fourn/commande/list.php | 4 +- htdocs/fourn/facture/list.php | 8 +- htdocs/fourn/facture/paiement.php | 10 +- htdocs/fourn/product/list.php | 2 +- htdocs/loan/index.php | 2 +- htdocs/margin/checkMargins.php | 2 +- htdocs/opensurvey/list.php | 2 +- .../class/api_deprecated_product.class.php | 4 +- htdocs/product/list.php | 2 +- htdocs/product/price.php | 4 +- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- .../class/api_deprecated_contact.class.php | 2 +- .../class/api_deprecated_thirdparty.class.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/societe/price.php | 4 +- htdocs/supplier_proposal/list.php | 105 +++++++++++------- 59 files changed, 143 insertions(+), 106 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index f571af9873e..c064c74b0ac 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -243,7 +243,7 @@ $sql.=$db->order($sortfield,$sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 3edda4f8587..47dcce5031b 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -172,7 +172,7 @@ if (strlen(trim($search_pcgsubtype))) { $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 4127f5e4ee2..c5a1bffc694 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -90,7 +90,7 @@ $sql .= " WHERE f.entity = " . $conf->entity; $sql.=$db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 1cb37e92baa..69d0fdc7f94 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -248,7 +248,7 @@ if (strlen(trim($search_desc))) { } $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index f0a103ae912..557f786b4b8 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -143,7 +143,7 @@ else { // List - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index df2ee00e869..f60b1584455 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -293,7 +293,7 @@ llxHeader('', $title_page); // List -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 63b0955722f..6308c2d3edc 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -162,7 +162,7 @@ llxHeader('', $title_page); // List -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index d8df8eb5007..b607d055a7a 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -158,7 +158,7 @@ if (! empty($search_code_journal)) { * Mode List */ -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index b133e505d5c..7882c3b9320 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -200,7 +200,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't sha $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 83a01abadc3..7f214ffdf3c 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -215,7 +215,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't sha $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 5ac3f5b7a01..8c47627f2f7 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -178,7 +178,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don' $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 0d058ffc402..396095eee5a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -208,7 +208,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don' $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 41d62a60f22..d4428dbcb1a 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -182,7 +182,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2bbc150428b..2f19ff0bc75 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -217,7 +217,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 33925e8d130..77519b0e570 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -250,7 +250,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records with no order and no limits -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 5ab73082a96..078eb1e0e6f 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -110,7 +110,7 @@ if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 155656e92eb..3bbccd2693a 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -414,7 +414,7 @@ if ($rowid > 0) $sql.=" AND datefin < '".$db->idate($now)."'"; } // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index e6743546b2f..471c6b2fdde 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -209,7 +209,7 @@ class Categories extends DolibarrApi $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 7bff4d16082..2cb25b70779 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -124,7 +124,7 @@ class CategoryApi extends DolibarrApi $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')'; $sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -205,7 +205,7 @@ class CategoryApi extends DolibarrApi $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index e0ccf854b89..1584e28bad9 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -245,7 +245,7 @@ if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AN if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 95c2874150a..fdc94005cdb 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -85,7 +85,7 @@ $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; $sql.= " GROUP BY year, month, df"; $sql.= " ORDER BY year DESC, month DESC, df DESC"; -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e22b8538a66..ab7ee3c7c8a 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -412,7 +412,7 @@ if ($object->fetch($id) >= 0) $sql .= $db->order($sortfield,$sortorder); // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index bd52652d9c5..cdcedf9bbcc 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -333,7 +333,7 @@ $sql.= $db->order($sortfield,$sortorder); $sql.=', p.ref DESC'; // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/class/api_deprecated_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php index 16e37cc6235..b0b22764ec7 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -138,7 +138,7 @@ class CommandeApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2fd7b4822ef..0262187b342 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -560,7 +560,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 49113ed7d58..189fbaa188f 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -501,7 +501,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; $nbtotalofpages = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 51cb5c636fd..b3c9a903028 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -175,7 +175,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/class/api_deprecated_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php index 0b2949ca9bb..a2706b3150f 100644 --- a/htdocs/compta/facture/class/api_deprecated_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -137,7 +137,7 @@ class InvoiceApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 51295cd0cf1..fccb1d00106 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1555,7 +1555,7 @@ else $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($year_date_when,1,false))."' AND '".$db->idate(dol_get_last_day($year_date_when,12,false))."'"; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ea012cb3672..0e2ac88fe83 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -401,7 +401,7 @@ $listfield=explode(',',$sortfield); foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.','; $sql.= ' f.rowid DESC '; -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index df507490aec..8fd4eee5339 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -112,7 +112,7 @@ else if ($year > 0) } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 9495b56e90b..f55d5917750 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -186,7 +186,7 @@ else } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 04b73ccbb6d..33e5110153b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -365,7 +365,7 @@ else } // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e0f465b5389..efb2c13ea9e 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -288,7 +288,7 @@ if ($result) $totalnboflines = $db->num_rows($result); } -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index 2cfeaadd368..14e1a466275 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -101,7 +101,7 @@ class FormPropal } print ''; // Center diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 49d916d2d9d..c400f9d167b 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -225,7 +225,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index a6a60dc79c3..9ca8a79bb15 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -113,7 +113,7 @@ if (trim($search_name) != '') if ($search_amount) $sql.= natural_search(array('d.amount'), price2num(trim($search_amount)), 1); $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index d7624e146b1..34c989587af 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -238,7 +238,7 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 6f71bd77ce6..7ecbf665545 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -275,7 +275,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index cbfe245eba4..706ca4e143f 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -121,7 +121,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search $fieldstosearchall = array( 'cf.ref'=>'Ref', 'cf.ref_supplier'=>'RefSupplierOrder', - //'pd.description'=>'Description', + 'pd.description'=>'Description', 's.nom'=>"ThirdParty", 'cf.note_public'=>'NotePublic', ); @@ -371,7 +371,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 2ebdb7fe7bb..b424ff4e7a0 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -127,7 +127,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search $fieldstosearchall = array( 'f.ref'=>'Ref', 'f.ref_supplier'=>'RefSupplier', - //'fd.description'=>'Description', + 'pd.description'=>'Description', 's.nom'=>"ThirdParty", 'f.note_public'=>'NotePublic', ); @@ -246,7 +246,7 @@ $formcompany=new FormCompany($db); llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); $sql = "SELECT"; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +if ($search_all || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite,"; $sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; $sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; @@ -266,7 +266,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql.= ', '.MAIN_DB_PREFIX.'facture_fourn as f'; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn_extrafields as ef on (f.rowid = ef.fk_object)"; -if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn'; +if ($search_all || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; // We'll need this table joined to the select in order to filter by sale @@ -372,7 +372,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 16aca2068b7..5c370a41924 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -627,6 +627,14 @@ if (empty($action)) $sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label"; if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= $db->order($sortfield,$sortorder); + + $nbtotalofrecords = -1; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } + $sql.= $db->plimit($limit+1, $offset); $resql = $db->query($sql); @@ -643,7 +651,7 @@ if (empty($action)) $paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss); - print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, 0, 'title_accountancy.png'); + print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords, 'title_accountancy.png'); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 95ff1620691..97184909290 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -120,7 +120,7 @@ if ($fourn_id > 0) $sql .= " AND ppf.fk_soc = ".$fourn_id; } // Count total nb of records without orderby and limit -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index 0d79913f10e..a03abce6350 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -86,7 +86,7 @@ if ($filtre) { $sql.= " GROUP BY l.rowid, l.label, l.capital, l.datestart, l.dateend"; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 24451e39d77..eb3292cd332 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -157,7 +157,7 @@ if (! empty($enddate)) $sql .= " AND d.buy_price_ht IS NOT NULL"; $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_syslog(__FILE__, LOG_DEBUG); diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 584685ead51..42791f0af8d 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -124,7 +124,7 @@ $sql.= " u.login, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat"; // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/class/api_deprecated_product.class.php b/htdocs/product/class/api_deprecated_product.class.php index 66f34fbd9c3..cdda0c45fbb 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -126,7 +126,7 @@ class ProductApi extends DolibarrApi // Show product on buy if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -212,7 +212,7 @@ class ProductApi extends DolibarrApi // Show product on buy if ($to_buy) $sql.= " AND p.to_buy = ".$db->escape($to_buy); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 9b101907bda..24df0f65715 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -304,7 +304,7 @@ else $sql.=$hookmanager->resPrint; //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f74a637d270..8f1e7484ced 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1661,7 +1661,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int')); // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } @@ -1741,7 +1741,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // List of all prices by customers // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all($sortorder, $sortfield, 0, 0, $filter); } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 21444984d65..e2cb108f87d 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -456,7 +456,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index dfcda620a8c..848bc519946 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -259,7 +259,7 @@ $sql.=$db->order($sortfield,$sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c6a44f32c9b..b98126a6bd0 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -315,7 +315,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 5526aa91efb..86d79676d58 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -308,7 +308,7 @@ $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // No $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/class/api_deprecated_contact.class.php b/htdocs/societe/class/api_deprecated_contact.class.php index 65f361de23a..d3d085e7135 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -143,7 +143,7 @@ class ContactApi extends DolibarrApi $sql .= " AND sc.fk_user = " . $search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/class/api_deprecated_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php index 61c9c1cc013..3e937557941 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -189,7 +189,7 @@ class ThirdpartyApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 032df5b45d8..cbc4a9670a1 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -438,7 +438,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 9236fc35f6f..db2592f225c 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -379,7 +379,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { ); // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } @@ -469,7 +469,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Count total nb of records - $nbtotalofrecords = 0; + $nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index d2649a42a43..a8e38098775 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -55,7 +55,7 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','al $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_author=GETPOST('search_author','alpha'); -$viewstatut=$db->escape(GETPOST('viewstatut')); +$search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int'); $object_statut=$db->escape(GETPOST('supplier_proposal_statut')); $sall=GETPOST("sall"); @@ -89,11 +89,22 @@ if ($page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield='p.date_livraison'; +if (! $sortfield) $sortfield='sp.date_livraison'; if (! $sortorder) $sortorder='DESC'; -if($object_statut != '') -$viewstatut=$object_statut; +if ($object_statut != '') $search_status=$object_statut; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$contextpage='supplierproposallist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('supplierproposallist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('supplier_proposal'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + // List of fields to search into when doing a "search in all" $fieldstosearchall = array( @@ -137,7 +148,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO $monthvalid=''; $year=''; $month=''; - $viewstatut=''; + $search_status=''; $object_statut=''; } @@ -196,13 +207,30 @@ $companystatic=new Societe($db); $now=dol_now(); -$sql = 'SELECT s.rowid as socid, s.nom as name, s.town, s.client, s.code_client,'; -$sql.= ' p.rowid, p.note_private, p.total_ht, p.ref, p.fk_statut, p.fk_user_author, p.date_valid, p.date_livraison as dp,'; -if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; -$sql.= ' u.login'; -$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'supplier_proposal as p'; -if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'supplier_proposaldet as pd ON p.rowid=pd.fk_supplier_proposal'; -$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; +$sql = 'SELECT'; +if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +$sql.= ' s.rowid as socid, s.nom as name, s.town, s.client, s.code_client,'; +$sql.= " typent.code as typent_code,"; +$sql.= " state.code_departement as state_code, state.nom as state_name,"; +$sql.= ' sp.rowid, sp.note_private, sp.total_ht, sp.ref, sp.fk_statut, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,'; +$sql.= " p.rowid as project_id, p.ref as project_ref,"; +$sql.= " u.firstname, u.lastname, u.photo, u.login"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; +$sql.= ', '.MAIN_DB_PREFIX.'supplier_proposal as sp'; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."supplier_proposal_extrafields as ef on (sp.rowid = ef.fk_object)"; +if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'supplier_proposaldet as pd ON sp.rowid=pd.fk_supplier_proposal'; +if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sp.fk_user_author = u.rowid'; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = sp.fk_projet"; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) @@ -210,55 +238,54 @@ if ($search_user > 0) $sql.=", ".MAIN_DB_PREFIX."element_contact as c"; $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc"; } -$sql.= ' WHERE p.fk_soc = s.rowid'; -$sql.= ' AND p.entity = '.$conf->entity; +$sql.= ' WHERE sp.fk_soc = s.rowid'; +$sql.= ' AND sp.entity IN ('.getEntity('supplier_proposal', 1).')'; if (! $user->rights->societe->client->voir && ! $socid) //restriction { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } -if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_ref) $sql .= natural_search('sp.ref', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_author) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'"; -if ($search_montant_ht) $sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; +if ($search_author) $sql .= natural_search('u.login', $search_author); +if ($search_montant_ht) $sql.= " AND sp.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'"; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($socid) $sql.= ' AND s.rowid = '.$socid; -if ($viewstatut <> '') $sql.= ' AND p.fk_statut IN ('.$viewstatut.')'; +if ($search_status <> '') $sql.= ' AND sp.fk_statut IN ('.$search_status.')'; if ($month > 0) { if ($year > 0 && empty($day)) - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + $sql.= " AND sp.date_livraison 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 p.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; + $sql.= " AND sp.date_livraison 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(p.date_livraison, '%m') = '".$month."'"; + $sql.= " AND date_format(sp.date_livraison, '%m') = '".$month."'"; } else if ($year > 0) { - $sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql.= " AND sp.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } if ($monthvalid > 0) { if ($yearvalid > 0 && empty($dayvalid)) - $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,$monthvalid,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,$monthvalid,false))."'"; + $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,$monthvalid,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,$monthvalid,false))."'"; else if ($yearvalid > 0 && ! empty($dayvalid)) - $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $monthvalid, $dayvalid, $yearvalid))."' AND '".$db->idate(dol_mktime(23, 59, 59, $monthvalid, $dayvalid, $yearvalid))."'"; + $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $monthvalid, $dayvalid, $yearvalid))."' AND '".$db->idate(dol_mktime(23, 59, 59, $monthvalid, $dayvalid, $yearvalid))."'"; else - $sql.= " AND date_format(p.date_valid, '%m') = '".$monthvalid."'"; + $sql.= " AND date_format(sp.date_valid, '%m') = '".$monthvalid."'"; } else if ($yearvalid > 0) { - $sql.= " AND p.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,1,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,12,false))."'"; + $sql.= " AND sp.date_valid BETWEEN '".$db->idate(dol_get_first_day($yearvalid,1,false))."' AND '".$db->idate(dol_get_last_day($yearvalid,12,false))."'"; } if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) { - $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; + $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".$search_user; } +$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', sp.ref DESC'; -$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC'; - -$nbtotalofrecords = 0; +$nbtotalofrecords = -1; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -279,7 +306,7 @@ if ($result) $soc->fetch($socid); } - $param='&socid='.$socid.'&viewstatut='.$viewstatut; + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall) $param.='&sall='.$sall; @@ -291,7 +318,9 @@ if ($result) if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; if ($search_author) $param.='&search_author='.$search_author; - + if ($socid > 0) $param.='&socid='.$socid; + if ($search_status != '') $param.='&search_status='.$search_status; + // Lignes des champs de filtre print ''; if ($optioncss != '') print ''; @@ -344,13 +373,13 @@ if ($result) print '
'; print '
'; if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index ce4bf480668..89caaf91824 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2016 Laurent Destailleur * * 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 @@ -159,14 +159,13 @@ llxHeader(); $form=new Form($db); -$fullpath=$conf->ecm->dir_output.'/'.$ecmdir->label.'/'.$urlfile; +$fullpath=$conf->ecm->dir_output.'/'.$relativepath.$urlfile; $file = new stdClass(); $file->section_id=$ecmdir->id; $file->label=$urlfile; $head = ecm_file_prepare_head($file); -dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); if ($_GET["action"] == 'edit') { @@ -177,8 +176,10 @@ if ($_GET["action"] == 'edit') print ''; } +dol_fiche_head($head, 'card', $langs->trans("File"), 0, 'generic'); + print ''; -print ''; /*print ''; */ -if ($_GET["action"] == 'edit') -{ - print ''; -} + +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +print ''; print '
'.$langs->trans("Ref").''; +print '
'.$langs->trans("Ref").''; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -203,7 +204,7 @@ while ($tmpecmdir && $result > 0) print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; print $s; print ' -> '; -if (GETPOST('action') == 'edit') print ''; +if (GETPOST('action') == 'edit') print ''; else print $urlfile; print '
'.$langs->trans("Description").''; @@ -234,20 +235,39 @@ print '
'.$langs->trans("TotalSizeOfAttachedFiles").''; print dol_print_size($totalsize); print '
'; - print ''; - print '     '; - print ''; - print '
'.$langs->trans("DirectDownloadLink").''; +$modulepart='ecm'; +$forcedownload=1; +$rellink='/document.php?modulepart='.$modulepart; +if ($forcedownload) $rellink.='&attachment=1'; +if (! empty($object->entity)) $rellink.='&entity='.$object->entity; +$filepath=$relativepath.$file->label; +$rellink.='&file='.urlencode($filepath); +$fulllink=$urlwithroot.$rellink; +print img_picto('','object_globe.png').' '; +print ''; +print ' '.$langs->trans("Download").''; +print '
'; + +dol_fiche_end(); + if ($_GET["action"] == 'edit') { - print ''; + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print ''; } -print ''; // Confirmation de la suppression d'une ligne categorie diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index 17e1a1a4308..0099e831776 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -222,7 +222,7 @@ if ($action == 'edit') } print ''; -print ''; -print ''; // Zip / Town @@ -468,7 +462,7 @@ if (! empty($id) && $action == 'edit') print ''; // Country - print ''; @@ -593,9 +587,6 @@ if (! empty($id) && $action != 'edit') print '
'.$langs->trans("Ref").''; +print '
'.$langs->trans("Ref").''; $s=''; $tmpecmdir=new EcmDirectory($db); // Need to create a new one $tmpecmdir->fetch($ecmdir->id); @@ -233,7 +233,7 @@ while ($tmpecmdir && $result > 0) $tmpecmdir->ref=$tmpecmdir->label; if ($i == 0 && $action == 'edit') { - $s=''; + $s=''; } else $s=$tmpecmdir->getNomUrl(1).$s; if ($tmpecmdir->fk_parent) @@ -251,7 +251,7 @@ while ($tmpecmdir && $result > 0) print img_picto('','object_dir').' '.$langs->trans("ECMRoot").' -> '; print $s; print '
'.$langs->trans("Description").''; +print '
'.$langs->trans("Description").''; if ($action == 'edit') { print '
'.$langs->trans('Country').''; + print '
'.$langs->trans('Country').''; print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'; - $nbrows=12; - if (! empty($conf->projet->enabled)) $nbrows++; - // Ref /* print ''; */ // Date - print '"; @@ -668,13 +659,13 @@ if (! empty($id) && $action != 'edit') // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print '
'.$langs->trans("Ref").''; @@ -604,7 +595,7 @@ if (! empty($id) && $action != 'edit') print '
'.$langs->trans("Date").''; + print '
'.$langs->trans("Date").''; print dol_print_date($object->date,"day"); print "
'; - + print ''; print '
'; print '
'; - + /* * Payments */ @@ -737,16 +728,13 @@ if (! empty($id) && $action != 'edit') dol_print_error($db); } - print '
'; print '
'; print ''; - + print '
'; - - + dol_fiche_end(); - $remaintopay = $object->amount - $totalpaid; @@ -821,7 +809,7 @@ if (! empty($id) && $action != 'edit') print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf); print '
'; - + print '
'; } From fc0edc349914bd132d41b197271b0bfd7b75ce63 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 28 Nov 2016 21:27:02 +0100 Subject: [PATCH 13/41] Uniformize presentation of social contribution - Add button cancel in create mode --- htdocs/compta/sociales/card.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 8c21bf32ceb..9d6affdf573 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2016 Frédéric France + * Copyright (C) 2016 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 @@ -278,14 +279,16 @@ if ($action == 'create') dol_fiche_head(); print ''; - print ""; + // Label - print '"; + print ''; - print ''; + print ''; print ''; print ''; + // Type print ''; print ''; + // Date end period print ''; print ''; print ''; + // Amount print ''; print ''; print ''; print ''; + // Payment Mode print ''; + // Bank Account if (! empty($conf->banque->enabled)) { @@ -321,6 +328,7 @@ if ($action == 'create') $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; } + // Date due print ''; print ''; print '
'; + print "
'; print $langs->trans("Label"); print '
'; print $langs->trans("Type"); @@ -294,6 +297,7 @@ if ($action == 'create') $formsocialcontrib->select_type_socialcontrib(GETPOST("actioncode")?GETPOST("actioncode"):'','actioncode',1); print '
'; @@ -303,6 +307,7 @@ if ($action == 'create') print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1); print '
'; @@ -310,10 +315,12 @@ if ($action == 'create') print '
' . $langs->trans('PaymentMode') . ''; $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); print '
'; @@ -337,7 +345,9 @@ if ($action == 'create') print '
'; print ''; - print '
'; + print '     '; + print ''; + print '
'; print ''; } @@ -587,7 +597,7 @@ if ($id > 0) { print "id&action=reopen\">".$langs->trans("ReOpen").""; } - + // Edit if ($object->paye == 0 && $user->rights->tax->charges->creer) { From 83972b39cef6ae441547ff5432e184865e6997a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 23:58:36 +0100 Subject: [PATCH 14/41] Complete work on dol_banner. Fix errors due to missing columns. --- htdocs/compta/sociales/card.php | 181 ++++++++++-------- .../sociales/class/chargesociales.class.php | 15 +- htdocs/core/lib/functions.lib.php | 6 + .../install/mysql/migration/4.0.0-5.0.0.sql | 4 + .../mysql/tables/llx_chargesociales.sql | 3 + htdocs/langs/en_US/projects.lang | 4 +- 6 files changed, 132 insertions(+), 81 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 8c21bf32ceb..5b8409c0ddb 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -72,6 +72,14 @@ if ($action == 'reopen' && $user->rights->tax->charges->creer) { } } +if ($action == 'setlib' && $user->rights->tax->charges->creer) +{ + $object->fetch($id); + $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); +} + // payment mode if ($action == 'setmode' && $user->rights->tax->charges->creer) { $object->fetch($id); @@ -356,6 +364,8 @@ if ($id > 0) { $head=tax_prepare_head($object); + $totalpaye = $object->getSommePaiement(); + // Clone confirmation if ($action === 'clone') { @@ -389,17 +399,34 @@ if ($id > 0) dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); - print ''; - + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("Label", 'lib', $object->lib, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); + $morehtmlref.='
'; + $linkback = '' . $langs->trans("BackToList") . ''; + $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + + print '
'; + print '
'; + print '
'; + + print '
'; + + /* // Ref print '"; + */ // Label - if ($action == 'edit') + /*if ($action == 'edit') { print ''; - } - + }*/ + // Type print ""; - - $rowspan=6; - if (! empty($conf->banque->enabled)) $rowspan++; - print '"; - print ""; // Period end date @@ -555,10 +513,83 @@ if ($id > 0) } // Status - print ''; + //print ''; print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id',$linkback); print "
'.$langs->trans("Label").''; print ''; @@ -408,79 +435,10 @@ if ($id > 0) else { print '
'.$langs->trans("Label").''.$object->lib.'
".$langs->trans("Type")."".$object->type_libelle."'; - - /* - * Payments - */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; - $sql.= "c.code as type_code,c.libelle as paiement_type"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; - $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql.= " WHERE p.fk_charge = ".$id; - $sql.= " AND p.fk_charge = cs.rowid"; - $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " AND p.fk_typepaiement = c.id"; - $sql.= " ORDER BY dp DESC"; - - //print $sql; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; $total = 0; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print "'; - print '\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; - print "\n"; - print '\n"; - print ""; - $totalpaye += $objp->amount; - $i++; - } - - if ($object->paye == 0) - { - print "\n"; - print "\n"; - - $resteapayer = $object->amount - $totalpaye; - - print ""; - print "\n"; - } - print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; - print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; - $db->free($resql); - } - else - { - dol_print_error($db); - } - print "
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'; + print '
'; + print '
'; + print '
'; + + /* + * Payments + */ + $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " WHERE p.fk_charge = ".$id; + $sql.= " AND p.fk_charge = cs.rowid"; + $sql.= " AND cs.entity = ".$conf->entity; + $sql.= " AND p.fk_typepaiement = c.id"; + $sql.= " ORDER BY dp DESC"; + + //print $sql; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; $total = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print "'; + print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "\n"; + print '\n"; + print ""; + $totalpaye += $objp->amount; + $i++; + } + + if ($object->paye == 0) + { + print "\n"; + print "\n"; + + $resteapayer = $object->amount - $totalpaye; + + print ""; + print "\n"; + } + print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; + print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; + $db->free($resql); + } + else + { + dol_print_error($db); + } + + print '
'; + print '
'; + print ''; + + print '
'; + dol_fiche_end(); diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index ca9af965758..1ba0773afff 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -34,7 +34,8 @@ class ChargeSociales extends CommonObject public $element='chargesociales'; public $table='chargesociales'; public $table_element='chargesociales'; - + public $picto = 'bill'; + /** * {@inheritdoc} */ @@ -371,7 +372,7 @@ class ChargeSociales extends CommonObject /** * Retourne le libelle du statut d'une charge (impaye, payee) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ @@ -384,7 +385,7 @@ class ChargeSociales extends CommonObject * Renvoi le libelle d'un statut donne * * @param int $statut Id statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ @@ -428,7 +429,13 @@ class ChargeSociales extends CommonObject if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - + if ($mode == 6) + { + if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); + } + return "Error, mode/status not found"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7b69b17f89d..33be611442e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1055,6 +1055,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlstatus.=$tmptxt; } + elseif ($object->element == 'chargesociales') + { + $tmptxt=$object->getLibStatut(6, $object->totalpaye); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); + $morehtmlstatus.=$tmptxt; + } elseif ($object->element == 'facturerec') { $morehtmlstatus.=''; diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index b602f5c1bf6..4d653644f39 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -64,6 +64,10 @@ ALTER TABLE llx_website ADD COLUMN virtualhost varchar(255) after fk_default_hom ALTER TABLE llx_chargesociales ADD COLUMN fk_account integer after fk_type; ALTER TABLE llx_chargesociales ADD COLUMN fk_mode_reglement integer after fk_account; +ALTER TABLE llx_chargesociales ADD COLUMN fk_user_author integer; +ALTER TABLE llx_chargesociales ADD COLUMN fk_user_modif integer; +ALTER TABLE llx_chargesociales ADD COLUMN fk_user_valid integer; + ALTER TABLE llx_ecm_files ADD COLUMN gen_or_uploaded varchar(12) after cover; diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql index 0514811eb15..95ab50661b6 100644 --- a/htdocs/install/mysql/tables/llx_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_chargesociales.sql @@ -26,6 +26,9 @@ create table llx_chargesociales tms timestamp, date_creation datetime, -- date de creation date_valid datetime, -- date de validation + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating fk_type integer NOT NULL, fk_account integer, -- bank account fk_mode_reglement integer, -- mode de reglement diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index dedd187db6d..ecf61d17d36 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -20,8 +20,8 @@ OnlyOpenedProject=Only open projects are visible (projects in draft or closed st ClosedProjectsAreHidden=Closed projects are not visible. TasksPublicDesc=This view presents all projects and tasks you are allowed to read. TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). -AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task you are assigned on. Assign task to you if you want to enter time on it. -OnlyYourTaskAreVisible=Only tasks you are assigned on are visible. Assign task to you if you want to enter time on it. +AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task assigned to you. Assign task to yourself if you need to enter time on it. +OnlyYourTaskAreVisible=Only tasks assigned to you are visible. Assign task to yourself if it is not visible and you need to enter time on it. ImportDatasetTasks=Tasks of projects NewProject=New project AddProject=Create project From d73c24bb457fd0a75e5fda6e86f62facce4a2f7b Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 29 Nov 2016 06:34:20 +0100 Subject: [PATCH 15/41] Social contribution in adaptive mode (Payment are under the information) --- htdocs/compta/sociales/card.php | 166 +++++++++--------- .../sociales/class/chargesociales.class.php | 1 + 2 files changed, 87 insertions(+), 80 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 9d6affdf573..5f3969d35b1 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -396,103 +396,38 @@ if ($id > 0) print ''; } - dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); - - print ''; $linkback = '' . $langs->trans("BackToList") . ''; - + + // dol_banner_tab($object, 'id', $linkback, 1, 'id', 'id'); + + print '
'; + print '
'; + print '
'; + + print '
'; + // Ref - print '"; // Label if ($action == 'edit') { - print ''; } else { - print ''; + print ''; } // Type print ""; - $rowspan=6; - if (! empty($conf->banque->enabled)) $rowspan++; - print '"; - - print ""; - // Period end date print ""; print "'; + // print ''; print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id',$linkback); print "
'.$langs->trans("Label").''; + print '
'.$langs->trans("Label").''; print ''; print '
'.$langs->trans("Label").''.$object->lib.'
'.$langs->trans("Label").''.$object->lib.'
".$langs->trans("Type")."".$object->type_libelle."'; - - /* - * Payments - */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; - $sql.= "c.code as type_code,c.libelle as paiement_type"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; - $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql.= " WHERE p.fk_charge = ".$id; - $sql.= " AND p.fk_charge = cs.rowid"; - $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " AND p.fk_typepaiement = c.id"; - $sql.= " ORDER BY dp DESC"; - - //print $sql; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; $total = 0; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print "'; - print '\n"; - $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; - print "\n"; - print '\n"; - print ""; - $totalpaye += $objp->amount; - $i++; - } - - if ($object->paye == 0) - { - print "\n"; - print "\n"; - - $resteapayer = $object->amount - $totalpaye; - - print ""; - print "\n"; - } - print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; - print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; - $db->free($resql); - } - else - { - dol_print_error($db); - } - print "
".$langs->trans("PeriodEndDate").""; @@ -565,13 +500,84 @@ if ($id > 0) } // Status - print '
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'; + print ''; + print '
'; + print '
'; + + /* + * Payments + */ + $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " WHERE p.fk_charge = ".$id; + $sql.= " AND p.fk_charge = cs.rowid"; + $sql.= " AND cs.entity = ".$conf->entity; + $sql.= " AND p.fk_typepaiement = c.id"; + $sql.= " ORDER BY dp DESC"; + + //print $sql; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; $total = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print "'; + print '\n"; + $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; + print "\n"; + print '\n"; + print ""; + $totalpaye += $objp->amount; + $i++; + } + + if ($object->paye == 0) + { + print "\n"; + print "\n"; + + $resteapayer = $object->amount - $totalpaye; + + print ""; + print "\n"; + } + print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").' 
"; + print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."".$labeltype.' '.$objp->num_paiement."'.price($objp->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AlreadyPaid")." :".price($totalpaye)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("AmountExpected")." :".price($object->amount)." ".$langs->trans("Currency".$conf->currency)."
".$langs->trans("RemainderToPay")." :".price($resteapayer)." ".$langs->trans("Currency".$conf->currency)."
"; + $db->free($resql); + } + else + { + dol_print_error($db); + } + + print '
'; + print '
'; + print ''; + + print '
'; dol_fiche_end(); - - + if ($action == 'edit') { print '
'; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index ca9af965758..e2df56ae91b 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -34,6 +34,7 @@ class ChargeSociales extends CommonObject public $element='chargesociales'; public $table='chargesociales'; public $table_element='chargesociales'; + var $picto = 'bill'; /** * {@inheritdoc} From 360c952e5a8c90bf00fa2314cebd72ecc8b7d316 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 29 Nov 2016 09:50:55 +0100 Subject: [PATCH 16/41] FIX column too small, header on 2 lines --- htdocs/core/modules/livraison/doc/pdf_typhon.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index ed0d537d736..1f8e06eb04d 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -315,9 +315,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder $height_note=0; } - $iniY = $tab_top + 7; - $curY = $tab_top + 7; - $nexY = $tab_top + 7; + $iniY = $tab_top + 11; + $curY = $tab_top + 11; + $nexY = $tab_top + 11; // Loop on each lines for ($i = 0 ; $i < $nblines ; $i++) @@ -637,7 +637,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); + $pdf->line($this->marge_gauche, $tab_top+10, $this->page_largeur-$this->marge_droite, $tab_top+10); } $pdf->SetDrawColor(128,128,128); From f2672732518929fa4d60109bfcc32246613008e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 10:38:27 +0100 Subject: [PATCH 17/41] Missing translation --- htdocs/langs/en_US/banks.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index d4fe1334d20..07a720e6537 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -28,6 +28,10 @@ Reconciliation=Reconciliation RIB=Bank Account Number IBAN=IBAN number BIC=BIC/SWIFT number +SwiftValid=BIC/SWIFT valid +SwiftVNotalid=BIC/SWIFT not valid +IbanValid=BAN valid +IbanNotValid=BAN not valid StandingOrders=Direct Debit orders StandingOrder=Direct debit order AccountStatement=Account statement From c33e4868283cb1eeedfd4028e2106496c339aa09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 10:42:10 +0100 Subject: [PATCH 18/41] Fix order of option and picto --- htdocs/admin/fckeditor.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 3cb111c4d53..54990b45913 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -46,27 +46,27 @@ if (!$user->admin) accessforbidden(); $modules = array( 'SOCIETE' => 'FCKeditorForCompany', 'PRODUCTDESC' => 'FCKeditorForProduct', -'MAILING' => 'FCKeditorForMailing', 'DETAILS' => 'FCKeditorForProductDetails', 'USERSIGN' => 'FCKeditorForUserSignature', +'MAILING' => 'FCKeditorForMailing', 'MAIL' => 'FCKeditorForMail' ); // Conditions pour que l'option soit proposee $conditions = array( 'SOCIETE' => 1, 'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)), -'MAILING' => ! empty($conf->mailing->enabled), 'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled)), 'USERSIGN' => 1, +'MAILING' => ! empty($conf->mailing->enabled), 'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)) ); // Picto $picto = array( 'SOCIETE' => 'generic', 'PRODUCTDESC' => 'product', -'MAILING' => 'email', -'DETAILS' => 'generic', +'DETAILS' => 'product', 'USERSIGN' => 'user', +'MAILING' => 'email', 'MAIL' => 'email' ); From 39c2088aa5fda5bcc252111bc6a67c97381d5b65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 11:23:15 +0100 Subject: [PATCH 19/41] Fix constant --- htdocs/install/mysql/data/llx_const.sql | 3 +-- htdocs/install/mysql/migration/repair.sql | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql index 0a31d3c3159..42ecad2b927 100644 --- a/htdocs/install/mysql/data/llx_const.sql +++ b/htdocs/install/mysql/data/llx_const.sql @@ -33,9 +33,8 @@ -- Visible in misc page insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_NOT_INSTALLED','1','chaine','Setup is running',1,0); insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_FEATURES_LEVEL','0','chaine','Level of features to show: -1=stable+deprecated, 0=stable only (default), 1=stable+experimental, 2=stable+experimental+development',1,0); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_LOGTOHTML','0','chaine','If this constants is defined, it is possible to have logs inside pages by adding the parameter &logtohtml=1',1,0); insert into llx_const (name, value, type, note, visible, entity) values ('MAILING_LIMIT_SENDBYWEB','25','chaine','Number of targets to defined packet size when sending mass email',1,0); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); +insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL. Module log must also be enabled.',1,0); -- Hidden and common to all entities insert into llx_const (name, value, type, note, visible, entity) values ('SYSLOG_HANDLERS','["mod_syslog_file"]','chaine','Which logger to use',0,0); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 3ba06daabce..d487217cb9a 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -17,7 +17,7 @@ -- ALTER TABLE llx_accountingaccount MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- ALTER TABLE llx_accountingaccount MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; --- You can check with show full columns from llx_accountingaccount; +-- You can check with "show full columns from llx_accountingaccount"; From 53d1dbf4b98ecf3d014e00b44e331285e1748aab Mon Sep 17 00:00:00 2001 From: Sof Date: Tue, 29 Nov 2016 12:06:58 +0100 Subject: [PATCH 20/41] Fix: Codebar suggestion in edit mode --- htdocs/product/card.php | 55 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c31c8885454..db62d5b01fd 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -820,6 +820,23 @@ $formfile = new FormFile($db); $formproduct = new FormProduct($db); if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); +// Load object modBarCodeProduct +$res=0; +if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) +{ + $module=strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); + $dirbarcode=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']); + foreach ($dirbarcode as $dirroot) + { + $res=dol_include_once($dirroot.$module.'.php'); + if ($res) break; + } + if ($res > 0) + { + $modBarCodeProduct =new $module(); + } +} + if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { @@ -857,22 +874,6 @@ else $modCodeProduct = new $module(); } - // Load object modBarCodeProduct - if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) - { - $module=strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); - $dirbarcode=array_merge(array('/core/modules/barcode/'),$conf->modules_parts['barcode']); - foreach ($dirbarcode as $dirroot) - { - $res=dol_include_once($dirroot.$module.'.php'); - if ($res) break; - } - if ($res > 0) - { - $modBarCodeProduct =new $module(); - } - } - print '
'; print ''; print ''; @@ -1483,10 +1484,13 @@ else if (($action != 'editbarcodetype') && ! empty($user->rights->produit->creer) && $createbarcode) print '
id.'">'.img_edit($langs->trans('Edit'),1).'
'; print '
'; - if ($action == 'editbarcodetype') + if ($action == 'editbarcodetype' || $action == 'editbarcode') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); + } + if ($action == 'editbarcodetype') + { $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'fk_barcode_type'); } else @@ -1506,13 +1510,16 @@ else print ''; if ($action == 'editbarcode') { - print ''; - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; + $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; + if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type); + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ' '; + print '
'; } else { From e05de2942b51de1c6a07d5df40352f4b45e13ba4 Mon Sep 17 00:00:00 2001 From: Sof Date: Tue, 29 Nov 2016 12:19:01 +0100 Subject: [PATCH 21/41] Fix: update informations --- htdocs/product/card.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index db62d5b01fd..122e80b2e69 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1,7 +1,7 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2006 Auguria SARL @@ -11,9 +11,10 @@ * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2014 Cédric Gross * Copyright (C) 2014-2015 Ferran Marcet - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2016 Meziane Sof * * 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 From 9ff38ee1361a4766c9d00f28732f914405fa2834 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 12:28:17 +0100 Subject: [PATCH 22/41] Add missing currency for madagascar --- htdocs/install/mysql/data/llx_c_currencies.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index 5b766d2006d..57899dc7ea5 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -96,6 +96,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LVL' INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LBP', '[163]', 1, 'Lebanon Pound'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LRD', '[36]', 1, 'Liberia Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'LTL', '[76,116]', 1, 'Lithuania Litas'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MGA', NULL, 1, 'Ariary'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MKD', '[1076,1077,1085]', 1, 'Macedonia Denar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MYR', '[82,77]', 1, 'Malaysia Ringgit'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MRO', NULL, 1, 'Mauritania Ouguiya'); From f6734be1a17d3be5875138701fc1c5cb2831cf7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 17:08:44 +0100 Subject: [PATCH 23/41] Fix security hole. Add quick and fast hack to fix it --- htdocs/cron/admin/cron.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index 697b24fcc1e..5b517857c7c 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -88,9 +88,20 @@ print "
'.$langs->trans("KeyForCronAccess").''; -if (! empty($conf->use_javascript_ajax)) - print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +$disabled=''; +if (! empty($conf->global->CRON_DISABLE_KEY_CHANGE)) $disabled=' disabled="disabled"'; +print ''; +if (empty($conf->global->CRON_DISABLE_KEY_CHANGE)) +{ + print ''; + if (! empty($conf->use_javascript_ajax)) + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +} +else +{ + print (! empty($conf->global->CRON_KEY)?$conf->global->CRON_KEY:''); + print ''; +} print ' 
'; if ($picto && $titre) print img_picto('', $picto, 'class="hideonsmartphone valignmiddle" id="pictotitle"', $pictoisfullpath); print '
'.$titre; - if (!empty($titre) && $savtotalnboflines > 0) print ' ('.$totalnboflines.')'; + if (!empty($titre) && $savtotalnboflines >= 0) print ' ('.$totalnboflines.')'; print '
'; print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'sp.ref','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Supplier'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.date_valid','',$param, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'sp.date_valid','',$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'sp.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'sp.total_ht','',$param, 'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'sp.fk_statut','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -389,7 +418,7 @@ if ($result) print ''; print ''; print ''; // Check boxes print '
'; - $formpropal->selectProposalStatus($viewstatut,1,0,1,'supplier'); + $formpropal->selectProposalStatus($search_status,1,0,1,'supplier','search_status'); print ''; From 22e2c3ed292c956ebb9305697dcf2e3d6d2e2669 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 23:02:37 +0100 Subject: [PATCH 26/41] Fix missing pagination on supplier payments --- htdocs/fourn/facture/list.php | 2 +- htdocs/fourn/facture/paiement.php | 90 +++++++++++++++++++++++-------- 2 files changed, 68 insertions(+), 24 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index b424ff4e7a0..7ae18da125f 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -435,7 +435,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); + print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); if ($search_all) { diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 5c370a41924..800df6bd812 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -83,13 +83,19 @@ if ($user->societe_id > 0) $hookmanager->initHooks(array('paymentsupplier')); $extrafields = new ExtraFields($db); +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('paymentsupplier'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + +$arrayfields=array(); + /* * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_ref=""; $search_account=""; @@ -100,6 +106,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $day=''; $year=''; $month=''; + $search_array_options=array(); } $parameters=array('socid'=>$socid); @@ -590,10 +597,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie */ if (empty($action)) { - if ($page == -1) $page = 0 ; $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; + $sortfield = GETPOST("sortfield",'alpha'); + $sortorder = GETPOST("sortorder",'alpha'); + $page=GETPOST("page",'int'); + if ($page == -1) { $page = 0 ; } $offset = $limit * $page ; - + $pageprev = $page - 1; + $pagenext = $page + 1; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='p.datep'; @@ -644,53 +655,86 @@ if (empty($action)) $i = 0; $var=True; - $paramlist=''; - $paramlist.=($search_ref?"&search_ref=".urlencode($search_ref):""); - $paramlist.=($search_company?"&search_company=".urlencode($search_company):""); - $paramlist.=($search_amount?"&search_amount=".urlencode($search_amount):""); - $paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); - if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss); - - print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords, 'title_accountancy.png'); + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($search_ref) $param.=($search_ref?"&search_ref=".urlencode($search_ref):""); + if ($search_company) $param.=($search_company?"&search_company=".urlencode($search_company):""); + if ($search_amount != '') $param.=($search_amount?"&search_amount=".urlencode($search_amount):""); + if ($search_payment_num) $param.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); + if ($optioncss != '') $param.='&optioncss='.$optioncss; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + + $massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); + + print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); print ''; if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $moreforfilter=''; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; + else $moreforfilter = $hookmanager->resPrint; + + if ($moreforfilter) + { + print '
'; + print $moreforfilter; + print '
'; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + print '
'; print ''."\n"; print ''; - print_liste_field_titre($langs->trans('RefPayment'),$_SERVER["PHP_SELF"],'p.rowid','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','',$paramlist,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'c.libelle','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$paramlist,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$paramlist,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'p.amount','',$paramlist,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('RefPayment'),$_SERVER["PHP_SELF"],'p.rowid','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'c.libelle','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Account'),$_SERVER["PHP_SELF"],'ba.label','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'p.amount','',$param,'align="right"',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$param,'',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; // Lines for filters fields print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '\n"; @@ -1135,7 +1136,7 @@ if ($resql) print ''; print ''; } - if (! empty($arrayfields['am']['checked'])) + if (! empty($arrayfields['dynamount_payed']['checked'])) { print ''; @@ -1369,9 +1370,9 @@ if ($resql) $totalarray['totalttc'] += $obj->total_ttc; } - if (! empty($arrayfields['am']['checked'])) + if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''; + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; $totalarray['totalam'] += $paiement; @@ -1379,7 +1380,7 @@ if ($resql) if (! empty($arrayfields['rtp']['checked'])) { - print ''; + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; From 37d0e7a2e8562d86975cc503efe9d7c23e76fb37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 16:17:54 +0100 Subject: [PATCH 33/41] Doxygen --- htdocs/accountancy/class/accountingaccount.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index b63d7ce2fda..9749e38007f 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -60,10 +60,10 @@ class AccountingAccount extends CommonObject /** * Load record in memory * - * @param int $rowid Id - * @param string $account_number Account number - * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system - * @return int <0 if KO, >0 if OK + * @param int $rowid Id + * @param string $account_number Account number + * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system + * @return int <0 if KO, Id of record if OK and found */ function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) { global $conf; From c17d354367937f9b9271cdc4807ab9ac1a6c350a Mon Sep 17 00:00:00 2001 From: arnaud Date: Wed, 30 Nov 2016 16:48:27 +0100 Subject: [PATCH 34/41] Fix propal updateline oldcopy extrafields --- htdocs/comm/propal/class/propal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6c5fdcbbec4..d94932d10c8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -651,6 +651,7 @@ class Propal extends CommonObject //Fetch current line from the database and then clone the object and set it in $oldline property $line = new PropaleLigne($this->db); $line->fetch($rowid); + $line->fetch_optionals(); // Fetch extrafields for oldcopy $staticline = clone $line; From 317df1cf9168849e583b69f40916b1e6832d8afa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 20:24:36 +0100 Subject: [PATCH 35/41] Complete work on use of the new ol_banner_tab. --- htdocs/core/lib/expensereport.lib.php | 12 +++ htdocs/core/lib/functions.lib.php | 2 +- htdocs/expensereport/document.php | 27 +++--- htdocs/expensereport/info.php | 23 ++++- htdocs/expensereport/note.php | 119 ++++++++++++++++++++++++++ 5 files changed, 167 insertions(+), 16 deletions(-) create mode 100644 htdocs/expensereport/note.php diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index bc5641b2593..cc60f9feb13 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -56,6 +56,18 @@ function expensereport_prepare_head($object) $head[$h][2] = 'documents'; $h++; + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $nbNote = 0; + if(!empty($object->note_private)) $nbNote++; + if(!empty($object->note_public)) $nbNote++; + $head[$h][0] = DOL_URL_ROOT.'/expensereport/note.php?id='.$object->id; + $head[$h][1] = $langs->trans('Notes'); + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + $head[$h][2] = 'note'; + $h++; + } + $head[$h][0] = DOL_URL_ROOT . '/expensereport/info.php?id=' . $object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1e0e4239763..01c23ce70f6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2585,7 +2585,7 @@ function img_warning($titlealt = 'default', $morealt = '') if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); - return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): '')); + return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): '')); } /** diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 9ff90982c3e..0ada24ed89e 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -93,7 +93,15 @@ if ($object->id) dol_fiche_head($head, 'documents', $langs->trans("ExpenseReport"), 0, 'trip'); - + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -102,25 +110,22 @@ if ($object->id) $totalsize+=$file['size']; } - + print '
'; + print '
'; + print '
'; - print ''; + print ''; print ' '; - print ''; + print ''; print ''; $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); print ''; - print ''; + print ''; print ''; $form->select_comptes($search_account,'search_account',0,'',1); print ''; - print ''; + print ''; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); From 874bb488dab225e2bf70a755a84aec1b1b5a002d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 23:42:56 +0100 Subject: [PATCH 27/41] Fix bad comment --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b55d2ee9c21..05a4a8d398e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -549,7 +549,7 @@ class FormFile $buttonlabeltoshow=$buttonlabel; if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); - if ($conf->browser->layout == 'phone') $urlsource.='#'.$forname.'_form'; # So we switch to form after a generation + if ($conf->browser->layout == 'phone') $urlsource.='#'.$forname.'_form'; // So we switch to form after a generation if (empty($noform)) $out.= ''; $out.= ''; $out.= ''; From d86c3931e2872949e0aadf044ca6129e9b6a3d6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 09:09:09 +0100 Subject: [PATCH 28/41] Fix translation --- htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/langs/en_US/main.lang | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index bb53a0dd1da..84f61145de7 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -20,7 +20,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Home - Dashboard -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', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'Dashboard', 0, '', '', '', 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 ('', '1', __HANDLER__, 'left', 90__+MAX_llx_menu__, 'home', '', 1__+MAX_llx_menu__, '/index.php', 'MyDashboard', 0, '', '', '', 2, 0, __ENTITY__); -- Home - Setup 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', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 629db07eb77..ec39ba35302 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -508,7 +508,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("users"); // Home - dashboard - $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("Dashboard"), 0, 1, '', $mainmenu, 'home'); + $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home'); // Setup $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup'); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a668f9377d3..c2872ecc8f1 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -697,6 +697,7 @@ Test=Test Element=Element NoPhotoYet=No pictures available yet Dashboard=Dashboard +MyDashboard=My dashboard Deductible=Deductible from=from toward=toward From c23919c51a110dfff2acab42bc69b40c6cdddd9f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 30 Nov 2016 09:41:33 +0100 Subject: [PATCH 29/41] change left menu name of categorie It is impossible to add sub-menus to other categories left menus if not... --- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 629db07eb77..d6e84403c15 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -681,15 +681,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $menutoshow=$langs->trans("CustomersCategoriesShort"); if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $menutoshow=$langs->trans("ProspectsCategoriesShort"); $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories Contact - $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); $newmenu->add("/categories/card.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); // Categories suppliers if (! empty($conf->fournisseur->enabled)) { - $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); + $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); $newmenu->add("/categories/card.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); From 81e60f36e7dbabe2ac46f0054f7d28853e04d9d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 14:17:03 +0100 Subject: [PATCH 30/41] Fix: message should not have color of warning --- htdocs/theme/eldy/style.css.php | 6 +++--- htdocs/theme/md/style.css.php | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 6685b0cc745..16a6151858b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3041,14 +3041,14 @@ div.error { /* Info admin */ div.info { - color: #302010; + color: #303020; padding: 0.4em 0.4em 0.4em 0.4em; margin: 0.5em 0em 0.5em 0em; - border: 1px solid #DFBF9A; + border: 1px solid #AAAAAA; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - background: #EFCFAA; + background: #D0DAD4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 43e5398b13e..968fedfb51f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2944,14 +2944,14 @@ div.error { /* Info admin */ div.info { - color: #302010; + color: #303020; padding: 0.4em 0.4em 0.4em 0.4em; margin: 0.5em 0em 0.5em 0em; - border: 1px solid #DFBF9A; - -moz-border-radius:3px; - -webkit-border-radius: 3px; - border-radius:3px; - background: #EFCFAA; + border: 1px solid #AAAAAA; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + background: #D0DAD4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } From b518e60ff5cb9f69d888dd475a808137f035a72f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 15:04:45 +0100 Subject: [PATCH 31/41] Fix: message should not have color of warning --- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 16a6151858b..b00dbc174e6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3048,7 +3048,7 @@ div.info { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - background: #D0DAD4; + background: #E0EAE4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 968fedfb51f..e192501354d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2951,7 +2951,7 @@ div.info { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - background: #D0DAD4; + background: #E0EAE4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } From e846d746549b3244c6ecf17c3313b56615f61d38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 15:19:16 +0100 Subject: [PATCH 32/41] Fix sort on invlice list --- htdocs/compta/facture/list.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 79342baf293..d9e5ae8ce23 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -130,7 +130,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search $fieldstosearchall = array( 'f.facnumber'=>'Ref', 'f.ref_client'=>'RefCustomer', - 'fd.description'=>'Description', + 'pd.description'=>'Description', 's.nom'=>"ThirdParty", 'f.note_public'=>'NotePublic', ); @@ -152,7 +152,7 @@ $arrayfields=array( 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), - 'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0), + 'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0), 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -648,7 +648,9 @@ $sql.= ' f.datec as date_creation, f.tms as date_update,'; $sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name"; -if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status +// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) +// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. +if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed'; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks @@ -662,7 +664,6 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s $sql.= ', '.MAIN_DB_PREFIX.'facture as f'; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields as ef on (f.rowid = ef.fk_object)"; if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; -else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; // We'll need this table joined to the select in order to filter by sale @@ -1018,8 +1019,8 @@ if ($resql) if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'rtp','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -1038,7 +1039,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,type,dynamount_payed","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "
'; print ''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').''.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').'
'; $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - - // Societe - //print ""; - - print ''; + print ''; print ''; print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
".$langs->trans("Company")."".$object->client->getNomUrl(1)."
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; print '
'; + dol_fiche_end(); + + $modulepart = 'expensereport'; $permission = $user->rights->expensereport->creer; $permtoedit = $user->rights->expensereport->creer; diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index b3ebbc153ef..476a547c8f0 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -43,21 +43,36 @@ $title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Info"); $helpurl="EN:Module_Expense_Reports"; llxHeader("",$title,$helpurl); -if ($id) +if ($id > 0 || ! empty($ref)) { $object = new ExpenseReport($db); - $object->fetch($id); - $object->info($id); + $object->fetch($id,$ref); + $object->info($object->id); $head = expensereport_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("ExpenseReport"), 0, 'trip'); - print ''; $sql = "SELECT sum(p.amount) as total"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p"; - $sql.= " WHERE p.fk_expensereport = ".$chid; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e"; + $sql.= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$chid; + $sql.= ' AND e.entity IN ('.getEntity('expensereport', 1).')'; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/expensereport/synchro_compta.php b/htdocs/expensereport/synchro_compta.php index 31c2d985840..eba616d2620 100644 --- a/htdocs/expensereport/synchro_compta.php +++ b/htdocs/expensereport/synchro_compta.php @@ -139,6 +139,7 @@ else: $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; $sql.= " WHERE d.fk_statut = 6"; + $sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; $sql.= " ORDER BY d.date_valid DESC"; $resql=$db->query($sql); From 7a3b3090139e9300504d4f3ad4cd43911523a361 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:22:26 +0100 Subject: [PATCH 40/41] Fix width --- htdocs/compta/paiement/cheque/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index ebfd598ee0b..9ea4d6eb1e0 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -160,7 +160,7 @@ if ($resql) print ''; print ''; print ''; print ''; print '"; // Num ref cheque - print ''; } @@ -847,20 +853,33 @@ foreach ($listofreferent as $key => $value) // Amount inc tax if (empty($value['disableamount'])) { + $total_ttc_by_line=null; if ($tablename == 'don') $total_ttc_by_line=$element->amount; elseif ($tablename == 'projet_task') { - $defaultvat = get_default_tva($mysoc, $mysoc); - $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + if (! empty($conf->salaries->enabled)) + { + // TODO Permission to read daily rate + $defaultvat = get_default_tva($mysoc, $mysoc); + $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + } + else + { + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); + } } else { $total_ttc_by_line=$element->total_ttc; } print ''; } @@ -923,15 +942,25 @@ foreach ($listofreferent as $key => $value) if ($breakline) print $breakline; + // Total print ''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; - else print ''; + print ''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; - else print ''; + print ''; print ''; print ''; }
'; + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + + print '
'; + + print '
'; dol_print_object_info($object); print '
'; print '
'; + + dol_fiche_end(); } llxFooter(); diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php new file mode 100644 index 00000000000..71ba4eb32dd --- /dev/null +++ b/htdocs/expensereport/note.php @@ -0,0 +1,119 @@ + + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 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 + * 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 . + */ + +/** + * \file htdocs/commande/note.php + * \ingroup commande + * \brief Fiche de notes sur une commande + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + +$langs->load("trips"); +$langs->load("companies"); +$langs->load("bills"); +$langs->load("orders"); + +$id = GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); +$socid=GETPOST('socid','int'); +$action=GETPOST('action','alpha'); + +// Security check +$socid=0; +if ($user->societe_id) $socid=$user->societe_id; +$result=restrictedArea($user,'expensereport',$id,''); + + +$object = new ExpenseReport($db); +if (! $object->fetch($id, $ref) > 0) +{ + dol_print_error($db); +} + +$permissionnote=$user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once + + +/* + * View + */ +$title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Note"); +$helpurl="EN:Module_Expense_Reports"; +llxHeader("",$title,$helpurl); + +$form = new Form($db); + +if ($id > 0 || ! empty($ref)) +{ + $object = new ExpenseReport($db); + $object->fetch($id, $ref); + $object->info($object->id); + + $head = expensereport_prepare_head($object); + + dol_fiche_head($head, 'note', $langs->trans("ExpenseReport"), 0, 'trip'); + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + /* + print ''; + + // Ref + print '"; + + print "
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); + print "
"; + + print '
'; + */ + + print '
'; + print '
'; + + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + dol_fiche_end(); + +} + + +llxFooter(); +$db->close(); From 495ba00cb63b73b496ed3c7f5751102c14303afd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 14:21:46 +0100 Subject: [PATCH 36/41] Fix: Slurp, database corruption due to missing unique key on main key. --- .../install/mysql/migration/4.0.0-5.0.0.sql | 11 ++++++ .../mysql/tables/llx_expensereport.key.sql | 36 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_expensereport.key.sql diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 4d653644f39..9b65050b663 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -219,6 +219,15 @@ create table llx_user_employment )ENGINE=innodb; +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_debut (date_debut); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_fin (date_fin); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_statut (fk_statut); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_author (fk_user_author); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user_valid); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); + -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. drop table tmp_links_double; @@ -230,5 +239,7 @@ drop table tmp_links_double; ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); +ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, entity); + UPDATE llx_projet_task SET ref = NULL WHERE ref = ''; ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); diff --git a/htdocs/install/mysql/tables/llx_expensereport.key.sql b/htdocs/install/mysql/tables/llx_expensereport.key.sql new file mode 100644 index 00000000000..a7e4fd54425 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_expensereport.key.sql @@ -0,0 +1,36 @@ +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- Copyright (C) 2008-2010 Regis Houssin +-- +-- 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 . +-- +-- =================================================================== + + +ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, entity); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_debut (date_debut); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_fin (date_fin); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_statut (fk_statut); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_author (fk_user_author); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user_valid); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); + +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_approve FOREIGN KEY (fk_user_approve) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_refuse FOREIGN KEY (fk_user_refuse) REFERENCES llx_user (rowid); + From 411e82b7a3b528072438143e88cd4c309fa95f38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 14:52:38 +0100 Subject: [PATCH 37/41] Fix button set to paid not always visible when it should. --- htdocs/expensereport/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index d3b25d2277f..9112f8ee99b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1999,7 +1999,8 @@ if ($action != 'create' && $action != 'edit') // If bank module is not used if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5) { - if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) + //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) + if ($object->paid == 0) { print '"; } From 33139dd57abc8b8ab02ffc4f0c0c254d826051b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 17:46:59 +0100 Subject: [PATCH 38/41] Fix missing translation of page "disabled" and "offline". --- htdocs/cache.manifest | 4 ++-- htdocs/disabled.php | 29 ----------------------- htdocs/public/notice.php | 50 +++++++++++++++++++++++++++++++++++++++ htdocs/public/offline.php | 37 ----------------------------- 4 files changed, 52 insertions(+), 68 deletions(-) delete mode 100644 htdocs/disabled.php create mode 100644 htdocs/public/notice.php delete mode 100644 htdocs/public/offline.php diff --git a/htdocs/cache.manifest b/htdocs/cache.manifest index 9119290941b..a3d1b1c554f 100644 --- a/htdocs/cache.manifest +++ b/htdocs/cache.manifest @@ -33,5 +33,5 @@ NETWORK: # If the browser is unable to retrieve the original content, the fallback resource will be used. # In the example above, we display a static image in case the dynamic one is unavailable. FALLBACK: -#/ public/offline.php -#theme/amarok/img/* theme/eldy/img/ +#/ public/notice.php +#theme/eldy/img/* theme/md/img/* diff --git a/htdocs/disabled.php b/htdocs/disabled.php deleted file mode 100644 index 43c650466a6..00000000000 --- a/htdocs/disabled.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * 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 htdocs/disabled.php - * \brief Page to use to replace index.php to disable all software - */ -?> - - -This feature has been disabled on this test server.
-Cette fonctionnalité a été désactivée sur ce serveur de test.
- - diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php new file mode 100644 index 00000000000..623baa2020a --- /dev/null +++ b/htdocs/public/notice.php @@ -0,0 +1,50 @@ + + * + * 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 . + */ + +/** + * \file htdocs/public/notice.php + * \brief Dolibarr page to show a notice. + * Default notice is a message to say network connection is off. + * You can also call this page with URL: + * /public/notice.php?lang=xx_XX&transkey=translation_key (key must be inside file main.lang, error.lang or other.lang) + * /public/notice.php?transphrase=url_encoded_sentence_to_show + */ + +define('NOCSRFCHECK',1); +define('NOLOGIN',1); + +require '../main.inc.php'; + + +/** + * View + */ + +if (! GETPOST('transkey') && ! GETPOST('transphrase')) +{ + print 'Sorry, it seems your internet connexion is off.
'; + print 'You need to be connected to network to use this software.
'; +} +else +{ + $langs->load("error"); + $langs->load("other"); + + if (GETPOST('transphrase')) print GETPOST('transphrase'); + if (GETPOST('transkey')) print $langs->trans(GETPOST('transkey')); +} + diff --git a/htdocs/public/offline.php b/htdocs/public/offline.php deleted file mode 100644 index 043da4ac9c7..00000000000 --- a/htdocs/public/offline.php +++ /dev/null @@ -1,37 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent - * - * 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 . - */ - -/** - * \file htdocs/public/offline.php - * \brief Dolibarr offline page - */ - -define('NOCSRFCHECK',1); -define('NOLOGIN',1); - -require '../main.inc.php'; - -/** - * View - */ - -print 'Sorry, it seems your internet connexion is off.
'; -print 'You need to be connected to network to use this software.
'; - From a75577516d1bf37c69418258b2dc5e9beec821ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:13:04 +0100 Subject: [PATCH 39/41] Fix pb with multicompany on expense report --- htdocs/expensereport/export_csv.php | 1 + htdocs/expensereport/index.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/expensereport/payment/card.php | 2 +- htdocs/expensereport/payment/payment.php | 5 +++-- htdocs/expensereport/synchro_compta.php | 1 + 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php index 3cf520c6739..d55e262e2e4 100644 --- a/htdocs/expensereport/export_csv.php +++ b/htdocs/expensereport/export_csv.php @@ -128,6 +128,7 @@ if (isset($_POST['action'])) $sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; + $sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; $sql.= " ORDER BY d.rowid"; $result = $db->query($sql); diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 117ecc5e3c4..83e45d2a1b7 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -147,7 +147,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u" if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user_author"; if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND d.fk_user_author IN ('.join(',',$childids).')'; -//$sql.= " AND d.entity = ".$conf->entity; +$sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND d.fk_user_author = ".$socid; $sql.= $db->order($sortfield,$sortorder); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index b857b9c92d4..476ef2224f5 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -133,7 +133,7 @@ $sql.= " d.date_debut, d.date_fin, d.date_valid,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; -$sql.= " WHERE d.entity = ".$conf->entity; +$sql.= ' WHERE d.entity IN ('.getEntity('expensereport', 1).')'; // Search all if (!empty($sall)) { diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 19d5b3206f7..f9ba5af3dc0 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -199,7 +199,7 @@ $disable_delete = 0; $sql = 'SELECT er.rowid as did, er.paid, er.total_ttc, per.amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport as per,'.MAIN_DB_PREFIX.'expensereport as er'; $sql.= ' WHERE per.fk_expensereport = er.rowid'; -$sql.= ' AND er.entity = '.$conf->entity; +$sql.= ' AND er.entity IN ('.getEntity('expensereport', 1).')'; $sql.= ' AND per.rowid = '.$id; dol_syslog("expensereport/payment/card.php", LOG_DEBUG); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index c4351e4d038..e361a9954c0 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -193,8 +193,9 @@ if (GETPOST("action") == 'create') print '
'.$langs->trans("Amount").''.price($expensereport->total_ttc,0,$outputlangs,1,-1,-1,$conf->currency).'
 '; - print ''; + print ''; print ''; @@ -179,7 +179,7 @@ if ($resql) print "
'; + print ''; $checkdepositstatic->id=$objp->rowid; $checkdepositstatic->ref=($objp->ref?$objp->ref:$objp->rowid); $checkdepositstatic->statut=$objp->statut; From 69b5baebc53450ce9a3fb6c12c3a5da60903266d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:54:06 +0100 Subject: [PATCH 41/41] FIX rendering of output of estimated amount on project overview page. --- htdocs/projet/element.php | 55 ++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index cbd22856e4c..1d9ffd61a99 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -812,6 +812,8 @@ foreach ($listofreferent as $key => $value) $warning=''; if (empty($value['disableamount'])) { + $total_ht_by_line=null; + $othermessage=''; if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') { @@ -828,7 +830,7 @@ foreach ($listofreferent as $key => $value) } else { - print $langs->trans("ModuleDisabled"); + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); } } else @@ -836,9 +838,13 @@ foreach ($listofreferent as $key => $value) $total_ht_by_line=$element->total_ht; } print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ht_by_line)?price($total_ht_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ht_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ht_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ttc_by_line)?price($total_ttc_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ttc_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ttc_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print '
'.$langs->trans("Number").': '.$i.''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("Total").' : '.price($total_ht).''.$langs->trans("TotalHT").' : '.price($total_ht).''; + if (empty($value['disableamount'])) + { + if (! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); + } + print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; + if (empty($value['disableamount'])) + { + + if (! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); + } + print '