diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f3c391b5ecd..40029d45f84 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2014-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Frederic France + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -31,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; /** @@ -1584,7 +1586,8 @@ class Adherent extends CommonObject } if ($option == 'category') { - $link = ''; } diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 62e54c17948..9f404fe1510 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -157,7 +157,7 @@ print ""; if ($conf->use_javascript_ajax) { print '
'; - print ''; + print '
'; print ''; print ''; print ''; @@ -469,7 +469,7 @@ else // Show { // Show bugtrack link $var=!$var; - print '"; print ''; print ""; diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index db7b73998c1..7ba04331454 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -50,14 +51,14 @@ $parent=GETPOST('parent'); if ($origin) { - if ($type == 0) $idProdOrigin = $origin; - if ($type == 1) $idSupplierOrigin = $origin; - if ($type == 2) $idCompanyOrigin = $origin; - if ($type == 3) $idMemberOrigin = $origin; - if ($type == 4) $idContactOrigin = $origin; + if ($type == Categorie::TYPE_PRODUCT) $idProdOrigin = $origin; + if ($type == Categorie::TYPE_SUPPLIER) $idSupplierOrigin = $origin; + if ($type == Categorie::TYPE_CUSTOMER) $idCompanyOrigin = $origin; + if ($type == Categorie::TYPE_MEMBER) $idMemberOrigin = $origin; + if ($type == Categorie::TYPE_CONTACT) $idContactOrigin = $origin; } -if ($catorigin && $type == 0) $idCatOrigin = $catorigin; +if ($catorigin && $type == Categorie::TYPE_PRODUCT) $idCatOrigin = $catorigin; $object = new Categorie($db); diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 0dc404ac3d1..155593b5efd 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -6,6 +6,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -46,40 +47,40 @@ $dbtablename = ''; // For categories on third parties if (! empty($socid)) $id = $socid; -if (! isset($type)) $type = 0; -if ($type == 1 || $type == 2) $socid = $id; +if (! isset($type)) $type = Categorie::TYPE_PRODUCT; +if ($type == Categorie::TYPE_SUPPLIER || $type == Categorie::TYPE_CUSTOMER) $socid = $id; if ($id || $ref) { - if ($type == 0) { + if ($type == Categorie::TYPE_PRODUCT) { $elementtype = 'product'; $objecttype = 'produit|service&categorie'; $objectid = isset($id)?$id:(isset($ref)?$ref:''); $dbtablename = 'product'; $fieldid = isset($ref)?'ref':'rowid'; } - elseif ($type == 1) { + elseif ($type == Categorie::TYPE_SUPPLIER) { $elementtype = 'fournisseur'; $objecttype = 'societe&categorie'; $objectid = isset($id)?$id:(isset($socid)?$socid:''); $dbtablename = '&societe'; $fieldid = 'rowid'; } - elseif ($type == 2) { + elseif ($type == Categorie::TYPE_CUSTOMER) { $elementtype = 'societe'; $objecttype = 'societe&categorie'; $objectid = isset($id)?$id:(isset($socid)?$socid:''); $dbtablename = '&societe'; $fieldid = 'rowid'; } - elseif ($type == 3) { + elseif ($type == Categorie::TYPE_MEMBER) { $elementtype = 'member'; $objecttype = 'adherent&categorie'; $objectid = isset($id)?$id:(isset($ref)?$ref:''); $dbtablename = 'adherent'; $fieldid = ! empty($ref)?'ref':'rowid'; } - elseif ($type == 4) { + elseif ($type == Categorie::TYPE_CONTACT) { $elementtype = 'societe'; $objecttype = 'contact'; $objectid = isset($id)?$id:(isset($ref)?$ref:''); @@ -109,34 +110,34 @@ if (empty($reshook)) // Remove element from category if ($removecat > 0) { - if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) + if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $object = new Product($db); $result = $object->fetch($id, $ref); $elementtype = 'product'; } - if ($type==1 && $user->rights->societe->creer) + if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; $object = new Fournisseur($db); $result = $object->fetch($objectid); $elementtype = 'fournisseur'; } - if ($type==2 && $user->rights->societe->creer) + if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { $object = new Societe($db); $result = $object->fetch($objectid); $elementtype = 'societe'; } - if ($type == 3 && $user->rights->adherent->creer) + if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $object = new Adherent($db); $result = $object->fetch($objectid); $elementtype = 'member'; } - if ($type == 4 && $user->rights->societe->creer) + if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $object = new Contact($db); @@ -157,34 +158,34 @@ if (empty($reshook)) // Add object into a category if ($parent > 0) { - if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) + if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $object = new Product($db); $result = $object->fetch($id, $ref); $elementtype = 'product'; } - if ($type==1 && $user->rights->societe->creer) + if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; $object = new Fournisseur($db); $result = $object->fetch($objectid); $elementtype = 'fournisseur'; } - if ($type==2 && $user->rights->societe->creer) + if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { $object = new Societe($db); $result = $object->fetch($objectid); $elementtype = 'societe'; } - if ($type==3 && $user->rights->adherent->creer) + if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $object = new Adherent($db); $result = $object->fetch($objectid); $elementtype = 'member'; } - if ($type == 4 && $user->rights->societe->creer) + if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $object = new Contact($db); @@ -324,7 +325,7 @@ if ($socid) } else if ($id || $ref) { - if ($type == 0) + if ($type == Categorie::TYPE_PRODUCT) { $langs->load("products"); @@ -377,7 +378,7 @@ else if ($id || $ref) formCategory($db,$product,0,$socid,($user->rights->produit->creer || $user->rights->service->creer)); } - if ($type == 3) + if ($type == Categorie::TYPE_MEMBER) { $langs->load("members"); @@ -455,7 +456,7 @@ else if ($id || $ref) formCategory($db,$member,3,0,$user->rights->adherent->creer); } - if ($type == 4) + if ($type == Categorie::TYPE_CONTACT) { $langs->load("contact"); @@ -618,16 +619,16 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) { global $user,$langs,$form,$bc; - if ($typeid == 0) $title = $langs->trans("ProductsCategoriesShort"); - if ($typeid == 1) $title = $langs->trans("SuppliersCategoriesShort"); - if ($typeid == 2) $title = $langs->trans("CustomersProspectsCategoriesShort"); - if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort"); - if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort"); + if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort"); + if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort"); + if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort"); + if ($typeid == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCategoriesShort"); + if ($typeid == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort"); $linktocreate=''; if ($showclassifyform && $user->rights->categorie->creer) { - $linktocreate='id.'&type='.$typeid).'">'; + $linktocreate='id.'&type='.$typeid).'">'; $linktocreate.=$langs->trans("CreateCat").' '; $linktocreate.=img_picto($langs->trans("Create"),'filenew'); $linktocreate.=""; @@ -662,11 +663,11 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) if (count($cats) > 0) { - if ($typeid == 0) $title=$langs->trans("ProductIsInCategories"); - if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories"); - if ($typeid == 2) $title=$langs->trans("CompanyIsInCustomersCategories"); - if ($typeid == 3) $title=$langs->trans("MemberIsInCategories"); - if ($typeid == 4) $title=$langs->trans("ContactIsInCategories"); + if ($typeid == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductIsInCategories"); + if ($typeid == Categorie::TYPE_SUPPLIER) $title=$langs->trans("CompanyIsInSuppliersCategories"); + if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyIsInCustomersCategories"); + if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberIsInCategories"); + if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactIsInCategories"); print "\n"; print '
'.$langs->trans("Statistics").'
'; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 38ffeae2993..05035fa1f9f 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1,8 +1,8 @@ - * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2013 Raphaël Doursenaud +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2013-2015 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -209,8 +209,9 @@ if ($resql) $moreforfilter=''; if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories(3,$search_categ,'search_categ',1); + $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1); $moreforfilter.='       '; } if ($moreforfilter) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 41c4fe6956c..7f1d17183d2 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -283,7 +283,7 @@ if ($action == 'edit') // Edit { // Show bugtrack link $var=!$var; - print '
'.$langs->trans("ShowBugTrackLink").''; + print '
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); print ' 
'.$langs->trans("ShowBugTrackLink").''; + print '
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)." 
'; print ''; @@ -687,11 +688,11 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) // Link to delete from category print '
'.$title.':
'; $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; - if ($typeid == 4) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer; + if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer; if ($permission) { print ""; @@ -715,18 +716,17 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) } else { - if ($typeid == 0) $title=$langs->trans("ProductHasNoCategory"); - if ($typeid == 1) $title=$langs->trans("CompanyHasNoCategory"); - if ($typeid == 2) $title=$langs->trans("CompanyHasNoCategory"); - if ($typeid == 3) $title=$langs->trans("MemberHasNoCategory"); - if ($typeid == 4) $title=$langs->trans("ContactHasNoCategory"); + if ($typeid == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductHasNoCategory"); + if ($typeid == Categorie::TYPE_SUPPLIER) $title=$langs->trans("CompanyHasNoCategory"); + if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyHasNoCategory"); + if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberHasNoCategory"); + if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactHasNoCategory"); print $title; print "
"; } return 0; } - llxFooter(); $db->close(); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 96949371bae..167a256a990 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1,13 +1,14 @@ - * Copyright (C) 2005 Davoleau Brice - * Copyright (C) 2005 Rodolphe Quiedeville - * Copyright (C) 2006-2012 Regis Houssin - * Copyright (C) 2006-2012 Laurent Destailleur - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2015 Marcos García +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2005 Davoleau Brice + * Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2006-2012 Regis Houssin + * Copyright (C) 2006-2012 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -40,6 +41,13 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; */ class Categorie extends CommonObject { + // Categories types + const TYPE_PRODUCT = 0; + const TYPE_SUPPLIER = 1; + const TYPE_CUSTOMER = 2; + const TYPE_MEMBER = 3; + const TYPE_CONTACT = 4; + public $element='category'; public $table_element='categories'; @@ -472,7 +480,7 @@ class Categorie extends CommonObject * Link an object to the category * * @param Object $obj Object to link to category - * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') + * @param string $type Type of category ('societe', 'member', 'product', 'contact', 'fournisseur) * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked */ function add_type($obj,$type) @@ -485,12 +493,22 @@ class Categorie extends CommonObject // For backward compatibility if ($type == 'company') $type='societe'; - if ($type == 'customer') $type='societe'; - if ($type == 'supplier') $type='fournisseur'; + elseif ($type == 'customer') $type='societe'; + elseif ($type == 'supplier') $type='fournisseur'; - $column_name=$type; - if ($type=='contact') $column_name='socpeople'; - if ($type=='fournisseur') $column_name='societe'; + /** + * llx_categorie_contact => fk_socpeople + * llx_categorie_fournisseur, llx_categorie_societe => fk_soc + * llx_categorie_member => fk_member + * llx_categorie_product => fk_product + */ + if ($type == 'contact') { + $column_name = 'socpeople'; + } elseif ($type == 'fournisseur' || ($type == 'societe')) { + $column_name = 'soc'; + } else { + $column_name = $type; + } $this->db->begin(); @@ -1166,11 +1184,17 @@ class Categorie extends CommonObject $cats = array(); $typeid=-1; $table=''; - if ($type == '0' || $type == 'product') { $typeid=0; $table='product'; $type='product'; } - else if ($type == '1' || $type == 'supplier') { $typeid=1; $table='soc'; $type='fournisseur'; } - else if ($type == '2' || $type == 'customer') { $typeid=2; $table='soc'; $type='societe'; } - else if ($type == '3' || $type == 'member') { $typeid=3; $table='member'; $type='member'; } - else if ($type == '4' || $type == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } + if ($type == '0' || $type == 'product') { + $typeid=self::TYPE_PRODUCT; $table='product'; $type='product'; + } else if ($type == '1' || $type == 'supplier') { + $typeid=self::TYPE_SUPPLIER; $table='soc'; $type='fournisseur'; + } else if ($type == '2' || $type == 'customer') { + $typeid=self::TYPE_CUSTOMER; $table='soc'; $type='societe'; + } else if ($type == '3' || $type == 'member') { + $typeid=self::TYPE_MEMBER; $table='member'; $type='member'; + } else if ($type == '4' || $type == 'contact') { + $typeid=self::TYPE_CONTACT; $table='socpeople'; $type='contact'; + } $sql = "SELECT ct.fk_categorie, c.label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; @@ -1220,11 +1244,11 @@ class Categorie extends CommonObject $cats = array(); $typeid=-1; - if ($type == 0 || $type == 'product') { $typeid=0; } - else if ($type == 1 || $type == 'supplier') { $typeid=1; } - else if ($type == 2 || $type == 'customer') { $typeid=2; } - else if ($type == 3 || $type == 'member') { $typeid=3; } - else if ($type == 4 || $type == 'contact') { $typeid=4; } + if ($type == 0 || $type == 'product') { $typeid=self::TYPE_PRODUCT; } + else if ($type == 1 || $type == 'supplier') { $typeid=self::TYPE_SUPPLIER; } + else if ($type == 2 || $type == 'customer') { $typeid=self::TYPE_CUSTOMER; } + else if ($type == 3 || $type == 'member') { $typeid=self::TYPE_MEMBER; } + else if ($type == 4 || $type == 'contact') { $typeid=self::TYPE_CONTACT; } // Generation requete recherche $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; @@ -1550,7 +1574,7 @@ class Categorie extends CommonObject $this->specimen=1; $this->description = 'This is a description'; $this->socid = 1; - $this->type = 0; + $this->type = self::TYPE_PRODUCT; } /** diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 590cb4edb49..2a41d318ff5 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -1,9 +1,10 @@ - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2006-2015 Laurent Destailleur - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -35,7 +36,7 @@ $langs->load("categories"); if (! $user->rights->categorie->lire) accessforbidden(); $id=GETPOST('id','int'); -$type=(GETPOST('type') ? GETPOST('type') : 0); +$type=(GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT); $catname=GETPOST('catname','alpha'); $section=(GETPOST('section')?GETPOST('section'):0); @@ -47,12 +48,12 @@ $section=(GETPOST('section')?GETPOST('section'):0); $categstatic = new Categorie($db); $form = new Form($db); -if ($type == 0) $title=$langs->trans("ProductsCategoriesArea"); -elseif ($type == 1) $title=$langs->trans("SuppliersCategoriesArea"); -elseif ($type == 2) $title=$langs->trans("CustomersCategoriesArea"); -elseif ($type == 3) $title=$langs->trans("MembersCategoriesArea"); -elseif ($type == 4) $title=$langs->trans("ContactsCategoriesArea"); -else $title=$langs->trans("CategoriesArea"); +if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoriesArea"); +elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoriesArea"); +elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea"); +elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea"); +elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea"); +else $title=$langs->trans("CategoriesArea"); $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index eb496db1af9..f3a84eed5d5 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2014 Jean-François Ferry +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2014 Jean-François Ferry + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -93,11 +94,11 @@ $form = new Form($db); if ($object->id) { $title=$langs->trans("ProductsCategoryShort"); - if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); - elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); - elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); - elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); - elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); + if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort"); + elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort"); + elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort"); + elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort"); + elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort"); $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'photos', $title, 0, 'category'); diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 98d4fb2b930..94570d48f3e 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -1,7 +1,8 @@ - * Copyright (C) 2007 Rodolphe Quiedeville - * Copyright (C) 2010-2012 Destailleur Laurent +/* Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2010-2012 Destailleur Laurent + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -143,12 +144,12 @@ llxHeader("","",$langs->trans("Translation")); $form = new Form($db); $formadmin=new FormAdmin($db); -if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); -elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); -elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); -elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); -elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); -else $title=$langs->trans("Category"); +if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort"); +elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort"); +elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort"); +elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort"); +elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort"); +else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); dol_fiche_head($head, 'translation', $title, 0, 'category'); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 198ac73cd2a..36e6f53ecc3 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1,8 +1,9 @@ - * Copyright (C) 2006-2010 Laurent Destailleur - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2005 Matthieu Valleton + * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -70,33 +71,33 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); // Remove element from category if ($id > 0 && $removeelem > 0) { - if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) + if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $tmpobject = new Product($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'product'; } - else if ($type==1 && $user->rights->societe->creer) + else if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'fournisseur'; } - else if ($type==2 && $user->rights->societe->creer) + else if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'societe'; } - else if ($type == 3 && $user->rights->adherent->creer) + else if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; } - else if ($type == 4 && $user->rights->societe->creer) { + else if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $tmpobject = new Contact($db); @@ -121,7 +122,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi } } -if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) +if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $newobject = new Product($db); @@ -158,12 +159,12 @@ $form = new Form($db); llxHeader("","",$langs->trans("Categories")); -if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); -elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); -elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); -elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); -elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); -else $title=$langs->trans("Category"); +if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort"); +elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort"); +elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort"); +elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort"); +elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort"); +else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); @@ -283,7 +284,7 @@ else } // List of products or services (type is type of category) -if ($object->type == 0) +if ($object->type == Categorie::TYPE_PRODUCT) { $prods = $object->getObjectsInCateg("product"); if ($prods < 0) @@ -292,7 +293,7 @@ if ($object->type == 0) } else { - $showclassifyform=1; $typeid=0; + $showclassifyform=1; $typeid=Categorie::TYPE_PRODUCT; // Form to add record into a category if ($showclassifyform) @@ -334,10 +335,10 @@ if ($object->type == 0) print '
'; $typeid=$object->type; $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; + if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer; if ($permission) { print ""; @@ -356,7 +357,7 @@ if ($object->type == 0) } } -if ($object->type == 1) +if ($object->type == Categorie::TYPE_SUPPLIER) { $socs = $object->getObjectsInCateg("supplier"); if ($socs < 0) @@ -384,10 +385,10 @@ if ($object->type == 1) print ''; $typeid=$object->type; $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; + if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer; if ($permission) { print ""; @@ -407,7 +408,7 @@ if ($object->type == 1) } } -if($object->type == 2) +if($object->type == Categorie::TYPE_CUSTOMER) { $socs = $object->getObjectsInCateg("customer"); if ($socs < 0) @@ -438,10 +439,10 @@ if($object->type == 2) print ''; $typeid=$object->type; $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; + if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer; if ($permission) { print ""; @@ -461,7 +462,7 @@ if($object->type == 2) } // List of members -if ($object->type == 3) +if ($object->type == Categorie::TYPE_MEMBER) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; @@ -493,10 +494,10 @@ if ($object->type == 3) print ''; $typeid=$object->type; $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; + if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer; if ($permission) { print ""; @@ -515,7 +516,7 @@ if ($object->type == 3) } //Categorie contact -if($object->type == 4) +if($object->type == Categorie::TYPE_CONTACT) { $contacts = $object->getObjectsInCateg("contact"); if ($contacts < 0) @@ -544,11 +545,11 @@ if($object->type == 4) print ''; $typeid=$object->type; $permission=0; - if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); - if ($typeid == 1) $permission=$user->rights->societe->creer; - if ($typeid == 2) $permission=$user->rights->societe->creer; - if ($typeid == 3) $permission=$user->rights->adherent->creer; - if ($typeid == 4) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); + if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer; + if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer; + if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer; if ($permission) { print ""; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index eb88215fa20..aa34c83523c 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -6,6 +6,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS + * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -609,6 +610,8 @@ if ($action == 'create') if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); else print_fiche_titre($langs->trans("AddAnAction")); + dol_fiche_head(); + print ''; // Type of event @@ -784,7 +787,9 @@ if ($action == 'create') print '
'; - print '
'; + dol_fiche_end(); + + print '
'; print ''; print '     '; print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index e8635ec4861..91082646913 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -675,6 +675,8 @@ if ($action == 'create') print_fiche_titre($langs->trans("NewMailing")); + dol_fiche_head(); + print ''; print ''; print ''; @@ -706,12 +708,14 @@ if ($action == 'create') print ''; print '
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,70); + $doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor->Create(); print '
'; - print '
'; + dol_fiche_end(); + + print '
'; print ''; } diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index b67b6fe9276..428e561f4fe 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -115,7 +115,7 @@ if ($resql) } $db->free($resql); - print ''; + print '
'; print ''."\n"; $var=true; $listofstatus=array(0,1,2,3,4); diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 47c051a4f47..e807b3fcbc4 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -1,11 +1,12 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Philippe Grand - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011 Philippe Grand + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -219,34 +220,23 @@ $sql.= " AND s.client IN (2, 3)"; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; if ($socid) $sql.= " AND s.rowid = " .$socid; -if ($search_stcomm != '') $sql.= " AND s.fk_stcomm=".$search_stcomm; -if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; -if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; -if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_nom) { - $sql .= natural_search('s.nom', $search_nom); -} +if ($search_stcomm != '') $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); +if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; +if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; +if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; +if ($search_nom) $sql .= natural_search('s.nom', $search_nom); if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'"; -if ($search_town) { - $sql .= natural_search('s.town', $search_town); -} -if ($search_state) { - $sql .= natural_search('d.nom', $search_state); -} -if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; +if ($search_town) $sql .= natural_search('s.town', $search_town); +if ($search_state) $sql .= natural_search('d.nom', $search_state); +if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); // Insert levels filters -if ($search_levels) -{ - $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; -} +if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; // Insert sale filter -if ($search_sale > 0) +if ($search_sale > 0) $sql .= " AND sc.fk_user = ".$db->escape($search_sale); +if ($socname) { - $sql .= " AND sc.fk_user = ".$db->escape($search_sale); -} -if ($socname) { $sql .= natural_search('s.nom', $search_nom); $sortfield = "s.nom"; $sortorder = "ASC"; @@ -309,8 +299,9 @@ if ($resql) $moreforfilter=''; if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ',1); + $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1); $moreforfilter.='       '; } // If the user can view prospects other than his' @@ -362,22 +353,17 @@ if ($resql) print ''; print ''; - // Added by Matelli + // Prospect levelt print ''; + // Prospect status print ''; print ''; print '
'.$langs->trans("Statistics").' - '.$langs->trans("Proposals").'
'; - // Generate in $options_from the list of each option sorted - $options_from = ''; + $options_from = ''; // Generate in $options_from the list of each option sorted foreach ($tab_level as $tab_level_sortorder => $tab_level_label) { $options_from .= ''; } - - // Reverse the list - array_reverse($tab_level, true); - - // Generate in $options_to the list of each option sorted in the reversed order - $options_to = ''; + array_reverse($tab_level, true); // Reverse the list + $options_to = ''; // Generate in $options_to the list of each option sorted in the reversed order foreach ($tab_level as $tab_level_sortorder => $tab_level_label) { $options_to .= ''; - print ' '; + // TODO Add here a list of prospect status + //print $form->selectarray($htmlname, $array, $search_stcomm); + //print ' '; print ''; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 7c6f2d52211..7957803a5d5 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -115,7 +115,7 @@ if ($resql) $i++; } $db->free($resql); - print ''; + print '
'; print ''."\n"; $listofstatus=array(0,1,2,3,3,-1); $bool=false; diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 1aea3e27c1b..7dffc753bc4 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -7,6 +7,7 @@ * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2012-2014 Marcos García * Copyright (C) 2011-2015 Alexandre Spangaro + * Copyright (C) 2015 Florian Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,6 +69,15 @@ $req_desc=GETPOST("req_desc",'',3); $req_debit=GETPOST("req_debit",'',3); $req_credit=GETPOST("req_credit",'',3); +$req_stdtmonth=GETPOST('req_stdtmonth', 'int'); +$req_stdtday=GETPOST('req_stdtday', 'int'); +$req_stdtyear=GETPOST('req_stdtyear', 'int'); +$req_stdt = dol_mktime(0, 0, 0, $req_stdtmonth, $req_stdtday, $req_stdtyear); +$req_enddtmonth=GETPOST('req_enddtmonth', 'int'); +$req_enddtday=GETPOST('req_enddtday', 'int'); +$req_enddtyear=GETPOST('req_enddtyear', 'int'); +$req_enddt = dol_mktime(23, 59, 59, $req_enddtmonth, $req_enddtday, $req_enddtyear); + $vline=GETPOST("vline"); $page=GETPOST('page','int'); $negpage=GETPOST('negpage','int'); @@ -87,6 +97,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $req_desc=""; $req_debit=""; $req_credit=""; + $req_stdtmonth=""; + $req_stdtday=""; + $req_stdtyear=""; + $req_stdt = ""; + $req_enddtmonth=""; + $req_enddtday=""; + $req_enddtyear=""; + $req_enddt = ""; } /* @@ -158,7 +176,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->m * View */ -llxHeader(); +llxHeader('',$langs->trans("FinancialAccount").'-'.$langs->trans("Transactions")); $societestatic=new Societe($db); $userstatic=new User($db); @@ -253,6 +271,27 @@ if ($id > 0 || ! empty($ref)) $param.='&paiementtype='.urlencode($paiementtype); $mode_search = 1; } + + if ($req_stdt && $req_enddt) + { + $sql_rech.=" AND (b.datev BETWEEN '".$db->escape($db->idate($req_stdt))."' AND '".$db->escape($db->idate($req_enddt))."')"; + $param.='&req_stdtmonth='.$req_stdtmonth.'&req_stdtyear='.$req_stdtyear.'&req_stdtday='.$req_stdtday; + $param.='&req_enddtmonth='.$req_enddtmonth.'&req_enddtday='.$req_enddtday.'&req_enddtyear='.$req_enddtyear; + $mode_search = 1; + } + elseif ($req_stdt) + { + $sql_rech.=" AND b.datev >= '".$db->escape($db->idate($req_stdt))."'"; + $param.='&req_stdtmonth='.$req_stdtmonth.'&req_stdtyear='.$req_stdtyear.'&req_stdtday='.$req_stdtday; + $mode_search = 1; + } + elseif ($req_enddt) + { + $sql_rech.=" AND b.datev <= '".$db->escape($db->idate($req_enddt))."'"; + $param.='&req_enddtmonth='.$req_enddtmonth.'&req_enddtday='.$req_enddtday.'&req_enddtyear='.$req_enddtyear; + $mode_search = 1; + } + $sql = "SELECT count(*) as total"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; @@ -398,7 +437,13 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $navig ='
'; if ($limitsql > $viewline) $navig.=''.img_previous().''; $navig.= ' "; // ' Page '; @@ -489,9 +534,12 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; + $period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1); + $period_filter .= '
'. $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1); + print '
'; print ''; - print ''; + print ''; print ''."\n"; + $total_deb +=$objp->amount; } else { print ''."\n"; + $total_cred +=$objp->amount; } // Balance @@ -886,11 +936,23 @@ if ($id > 0 || ! empty($ref)) // Show total if ($page == 0 && ! $mode_search) { + //Real account situation print ''; - print ''; + print ''; + print ''; + print ''; + } else { + // Only total according row displays + print ''; + print ''; + print ''; + print ''; print ''; print ''; } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 49af748c115..e2422bffa70 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -347,7 +348,9 @@ if ($action == 'new') print '
'; print ''; - //print '
aaa'; + + dol_fiche_head(); + print '
'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'
  '.$period_filter.''; //$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...) $filtertype=''; @@ -576,7 +624,7 @@ if ($id > 0 || ! empty($ref)) $var=true; $num = $db->num_rows($result); - $i = 0; $total = 0; $sep = -1; + $i = 0; $total = 0; $sep = -1; $total_deb=0; $total_cred=0; while ($i < $num) { @@ -811,10 +859,12 @@ if ($id > 0 || ! empty($ref)) if ($objp->amount < 0) { print ''.price($objp->amount * -1).'   '.price($objp->amount).'
'; if ($sep > 0) print ' '; // If we had at least one line in future else print $langs->trans("CurrentBalance"); print ' '.$object->currency_code.''.price($total, 0, $langs, 0, 0, -1, $object->currency_code).''.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).' 
'; + if ($sep > 0) print ' '; // If we had at least one line in future + else print $langs->trans("Total"); + print ' '.$object->currency_code.''.price($total_deb*-1, 0, $langs, 0, 0, -1, $object->currency_code).''.price($total_cred, 0, $langs, 0, 0, -1, $object->currency_code).''.price($total_cred-($total_deb*-1), 0, $langs, 0, 0, -1, $object->currency_code).' 
'; //print ''; // Filter @@ -358,6 +361,9 @@ if ($action == 'new') $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); print ''; print '
'.$langs->trans('Date').''.dol_print_date($now,'day').'
'; + + dol_fiche_end(); + print '
'; print ''; if ($filterdate || $filteraccountid > 0) @@ -366,8 +372,7 @@ if ($action == 'new') print ''; } print '
'; - //print ''; - print ''; + print ''; print '
'; $sql = "SELECT ba.rowid as bid, b.datec as datec, b.dateo as date, b.rowid as chqid, "; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 61f0bbb590d..4b92ce7eebc 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -1,6 +1,7 @@ - * Copyright (C) 2013 Laurent Destailleur +/* Copyright (C) 2013 Antoine Iauch + * Copyright (C) 2013 Laurent Destailleur + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -26,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $langs->load("products"); $langs->load("categories"); @@ -245,7 +247,7 @@ if ($modecompta == 'CREANCES-DETTES') // Category filter print '
'; - print $langs->trans("Category") . ': ' . $formother->select_categories(0, $selected_cat, 'search_categ', true); + print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true); print ' '; print $langs->trans("SubCats") . '? '; print ' - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2013 Antoine Iauch +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2013 Antoine Iauch + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $langs->load("companies"); $langs->load("categories"); @@ -313,7 +315,7 @@ print ""; // Category filter print ''; print ''; print ''; // Other attributes @@ -1036,7 +1036,7 @@ else // Statut print ''; print ''; print ''."\n"; // Other attributes diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a61b0ea37bf..72590c82e82 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -970,7 +970,7 @@ class Contact extends CommonObject } elseif ($mode == 4) { - if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('StatusContactDraft'); + if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); } elseif ($mode == 5) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index ec8004aa18a..72eee453c9f 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1,12 +1,12 @@ - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Raphaël Doursenaud - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry +/* Copyright (C) 2001-2004 Rodolphe Quiedeville + * Copyright (C) 2003 Eric Seigne + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013-2015 Raphaël Doursenaud + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -275,8 +275,9 @@ if ($result) if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$formother->select_categories(4,$search_categ,'search_categ',1); + $moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1); $moreforfilter.='       '; } if ($moreforfilter) diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 84e8ae88431..56cdbe90ca3 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -177,7 +177,7 @@ else } -print '
'; -print $langs->trans("Category") . ': ' . $formother->select_categories(2, $selected_cat, 'search_categ', true); +print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', true); print ' '; print $langs->trans("SubCats") . '? '; print ''.$langs->trans("Status").''; - print $object->getLibStatut(5); + print $object->getLibStatut(4); print '
'.$langs->trans("Status").''; - print $object->getLibStatut(5); + print $object->getLibStatut(4); print '
'; +print '
'; print ''."\n"; $var=true; $listofstatus=array(0,4,4,5); $bool=false; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 77877a37cb2..0bd0625ee5d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -418,7 +418,7 @@ abstract class CommonObject /** * Get array of all contacts for an object * - * @param int $statut Status of lines to get (-1=all) + * @param int $statut Status of links to get (-1=all) * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param int $list 0:Return array contains all properties, 1:Return array contains just id * @return array Array of contacts @@ -429,9 +429,9 @@ abstract class CommonObject $tab=array(); - $sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user - if ($source == 'internal') $sql.=", '-1' as socid"; - if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid"; + $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user + if ($source == 'internal') $sql.=", '-1' as socid, t.statut as statuscontact"; + if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid, t.statut as statuscontact"; $sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email"; $sql.= ", tc.source, tc.element, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; @@ -463,8 +463,8 @@ abstract class CommonObject $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); $tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id, 'nom'=>$obj->lastname, // For backward compatibility - 'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, - 'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut, 'fk_c_type_contact' => $obj->fk_c_type_contact); + 'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'statuscontact'=>$obj->statuscontact, + 'rowid'=>$obj->rowid, 'code'=>$obj->code, 'libelle'=>$libelle_type, 'status'=>$obj->statuslink, 'fk_c_type_contact'=>$obj->fk_c_type_contact); } else { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 1c132502b78..e2313d157d5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -923,7 +923,12 @@ class ExtraFields } elseif ($type == 'chkbxlst') { - $value_arr = explode(',', $value); + if (is_array($value)) { + $value_arr = $value; + } + else { + $value_arr = explode(',', $value); + } if (is_array($param['options'])) { $param_list = array_keys($param['options']); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 39634e6af31..b4e5a8a0ec0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1,21 +1,21 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2014 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2006 Marc Barilley/Ocebo - * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2010-2014 Philippe Grand - * Copyright (C) 2011 Herve Prot - * Copyright (C) 2012-2014 Marcos García - * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud - * Copyright (C) 2014 Alexandre Spangaro +/* Copyright (c) 2002-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2014 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2006 Marc Barilley/Ocebo + * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2014 Philippe Grand + * Copyright (C) 2011 Herve Prot + * Copyright (C) 2012-2014 Marcos García + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2012-2015 Raphaël Doursenaud + * Copyright (C) 2014 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -4304,36 +4304,40 @@ class Form /** * Return a HTML select string, built from an array of key+value. - * Note: Do not use returned string into a langs->trans function, content may be entity encoded twice. + * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice. * - * @param string $htmlname Name of html select area - * @param array $array Array with key+value - * @param string $id Preselected key - * @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' '). - * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value" - * @param int $value_as_key 1 to use value as key - * @param string $moreparam Add more parameters onto the select tag - * @param int $translate Translate and encode value - * @param int $maxlen Length maximum for labels - * @param int $disabled Html select box is disabled - * @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort - * @param string $morecss Add more class to css styles - * @param int $addjscombo Add js combo - * @return string HTML select string. + * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect + * @param array $array Array with key+value + * @param string|string[] $id Preselected key or preselected keys for multiselect + * @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' '). + * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value" + * @param int $value_as_key 1 to use value as key + * @param string $moreparam Add more parameters onto the select tag + * @param int $translate Translate and encode value + * @param int $maxlen Length maximum for labels + * @param int $disabled Html select box is disabled + * @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort + * @param string $morecss Add more class to css styles + * @param int $addjscombo Add js combo + * @return string HTML select string. * @see multiselectarray */ static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0) { global $conf, $langs; + // Do we want a multiselect ? + $multiselect = 0; + if (preg_match('/^multi/',$htmlname)) $multiselect = 1; + if ($value_as_key) $array=array_combine($array, $array); $out=''; // Add code for jquery to use multiselect - if ($addjscombo && empty($conf->dol_use_jmobile) && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) + if ($addjscombo && empty($conf->dol_use_jmobile) && $multiselect) { - $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; + $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2':$conf->global->MAIN_USE_JQUERY_MULTISELECT; $out.=' "; } @@ -4974,21 +4975,22 @@ function dol_getmypid() /** - * Generate natural SQL search string + * Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields) * - * @param string|string[] $fields String or array of strings, filled with the name of fields in the SQL query + * @param string|string[] $fields String or array of strings, filled with the name of all fields in the SQL query we must check (combined with a OR) * @param string $value The value to look for. - * If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2 - * If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000" - * @param integer $numeric 0=value is list of keywords, 1=value is a numeric test + * If param $mode is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2 + * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000" + * If param $mode is 2, can contains a list of id separated by comma like "1,3,4" + * @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4') * @param integer $nofinaland 1=Do now output the final 'AND' * @return string $res The statement to append to the SQL query */ -function natural_search($fields, $value, $numeric=0, $nofinaland=0) +function natural_search($fields, $value, $mode=0, $nofinaland=0) { global $db,$langs; - if ($numeric) + if ($mode == 1) { $value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do } @@ -5005,7 +5007,7 @@ function natural_search($fields, $value, $numeric=0, $nofinaland=0) $newres = ''; foreach ($fields as $field) { - if ($numeric) + if ($mode == 1) { $operator='='; $newcrit = preg_replace('/([<>=]+)/','',trim($crit)); @@ -5029,8 +5031,13 @@ function natural_search($fields, $value, $numeric=0, $nofinaland=0) $i2++; // a criteria was added to string } } - else + else if ($mode == 2) { + $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $db->escape(trim($crit)) . ")"; + $i2++; // a criteria was added to string + } + else + { $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($crit)) . "%'"; $i2++; // a criteria was added to string } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 1a1fd706e0a..e06577cf8f5 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -637,10 +637,21 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m //$date=dol_mktime(12, 0, 0, 1, 1, 1900); //$date=dol_stringtotime('20130101'); + $hasglobalcounter=false; // Extract value for mask counter, mask raz and mask offset - if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; - $masktri=$reg[1].(! empty($reg[2])?$reg[2]:'').(! empty($reg[3])?$reg[3]:''); - $maskcounter=$reg[1]; + if (preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) + { + $masktri=$reg[1].(! empty($reg[2])?$reg[2]:'').(! empty($reg[3])?$reg[3]:''); + $maskcounter=$reg[1]; + $hasglobalcounter=true; + } + else + { + // setting some defaults so the rest of the code won't fail if there is a third party counter + $masktri='00000'; + $maskcounter='00000'; + } + $maskraz=-1; $maskoffset=0; $resetEveryMonth=false; @@ -659,6 +670,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; } else $maskrefclient=''; + + // fail if there is neither a global nor a third party counter + if (! $hasglobalcounter && ($maskrefclient_maskcounter == '')) + { + return 'ErrorBadMask'; + } // Extract value for third party type if (preg_match('/\{(t+)\}/i',$mask,$regType)) @@ -993,10 +1010,21 @@ function check_value($mask,$value) { $result=0; + $hasglobalcounter=false; // Extract value for mask counter, mask raz and mask offset - if (! preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; - $masktri=$reg[1].(isset($reg[2])?$reg[2]:'').(isset($reg[3])?$reg[3]:''); - $maskcounter=$reg[1]; + if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg)) + { + $masktri=$reg[1].(isset($reg[2])?$reg[2]:'').(isset($reg[3])?$reg[3]:''); + $maskcounter=$reg[1]; + $hasglobalcounter=true; + } + else + { + // setting some defaults so the rest of the code won't fail if there is a third party counter + $masktri='00000'; + $maskcounter='00000'; + } + $maskraz=-1; $maskoffset=0; if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; @@ -1015,6 +1043,12 @@ function check_value($mask,$value) } else $maskrefclient=''; + // fail if there is neither a global nor a third party counter + if (! $hasglobalcounter && ($maskrefclient_maskcounter == '')) + { + return 'ErrorBadMask'; + } + $maskwithonlyymcode=$mask; $maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$maskcounter,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode); diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 695c3d65629..0dbdcf64a86 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -1,6 +1,7 @@ - * Copyright (C) 2015 Alexandre Spangaro +/* Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -70,7 +71,9 @@ function member_prepare_head(Adherent $object) // Show category tab if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=3'; + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $type = Categorie::TYPE_MEMBER; + $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type; $head[$h][1] = $langs->trans('Categories'); $head[$h][2] = 'category'; $h++; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6c94d5595dd..6174e2de121 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -6,7 +6,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * @@ -1099,7 +1099,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categstatic=new Categorie($db); // recovering the list of all the categories linked to product - $tblcateg=$categstatic->containing($idprod,0); + $tblcateg=$categstatic->containing($idprod, Categorie::TYPE_PRODUCT); foreach ($tblcateg as $cate) { // Adding the descriptions if they are filled diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 32e5fa4ba78..e6a84657d87 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -1,7 +1,8 @@ - * Copyright (C) 2007 Rodolphe Quiedeville - * Copyright (C) 2009-2010 Regis Houssin +/* Copyright (C) 2006-2008 Laurent Destailleur + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2009-2010 Regis Houssin + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -60,7 +61,9 @@ function product_prepare_head($object) /* No more required. Replaced with new multiselect component if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { - $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=0'; + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $type = Categorie::TYPE_PRODUCT; + $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type; $head[$h][1] = $langs->trans('Categories'); $head[$h][2] = 'category'; $h++; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7bba3d5edfa..b1197202d1b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -583,11 +583,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("commercial"); $newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); - if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); - if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); - if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); - if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); - if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); + if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); $newmenu->add("/societe/soc.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer); //$newmenu->add("/contact/list.php?leftmenu=customers&type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 73a8390c9e6..c6492ab5161 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2011 Regis Houssin * Copyright (C) 2013 Cedric Gross + * Copyright (C) 2015 Bahfir Abbes * * 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 @@ -90,6 +91,7 @@ class modAgenda extends DolibarrModules $this->const[12] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_VALIDATE","chaine","1"); $this->const[13] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_SENTBYMAIL","chaine","1"); $this->const[14] = array("MAIN_AGENDA_ACTIONAUTO_BILL_UNVALIDATE","chaine","1"); + $this->const[15] = array("MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_UNVALIDATE","chaine","1"); // New pages on tabs // ----------------- diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 867b7cb9ffb..382abbe81c0 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2013-2015 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -164,6 +164,8 @@ $userstatic=new User($db);
id=$tab[$i]['id']; @@ -182,24 +184,24 @@ $userstatic=new User($db);
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 46a6cd0daa6..8a77bf86b4f 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2013 Cedric GROSS * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Bahfir Abbes * * 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 @@ -493,6 +494,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + $object->sendtoid=0; + } + elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') + { + $langs->load("other"); + $langs->load("bills"); + + $object->actiontypecode='AC_OTH_AUTO'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + $object->sendtoid=0; } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index 8da8c6e3e00..99a8a152384 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2014 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Bahfir Abbes * * 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 @@ -197,6 +198,7 @@ class InterfaceDemo extends DolibarrTriggers case 'BILL_SUPPLIER_PAYED': case 'BILL_SUPPLIER_UNPAYED': case 'BILL_SUPPLIER_VALIDATE': + case 'BILL_SUPPLIER_UNVALIDATE': case 'LINEBILL_SUPPLIER_CREATE': case 'LINEBILL_SUPPLIER_UPDATE': case 'LINEBILL_SUPPLIER_DELETE': diff --git a/htdocs/don/index.php b/htdocs/don/index.php index e157c465a9b..7630ed8d3e7 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -85,7 +85,7 @@ print '
'.$langs->trans("Statistics").' - '.$langs->trans("Services").'
'; print '
'; -print ''; +print '
'; print ''; print ''; print "\n"; diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index b1f09ffcb22..226987c0c44 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -1,6 +1,7 @@ * Copyright (C) 2008-2012 Regis Houssin + * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +21,6 @@ * \file htdocs/ecm/docdir.php * \ingroup ecm * \brief Main page for ECM section area - * \author Laurent Destailleur */ require '../main.inc.php'; @@ -154,6 +154,8 @@ if ($action == 'create') $title=$langs->trans("ECMNewSection"); print_fiche_titre($title); + + dol_fiche_head(); print '
'.$langs->trans("Statistics").'
'; @@ -174,6 +176,8 @@ if ($action == 'create') print ''."\n"; print '

'; + + dol_fiche_end(); print '
'; print ''; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 994ddb28310..1cfbe941d9a 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2015 Bahfir Abbes * * 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 @@ -1073,7 +1074,14 @@ class FactureFournisseur extends CommonInvoice } } } - + // Triggers call + if (! $error && empty($notrigger)) + { + // Call trigger + $result=$this->call_trigger('BILL_SUPPLIER_VALIDATE',$user); + if ($result < 0) $error++; + // End call triggers + } if ($error == 0) { $this->db->commit(); diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 0943e76c3a5..60b9b65e8e8 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -114,7 +114,7 @@ if ($resql) } $db->free($resql); - print ''; + print '
'; print ''; print "\n"; foreach (array(0,1,2,3,4,5,6) as $statut) diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index c44aa39622d..8f77ea73115 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Philippe Grand - * Copyright (C) 2013 Cédric Salvador +/* Copyright (C) 2001-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011 Philippe Grand + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -167,8 +168,9 @@ if ($resql) $moreforfilter=''; if (! empty($conf->categorie->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$htmlother->select_categories(1,$search_categ,'search_categ',1); + $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_SUPPLIER,$search_categ,'search_categ',1); $moreforfilter.='       '; } if ($moreforfilter) diff --git a/htdocs/fourn/product/categorie.php b/htdocs/fourn/product/categorie.php deleted file mode 100644 index ef07b730a97..00000000000 --- a/htdocs/fourn/product/categorie.php +++ /dev/null @@ -1,175 +0,0 @@ - - * Copyright (C) 2005 Brice Davoleau - * Copyright (C) 2005-2007 Regis Houssin - * Copyright (C) 2012 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/fourn/product/categorie.php - * \ingroup product - * \brief Page of products categories - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - -$langs->load("categories"); - -$mesg = ''; - -if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden(); - -/* - * Creation de l'objet produit correspondant a l'id - */ -if ($_GET["id"]) -{ - $product = new Product($db); - $result = $product->fetch($_GET["id"]); -} - -llxHeader("","",$langs->trans("CardProduct0")); - -/* - * Fiche produit - */ -if ($_GET["id"]) -{ - //on veut supprimer une cat�gorie - if ($_REQUEST["cat"]) - { - $cat = new Categorie($db); - $cat->del_product($product); - } - - //on veut ajouter une cat�gorie - if (isset($_REQUEST["add_cat"]) && $_REQUEST["add_cat"]>=0) - { - $cat = new Categorie($db); - $cat->add_product($product); - } - - if ( $result ) - { - - /* - * En mode visu - */ - - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/fourn/product/card.php?id=".$product->id; - $head[$h][1] = $langs->trans("Card"); - $h++; - - - if (! empty($conf->stock->enabled)) - { - $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; - $head[$h][1] = $langs->trans("Stock"); - $h++; - } - - if (! empty($conf->fournisseur->enabled)) - { - $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; - $head[$h][1] = $langs->trans("Suppliers"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; - $head[$h][1] = $langs->trans("Photos"); - $h++; - - $head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$product->id; - $head[$h][1] = $langs->trans('Statistics'); - $h++; - - //affichage onglet cat�gorie - if (! empty($conf->categorie->enabled)){ - $head[$h][0] = DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id; - $head[$h][1] = $langs->trans('Categories'); - $hselected = $h; - $h++; - } - - - dol_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); - - print($mesg); - print '
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'
'; - print ""; - print ''; - - print ''; - print "
'.$langs->trans("Ref").''.$product->ref.'
'.$langs->trans("Label").''.$product->label.'

\n"; - - $c = new Categorie($db); - $cats = $c->containing($_REQUEST['id'],0); - - if (count($cats) > 0) - { - print "Vous avez stock� le produit dans les cat�gorie suivantes:

"; - print ''; - print ''; - - - foreach ($cats as $cat) - { - - $ways = $cat->print_all_ways(); - foreach ($ways as $way) - { - $i = !$i; - print ""; - print "\n"; - - } - - } - print "
'.$langs->trans("AllWays").'
".$way."".$langs->trans("DeleteFromCat")."


\n"; - } - else if($cats < 0) - { - print $langs->trans("ErrorUnknown"); - } - - else - { - print $langs->trans("NoCat")."

"; - } - - } - - print $langs->trans("AddProductToCat")."

"; - print ''; - print ''; - print ''; - print ""; - print "

"; - -} -$db->close(); - - -llxFooter(); diff --git a/htdocs/fourn/product/index.php b/htdocs/fourn/product/index.php deleted file mode 100644 index 28e84e30f6a..00000000000 --- a/htdocs/fourn/product/index.php +++ /dev/null @@ -1,153 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/product/index.php - * \ingroup product - * \brief Page accueil des produits et services - */ - -require '../../main.inc.php'; - -// Security check -if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden(); - - -/* - * View - */ - -llxHeader("","",$langs->trans("ProductsAndServices")); - -print_fiche_titre($langs->trans("ProductsAndServicesArea")); - -print ''; - -print '
'; - -/* - * Zone recherche produit/service - */ -print '
'; -print ''; -print ''; -print "\n"; -print ''; -print "'; -print "'; -print "
'.$langs->trans("Search").'
"; -print $langs->trans("Ref").' :
"; -print $langs->trans("Label").' :

\n"; - -/* - * Nombre de produits et/ou services - */ -$prodser = array(); -$sql = "SELECT count(*), p.fk_product_type"; -$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; -$sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; -$sql.= " GROUP BY p.fk_product_type"; -$resql=$db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $prodser[$row[1]] = $row[0]; - $i++; - } - $db->free($resql); -} - -print ''; -print ''; -if (! empty($conf->product->enabled)) -{ - print ""; - print ''; - print ""; -} -if (! empty($conf->service->enabled)) -{ - print ""; - print ''; - print ""; -} -print '
'.$langs->trans("Statistics").'
'.$langs->trans("Products").''.round($prodser[0]).'
'.$langs->trans("Services").''.round($prodser[1]).'
'; - -print '
'; - - -/* - * Derniers produits en vente - */ -$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.type"; -$sql.= " FROM ".MAIN_DB_PREFIX."product as p "; -$sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; -$sql.= " AND p.fk_product_type <> 1"; -$sql.= " ORDER BY p.datec DESC "; -$sql.= $db->plimit(15, 0); - -$resql = $db->query($sql); - -if ($resql) -{ - $num = $db->num_rows($resql); - - $i = 0; - - if ($num > 0) - { - print ''; - - print ''; - - $var=True; - while ($i < $num) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print ""; - print "\n"; - $i++; - } - $db->free($resql); - - print "
'.$langs->trans("LastProducts").'
rowid\">"; - if ($objp->fk_product_type==1) print img_object($langs->trans("ShowService"),"service"); - else print img_object($langs->trans("ShowProduct"),"product"); - print " rowid\">$objp->ref$objp->label"; - if ($objp->fk_product_type==1) print $langs->trans('ShowService'); - else print $langs->trans('ShowProduct'); - print "
"; - } -} -else -{ - dol_print_error(); -} - -print '
'; - -$db->close(); - -llxFooter(); diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php deleted file mode 100644 index 49f2fc2b65b..00000000000 --- a/htdocs/fourn/product/photos.php +++ /dev/null @@ -1,215 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/fourn/product/photos.php - * \ingroup product - * \brief Page de la fiche produit - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - -$id = GETPOST('id', 'int'); - -if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden(); - -$object = new Product($db); - - -/* - * View - */ - -if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) -{ - if ($id) - { - $result = $object->fetch($id); - - $object->add_photo($conf->product->multidir_output[$object->entity], $_FILES['photofile']); - } -} -/* - * - */ -llxHeader("","",$langs->trans("CardProduct0")); - -/* - * Fiche produit - */ -if ($id) -{ - $result = $object->fetch($id); - - if ( $result ) - { - /* - * En mode visu - */ - - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/fourn/product/card.php?id=".$object->id; - $head[$h][1] = $langs->trans("Card"); - $h++; - - - if (! empty($conf->stock->enabled)) - { - $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; - $head[$h][1] = $langs->trans("Stock"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/fourn/product/photos.php?id=".$object->id; - $head[$h][1] = $langs->trans("Photos"); - $hselected = $h; - $h++; - - //Affichage onglet Categories - if (! empty($conf->categorie->enabled)){ - $head[$h][0] = DOL_URL_ROOT."/fourn/product/categorie.php?id=".$object->id; - $head[$h][1] = $langs->trans('Categories'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/card.php?id=".$object->id; - $head[$h][1] = $langs->trans("CommercialCard"); - $h++; - - dol_fiche_head($head, $hselected, $langs->trans("CardProduct".$object->type).' : '.$object->ref); - - print($mesg); - print ''; - print ""; - print ''; - print ''; - print ''; - print ''; - print "
'.$langs->trans("Ref").''.$object->ref.''; - print $object->getLibStatut(2); - print '
'.$langs->trans("Label").''.$object->label.''.$langs->trans("SellingPrice").''.price($object->price).'

\n"; - - /* - * Ajouter une photo - * - */ - if ($action == 'ajout_photo' && ($user->rights->produit->creer || $user->rights->service->creer) && ! empty($conf->global->MAIN_UPLOAD_DOC)) - { - print_titre($langs->trans("AddPhoto")); - - print '
'; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print '
'.$langs->trans("File").'
'; - print ' '; - - - print '
'; - print '

'; - } - - - // Affiche photos - if ($action != 'ajout_photo') - { - $nbphoto=0; - $nbbyrow=5; - - $pdir = get_exdir($object->id,2,0,0,$object,'product') . $object->id ."/photos/"; - $dir = $conf->product->multidir_output[$object->entity] . '/'. $pdir; - - print '
'; - - foreach ($object->liste_photos($dir) as $obj) - { - $nbphoto++; - - // if ($nbbyrow && $nbphoto == 1) print '
'; - - if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print ''; - if ($nbbyrow) print ''; - if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; - } - - // Ferme tableau - while ($nbphoto % $nbbyrow) - { - print ''; - $nbphoto++; - } - - if ($nbphoto < 1) - { - print '
'; - - print ''; - - // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine - if ($obj['photo_vignette']) $filename=$obj['photo_vignette']; - else $filename=$obj['photo']; - print ''; - - print ''; - print '
'.$langs->trans("File").': '.dol_trunc($filename,16); - if ($user->rights->produit->creer || $user->rights->service->creer) - { - print '
'.img_delete().''; - } - if ($nbbyrow) print '
 
'; - print "
".$langs->trans("NoPhotoYet")."

"; - print '
'; - } - - print '
'; - } - - - print "\n"; - - } - - print "\n
\n"; - - if ($action == '') - { - if (($user->rights->produit->creer || $user->rights->service->creer) && ! empty($conf->global->MAIN_UPLOAD_DOC)) - { - print 'id.'">'; - print $langs->trans("AddPhoto").''; - } - } - - print "\n
\n"; - -} -else -{ - print $langs->trans("ErrorUnknown"); -} - - -llxFooter(); -$db->close(); diff --git a/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css b/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css index 7da7faec899..b257b33bee5 100644 --- a/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css +++ b/htdocs/includes/jquery/plugins/datatables/css/jquery.dataTables.css @@ -154,7 +154,7 @@ table.dataTable tr.even td.sorting_3 { background-color: #F9F9FF; } margin: 0 3px; cursor: pointer; *cursor: hand; - color: #333 !important; + /* DOL_LDR CHANGE color: #333 !important; */ } .paging_full_numbers a.paginate_button { diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 97a52ff6c34..04f8a3caf4c 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -328,8 +328,9 @@ if (! empty($force_install_message)) $option.='>'; $option.=$type.'   '; if ($note) $option.=' '.$note; - // Experimental - if ($type=='mssql') $option.=' '.$langs->trans("Experimental"); + // Deprecated and experimental + if ($type=='mysql') $option.=' ' . $langs->trans("Deprecated"); + elseif ($type=='mssql') $option.=' '.$langs->trans("Experimental"); elseif ($type=='sqlite') $option.=' '.$langs->trans("Experimental"); elseif ($type=='sqlite3') $option.=' '.$langs->trans("Experimental"); // No available diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 1dde6d5d37c..408c7a36ff6 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -8,6 +8,7 @@ -- Copyright (C) 2010-2013 Juanjo Menent -- Copyright (C) 2013 Cedric Gross -- Copyright (C) 2014 Raphaël Doursenaud +-- Copyright (C) 2015 Bahfir Abbes -- -- 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 @@ -74,3 +75,4 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',35); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',36); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_UNVALIDATE', 'Supplier invoice unvalidated', 'Executed when a supplier invoice status is set back to draft', 'invoice_supplier',15); diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 1d5ba017aab..c44fa88c49c 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -625,17 +625,24 @@ ALTER TABLE llx_user ADD gender VARCHAR(10); ALTER TABLE llx_user ADD api_key VARCHAR(128) DEFAULT NULL AFTER pass_temp; ALTER TABLE llx_user ADD INDEX idx_user_api_key (api_key); +-- Deprecated fields +ALTER TABLE llx_actioncomm DROP COLUMN datea; +ALTER TABLE llx_actioncomm DROP INDEX idx_actioncomm_datea; +ALTER TABLE llx_actioncomm DROP COLUMN datea2; - +-- Email tracking ALTER TABLE llx_actioncomm ADD COLUMN email_msgid varchar(256); ALTER TABLE llx_actioncomm ADD COLUMN email_from varchar(256); ALTER TABLE llx_actioncomm ADD COLUMN email_sender varchar(256); ALTER TABLE llx_actioncomm ADD COLUMN email_to varchar(256); ALTER TABLE llx_actioncomm ADD COLUMN errors_to varchar(256); + +-- Recuring events ALTER TABLE llx_actioncomm ADD COLUMN recurid varchar(128); ALTER TABLE llx_actioncomm ADD COLUMN recurrule varchar(128); -ALTER TABLE llx_actioncomm ADD COLUMN ecurdateend datetime; +ALTER TABLE llx_actioncomm ADD COLUMN recurdateend datetime; ALTER TABLE llx_stcomm ADD COLUMN picto varchar(128); - +-- New trigger for Supplier invoice unvalidation +INSERT INTO llx_c_action_trigger (code, label, description, elementtype, rang) VALUES ('BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15); diff --git a/htdocs/install/mysql/tables/llx_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_actioncomm.key.sql index 1da34c65bab..64162dbbc73 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.key.sql @@ -18,7 +18,6 @@ -- =========================================================================== -ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datea (datea); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_code (code); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b1d0f284501..65412df87d0 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -946,7 +946,7 @@ DoNotSuggestPaymentMode=Do not suggest NoActiveBankAccountDefined=No active bank account defined OwnerOfBankAccount=Owner of bank account %s BankModuleNotActive=Bank accounts module not enabled -ShowBugTrackLink=Show link "Report a bug" +ShowBugTrackLink=Show link "%s" ShowWorkBoard=Show "workbench" on homepage Alerts=Alerts Delays=Delays diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 7de123d5ea3..0c61ce35e2e 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -64,6 +64,7 @@ DatabaseSuperUserAccess=Database server - Superuser access CheckToCreateDatabase=Check box if database does not exist and must be created.
In this case, you must fill the login/password for superuser account at the bottom of this page. CheckToCreateUser=Check box if database owner does not exist and must be created.
In this case, you must choose its login and password and also fill the login/password for the superuser account at the bottom of this page. If this box is unchecked, owner database and its passwords must exists. Experimental=(experimental) +Deprecated=(deprecated) DatabaseRootLoginDescription=Login of the user allowed to create new databases or new users, mandatory if your database or its owner does not already exists. KeepEmptyIfNoPassword=Leave empty if user has no password (avoid this) SaveConfigurationFile=Save values @@ -211,4 +212,4 @@ MigrationCategorieAssociation=Migration of categories MigrationEvents=Migration of events to add event owner into assignement table ShowNotAvailableOptions=Show not available options -HideNotAvailableOptions=Hide not available options \ No newline at end of file +HideNotAvailableOptions=Hide not available options diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 841cea51cd0..6df0f77f500 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1004,39 +1004,38 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; $jquerytheme = 'smoothness'; if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; - if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery - else print ''."\n"; // JQuery - print ''."\n"; // Tooltip - print ''."\n"; // JNotify + if (constant('JS_JQUERY_UI')) print ''."\n"; // JQuery + else print ''."\n"; // JQuery + print ''."\n"; // Tooltip + print ''."\n"; // JNotify /*if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD'))) // jQuery fileupload { - print ''."\n"; + print ''."\n"; }*/ if (! empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || (defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES'))) // jQuery datatables { - //print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - //print ''."\n"; - print ''."\n"; + //print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + //print ''."\n"; + print ''."\n"; } if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) // jQuery plugin "mutiselect", "multiple-select", "select2"... { $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; - print ''."\n"; + print ''."\n"; } // jQuery Timepicker if (! empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { - print ''."\n"; + print ''."\n"; } // jQuery jMobile if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) { - print ''."\n"; + print ''."\n"; } - } print ''."\n"; @@ -1065,7 +1064,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (GETPOST('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover','int'); } if (GETPOST('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile','int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); } //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; - print ''."\n"; + print ''."\n"; + if (! empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) print ''."\n".''."\n"; // CSS forced by modules (relative url starting with /) if (! empty($conf->modules_parts['css'])) @@ -1078,7 +1078,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs { if (empty($cssfile)) dol_syslog("Warning: module ".$modcss." declared a css path file into its descriptor that is empty.", LOG_WARNING); // cssfile is a relative path - print ''."\n".''."\n"; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 7443fbdfba0..9c5d27d070e 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,6 +136,8 @@ print_fiche_titre($langs->trans("CreatePoll").' (1 / 2)'); //debut du formulaire print '
'."\n"; +dol_fiche_head(); + //Affichage des différents champs textes a remplir print ''."\n"; @@ -158,6 +161,8 @@ print $form->select_date($champdatefin?$champdatefin:-1,'champdatefin','','','', print ''."\n"; print '
'."\n"; +dol_fiche_end(); + //focus javascript sur le premier champ print '