From b2a9b48a78478dedaddb70293bf265db839355bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Oct 2014 10:40:48 +0200 Subject: [PATCH 01/33] Update ajax.lib.php Add a delay before making request, may avoid multiple request to server when typing search request --- htdocs/core/lib/ajax.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4bc6da083aa..d6cc1a287d7 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -173,6 +173,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt } $("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified } + ,delay: 1000 }).data( "autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .data( "item.autocomplete", item ) From f18e513046cb3c6b00829d8318921cdbd7e0dc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Oct 2014 18:44:56 +0100 Subject: [PATCH 02/33] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8848adea948..7c7c280bef3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1832,11 +1832,12 @@ class Form * @param string $filterkey Filtre des produits * @param int $statut -1=Return all products, 0=Products not on sell, 1=Products on sell * @param int $outputmode 0=HTML select string, 1=Array + * @param int $limit Limit of line number * @return array Array of keys for json */ - function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0) + function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100) { - global $langs,$conf; + global $langs,$conf,$db; $out=''; $outarray=array(); @@ -1874,6 +1875,7 @@ class Form $sql.=')'; } $sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC"; + $sql.= $db->plimit($limit); // Build output string From 08e958152cbdbd66dc0805c55e179098aae7dc5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Oct 2014 18:45:47 +0100 Subject: [PATCH 03/33] Update ajax.lib.php --- htdocs/core/lib/ajax.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index d6cc1a287d7..93f23557c24 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -173,7 +173,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt } $("#search_'.$htmlname.'").trigger("change"); // To tell that input text field was modified } - ,delay: 1000 + ,delay: 500 }).data( "autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .data( "item.autocomplete", item ) From abfa1a5fde9f4c73692343413a3ac54c35901200 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 1 Nov 2014 14:28:28 +0100 Subject: [PATCH 04/33] cheque list --- htdocs/compta/paiement/cheque/list.php | 32 ++++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 1699656acb1..08284e2796e 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -38,6 +38,9 @@ $langs->load("bills"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'banque', '',''); +$search_ref = GETPOST('search_ref','int'); +$search_account = GETPOST('search_account','int'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -57,6 +60,16 @@ $formother = new FormOther($db); $checkdepositstatic=new RemiseCheque($db); $accountstatic=new Account($db); +// If click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_ref=''; + $search_amount=''; + $search_account=''; + $year=''; + $month=''; +} + /* * View */ @@ -72,9 +85,9 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid"; $sql.= " AND bc.entity = ".$conf->entity; // Search criteria -if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int'); -if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int'); -if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount")); +if ($search_ref) $sql.=" AND bc.number=".$search_ref; +if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account; +if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($month > 0) { if ($year > 0 && empty($day)) @@ -117,7 +130,7 @@ if ($resql) // Lignes des champs de filtre print ''; print ''; - print ''; + print ''; print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -125,16 +138,15 @@ if ($resql) $formother->select_year($year?$year:-1,'year',1, 20, 5); print ''; print ''; - $form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); + $form->select_comptes($search_account,'search_account',0,'',1); print ''; print ' '; print ''; - print ''; + print ''; print ''; - print ''; - print ''; - print ''; - print "\n"; + print ''; + print ''; + print "\n"; $var=true; while ($i < min($num,$limit)) From 9e07c3a7b690c263e2c3d0c92c9d8e7427fed7de Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 1 Nov 2014 14:51:52 +0100 Subject: [PATCH 05/33] Typo --- htdocs/compta/paiement/cheque/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 08284e2796e..63923d6a3ce 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -116,7 +116,7 @@ if ($resql) print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num); - print '
    '; + print ''; print ''; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder); From a0d3dbd93ca0fdf7a2e0a496acf61d7065ad23a0 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 1 Nov 2014 14:52:05 +0100 Subject: [PATCH 06/33] Social Contrib list --- htdocs/compta/sociales/index.php | 43 ++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 022aaf14ff0..b280fbdc2c2 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -36,6 +36,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$search_ref = GETPOST('search_ref','int'); +$search_label = GETPOST('search_label','alpha'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -65,6 +68,16 @@ else $typeid=$_REQUEST['typeid']; } +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_label=""; + $search_amount=""; + $typeid=""; + $year=""; + $month=""; + $filtre=""; +} /* * View @@ -85,7 +98,11 @@ $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql.= " WHERE cs.fk_type = c.id"; $sql.= " AND cs.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".$db->escape(GETPOST("search_label"))."%'"; + +// Search criteria +if ($search_ref) $sql.=" AND cs.rowid=".$search_ref; +if ($search_label) $sql.=" AND cs.libelle LIKE '%".$db->escape($search_label)."%'"; +if ($search_amount) $sql.=" AND cs.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($year > 0) { $sql .= " AND ("; @@ -139,10 +156,8 @@ if ($resql) { print ''; - - print "
    "; - - print ""; + print '
    '; + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); @@ -153,20 +168,26 @@ if ($resql) print "\n"; print ''; - print ''; - print ''; + // Ref + print ''; + // Label + print ''; // Type print ''; // Period end date print ''; - print ''; - print ''; + // Amount print ''; - print "\n"; + print ''; + print '\n"; while ($i < min($num,$limit)) { From 5122b32cccbc3ff9cdbb7de94e9659e408043420 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 1 Nov 2014 14:59:39 +0100 Subject: [PATCH 07/33] Salaries list --- htdocs/compta/salaries/index.php | 36 ++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index b2fc3e1b4a3..8382029aa56 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -33,6 +33,9 @@ $socid = GETPOST("socid","int"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'salaries', '', '', ''); +$search_ref = GETPOST('search_ref','int'); +$search_label = GETPOST('search_label','alpha'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -61,6 +64,14 @@ else $typeid=$_REQUEST['typeid']; } +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_label=""; + $search_amount=""; + $typeid=""; +} + /* * View */ @@ -78,8 +89,11 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst $sql.= " ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.rowid = s.fk_user"; $sql.= " AND s.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND s.label LIKE '%".$db->escape(GETPOST("search_label"))."%'"; -if (GETPOST("search_amount")) $sql.=" AND s.amount = ".price2num(GETPOST("search_amount")); + +// Search criteria +if ($search_ref) $sql.=" AND s.rowid=".$search_ref; +if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'"; +if ($search_amount) $sql.=" AND s.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($filtre) { $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; @@ -118,19 +132,23 @@ if ($result) print "\n"; print ''; + // Ref + print ''; print ''; - print ''; - print ''; + // Label + print ''; print ''; // Type print ''; - print ''; - print ''; - print "\n"; + // Amount + print ''; + print '\n"; while ($i < min($num,$limit)) { From 26c63f3ea48a4d75d54c9479c226416436d7e792 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 1 Nov 2014 15:06:46 +0100 Subject: [PATCH 08/33] donation list --- htdocs/compta/dons/list.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/dons/list.php b/htdocs/compta/dons/list.php index badc71c96e2..174b5357bb2 100644 --- a/htdocs/compta/dons/list.php +++ b/htdocs/compta/dons/list.php @@ -43,12 +43,20 @@ if (! $sortfield) $sortfield="d.datedon"; $limit = $conf->liste_limit; $statut=isset($_GET["statut"])?$_GET["statut"]:"-1"; -$search_ref=GETPOST('search_ref'); -$search_company=GETPOST('search_company'); -$search_name=GETPOST('search_name'); +$search_ref=GETPOST('search_ref','alpha'); +$search_company=GETPOST('search_company','alpha'); +$search_name=GETPOST('search_name','alpha'); +$search_amount = GETPOST('search_amount','alpha'); if (!$user->rights->don->lire) accessforbidden(); +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_company=""; + $search_name=""; + $search_amount=""; +} /* * View @@ -82,6 +90,8 @@ if (trim($search_name) != '') { $sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name); } +if ($search_amount) $sql.=" AND d.amount='".$db->escape(price2num(trim($search_amount)))."'"; + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -141,11 +151,10 @@ if ($resql) print ' '; print ''; } - print ''; + print ''; print '\n"; + print ''; + print "\n"; $var=True; while ($i < min($num,$limit)) From 5586893ca2ed4b6ad357f55edd1874fc7ec327b2 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Sat, 1 Nov 2014 21:00:28 +0100 Subject: [PATCH 09/33] Update odf.php add new fonction getvalue (valuename) return value inside [valuename][/valuename] tag --- htdocs/includes/odtphp/odf.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 225466ca453..d4b79af8013 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -610,6 +610,21 @@ IMG; closedir($handle); } } + + /** + * return the value present on odt in [valuename][/valuename] + * @param string $value name balise in the template + * @return string the value inside the balise + * + */ + public function getvalue($valuename) + { + $searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/"; + preg_match($searchreg, $this->contentXml, $matches); + $this->contentXml = preg_replace($searchreg, "", $this->contentXml); + return $matches[1]; + } + } ?> From 98299f88e8c26ae4841d0658157b5120c8a7e104 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 08:12:34 +0100 Subject: [PATCH 10/33] Suppliers list --- htdocs/fourn/facture/list.php | 89 ++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 9439fc534bd..7ce928caa06 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -64,8 +64,14 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="fac.datef,fac.rowid"; -$month = GETPOST('month','int'); -$year = GETPOST('year','int'); +$search_ref = GETPOST("search_ref","int"); +$search_ref_supplier = GETPOST("search_ref_supplier","alpha"); +$search_label = GETPOST("search_label","alpha"); +$search_company = GETPOST("search_company","alpha"); +$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha"); +$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha"); +$month = GETPOST("month","int"); +$year = GETPOST("year","int"); /* @@ -93,8 +99,17 @@ if ($mode == 'search') } } - - +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_ref_supplier=""; + $search_label=""; + $search_company=""; + $search_amount_no_tax=""; + $search_amount_all_tax=""; + $year=""; + $month=""; +} /* * View @@ -132,14 +147,14 @@ if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a } } -if (GETPOST("search_ref")) +if ($search_ref) { - if (is_numeric(GETPOST("search_ref"))) $sql .= natural_search(array('fac.rowid', 'fac.ref'), GETPOST('search_ref'));// For backward compatibility - else $sql .= natural_search('fac.ref', GETPOST("search_ref")); + if (is_numeric($search_ref)) $sql .= natural_search(array('fac.rowid', 'fac.ref'), $search_ref);// For backward compatibility + else $sql .= natural_search('fac.ref', $search_ref); } -if (GETPOST("search_ref_supplier")) +if (search_ref_supplier) { - $sql .= natural_search('fac.ref_supplier', GETPOST('search_ref_supplier')); + $sql .= natural_search('fac.ref_supplier', $search_ref_supplier); } if ($month > 0) { @@ -152,24 +167,24 @@ else if ($year > 0) { $sql.= " AND fac.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } -if (GETPOST("search_libelle")) +if ($search_label) { - $sql .= natural_search('fac.libelle', GETPOST('search_libelle')); + $sql .= natural_search('fac.libelle', $search_label); } -if (GETPOST("search_societe")) +if ($search_company) { - $sql .= natural_search('s.nom', GETPOST('search_societe')); + $sql .= natural_search('s.nom', $search_company); } -if (GETPOST("search_montant_ht")) +if ($search_amount_no_tax) { - $sql .= " AND fac.total_ht = '".$db->escape(price2num(GETPOST("search_montant_ht")))."'"; + $sql .= " AND fac.total_ht = '".$db->escape(price2num($search_amount_no_tax))."'"; } -if (GETPOST("search_montant_ttc")) +if ($search_amount_all_tax) { - $sql .= " AND fac.total_ttc = '".$db->escape(price2num(GETPOST("search_montant_ttc")))."'"; + $sql .= " AND fac.total_ttc = '".$db->escape(price2num($search_amount_all_tax))."'"; } $nbtotalofrecords = 0; @@ -195,14 +210,14 @@ if ($resql) } $param='&socid='.$socid; - if ($month) $param.='&month='.urlencode($month); - if ($year) $param.='&year=' .urlencode($year); - if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref")); - if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier")); - if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle")); - if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe")); - if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht")); - if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc")); + if ($month) $param.='&month='.urlencode($month); + if ($year) $param.='&year=' .urlencode($year); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_ref_supplier) $param.='&search_ref_supplier'.urlencode($search_ref_supplier); + if ($search_label) $param.='&search_label='.urlencode($search_label); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax); + if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre")); print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); @@ -218,17 +233,18 @@ if ($resql) if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"fac.total_ht","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"fac.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","",$param,'align="right"',$sortfield,$sortorder); + print ''; print "\n"; // Lignes des champs de filtre print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) { @@ -250,13 +266,15 @@ if ($resql) print ''; } print ''; print "\n"; @@ -312,6 +330,8 @@ if ($resql) //print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$objp->am); print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5); print ''; + + print ''; print "\n"; $i++; @@ -325,6 +345,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print "\n"; } } From e48350fdc187e2c406905bb2159371e78f9afd84 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 08:33:39 +0100 Subject: [PATCH 11/33] Unpayed suppliers invoices list --- htdocs/fourn/facture/impayees.php | 78 +++++++++++++++---------------- htdocs/fourn/facture/list.php | 23 +++++---- 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index a80cb00f2d3..3253a79fcd8 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -47,6 +47,31 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); + +$search_ref = GETPOST('search_ref','alpha'); +$search_ref_supplier = GETPOST('search_ref_supplier','alpha'); +$search_company = GETPOST('search_company','alpha'); +$search_amount_no_tax = GETPOST('search_amount_no_tax','alpha'); +$search_amount_all_tax = GETPOST('search_amount_all_tax','alpha'); + +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="f.date_lim_reglement"; +if (! $sortorder) $sortorder="ASC"; + +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_ref_supplier=""; + $search_company=""; + $search_amount_no_tax=""; + $search_amount_all_tax=""; +} /* * View @@ -61,31 +86,6 @@ $title=$langs->trans("BillsSuppliersUnpaid"); $facturestatic=new FactureFournisseur($db); $companystatic=new Societe($db); - -/*************************************************************************** -* * -* Mode Liste * -* * -***************************************************************************/ - -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); - -$search_ref = GETPOST('search_ref','alpha'); -$search_ref_supplier = GETPOST('search_ref_supplier','alpha'); -$search_societe = GETPOST('search_societe','alpha'); -$search_montant_ht = GETPOST('search_montant_ht','int'); -$search_montant_ttc = GETPOST('search_montant_ttc','int'); - - -$page = GETPOST("page",'int'); -if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if (! $sortfield) $sortfield="f.date_lim_reglement"; -if (! $sortorder) $sortorder="ASC"; - if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.rowid as socid, s.nom as name,"; @@ -124,19 +124,19 @@ if ($user->rights->fournisseur->facture->lire) $sql .= " AND f.ref_supplier LIKE '%".$search_ref_supplier."%'"; } - if ($search_societe) + if ($search_company) { - $sql .= " AND s.nom LIKE '%".$search_societe."%'"; + $sql .= " AND s.nom LIKE '%".$search_company."%'"; } - if ($search_montant_ht) + if ($search_amount_no_tax) { - $sql .= " AND f.total_ht = '".$search_montant_ht."'"; + $sql .= " AND f.total_ht = '".$search_amount_no_tax."'"; } - if ($search_montant_ttc) + if ($search_amount_all_tax) { - $sql .= " AND f.total_ttc = '".$search_montant_ttc."'"; + $sql .= " AND f.total_ttc = '".$search_amount_all_tax."'"; } if (dol_strlen(GETPOST('sf_re')) > 0) @@ -165,9 +165,9 @@ if ($user->rights->fournisseur->facture->lire) if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_ref_supplier) $param.='&search_ref_supplier='.urlencode($search_ref_supplier); - if ($search_societe) $param.='&search_societe='.urlencode($search_societe); - if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht); - if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_amount_no_tax) $param.='&search_amount_no_tax='.urlencode($search_amount_no_tax); + if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); $param.=($option?"&option=".$option:""); if (! empty($late)) $param.='&late='.urlencode($late); @@ -209,15 +209,15 @@ if ($user->rights->fournisseur->facture->lire) print ''; print ''; print ''; - print "\n"; + print ''; + print "\n"; if ($num > 0) { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 7ce928caa06..616e9690e8a 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -73,6 +73,17 @@ $search_amount_all_tax = GETPOST("search_amount_all_tax","alpha"); $month = GETPOST("month","int"); $year = GETPOST("year","int"); +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_ref_supplier=""; + $search_label=""; + $search_company=""; + $search_amount_no_tax=""; + $search_amount_all_tax=""; + $year=""; + $month=""; +} /* * Actions @@ -99,18 +110,6 @@ if ($mode == 'search') } } -if (GETPOST("button_removefilter")) -{ - $search_ref=""; - $search_ref_supplier=""; - $search_label=""; - $search_company=""; - $search_amount_no_tax=""; - $search_amount_all_tax=""; - $year=""; - $month=""; -} - /* * View */ From 64b9299eb6a96accf742d8bc4726557a8db73bba Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 08:45:42 +0100 Subject: [PATCH 12/33] Suppliers invoice payment list --- htdocs/fourn/facture/paiement.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 831749b1904..33691cb7942 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -458,6 +458,15 @@ if (empty($action)) $search_paymenttype=GETPOST('search_paymenttype'); $search_amount=GETPOST('search_amount'); $search_company=GETPOST('search_company'); + + if (GETPOST("button_removefilter")) + { + $search_ref=""; + $search_account=""; + $search_paymenttype=""; + $search_amount=""; + $search_company=""; + } $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,'; $sql.= ' s.rowid as socid, s.nom as name,'; @@ -548,8 +557,9 @@ if (empty($action)) print ''; print ''; + print ''; + print ''; + print ''; print "\n"; while ($i < min($num,$limit)) From 6109529c6c6c88e6e84f98d3a4a54ecf33ee6158 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 14:19:28 +0100 Subject: [PATCH 13/33] vat payments list & typo on css class --- htdocs/compta/paiement/cheque/list.php | 4 +-- htdocs/compta/salaries/index.php | 2 +- htdocs/compta/sociales/index.php | 4 +-- htdocs/compta/tva/reglement.php | 41 ++++++++++++++++---------- htdocs/fourn/facture/paiement.php | 6 ++-- 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 63923d6a3ce..47a6ee8ba74 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -130,7 +130,7 @@ if ($resql) // Lignes des champs de filtre print ''; print ''; print ''; print ''; print ''; print ''; // Ref print ''; print ''; // Label diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index b280fbdc2c2..00ef402fa36 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -170,7 +170,7 @@ if ($resql) print ''; // Ref print ''; // Label print ''; @@ -182,7 +182,7 @@ if ($resql) print ''; // Amount print ''; print ''; print '"; print '"; - print ''; + print ''; print ''; $var=!$var; @@ -360,6 +360,9 @@ $var=!$var; print ' function valuePatternChange(){'; print ' var lang_save = "'.$langs->trans("Save").'";'; print ' var lang_error = "'.$langs->trans("Error").'";'; + print ' var lang_Disabled = "'.$langs->trans("Disabled").'";'; + print ' var lang_Activated = "'.$langs->trans("Activated").'";'; + print ' $("#textcheckbox").html($("#NoAmbiCaracAutoGeneration")[0].checked ? unescape(lang_Activated) : unescape(lang_Disabled));'; print ' if(valuePossible()){'; print ' $("#linkChangePattern").attr("href",generatelink()).text(lang_save);'; print ' }'; diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php index b2eab5d1495..aedc870560f 100644 --- a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php +++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php @@ -72,16 +72,14 @@ class modGeneratePassPerso extends ModeleGenPassword $this->user=$user; if(empty($conf->global->USER_PASSWORD_PATTERN)){ - dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;8;0','chaine',0,'',$conf->entity); + // default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation. + dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1','chaine',0,'',$conf->entity); } $this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - //$this->Maj = "Y"; $this->Min = strtolower($this->Maj); $this->Nb = "0123456789"; - //$this->Nb = "X"; $this->Spe = "!@#$%&*()_-+={}[]\\|:;'/"; - //$this->Spe = "<>;}?"; $this->Ambi = array("1","I","l","|","O","0"); $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); @@ -149,7 +147,13 @@ class modGeneratePassPerso extends ModeleGenPassword for($i=strlen($pass);$i<$this->length2; $i++){ // y $pass .= $this->All[rand(0,strlen($this->All) -1)]; } - return str_shuffle($pass) ; + + $pass = str_shuffle($pass) ; + + if($this->validatePassword($pass)) { + return $pass; + } + return $this->getNewGeneratedPassword(); } /** @@ -160,6 +164,27 @@ class modGeneratePassPerso extends ModeleGenPassword */ function validatePassword($password) { + $password_a = str_split($password); + $maj = str_split($this->Maj); + $num = str_split($this->Nb); + $spe = str_split($this->Spe); + + if(count(array_intersect($password_a, $maj)) < $this->NbMaj){ + return 0; + } + + if(count(array_intersect($password_a, $num)) < $this->NbNum){ + return 0; + } + + if(count(array_intersect($password_a, $spe)) < $this->NbSpe){ + return 0; + } + + if(!$this->consecutiveInterationSameCharacter($password)){ + return 0; + } + return 1; } @@ -172,8 +197,7 @@ class modGeneratePassPerso extends ModeleGenPassword function consecutiveInterationSameCharacter($password){ $last = ""; $count = 0; - $char = explode("", $password); - + $char = str_split($password); foreach($char as $c){ if($c != $last){ $last = $c; @@ -182,11 +206,11 @@ class modGeneratePassPerso extends ModeleGenPassword $count++; } - if($count > $this->NbRepeat) { - return true; + if($count >= $this->NbRepeat) { + return 0; } } - return false; + return 1; } } diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 53061a3e944..bae681d6981 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -331,7 +331,7 @@ NbMajMin=Nombre de majuscule minimum NbNumMin=Nombre de chiffre minimum NbSpeMin=Nombre de caractère speciaux minimum NbIteConsecutive=Nombre maximum d'iterations consecutive du même caractère -NoAmbiCaracAutoGeneration=Desactivaté les caractère ambigus pour la generation automatique ("1","I","l","|","0","O") +NoAmbiCaracAutoGeneration=Ne pas utiliser les caractère ambigus pour la generation automatique ("1","I","l","|","0","O") SetupPerso=Configuration personalisable LanguageFilesCachedIntoShmopSharedMemory=Fichiers .lang en mémoire partagée ExamplesWithCurrentSetup=Exemples avec le paramétrage actif courant From 0a0dd81c9ab18afecb5918a27024edeef64d48e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Nov 2014 13:54:18 +0100 Subject: [PATCH 29/33] Fix: When selecting a carbon copy fro select list, mail was not attached to user. --- htdocs/comm/propal.php | 139 +-------------------- htdocs/commande/card.php | 156 +---------------------- htdocs/compta/facture.php | 170 ++------------------------ htdocs/core/actions_sendmails.inc.php | 26 +++- htdocs/societe/soc.php | 1 + 5 files changed, 42 insertions(+), 450 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index fcdda5eaaa1..3eeef6916eb 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -553,146 +553,19 @@ else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST( } } -// Add file in email form -if (GETPOST('addfile')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir = $conf->user->dir_output . "/" . $user->id; - $upload_dir_tmp = $vardir . '/temp'; - - dol_add_file_process($upload_dir_tmp, 0, 0); - $action = 'presend'; -} - -// Remove file in email form -if (GETPOST('removedfile')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir = $conf->user->dir_output . "/" . $user->id; - $upload_dir_tmp = $vardir . '/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'], 0); - $action = 'presend'; -} /* * Send mail */ -if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { - $langs->load('mails'); - if ($object->id > 0) { - if ($_POST['sendto']) { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } elseif ($_POST['receiver'] != '-1') { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property($_POST['receiver'], 'email'); - $sendtoid = $_POST['receiver']; - } - } +// Actions to send emails +$actiontypecode='AC_PROP'; +$trigger_name='PROPAL_SENTBYMAIL'; +$paramname='id'; +$mode='emailfromproposal'; +include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - if (dol_strlen($sendto)) { - $langs->load("commercial"); - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>'; - $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); - $deliveryreceipt = $_POST['deliveryreceipt']; - - if (dol_strlen($_POST['subject'])) - $subject = $_POST['subject']; - else - $subject = $langs->transnoentities('Propal') . ' ' . $object->ref; - $actiontypecode = 'AC_PROP'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2 = $langs->transnoentities('Action' . $actiontypecode); - - // Create form object - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles = $formmail->get_attached_files(); - $filepath = $attachedfiles ['paths']; - $filename = $attachedfiles ['names']; - $mimetype = $attachedfiles ['mimes']; - - // Envoi de la propal - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { - $result = $mailfile->sendfile(); - if ($result) { - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($db); - $result = $interface->run_triggers('PROPAL_SENTBYMAIL', $object, $user, $langs, $conf); - if ($result < 0) { - $error++; - $object->errors = $interface->errors; - } - // Fin appel triggers - - if (! $error) { - // Redirect here - // This avoid sending mail twice if going out and then back to page - $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)); - setEventMessage($mesg); - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); - exit(); - } else { - dol_print_error($db); - } - } else { - $langs->load("other"); - if ($mailfile->error) { - $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); - $mesg .= '
    ' . $mailfile->error; - } else { - $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - setEventMessage($mesg, 'errors'); - } - } - } else { - $langs->load("other"); - setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors'); - dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); - } - } else { - $langs->load("other"); - setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal")), 'errors'); - dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Proposal"))); - } -} // Go back to draft if ($action == 'modif' && $user->rights->propal->creer) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 792da64a923..4bf1eceb6dc 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1151,162 +1151,18 @@ else if ($action == 'update_extras') { $action = 'edit_extras'; } -/* - * Add file in email form - */ -if (GETPOST('addfile')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - // Set tmp user directory TODO Use a dedicated directory for temp mails files - $vardir = $conf->user->dir_output . "/" . $user->id; - $upload_dir_tmp = $vardir . '/temp'; - - dol_add_file_process($upload_dir_tmp, 0, 0); - $action = 'presend'; -} - -/* - * Remove file in email form - */ -if (GETPOST('removedfile')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir = $conf->user->dir_output . "/" . $user->id; - $upload_dir_tmp = $vardir . '/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile'), 0); - $action = 'presend'; -} - /* * Send mail */ -if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { - $langs->load('mails'); - if ($object->id > 0) { - // $ref = dol_sanitizeFileName($object->ref); - // $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; +// Actions to send emails +$actiontypecode='AC_COM'; +$trigger_name='ORDER_SENTBYMAIL'; +$paramname='id'; +$mode='emailfromorder'; +include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - // if (is_readable($file)) - // { - if (GETPOST('sendto')) { - // Le destinataire a ete fourni via le champ libre - $sendto = GETPOST('sendto'); - $sendtoid = 0; - } elseif (GETPOST('receiver') != '-1') { - // Recipient was provided from combo list - if (GETPOST('receiver') == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'), 'email'); - $sendtoid = GETPOST('receiver'); - } - } - if (dol_strlen($sendto)) { - $langs->load("commercial"); - - $from = GETPOST('fromname') . ' <' . GETPOST('frommail') . '>'; - $replyto = GETPOST('replytoname') . ' <' . GETPOST('replytomail') . '>'; - $message = GETPOST('message'); - $sendtocc = GETPOST('sendtocc'); - $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); - $deliveryreceipt = GETPOST('deliveryreceipt'); - - if ($action == 'send') { - if (dol_strlen(GETPOST('subject'))) - $subject = GETPOST('subject'); - else - $subject = $langs->transnoentities('Order') . ' ' . $object->ref; - $actiontypecode = 'AC_COM'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2 = $langs->transnoentities('Action' . $actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles = $formmail->get_attached_files(); - $filepath = $attachedfiles ['paths']; - $filename = $attachedfiles ['names']; - $mimetype = $attachedfiles ['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { - $result = $mailfile->sendfile(); - if ($result) { - //Must not contain quotes - $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)); - setEventMessage($mesg); - - $error = 0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; - $object->actionmsg2 = $actionmsg2; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($db); - $result = $interface->run_triggers('ORDER_SENTBYMAIL', $object, $user, $langs, $conf); - if ($result < 0) { - $error ++; - $this->errors = $interface->errors; - } - // Fin appel triggers - - if ($error) { - dol_print_error($db); - } else { - // Redirect here - // This avoid sending mail twice if going out and then back to page - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); - exit(); - } - } else { - $langs->load("other"); - if ($mailfile->error) { - $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); - $mesg .= '
    ' . $mailfile->error; - } else { - $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - - setEventMessage($mesg, 'errors'); - } - } - } else { - $langs->load("other"); - setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors'); - dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); - } - } else { - $langs->load("other"); - setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order")), 'errors'); - dol_syslog($langs->trans('ErrorFailedToReadEntity', $langs->trans("Order"))); - } -} if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) { if ($action == 'addcontact') { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2ba425f5a90..9d003ae0aa7 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1550,178 +1550,24 @@ if (GETPOST('linkedOrder')) { $result = $object->add_object_linked('commande', GETPOST('linkedOrder')); } -/* - * Add file in email form - */ -if (GETPOST('addfile')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir = $conf->user->dir_output . "/" . $user->id; - $upload_dir_tmp = $vardir . '/temp'; - - dol_add_file_process($upload_dir_tmp, 0, 0); - $action = 'presend'; -} - -/* - * Remove file in email form - */ -if (! empty($_POST['removedfile'])) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir = $conf->user->dir_output . "/" . $user->id; - $upload_dir_tmp = $vardir . '/temp'; - - // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'], 0); - $action = 'presend'; -} /* * Send mail */ -if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) { - $langs->load('mails'); - $actiontypecode = ''; - $subject = ''; - $actionmsg = ''; - $actionmsg2 = ''; +// Actions to send emails +if (empty($id)) $id=$facid; +$actiontypecode='AC_FAC'; +$trigger_name='BILL_SENTBYMAIL'; +$paramname='id'; +$mode='emailfrominvoice'; +include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - $result = $object->fetch($id); - $result = $object->fetch_thirdparty(); - - if ($result > 0) { - // $ref = dol_sanitizeFileName($object->ref); - // $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; - - // if (is_readable($file)) - // { - if ($_POST['sendto']) { - // Le destinataire a ete fourni via le champ libre - $sendto = $_POST['sendto']; - $sendtoid = 0; - } elseif ($_POST['receiver'] != '-1') { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $object->thirdparty->email; - $sendtoid = 0; - } else // Id du contact - { - $sendto = $object->thirdparty->contact_get_property($_POST['receiver'], 'email'); - $sendtoid = $_POST['receiver']; - } - } - - if (dol_strlen($sendto)) - { - $langs->load("commercial"); - - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>'; - $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>'; - $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); - $deliveryreceipt = $_POST['deliveryreceipt']; - - if ($action == 'send' || $action == 'relance') - { - if (dol_strlen($_POST['subject'])) - $subject = $_POST['subject']; - else - $subject = $langs->transnoentities('Bill') . ' ' . $object->ref; - $actiontypecode = 'AC_FAC'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - // $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); - } - - // Create form object - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - - $attachedfiles = $formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, - 1); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { - $result = $mailfile->sendfile(); - if ($result) { - $error = 0; - - // Initialisation donnees - $object->sendtoid = $sendtoid; - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; // Long text - $object->actionmsg2 = $actionmsg2; // Short text - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface = new Interfaces($db); - $result = $interface->run_triggers('BILL_SENTBYMAIL', $object, $user, $langs, $conf); - if ($result < 0) { - $error++; - $object->errors = $interface->errors; - } - // Fin appel triggers - - if ($error) { - dol_print_error($db); - } else { - // Redirect here - // This avoid sending mail twice if going out and then back to page - $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)); - setEventMessage($mesg); - header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id); - exit(); - } - } else { - $langs->load("other"); - - if ($mailfile->error) { - $mesg .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); - $mesg .= '
    ' . $mailfile->error; - } else { - $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; - } - - setEventMessage($mesg, 'errors'); - } - } - } else { - $langs->load("other"); - setEventMessage($langs->trans('ErrorMailRecipientIsEmpty') . '!', 'errors'); - dol_syslog($langs->trans('ErrorMailRecipientIsEmpty')); - } - } else { - $langs->load("other"); - setEventMessage($langs->trans('ErrorFailedToReadEntity', $langs->trans("Invoice")), 'errors'); - dol_syslog('Impossible de lire les donnees de la facture. Le fichier facture n\'a peut-etre pas ete genere.'); - } - - $action = 'presend'; -} /* * Generate document */ -else if ($action == 'builddoc') // En get ou en post +if ($action == 'builddoc') // En get ou en post { $object->fetch($id); $object->fetch_thirdparty(); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 625376ace58..51744775d9f 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -87,10 +87,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($result > 0) { - if ($_POST['sendto']) + if (trim($_POST['sendto'])) { // Recipient is provided into free text - $sendto = $_POST['sendto']; + $sendto = trim($_POST['sendto']); $sendtoid = 0; } elseif ($_POST['receiver'] != '-1') @@ -107,6 +107,22 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $sendtoid = $_POST['receiver']; } } + if (trim($_POST['sendtocc'])) + { + $sendtocc = trim($_POST['sendtocc']); + } + elseif ($_POST['receivercc'] != '-1') + { + // Recipient was provided from combo list + if ($_POST['receivercc'] == 'thirdparty') // Id of third party + { + $sendtocc = $thirdparty->email; + } + else // Id du contact + { + $sendtocc = $thirdparty->contact_get_property($_POST['receivercc'],'email'); + } + } if (dol_strlen($sendto)) { @@ -115,8 +131,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; - $sendtocc = $_POST['sendtocc']; - $sendtobcc=''; + $sendtocc = $sendtocc; + $sendtobcc= GETPOST('sendtoccc'); if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); if ($mode == 'emailfrominvoice') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO); @@ -172,7 +188,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($db); - $result=$interface->run_triggers('COMPANY_SENTBYMAIL',$object,$user,$langs,$conf); + $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index d9c5e70283c..0a5a9303d90 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -520,6 +520,7 @@ if (empty($reshook)) // Actions to send emails $id=$socid; $actiontypecode='AC_OTH_AUTO'; + $trigger_name='COMPANY_SENTBYMAIL'; $paramname='socid'; $mode='emailfromthirdparty'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; From 6837ff730b978a06d1a66897be333b15cb3ef7d3 Mon Sep 17 00:00:00 2001 From: Andrelec1 Date: Tue, 4 Nov 2014 14:41:56 +0100 Subject: [PATCH 30/33] Fix missing comma --- htdocs/install/mysql/tables/llx_societe.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 7822ed57a09..6b20774c4d1 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -3,6 +3,7 @@ -- Copyright (C) 2004-2014 Laurent Destailleur -- Copyright (C) 2005-2010 Regis Houssin -- Copyright (C) 2010 Juanjo Menent +-- Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> -- -- 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 @@ -91,7 +92,7 @@ create table llx_societe default_lang varchar(6), -- default language logo varchar(255), canvas varchar(32), -- type of canvas if used (null by default) - import_key varchar(14) -- import key + import_key varchar(14), -- import key webservices_url varchar(255), -- supplier webservice url webservices_key varchar(128), -- supplier webservice key )ENGINE=innodb; From c9c499717bf96e8d2280be1947cd7cdc22614304 Mon Sep 17 00:00:00 2001 From: Andrelec1 Date: Tue, 4 Nov 2014 14:56:18 +0100 Subject: [PATCH 31/33] Fix bad comma --- htdocs/install/mysql/tables/llx_societe.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 6b20774c4d1..e28cf062224 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -94,5 +94,5 @@ create table llx_societe canvas varchar(32), -- type of canvas if used (null by default) import_key varchar(14), -- import key webservices_url varchar(255), -- supplier webservice url - webservices_key varchar(128), -- supplier webservice key + webservices_key varchar(128) -- supplier webservice key )ENGINE=innodb; From 899fecb48461687cf032e3d85a2b37aae2bebc5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Nov 2014 16:40:01 +0100 Subject: [PATCH 32/33] Some maintenance sqls --- htdocs/install/mysql/migration/repair.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 57a89440343..d9e4a7b5ab5 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -187,3 +187,10 @@ UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS -- update llx_facturedet set total_tva = total_ttc - total_ht where total_vat = 0; -- update llx_facture set total = round(total_ttc / 1.2, 5) where total_ht = total_ttc; -- update llx_facture set tva = total_ttc - total where tva = 0; + +-- To insert elements into a category +-- Search idcategory: select rowid from llx_categorie where type=0 and label like '%xxx%' +-- Select all products to include: select * from llx_product where label like '%xxx%' +-- If ok, insert: insert into llx_categorie_product(fk_categorie, fk_product) select idcategory, rowid from llx_product where label like '%xxx%' + + From 565677343007304e10b9efde55884a4f24aca043 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Nov 2014 17:42:01 +0100 Subject: [PATCH 33/33] Update doc --- htdocs/install/mysql/migration/repair.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index d9e4a7b5ab5..8c334f9966d 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -193,4 +193,11 @@ UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS -- Select all products to include: select * from llx_product where label like '%xxx%' -- If ok, insert: insert into llx_categorie_product(fk_categorie, fk_product) select idcategory, rowid from llx_product where label like '%xxx%' +-- Replace xxx with your IP Address +-- bind-address = xxx.xxx.xxx.xxx +-- CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass'; +-- CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass'; +-- GRANT ALL ON *.* TO 'myuser'@'localhost'; +-- GRANT ALL ON *.* TO 'myuser'@'%'; +-- flush privileges;
     '; + print ''; + print ''; $formsocialcontrib->select_type_socialcontrib($typeid,'typeid',1,16,0); print '   '; - print ''; + print ''; print '
     '; + print ''; + print "
    '; + print ''; + print '   '; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print ''; - print ''; - print '
    '; + print ''; + print "
    '; - print ' '; - print ''; - print "
     
    '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -239,10 +255,10 @@ if ($resql) print ' '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; + print ''; + print ''; print ''; - print ''; - print ''; $liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed")); print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1); - print ''; + print ''; + print ''; + print ''; print '
     
    '.price($total).''.price($total_ttc).'  
      '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - print '
    '; print ''; - print ''; - print '
    '; - print ''; + print ''; print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; @@ -142,7 +142,7 @@ if ($resql) print ' '; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 8382029aa56..17c3efdbfaa 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -134,7 +134,7 @@ if ($result) print '
    '; - print ''; + print ''; print ' 
    '; - print ''; + print ''; print ' '; - print ''; + print ''; print ' '; diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 9bb4337782e..8babbd58f7d 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -35,6 +35,9 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'tax', '', '', 'charges'); +$search_ref = GETPOST('search_ref','int'); +$search_label = GETPOST('search_label','alpha'); +$search_amount = GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -63,6 +66,14 @@ else $typeid=$_REQUEST['typeid']; } +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_label=""; + $search_amount=""; + $typeid=""; +} + /* * View */ @@ -76,8 +87,9 @@ $sql = "SELECT t.rowid, t.amount, t.label, t.datev as dm, t.fk_typepayment as ty $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id"; $sql.= " WHERE t.entity = ".$conf->entity; -if (GETPOST("search_label")) $sql.=" AND t.label LIKE '%".$db->escape(GETPOST("search_label"))."%'"; -if (GETPOST("search_amount")) $sql.=" AND t.amount = ".price2num(GETPOST("search_amount")); +if ($search_ref) $sql.=" AND t.rowid=".$search_ref; +if ($search_label) $sql.=" AND t.label LIKE '%".$db->escape($search_label)."%'"; +if ($search_amount) $sql.=" AND t.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($filtre) { $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; @@ -106,27 +118,26 @@ if ($result) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre(""); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dm","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre(""); print "\n"; print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Type print ''; - print ''; - print ''; - print "\n"; + print ''; + print '\n"; while ($i < min($num,$limit)) { diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 33691cb7942..3c94003ee4a 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -543,11 +543,11 @@ if (empty($action)) // Lines for filters fields print ''; print ''; print ''; print ''; print ''; print ''; From ff68c685c0d9f5620d2a27b312052b1dec30de73 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 14:41:19 +0100 Subject: [PATCH 14/33] Customers payments list --- htdocs/compta/paiement/list.php | 49 +++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index da1f2bd2833..65615b9bbf3 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -42,6 +42,11 @@ $paymentstatic=new Paiement($db); $accountstatic=new Account($db); $companystatic=new Societe($db); +$search_ref=GETPOST("search_ref","int"); +$search_account=GETPOST("search_account","int"); +$search_paymenttype=GETPOST("search_paymenttype"); +$search_amount=GETPOST("search_amount"); +$search_company=GETPOST("search_company"); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -53,8 +58,14 @@ $limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; - - +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_account=""; + $search_amount=""; + $search_paymenttype=""; + $search_company=""; +} /* * View @@ -110,11 +121,11 @@ else else $sql.= " AND f.fk_user_author = ".$userid; } // Search criteria - if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int'); - if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int'); - if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'"; - if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount")); - if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company')); + if ($search_ref) $sql .=" AND p.rowid=".$search_ref; + if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; + if ($search_paymenttype != "") $sql .=" AND c.code='".$search_paymenttype."'"; + if ($search_amount) $sql .=" AND p.amount='".price2num($search_amount)."'"; + if ($search_company) $sql .= natural_search('s.nom', $search_company); } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -129,9 +140,9 @@ if ($resql) $paramlist=''; $paramlist.=(GETPOST("orphelins")?"&orphelins=1":""); - $paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:""); - $paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:""); - $paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:""); + $paramlist.=($search_ref?"&search_ref=".$search_ref:""); + $paramlist.=($search_company?"&search_company=".$search_company:""); + $paramlist.=($search_amount?"&search_amount=".$search_amount:""); print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); @@ -149,26 +160,29 @@ if ($resql) { print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder); } - print "\n"; + print ''; + print "\n"; // Lines for filters fields print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { @@ -223,7 +237,8 @@ if ($resql) if ($objp->statut == 0) print ''; print ''; } - + + print ''; print ''; $i++; From 1dcb7a58f3c5b5677f88784887c34d3f4d2827aa Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 14:51:21 +0100 Subject: [PATCH 15/33] Presentation & fix SQL injection --- htdocs/compta/sociales/index.php | 1 - htdocs/fourn/facture/paiement.php | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 00ef402fa36..db4bef2abe6 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -76,7 +76,6 @@ if (GETPOST("button_removefilter")) $typeid=""; $year=""; $month=""; - $filtre=""; } /* diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 3c94003ee4a..f467e9235ef 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -503,7 +503,7 @@ if (empty($action)) } if (! empty($search_amount)) { - $sql .= " AND p.amount=".price2num($search_amount); + $sql .= " AND p.amount='".price2num($search_amount)."'"; } if (! empty($search_company)) { @@ -524,7 +524,7 @@ if (empty($action)) $paramlist=''; $paramlist.=(! empty($search_ref)?"&search_ref=".$search_ref:""); $paramlist.=(! empty($search_company)?"&search_company=".$search_company:""); - $paramlist.=(! empty($search_amount)?"&search_amount=".$search_amount:""); + $paramlist.=(! empty($search_amount)?"&search_amount='".$search_amount:""); print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); @@ -538,7 +538,8 @@ if (empty($action)) 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"],'f.amount','',$paramlist,'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'ref_supplier','',$paramlist,'',$sortfield,$sortorder); - print "\n"; + print ''; + print "\n"; // Lines for filters fields print ''; @@ -557,7 +558,8 @@ if (empty($action)) print ''; print ''; print "\n"; @@ -594,7 +596,8 @@ if (empty($action)) print '';*/ - + + print ''; print ''; $i++; } From bebf0395999b4b5f3eb37402c38e33f7d2aa2117 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 15:05:20 +0100 Subject: [PATCH 16/33] Prospects list --- htdocs/comm/prospect/list.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 94286ee4c53..113618ffae8 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -48,7 +48,6 @@ $search_state = GETPOST("search_state"); $search_datec = GETPOST("search_datec"); $search_categ = GETPOST("search_categ",'int'); $search_status = GETPOST("search_status",'int'); -if ($search_status=='') $search_status=1; // always display activ customer first $catid = GETPOST("catid",'int'); $sortfield = GETPOST("sortfield",'alpha'); @@ -154,6 +153,21 @@ $sts = array(-1,0,1,2,3); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('prospectlist')); +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $socname=""; + $stcomm=""; + $search_nom=""; + $search_zipcode=""; + $search_town=""; + $search_state=""; + $search_datec=""; + $search_categ=""; + $search_status=""; +} + +if ($search_status=='') $search_status=1; // always display active customer first /* * Actions @@ -361,7 +375,7 @@ if ($resql) // Print these two select print $langs->trans("From").' '; print ' '; - print $langs->trans("To").' '; + print $langs->trans("to").' '; print ''; @@ -378,9 +392,9 @@ if ($resql) print ''; // Print the search button - print ''; + print '\n"; $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook From 85f0462c2028d0428bf376127c43623d9274d7f6 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 15:16:49 +0100 Subject: [PATCH 17/33] Suppliers list --- htdocs/fourn/list.php | 57 +++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index d3f7e55c199..296415c1aee 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -32,15 +32,15 @@ $langs->load("suppliers"); $langs->load("orders"); $langs->load("companies"); -$socname = GETPOST("socname"); -$search_nom = GETPOST("search_nom"); -$search_zipcode = GETPOST("search_zipcode"); -$search_town = GETPOST("search_town"); -$search_code_fournisseur = GETPOST("search_code_fournisseur"); -$search_compta_fournisseur = GETPOST("search_compta_fournisseur"); -$search_datec = GETPOST("search_datec"); -$search_categ = GETPOST('search_categ','int'); -$catid = GETPOST("catid",'int'); +$socname = GETPOST("socname"); +$search_name = GETPOST("search_name"); +$search_zipcode = GETPOST("search_zipcode"); +$search_town = GETPOST("search_town"); +$search_supplier_code = GETPOST("search_supplier_code"); +$search_supplier_accounting = GETPOST("search_supplier_accounting"); +$search_datec = GETPOST("search_datec"); +$search_categ = GETPOST('search_categ','int'); +$catid = GETPOST("catid",'int'); // Security check $socid = GETPOST('socid','int'); @@ -60,6 +60,19 @@ if (! $sortfield) $sortfield="nom"; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('supplierlist')); +if (GETPOST("button_removefilter_x")) +{ + $socname=""; + $search_name=""; + $search_zipcode=""; + $search_town=""; + $search_supplier_code=""; + $search_supplier_accounting=""; + $search_datec=""; + $search_categ=""; + $catid=""; +} + /* * Actions */ @@ -95,15 +108,15 @@ if ($socname) { $sortfield = "s.nom"; $sortorder = "ASC"; } -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); +if ($search_name) { + $sql .= natural_search('s.nom', $search_name); } if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; if ($search_town) { $sql .= natural_search('s.town', $search_town); } -if ($search_code_fournisseur) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_code_fournisseur)."%'"; -if ($search_compta_fournisseur) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_compta_fournisseur)."%'"; +if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'"; +if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'"; if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL"; @@ -126,7 +139,7 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - $param = "&search_nom=".$search_nom."&search_code_fournisseur=".$search_code_fournisseur."&search_zipcode=".$search_zipcode."&search_town=".$search_town; + $param = "&search_name=".$search_name."&search_supplier_code=".$search_supplier_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); @@ -166,26 +179,28 @@ if ($resql) print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; - + print '\n"; + $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook From df5d34266c933a8f9d1cb81b76bfcb13421ad19e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 15:26:20 +0100 Subject: [PATCH 18/33] Lost button --- htdocs/comm/propal/list.php | 7 +++++-- htdocs/contact/list.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 6522a592097..2b8e478d37d 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -322,8 +322,11 @@ if ($result) print ''; - print ''; + print ''; print "\n"; $var=true; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index c65e9601e53..a311c87cffc 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -357,7 +357,7 @@ if ($result) print ''; print ''; print ''; From 10ed271e38efe8360438d4a7ecb54aad2a141d34 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 20:18:46 +0100 Subject: [PATCH 19/33] Search bank transactions --- htdocs/compta/bank/search.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index 25b7d91a3ff..1e8196481e6 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; $langs->load("banks"); $langs->load("categories"); $langs->load("companies"); +$langs->load("margins"); // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -72,6 +73,15 @@ $limit = $conf->liste_limit; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='b.dateo'; +if (GETPOST("button_removefilter")) +{ + $description=""; + $type=""; + $debit=""; + $credit=""; + $account=""; + $bid=""; +} /* * View @@ -198,7 +208,7 @@ if ($resql) print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; + print ''; + print "\n"; // Loop on each record $total_debit=0; From 5bf5b9b16f2fd59d34c3e0c37ec2693395bd6f29 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 21:12:40 +0100 Subject: [PATCH 20/33] Trips list --- htdocs/compta/deplacement/list.php | 71 +++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index bb2c50b42bf..da0e3e21dcd 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -27,6 +27,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("companies"); $langs->load("users"); @@ -37,6 +39,10 @@ $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'deplacement','',''); +$search_ref=GETPOST('search_ref','int'); +$search_name=GETPOST('search_name','alpha'); +$search_company=GETPOST('search_company','alpha'); +// $search_amount=GETPOST('search_amount','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -48,13 +54,24 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="d.dated"; $limit = $conf->liste_limit; -$search_ref=GETPOST('search_ref','alpha'); +$year=GETPOST("year"); +$month=GETPOST("month"); +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_name=""; + $search_company=""; + // $search_amount=""; + $year=""; + $month=""; +} /* * View */ +$formother = new FormOther($db); $tripandexpense_static=new Deplacement($db); $userstatic = new User($db); @@ -76,10 +93,31 @@ $sql.= " AND d.entity = ".$conf->entity; if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; -if (trim($search_ref) != '') + +if ($search_ref) $sql.=" AND d.rowid=".$search_ref; +if ($search_name) { - $sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\''; + $sql .= natural_search('u.lastname', $search_name); } +if ($search_company) +{ + $sql .= natural_search('s.nom', $search_company); +} +// if ($search_amount) $sql.=" AND d.km='".$db->escape(price2num(trim($search_amount)))."'"; +if ($month > 0) +{ + if ($year > 0 && empty($day)) + $sql.= " AND d.dated 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 d.dated 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(d.dated, '%m') = '".$month."'"; +} +else if ($year > 0) +{ + $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; +} + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); @@ -97,7 +135,7 @@ if ($resql) print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder); @@ -107,24 +145,27 @@ if ($resql) // Filters lines print ''; print ''; print ''; + print ''; print ''; - print ''; print ''; - print ''; print '\n"; $var=true; @@ -142,9 +183,9 @@ if ($resql) // Type print ''; // Date - print ''; + print ''; // User - print ''; print "\n"; @@ -323,7 +334,8 @@ print ''; // ACTION print ''; print "\n"; From 39e83576a223efdcba485c410588b90e1f001e98 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 21:44:03 +0100 Subject: [PATCH 22/33] prelevement list --- htdocs/compta/prelevement/list.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 10fb995c023..0a68aa686ae 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -42,10 +42,10 @@ $result = restrictedArea($user, 'prelevement','','','bons'); $page = GETPOST('page','int'); $sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha'); $sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha'); -$search_line = GETPOST('search_ligne','alpha'); +$search_line = GETPOST('search_line','alpha'); $search_bon = GETPOST('search_bon','alpha'); $search_code = GETPOST('search_code','alpha'); -$search_societe = GETPOST('search_societe','alpha'); +$search_company = GETPOST('search_company','alpha'); $statut = GETPOST('statut','int'); $bon=new BonPrelevement($db,""); @@ -53,7 +53,14 @@ $ligne=new LignePrelevement($db,$user); $offset = $conf->liste_limit * $page ; - +if (GETPOST("button_removefilter")) +{ + $search_line=""; + $search_bon=""; + $search_code=""; + $search_company=""; + $statut=""; +} /* * View @@ -88,9 +95,9 @@ if ($search_code) { $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'"; } -if ($search_societe) +if ($search_company) { - $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'"; + $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'"; } $sql.=$db->order($sortfield,$sortorder); $sql.=$db->plimit($conf->liste_limit+1, $offset); @@ -122,15 +129,17 @@ if ($result) print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; $var=True; From a1980a1917bb8a4117f2aa6d0206f1e4cbd99d4a Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 22:04:01 +0100 Subject: [PATCH 23/33] Correct travis error - Not me ! --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 2d5bf7ab0cd..4b9401498d7 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -766,7 +766,7 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0) * @param int $inhour 0: return number of days, 1: return number of hours * @param int $lastday We include last day, 0: no, 1:yes * @param int $halfday Tag to define half day when holiday start and end - * @param string $countrycode Country code (company country code if not defined) + * @param string $country_code Country code (company country code if not defined) * @return int Number of days or hours */ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='') From 3ee4cfe30bddeb0f57814ea35516e4054b1f448f Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 3 Nov 2014 05:57:09 +0100 Subject: [PATCH 24/33] Intervention card list --- htdocs/fichinter/list.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 076ad9bc689..28dad4bbb89 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -61,6 +61,13 @@ $search_company=GETPOST('search_company','alpha'); $search_desc=GETPOST('search_desc','alpha'); $search_status=GETPOST('search_status'); +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $search_company=""; + $search_desc=""; + $search_status=""; +} /* * View @@ -125,6 +132,7 @@ if ($result) print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.fk_statut","",$urlparam,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"], ''); print "\n"; print ''; @@ -145,9 +153,10 @@ if ($result) print ''; - print "\n"; + print '\n"; $companystatic=new Societe($db); @@ -178,7 +187,8 @@ if ($result) print ''; } print ''; - + + print ''; print "\n"; $total += $objp->duree; @@ -188,10 +198,10 @@ if ($result) if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { print ''; - print ''; + print ''; print ''; } - + print '
      '; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print ''; - print ''; - print '
    '; + print ''; + print "
    '; - print ''; + print ''; print ' '; - print ''; + print ''; print ''; $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); @@ -556,7 +556,7 @@ if (empty($action)) $form->select_comptes($search_account,'search_account',0,'',1); print ''; - print ''; + print ''; print ''; print ''; print '
     
    '; - print ''; + print ''; print ' '; - print ''; + print ''; print ''; - $form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1); + $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); print ''; - $form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); + $form->select_comptes($search_account,'search_account',0,'',1); print ''; - print ''; + print ''; + print ''; print ''; + print ''; print ' 
     
    '; print ''; - print ''; + print ''; + print ''; print ''; print '
    '; print $invoicesupplierstatic->getNomUrl(1); print ' 
    '; - print ''; - print ''; + print ''; + print "
    '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; + print ''; + print "
    '; $formpropal->selectProposalStatus($viewstatut,1); print ''; - print ''; + print ''; + print ' '; + print ''; + print '
    '; print ''; - print '  '; + print ' '; print ''; print '
      '; - $form->select_types_paiements(empty($_REQUEST["type"])?'':$_REQUEST["type"], 'type', '', 2, 0, 1, 8); + $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8); print ''; @@ -214,9 +224,9 @@ if ($resql) print ''; print ''; if (! empty($_REQUEST['bid'])) print ''; - print ''; - print '
    '; - print ''; + print ''; print ''; - //print ''; + print ' '; + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year?$year:-1,'year',1, 20, 5); print ''; - //print ''; + print ''; print ''; - print ' '; + print ''; + print ''; print ''; - print ' '; - print ''; - print ' '; + // print ''; print ''; + print ''; print "
    '.$langs->trans($obj->type).''.dol_print_date($db->jdate($obj->dd),'day').''.dol_print_date($db->jdate($obj->dd),'day').''; + print ''; $userstatic->id = $obj->rowid; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; From 5b2318030387262c530c3cc5e55f047853bda2f7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 2 Nov 2014 21:28:02 +0100 Subject: [PATCH 21/33] Holiday list --- htdocs/holiday/index.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index 04a96a7001d..e988e640711 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -64,6 +64,19 @@ $search_employe = GETPOST('search_employe'); $search_valideur = GETPOST('search_valideur'); $search_statut = GETPOST('select_statut'); +if (GETPOST("button_removefilter")) +{ + $search_ref=""; + $month_create=""; + $year_create=""; + $month_start=""; + $year_start=""; + $month_end=""; + $year_end=""; + $search_employe=""; + $search_valideur=""; + $search_statut=""; +} /* * Actions @@ -71,8 +84,6 @@ $search_statut = GETPOST('select_statut'); // None - - /* * View */ @@ -257,7 +268,7 @@ print_liste_field_titre($langs->trans("Employe"),$_SERVER["PHP_SELF"],"cp.fk_use print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDebCP"),$_SERVER["PHP_SELF"],"cp.date_debut","",'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateFinCP"),$_SERVER["PHP_SELF"],"cp.date_fin","",'','align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cp.statut","",'','align="center"',$sortfield,$sortorder); print '
    '; -print ''; +print ''; +print ''; print '
       
    '; + print ''; + print ''; + print '
    '; $liststatus=$interventionstatic->statuts_short; print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1); - print ''; print '
    '; + print ''; + print "
    '.convertSecondToTime($objp->duree).''.$interventionstatic->LibStatut($objp->fk_statut,5).' 
    '.$langs->trans("Total").''.convertSecondToTime($total).' '.convertSecondToTime($total).'  
    '; print "\n"; $db->free($result); From 111b2e83f1e52f25eb34620330b541c226b4ef26 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 3 Nov 2014 06:05:51 +0100 Subject: [PATCH 25/33] Contracts list --- htdocs/contrat/list.php | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index dcc1b83e6d8..cf57e97933b 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -40,11 +40,11 @@ if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; -$search_nom=GETPOST('search_nom'); +$search_name=GETPOST('search_name'); $search_contract=GETPOST('search_contract'); $search_ref_supplier=GETPOST('search_ref_supplier','alpha'); $sall=GETPOST('sall'); -$statut=GETPOST('statut')?GETPOST('statut'):1; +$search_status=GETPOST('search_status'); $socid=GETPOST('socid'); if (! $sortfield) $sortfield="c.rowid"; @@ -58,6 +58,17 @@ $result = restrictedArea($user, 'contrat', $id); $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); +if (GETPOST("button_removefilter")) +{ + $search_name=""; + $search_contract=""; + $search_ref_supplier=""; + $sall=""; + $search_status=""; +} + +if ($search_status == '') $search_status=1; + /* * View @@ -84,8 +95,8 @@ $sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " AND c.entity = ".$conf->entity; if ($socid) $sql.= " AND s.rowid = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); +if ($search_name) { + $sql .= natural_search('s.nom', $search_name); } if ($search_contract) { $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); @@ -106,13 +117,13 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_nom='.$search_nom, $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num); print ''; print ''; $param='&search_contract='.$search_contract; - $param.='&search_nom='.$search_nom; + $param.='&search_name='.$search_name; $param.='&search_ref_supplier='.$search_ref_supplier; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); @@ -136,13 +147,13 @@ if ($resql) print ''; print ''; print ''; print ''; //print ''; - print '"; - print "\n"; + print '\n"; print ''; $var=true; From 5dacf3c3cd9116de20c97ecdb278b9174d5fb1fe Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 3 Nov 2014 06:12:57 +0100 Subject: [PATCH 26/33] Contracts services list --- htdocs/contrat/services.php | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 77fc0155430..b0fb4ed5edb 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -44,7 +44,7 @@ if (! $sortfield) $sortfield="c.rowid"; if (! $sortorder) $sortorder="ASC"; $filter=GETPOST("filter"); -$search_nom=GETPOST("search_nom"); +$search_name=GETPOST("search_name"); $search_contract=GETPOST("search_contract"); $search_service=GETPOST("search_service"); $statut=GETPOST('statut')?GETPOST('statut'):1; @@ -69,6 +69,21 @@ $staticcontrat=new Contrat($db); $staticcontratligne=new ContratLigne($db); $companystatic=new Societe($db); +if (GETPOST("button_removefilter")) +{ + $search_name=""; + $search_contract=""; + $search_service=""; + $op1month=""; + $op1day=""; + $op1year=""; + $filter_op1=""; + $op2month=""; + $op2day=""; + $op2year=""; + $filter_op2=""; +} + /* * View */ @@ -101,7 +116,7 @@ if ($mode == "0") $sql.= " AND cd.statut = 0"; if ($mode == "4") $sql.= " AND cd.statut = 4"; if ($mode == "5") $sql.= " AND cd.statut = 5"; if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'"; -if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'"; +if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'"; if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'"; if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; @@ -122,7 +137,7 @@ if ($resql) $param=''; if ($search_contract) $param.='&search_contract='.urlencode($search_contract); - if ($search_nom) $param.='&search_nom='.urlencode($search_nom); + if ($search_name) $param.='&search_name='.urlencode($search_name); if ($search_service) $param.='&search_service='.urlencode($search_service); if ($mode) $param.='&mode='.$mode; if ($filter) $param.='&filter='.$filter; @@ -168,7 +183,7 @@ if ($resql) print ''; // Third party print ''; print ''; - print '"; - print "\n"; + print '\n"; print ''; $contractstatic=new Contrat($db); From 5074feacd68e1876deb9338da4f8a708dfe75a50 Mon Sep 17 00:00:00 2001 From: Andrelec1 Date: Mon, 3 Nov 2014 17:57:55 +0100 Subject: [PATCH 27/33] Add option and create new class --- htdocs/admin/security.php | 114 +++++++++++ .../generate/modGeneratePassPerso.class.php | 192 ++++++++++++++++++ htdocs/langs/fr_FR/admin.lang | 8 + 3 files changed, 314 insertions(+) create mode 100644 htdocs/core/modules/security/generate/modGeneratePassPerso.class.php diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 43ccef1e954..0101465e674 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -165,6 +165,16 @@ else if ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') exit; } +if ($action == 'maj_pattern') +{ + dolibarr_set_const($db, "USER_PASSWORD_PATTERN", GETPOST("pattern"),'chaine',0,'',$conf->entity); + header("Location: security.php"); + exit; +} + + + + @@ -265,6 +275,110 @@ foreach ($arrayhandler as $key => $module) print '
    '; - print ''; + print ''; print '  '; - print "
    '; + print ''; + print "
    '; - print ''; + print ''; print ''; $arrayofoperators=array('<'=>'<','>'=>'>'); @@ -184,9 +199,9 @@ if ($resql) $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); print $form->select_date($filter_date2,'op2',0,0,1); print ''; - print "
    '; + print ''; + print "
    '; print ''; +//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1) +// Patter for Password Perso +if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){ +$var=!$var; + + $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); + /*$this->length2 = $tabConf[0]; + $this->NbMaj = $tabConf[1]; + $this->NbNum = $tabConf[2]; + $this->NbSpe = $tabConf[3]; + $this->NbRepeat = $tabConf[4]; + $this->WithoutAmbi = $tabConf[5]; + */ + print ''; + print ''; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print '"; + print ''; + print ''; + + $var=!$var; + print ""; + print ''; + print ''; + print '
    '.$langs->trans("PasswordPatternDesc").'
    ' . $langs->trans("MinLength")."
    ' . $langs->trans("NbMajMin")."
    ' . $langs->trans("NbNumMin")."
    ' . $langs->trans("NbSpeMin")."
    ' . $langs->trans("NbIteConsecutive")."
    ' . $langs->trans("NoAmbiCaracAutoGeneration")."
    '.$langs->trans("Save").'
    '; + + print ''; +} + + // Cryptage mot de passe print '
    '; $var=true; diff --git a/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php new file mode 100644 index 00000000000..b2eab5d1495 --- /dev/null +++ b/htdocs/core/modules/security/generate/modGeneratePassPerso.class.php @@ -0,0 +1,192 @@ + + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * + * 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/core/modules/security/generate/modGeneratePassPerso.class.php + * \ingroup core + * \brief File to manage no password generation. + */ + +require_once DOL_DOCUMENT_ROOT .'/core/modules/security/generate/modules_genpassword.php'; + + +/** + * \class modGeneratePassPerso + * \brief Class to generate a password according to personal rules + */ +class modGeneratePassPerso extends ModeleGenPassword +{ + var $id; + var $length; + var $length2; // didn't overright display + var $NbMaj; + var $NbNum; + var $NbSpe; + var $NbRepeat; + var $WithoutAmbi; + + var $db; + var $conf; + var $lang; + var $user; + + var $Maj; + var $Min; + var $Nb; + var $Spe; + var $Ambi; + var $All; + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param Conf $conf Handler de conf + * @param Translate $langs Handler de langue + * @param User $user Handler du user connecte + */ + function __construct($db, $conf, $langs, $user) + { + $this->id = "Perso"; + $this->length = $langs->trans("SetupPerso"); + + $this->db=$db; + $this->conf=$conf; + $this->langs=$langs; + $this->user=$user; + + if(empty($conf->global->USER_PASSWORD_PATTERN)){ + dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;8;0','chaine',0,'',$conf->entity); + } + + $this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + //$this->Maj = "Y"; + $this->Min = strtolower($this->Maj); + $this->Nb = "0123456789"; + //$this->Nb = "X"; + $this->Spe = "!@#$%&*()_-+={}[]\\|:;'/"; + //$this->Spe = "<>;}?"; + $this->Ambi = array("1","I","l","|","O","0"); + + $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); + $this->length2 = $tabConf[0]; + $this->NbMaj = $tabConf[1]; + $this->NbNum = $tabConf[2]; + $this->NbSpe = $tabConf[3]; + $this->NbRepeat = $tabConf[4]; + $this->WithoutAmbi = $tabConf[5]; + + if($this->WithoutAmbi){ + $this->Maj = str_replace($this->Ambi,"",$this->Maj ); + $this->Min = str_replace($this->Ambi,"",$this->Min ); + $this->Nb = str_replace($this->Ambi,"",$this->Nb ); + $this->Spe = str_replace($this->Ambi,"",$this->Spe ); + } + + $this->All = str_shuffle($this->Maj. $this->Min. $this->Nb. $this->Spe); + //$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe; + //$this->All = $this->Spe; + + } + + /** + * Return description of module + * + * @return string Description of text + */ + function getDescription() + { + global $langs; + return $langs->trans("PasswordGenerationPerso"); + } + + /** + * Return an example of password generated by this module + * + * @return string Example of password + */ + function getExample() + { + return $this->getNewGeneratedPassword(); + } + + /** + * Build new password + * + * @return string Return a new generated password + */ + function getNewGeneratedPassword() + { + $pass = ""; + for($i=0; $i<$this->NbMaj; $i++){ // Y + $pass .= $this->Maj[rand(0,strlen($this->Maj) - 1)]; + } + + for($i=0; $i<$this->NbNum; $i++){ // X + $pass .= $this->Nb[rand(0,strlen($this->Nb) - 1)]; + } + + for($i=0; $i<$this->NbSpe; $i++){ // @ + $pass .= $this->Spe[rand(0,strlen($this->Spe) - 1)]; + } + + for($i=strlen($pass);$i<$this->length2; $i++){ // y + $pass .= $this->All[rand(0,strlen($this->All) -1)]; + } + return str_shuffle($pass) ; + } + + /** + * Validate a password + * + * @param string $password Password to check + * @return int 0 if KO, >0 if OK + */ + function validatePassword($password) + { + return 1; + } + + /** + * consecutive iterations of the same character + * + * @param string $password Password to check + * @return int 0 if KO, >0 if OK + */ + function consecutiveInterationSameCharacter($password){ + $last = ""; + $count = 0; + $char = explode("", $password); + + foreach($char as $c){ + if($c != $last){ + $last = $c; + $count = 0; + }else{ + $count++; + } + + if($count > $this->NbRepeat) { + return true; + } + } + return false; + } +} + diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 28edf08867b..53061a3e944 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -327,6 +327,12 @@ ModuleDisabled=Module désactivé ModuleDisabledSoNoEvent=Module désactivé donc événement jamais créé ConfirmPurge=Êtes-vous sûr de vouloir réaliser cette purge ?
    Ceci effacera définitivement tous vos fichiers (espace GED, pièces jointes, etc...). MinLength=Longueur minimale +NbMajMin=Nombre de majuscule minimum +NbNumMin=Nombre de chiffre minimum +NbSpeMin=Nombre de caractère speciaux minimum +NbIteConsecutive=Nombre maximum d'iterations consecutive du même caractère +NoAmbiCaracAutoGeneration=Desactivaté les caractère ambigus pour la generation automatique ("1","I","l","|","0","O") +SetupPerso=Configuration personalisable LanguageFilesCachedIntoShmopSharedMemory=Fichiers .lang en mémoire partagée ExamplesWithCurrentSetup=Exemples avec le paramétrage actif courant ListOfDirectories=Liste des répertoires des modèles OpenDocument @@ -1057,6 +1063,8 @@ EmptyNumRefModelDesc=Code libre sans vérification. Peut être modifié à tout ##### Module password generation PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés. PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement. +PasswordGenerationPerso=Renvoie un mot de passe généré selon votre configuration. +PasswordPatternDesc=Pattern utilisé pour la génération de password personalisé ##### Users setup ##### UserGroupSetup=Configuration module utilisateurs et groupes GeneratePassword=Proposer un mot de passe généré From 796f2409a1f3ce47edea25da5c59195ea4c3dc2f Mon Sep 17 00:00:00 2001 From: Andrelec1 Date: Tue, 4 Nov 2014 11:38:16 +0100 Subject: [PATCH 28/33] Add verif and correction lang --- htdocs/admin/security.php | 5 ++- .../generate/modGeneratePassPerso.class.php | 44 ++++++++++++++----- htdocs/langs/fr_FR/admin.lang | 2 +- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 0101465e674..adb590ffcd2 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -326,7 +326,7 @@ $var=!$var; $var=!$var; print "
    ' . $langs->trans("NoAmbiCaracAutoGeneration")." '.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'