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..e5953121e82 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'; @@ -1166,11 +1174,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 +1234,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 +1564,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.='
'.$langs->trans("Statistics").' - '.$langs->trans("Services").'