diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index e094a507fcb..0efcf15ff0d 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -18,12 +18,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/** - \file htdocs/admin/barcode.php - \ingroup barcode - \brief Page d'administration/configuration du module Code barre - \version $Id$ -*/ +/** + \file htdocs/admin/barcode.php + \ingroup barcode + \brief Page d'administration/configuration du module Code barre + \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); @@ -34,7 +34,7 @@ $dir = DOL_DOCUMENT_ROOT."/includes/modules/barcode/"; $langs->load("admin"); if (!$user->admin) - accessforbidden(); +accessforbidden(); if ($_POST["action"] == 'setcoder') { @@ -47,17 +47,23 @@ if ($_POST["action"] == 'setcoder') else if ($_POST["action"] == 'setgenbarcodelocation') { dolibarr_set_const($db, "GENBARCODE_LOCATION",$_POST["genbarcodelocation"]); - Header("Location: barcode.php"); - exit; +} +else if ($_POST["action"] == 'setdefaultbarcodetype') +{ + dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $_POST["coder_id"]); +} +else if ($_POST["action"] == 'GENBARCODE_BARCODETYPE_THIRDPARTY') +{ + dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $_POST["coder_id"]); } /* -else if ($_POST["action"] == 'setproductusebarcode') -{ - dolibarr_set_const($db, "PRODUIT_USE_BARCODE",$_POST["value"]); - Header("Location: barcode.php"); - exit; -} -*/ + else if ($_POST["action"] == 'setproductusebarcode') + { + dolibarr_set_const($db, "PRODUIT_USE_BARCODE",$_POST["value"]); + Header("Location: barcode.php"); + exit; + } + */ $html = new Form($db); @@ -80,21 +86,21 @@ $var=true; while (($file = readdir($handle))!==false) { if (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') - { + { if (is_readable($dir.$file)) { if (eregi('(.*)\.modules\.php',$file,$reg)) { $filebis=$reg[1]; - + // Chargement de la classe de codage - require_once($dir.$file); - $classname = "mod".ucfirst($filebis); - $module = new $classname($db); + require_once($dir.$file); + $classname = "mod".ucfirst($filebis); + $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; $barcodelist[$filebis]=$module->info(); } @@ -126,7 +132,7 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; $var=true; - + while ($i < $num) { $obj = $db->fetch_object($resql); @@ -134,7 +140,7 @@ if ($resql) print ''; print $obj->libelle; print "\n"; - print $langs->trans('BarcodeDesc'.$obj->encoding); + print $langs->trans('BarcodeDesc'.$obj->encoding); //print "L'EAN se compose de 8 caract�res, 7 chiffres plus une cl� de contr�le.
"; //print "L'utilisation des symbologies EAN8 impose la souscription et l'abonnement aupr�s d'organisme tel que GENCOD.
"; //print "Codes num�riques utilis�s exclusivement � l'identification des produits susceptibles d'�tre vendus au grand public."; @@ -153,7 +159,7 @@ if ($resql) { $url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($obj->coder).'&code='.urlencode($obj->example).'&encoding='.urlencode($obj->encoding); //print $url; - print ''; + print ''; } else { @@ -213,137 +219,153 @@ if (!isset($_ENV['windir']) && !file_exists($_ENV['windir'])) } // Module produits -/* -if ($conf->produit->enabled) +if ($conf->societe->enabled) { $var=!$var; - print '
'; - print ''; - print ''; - print ''.$langs->trans("UseBarcodeInProductModule").''; + print ""; + print ""; + print ""; + print ''.$langs->trans("SetDefaultBarcodeTypeProducts").''; print ''; - print $html->selectyesno('value',$conf->global->PRODUIT_USE_BARCODE,1); - print ''; - print ''; + print $formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"coder_id",1); + print ''; + print ''; + print ""; + print ''; + print '
'; +} + +// Module produits +if ($conf->produit->enabled) +{ + $var=!$var; + print "
"; + print ""; + print ""; + print ''.$langs->trans("SetDefaultBarcodeTypeThirdParties").''; + print ''; + print $formbarcode->select_barcode_type($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,"coder_id",1); + print ''; + print ''; + print ""; print ''; print '
'; } -*/ print ''; /* -//EAN13 - $var=!$var; - print ''; - print "EAN13"; - print "\n"; - - print "L'EAN se compose de 13 caract�res, 12 chiffres plus une cl� de contr�le. Il fonctionne de la m�me mani�re que l'UPC, avec lequel il est compatible.
"; - print "L'utilisation des symbologies EAN13 impose la souscription et l'abonnement aupr�s d'organisme tel que GENCOD.
"; - print "Codes num�riques utilis�s exclusivement � l'identification des produits susceptibles d'�tre vendus au grand public."; - print ''; + //EAN13 + $var=!$var; + print ''; + print "EAN13"; + print "\n"; - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('EAN13','form'.$i); - print "\n"; - $i++; + print "L'EAN se compose de 13 caract�res, 12 chiffres plus une cl� de contr�le. Il fonctionne de la m�me mani�re que l'UPC, avec lequel il est compatible.
"; + print "L'utilisation des symbologies EAN13 impose la souscription et l'abonnement aupr�s d'organisme tel que GENCOD.
"; + print "Codes num�riques utilis�s exclusivement � l'identification des produits susceptibles d'�tre vendus au grand public."; + print ''; -//UPC - $var=!$var; - print ''; - print "UPC"; - print "\n"; - print "L'UPC est l'�quivalent de l'EAN8/13 pour des pays codificateurs autre que l'Europe.
"; - print "Il ne comporte que 11 chiffres plus la cl�.
"; - print "C'est en r�alit� un code EAN13 dont le premier chiffre serait z�ro et dont la pr�sentation serait l�g�rement diff�rente.
"; - print "Codes num�riques utilis�s exclusivement � l'identification des produits susceptibles d'�tre vendus au grand public."; - print ''; + // Affiche exemple + print ''; - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('UPC','form'.$i); - print "\n"; - $i++; - -//ISBN - $var=!$var; - print ''; - print "ISBN"; - print "\n"; - print "Le code ISBN est un code d�di� au milieu de la presse �crite."; - print ''; + print ''; + print $formbarcode->setBarcodeEncoder('EAN13','form'.$i); + print "\n"; + $i++; - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('ISBN','form'.$i); - print "\n"; - $i++; - -//code 39 - $var=!$var; - print ''; - print "Code 39"; - print "\n"; - print "Premier code alpha num�rique utilis� massivement dans l'Industrie pour sa capacit� d'encodage (chiffres et lettres)
"; - print "ainsi que par son degr� de s�curit� � l'encodage (clef de contr�le).
"; - print "Il met a disposition les 10 chiffres, les 26 lettres de l'alphabet et sept symboles.
"; - print "l'ast�risque (*) sert de caract�re de bornage. La lecture est bidirectionnelle.
"; - print "La longueur est variable mais en g�n�ral ne d�passe pas 32 caract�res."; - print ''; + //UPC + $var=!$var; + print ''; + print "UPC"; + print "\n"; + print "L'UPC est l'�quivalent de l'EAN8/13 pour des pays codificateurs autre que l'Europe.
"; + print "Il ne comporte que 11 chiffres plus la cl�.
"; + print "C'est en r�alit� un code EAN13 dont le premier chiffre serait z�ro et dont la pr�sentation serait l�g�rement diff�rente.
"; + print "Codes num�riques utilis�s exclusivement � l'identification des produits susceptibles d'�tre vendus au grand public."; + print ''; - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('C39','form'.$i); - print "\n"; - $i++; - - -//code 128 - $var=!$var; - print ''; - print "Code 128"; - print "\n"; - print "Ce code \"derni�re g�n�ration\" alpha num�rique est susceptible d'encoder les 128 caract�res de la table ASCII ( chiffres + lettres + symboles ).
"; - print "Le code 128 poss�de des algorithmes de cryptage s�curis�s assez avanc�s.
"; - print "C'est le plus complet des codes � barres, il propose 3 jeux de 128 caract�res.
"; - print "La lecture est bidirectionnelle.
"; - print "La longueur est variable mais en g�n�ral ne d�passe pas 20 caract�res."; - print ''; + // Affiche exemple + print ''; - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('C128','form'.$i); - print "\n"; - $i++; - -//I25 - $var=!$var; - print ''; - print "I25"; - print "\n"; - print "information"; - print ''; + print ''; + print $formbarcode->setBarcodeEncoder('UPC','form'.$i); + print "\n"; + $i++; + + //ISBN + $var=!$var; + print ''; + print "ISBN"; + print "\n"; + print "Le code ISBN est un code d�di� au milieu de la presse �crite."; + print ''; - // Affiche exemple - print ''; - - print ''; - print $formbarcode->setBarcodeEncoder('I25','form'.$i); - print "\n"; - $i++; -*/ + // Affiche exemple + print ''; + + print ''; + print $formbarcode->setBarcodeEncoder('ISBN','form'.$i); + print "\n"; + $i++; + + //code 39 + $var=!$var; + print ''; + print "Code 39"; + print "\n"; + print "Premier code alpha num�rique utilis� massivement dans l'Industrie pour sa capacit� d'encodage (chiffres et lettres)
"; + print "ainsi que par son degr� de s�curit� � l'encodage (clef de contr�le).
"; + print "Il met a disposition les 10 chiffres, les 26 lettres de l'alphabet et sept symboles.
"; + print "l'ast�risque (*) sert de caract�re de bornage. La lecture est bidirectionnelle.
"; + print "La longueur est variable mais en g�n�ral ne d�passe pas 32 caract�res."; + print ''; + + // Affiche exemple + print ''; + + print ''; + print $formbarcode->setBarcodeEncoder('C39','form'.$i); + print "\n"; + $i++; + + + //code 128 + $var=!$var; + print ''; + print "Code 128"; + print "\n"; + print "Ce code \"derni�re g�n�ration\" alpha num�rique est susceptible d'encoder les 128 caract�res de la table ASCII ( chiffres + lettres + symboles ).
"; + print "Le code 128 poss�de des algorithmes de cryptage s�curis�s assez avanc�s.
"; + print "C'est le plus complet des codes � barres, il propose 3 jeux de 128 caract�res.
"; + print "La lecture est bidirectionnelle.
"; + print "La longueur est variable mais en g�n�ral ne d�passe pas 20 caract�res."; + print ''; + + // Affiche exemple + print ''; + + print ''; + print $formbarcode->setBarcodeEncoder('C128','form'.$i); + print "\n"; + $i++; + + //I25 + $var=!$var; + print ''; + print "I25"; + print "\n"; + print "information"; + print ''; + + // Affiche exemple + print ''; + + print ''; + print $formbarcode->setBarcodeEncoder('I25','form'.$i); + print "\n"; + $i++; + */ print "
"; diff --git a/htdocs/admin/produit.php b/htdocs/admin/produit.php index 90062ebbd57..18173bea586 100644 --- a/htdocs/admin/produit.php +++ b/htdocs/admin/produit.php @@ -21,11 +21,11 @@ */ /** - \file htdocs/admin/produit.php - \ingroup produit - \brief Page d'administration/configuration du module Produit - \version $Id$ -*/ + \file htdocs/admin/produit.php + \ingroup produit + \brief Page d'administration/configuration du module Produit + \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); @@ -36,87 +36,87 @@ $langs->load("propal"); $langs->load("products"); if (!$user->admin) - accessforbidden(); +accessforbidden(); if ($_POST["action"] == 'nbprod') { - dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", $_POST["value"]); + dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", $_POST["value"]); } else if ($_POST["action"] == 'multiprix_num') { - dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", $_POST["value"]); + dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", $_POST["value"]); } if ($_POST["action"] == 'multiprix') { - $res=$db->DDLDescTable(MAIN_DB_PREFIX."societe","price_level"); - if(! $db->fetch_row($res)) - { - $field_desc = array('type'=>'TINYINT','value'=>'4','default'=>'1'); - if ($_POST["activate_multiprix"]) - { - // on ajoute le champ price_level dans la table societe - if ($db->DDLAddField(MAIN_DB_PREFIX."societe","price_level",$field_desc) < 0) - { - dolibarr_print_error($db); - exit; - } - } - dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); - dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); - } - else - { - dolibarr_syslog("Table definition for ".MAIN_DB_PREFIX."societe already ok"); - dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); - dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); - } + $res=$db->DDLDescTable(MAIN_DB_PREFIX."societe","price_level"); + if(! $db->fetch_row($res)) + { + $field_desc = array('type'=>'TINYINT','value'=>'4','default'=>'1'); + if ($_POST["activate_multiprix"]) + { + // on ajoute le champ price_level dans la table societe + if ($db->DDLAddField(MAIN_DB_PREFIX."societe","price_level",$field_desc) < 0) + { + dolibarr_print_error($db); + exit; + } + } + dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); + dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); + } + else + { + dolibarr_syslog("Table definition for ".MAIN_DB_PREFIX."societe already ok"); + dolibarr_set_const($db, "PRODUIT_MULTIPRICES", $_POST["activate_multiprix"]); + dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", "6"); + } } else if ($_POST["action"] == 'sousproduits') { - $res=$db->DDLDescTable(MAIN_DB_PREFIX."product_association"); - if(! $db->fetch_row($res)) - { - $table = MAIN_DB_PREFIX."product_association"; - $fields['fk_product_pere'] = array('type'=>'int','value'=>'11','null'=> 'not null','default'=> '0'); - $fields['fk_product_fils'] = array('type'=>'int','value'=>'11','null'=> 'not null','default'=> '0'); - $fields['qty'] = array('type'=>'double','default'=> 'null'); - $keys['idx_product_association_fk_product_pere'] = "fk_product_pere" ; - $keys['idx_product_association_fk_product_fils'] = "fk_product_fils" ; - if ($db->DDLCreateTable($table,$fields,"","InnoDB","","",$keys) < 0) + $res=$db->DDLDescTable(MAIN_DB_PREFIX."product_association"); + if(! $db->fetch_row($res)) { + $table = MAIN_DB_PREFIX."product_association"; + $fields['fk_product_pere'] = array('type'=>'int','value'=>'11','null'=> 'not null','default'=> '0'); + $fields['fk_product_fils'] = array('type'=>'int','value'=>'11','null'=> 'not null','default'=> '0'); + $fields['qty'] = array('type'=>'double','default'=> 'null'); + $keys['idx_product_association_fk_product_pere'] = "fk_product_pere" ; + $keys['idx_product_association_fk_product_fils'] = "fk_product_fils" ; + if ($db->DDLCreateTable($table,$fields,"","InnoDB","","",$keys) < 0) + { dolibarr_print_error($db); exit; - } - else - { + } + else + { dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $_POST["activate_sousproduits"]); + } + } + else + { + dolibarr_syslog("Table definition already ok"); + dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $_POST["activate_sousproduits"]); } - } - else - { - dolibarr_syslog("Table definition already ok"); - dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $_POST["activate_sousproduits"]); - } } else if ($_POST["action"] == 'viewProdDescInForm') { - dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $_POST["activate_viewProdDescInForm"]); + dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $_POST["activate_viewProdDescInForm"]); } else if ($_POST["action"] == 'confirmDeleteProdLineInForm') { - dolibarr_set_const($db, "PRODUIT_CONFIRM_DELETE_LINE", $_POST["activate_confirmDeleteProdLineInForm"]); + dolibarr_set_const($db, "PRODUIT_CONFIRM_DELETE_LINE", $_POST["activate_confirmDeleteProdLineInForm"]); } else if ($_POST["action"] == 'ProductCanvasAbility') { - dolibarr_set_const($db, "PRODUCT_CANVAS_ABILITY", $_POST["ProductCanvasAbility"]); - // Create temp directory for smarty - if (! empty($dolibarr_smarty_compile)) create_exdir($dolibarr_smarty_compile); - if (! empty($dolibarr_smarty_cache)) create_exdir($dolibarr_smarty_cache); + dolibarr_set_const($db, "PRODUCT_CANVAS_ABILITY", $_POST["ProductCanvasAbility"]); + // Create temp directory for smarty + if (! empty($dolibarr_smarty_compile)) create_exdir($dolibarr_smarty_compile); + if (! empty($dolibarr_smarty_cache)) create_exdir($dolibarr_smarty_cache); } else if ($_POST["action"] == 'usesearchtoselectproduct') { - dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectproduct"]); + dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $_POST["activate_usesearchtoselectproduct"]); } else if ($_GET["action"] == 'set') { @@ -126,11 +126,7 @@ else if ($_GET["action"] == 'set') } else if ($_POST["action"] == 'useecotaxe') { - dolibarr_set_const($db, "PRODUIT_USE_ECOTAXE", $_POST["activate_useecotaxe"]); -} -else if ($_POST["action"] == 'setdefaultbarcodetype') -{ - dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $_POST["coder_id"]); + dolibarr_set_const($db, "PRODUIT_USE_ECOTAXE", $_POST["activate_useecotaxe"]); } @@ -186,15 +182,15 @@ print ''; // multiprix nombre de prix a proposer if($conf->global->PRODUIT_MULTIPRICES == 1) { - $var=!$var; - print "
"; - print ""; - print ""; - print ''.$langs->trans("MultiPricesNumPrices").''; - print "global->PRODUIT_MULTIPRICES_LIMIT."\">"; - print ''; - print ''; - print '
'; + $var=!$var; + print "
"; + print ""; + print ""; + print ''.$langs->trans("MultiPricesNumPrices").''; + print "global->PRODUIT_MULTIPRICES_LIMIT."\">"; + print ''; + print ''; + print '
'; } // sousproduits activation/desactivation @@ -219,17 +215,17 @@ print ""; print ''.$langs->trans("UseSearchToSelectProduct").''; if (! $conf->use_javascript_ajax) { - print ''; - print $langs->trans("NotAvailableWhenAjaxDisabled"); - print ""; + print ''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print ""; } else { - print ''; - print $html->selectyesno("activate_usesearchtoselectproduct",$conf->global->PRODUIT_USE_SEARCH_TO_SELECT,1); - print ''; - print ''; - print ""; + print ''; + print $html->selectyesno("activate_usesearchtoselectproduct",$conf->global->PRODUIT_USE_SEARCH_TO_SELECT,1); + print ''; + print ''; + print ""; } print ''; print ''; @@ -276,25 +272,9 @@ print ""; print ''; print ''; -// Barcode -if ($conf->global->MAIN_MODULE_BARCODE) -{ - $var=!$var; - print "
"; - print ""; - print ""; - print ''.$langs->trans("SetDefaultBarcodeType").''; - print ''; - print $formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"coder_id",1); - print ''; - print ''; - print ""; - print ''; - print '
'; -} // Only rodolphe and auguria menu manage canvas menu (auguria not correctly yet) -if (eregi('^rodolphe',$conf->left_menu) || eregi('^auguria',$conf->left_menu)) +if (eregi('^rodolphe',$conf->left_menu) || eregi('^auguria',$conf->left_menu)) { // Propose utilisation de canvas. // Ces derniers ne sont geres que par le menu default @@ -330,30 +310,30 @@ if (eregi('^rodolphe',$conf->left_menu) || eregi('^auguria',$conf->left_menu)) if (substr($file, strlen($file) -10) == '.class.php' && substr($file,0,8) == 'product.') { $parts = explode('.',$file); - $classname = 'Product'.ucfirst($parts[1]); - require_once($dir.$file); + $classname = 'Product'.ucfirst($parts[1]); + require_once($dir.$file); $module = new $classname(); - + $var=!$var; print ""; - + print $module->description; - + print ''; - + $const = "PRODUIT_SPECIAL_".strtoupper($parts[1]); if ($conf->global->$const) { print img_tick(); print ''; - print ''.$langs->trans("Disable").''; + print ''.$langs->trans("Disable").''; } else { print ' '; print ''.$langs->trans("Activate").''; } - + print ''; } } diff --git a/htdocs/compta/facture/retardspaiement.php b/htdocs/compta/facture/retardspaiement.php new file mode 100644 index 00000000000..5e789805f9a --- /dev/null +++ b/htdocs/compta/facture/retardspaiement.php @@ -0,0 +1,365 @@ + + * Copyright (C) 2004 Éric Seigne + * Copyright (C) 2004-2007 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + +/** + \file htdocs/compta/facture/retardspaiement.php + \ingroup facture + \brief Page de liste des factures clients impayées + \version $Revision$ +*/ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); +require_once(DOL_DOCUMENT_ROOT."/paiement.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/includes/fpdf/fpdfi/fpdi.php"); + +$langs->load("bills"); + +// Security check +$facid = isset($_GET["facid"])?$_GET["facid"]:''; +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'facture',$facid,''); + + +llxHeader('',$langs->trans("BillsLate")); + +$html = new Form($db); +$formfile = new FormFile($db); +?> +rights->facture->lire) +{ + + + if ($_POST["action"] == "generate_pdf"){ + if(is_array($_POST['toGenerate'])) + { + + $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ; + + // liste les fichiers + $files = array() ; + $factures_bak = $factures ; + foreach($_POST['toGenerate'] as $basename){ + foreach($factures as $facture){ + if(strstr($facture["name"],$basename)){ + $files[] = DOL_DATA_ROOT . '/facture/' . $basename . '/' . $facture["name"] ; + } + } + } + + // génère le PDF à partir de tous les autres fichiers + $pdf=new FPDI(); + foreach($files as $file){ + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) { + $tplidx = $pdf->ImportPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } + } + + // vérifie que le chemin d'accès est bien accessible + if(!is_dir(DOL_DATA_ROOT . '/facture/impayes')) mkdir(DOL_DATA_ROOT . '/facture/impayes') ; + + // enregistre le fichier pdf concaténé + $pdf->Output( DOL_DATA_ROOT . '/facture/impayes/impayes '.dolibarr_date('Y-m-d H:i:s',time()).'.pdf'); + + } else { + print '
'.$langs->trans('UnpayedNotChecked').'
' ; + } + } + + $limit = $conf->liste_limit; + $offset = $limit * $page ; + + $sql = "SELECT s.nom, s.rowid as socid"; + $sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc"; + $sql.= ", ".$db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite"; + $sql.= ", f.paye as paye, f.rowid as facid, f.fk_statut"; + $sql.= ", sum(pf.amount) as am"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ",".MAIN_DB_PREFIX."facture as f"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; + $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " AND f.paye = 0 AND f.fk_statut = 1 AND f.date_lim_reglement < NOW()"; + if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql .= " AND s.rowid = ".$socid; + + if ($_GET["filtre"]) + { + $filtrearr = split(",", $_GET["filtre"]); + foreach ($filtrearr as $fil) + { + $filt = split(":", $fil); + $sql .= " AND " . $filt[0] . " = " . $filt[1]; + } + } + + if ($_GET["search_ref"]) + { + $sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'"; + } + + if ($_GET["search_societe"]) + { + $sql .= " AND s.nom like '%".$_GET["search_societe"]."%'"; + } + + if ($_GET["search_montant_ht"]) + { + $sql .= " AND f.total = '".$_GET["search_montant_ht"]."'"; + } + + if ($_GET["search_montant_ttc"]) + { + $sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'"; + } + + if (strlen($_POST["sf_ref"]) > 0) + { + $sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'"; + } + $sql.= " GROUP BY f.facnumber"; + + $sql.= " ORDER BY "; + $listfield=split(',',$sortfield); + foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; + $sql.= " f.facnumber DESC"; + + //$sql .= $db->plimit($limit+1,$offset); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + + if ($socid) + { + $soc = new Societe($db); + $soc->fetch($socid); + } + + $titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsLate")); + print_barre_liste($titre,$page,"retardspaiement.php","&socid=$socid",$sortfield,$sortorder,'',0); // We don't want pagination on this page + $i = 0; + print ''; + print ''; + + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=$socid","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Generate"),$_SERVER["PHP_SELF"],""); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socid=$socid",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socid=$socid",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socid=$socid",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socid=$socid",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socid=$socid",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socid=$socid",'align="right"',$sortfield,$sortorder); + print "\n"; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + print ''; + + + $facturestatic=new Facture($db); + + if ($num > 0) + { + $var=True; + $total_ht=0; + $total_ttc=0; + $total_payed=0; + + print ''; + print ''; + + while ($i < $num) + { + $objp = $db->fetch_object($result); + + $var=!$var; + + print ""; + $class = "impayee"; + + print '' ; + + print "\n"; + + print "\n"; + print "\n"; + + print ''; + + print ""; + print ""; + print ""; + + // Affiche statut de la facture + print ''; + + print "\n"; + $total_ht+=$objp->total_ht; + $total_ttc+=$objp->total_ttc; + $total_payed+=$objp->am; + + $i++; + } + + print ''; + print ""; + print ""; + print ""; + print ""; + print ''; + print "\n"; + } + + print "
'; + print '  '; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + + $facturestatic->id=$objp->facid; + $facturestatic->ref=$objp->facnumber; + $facturestatic->type=$objp->type; + + print ''; + print ''; + + print ''; + + print '
'; + print $facturestatic->getNomUrl(1); + print ''; + if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); + print ''; + + $filename=sanitize_string($objp->facnumber); + $filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber); + $urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid; + $formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1); + + print '
'; + + print '
".dolibarr_print_date($objp->df)."".dolibarr_print_date($objp->datelimite)."'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'".price($objp->total_ht)."".price($objp->total_ttc)."".price($objp->am)."'; + print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); + print '
".$langs->trans("Total").": ".price($total_ht)."".price($total_ttc)."".price($total_payed)." 
"; + + /* + * Gestion des documents générés + */ + $filedir=$conf->facture->dir_output . '/impayes'; + $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; + $genallowed=$user->rights->facture->creer; + $delallowed=$user->rights->facture->supprimer; + + //class="pair" ou "impair" pour les tr + $var = false ; $bc = array("pair","impair") ; + + // liste des fichier + $file_list=dol_dir_list($filedir,'files',0,'impayes.*','\.meta$','date',SORT_DESC);; + + print '
' ; + print_titre($langs->trans("Documents")); + print ''; + print '' ; + print '' ; + print '' ; + // Pour chaque fichier on affiche une ligne + foreach($file_list as $file){ + $filepath = $filedir."/".$file["name"] ; + $var = !$var ; + print '' ; + // Nom du fichier + print '' ; + // Taille + print '' ; + // Date + print '' ; + // Suppression + print '' ; + print '' ; + } + + print '
'.$langs->trans("File").''.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf($file["name"],2)." ".$file["name"].''.filesize($filepath). ' bytes'.dolibarr_print_date(filemtime($filepath),'dayhour').''.img_delete().'
'; + + print ''; + + $db->free(); + + + } + else + { + dolibarr_print_error($db); + } + +} + + + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/document.php b/htdocs/document.php index 58871685e85..f0cb5087ba6 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -108,6 +108,16 @@ if ($modulepart) $original_file=$conf->facture->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='$refname'"; } + + if ($modulepart == 'impayes') + { + $user->getrights('facture'); + if ($user->rights->facture->lire || eregi('^specimen',$original_file)) + { + $accessallowed=1; + } + $original_file=$original_file; + } // Wrapping pour les fiches intervention if ($modulepart == 'ficheinter') diff --git a/htdocs/fourn/product/fiche.php b/htdocs/fourn/product/fiche.php index a62b9316a9c..d198199798c 100644 --- a/htdocs/fourn/product/fiche.php +++ b/htdocs/fourn/product/fiche.php @@ -22,11 +22,11 @@ */ /** - \file htdocs/fourn/product/fiche.php - \ingroup product - \brief Page de la fiche produit - \version $Revision$ -*/ + \file htdocs/fourn/product/fiche.php + \ingroup product + \brief Page de la fiche produit + \version $Revision$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php"); @@ -55,142 +55,142 @@ if ($_GET["action"] == 'fastappro') // Action ajout d'un produit ou service if ($_POST["action"] == 'add' && $user->rights->produit->creer) { - $product = new Product($db); + $product = new Product($db); - $product->ref = $_POST["ref"]; - $product->libelle = $_POST["libelle"]; - $product->price = $_POST["price"]; - $product->catid = $_POST["catid"]; - $product->tva_tx = $_POST["tva_tx"]; - $product->type = $_POST["type"]; - $product->status = $_POST["statut"]; - $product->description = $_POST["desc"]; - $product->duration_value = $_POST["duration_value"]; - $product->duration_unit = $_POST["duration_unit"]; - $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; + $product->ref = $_POST["ref"]; + $product->libelle = $_POST["libelle"]; + $product->price = $_POST["price"]; + $product->catid = $_POST["catid"]; + $product->tva_tx = $_POST["tva_tx"]; + $product->type = $_POST["type"]; + $product->status = $_POST["statut"]; + $product->description = $_POST["desc"]; + $product->duration_value = $_POST["duration_value"]; + $product->duration_unit = $_POST["duration_unit"]; + $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; - $e_product = $product; + $e_product = $product; - $id = $product->create($user); - if ($id > 0) - { - Header("Location: fiche.php?id=$id"); - } - else - { - if ($id == -3) - { - $mesg='
'.$product->error.'
'; - $_error = 1; - $_GET["action"] = "create"; - $_GET["type"] = $_POST["type"]; - } - } + $id = $product->create($user); + if ($id > 0) + { + Header("Location: fiche.php?id=$id"); + } + else + { + if ($id == -3) + { + $mesg='
'.$product->error.'
'; + $_error = 1; + $_GET["action"] = "create"; + $_GET["type"] = $_POST["type"]; + } + } } // Action mise a jour d'un produit ou service -if ($_POST["action"] == 'update' && - $_POST["cancel"] <> $langs->trans("Cancel") && - $user->rights->produit->creer) +if ($_POST["action"] == 'update' && +$_POST["cancel"] <> $langs->trans("Cancel") && +$user->rights->produit->creer) { - $product = new Product($db); - if ($product->fetch($_POST["id"])) - { - $product->ref = $_POST["ref"]; - $product->libelle = $_POST["libelle"]; - $product->price = $_POST["price"]; - $product->description = $_POST["desc"]; - $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; - $product->duration_value = $_POST["duration_value"]; - $product->duration_unit = $_POST["duration_unit"]; - - if ($product->check()) + $product = new Product($db); + if ($product->fetch($_POST["id"])) { + $product->ref = $_POST["ref"]; + $product->libelle = $_POST["libelle"]; + $product->price = $_POST["price"]; + $product->description = $_POST["desc"]; + $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; + $product->duration_value = $_POST["duration_value"]; + $product->duration_unit = $_POST["duration_unit"]; + + if ($product->check()) + { if ($product->update($product->id, $user) > 0) - { - $_GET["action"] = ''; - $_GET["id"] = $_POST["id"]; + { + $_GET["action"] = ''; + $_GET["id"] = $_POST["id"]; - Header("Location: fiche.php?id=".$_POST["id"]); + Header("Location: fiche.php?id=".$_POST["id"]); - } + } else - { - $_GET["action"] = 're-edit'; - $_GET["id"] = $_POST["id"]; - $mesg = $product->mesg_error; - } - } - else - { + { + $_GET["action"] = 're-edit'; + $_GET["id"] = $_POST["id"]; + $mesg = $product->mesg_error; + } + } + else + { $_GET["action"] = 're-edit'; $_GET["id"] = $_POST["id"]; $mesg = $langs->trans("ErrorProductBadRefOrLabel"); + } } - } } if ($_POST["action"] == 'add_fourn' && $_POST["cancel"] <> $langs->trans("Cancel")) { - $product = new Product($db); - if( $product->fetch($_GET["id"]) ) - { - if ($product->add_fournisseur($user, $_POST["id_fourn"], $_POST["ref_fourn"]) > 0) + $product = new Product($db); + if( $product->fetch($_GET["id"]) ) { + if ($product->add_fournisseur($user, $_POST["id_fourn"], $_POST["ref_fourn"]) > 0) + { $action = ''; - } - else - { + } + else + { $action = ''; + } } - } } if ($_GET["action"] == 'remove_fourn') { - $product = new ProductFournisseur($db); - if( $product->fetch($_GET["id"]) ) - { - if ($product->remove_fournisseur($user, $_GET["id_fourn"]) > 0) + $product = new ProductFournisseur($db); + if( $product->fetch($_GET["id"]) ) { + if ($product->remove_fournisseur($user, $_GET["id_fourn"]) > 0) + { $_GET["action"] = ''; $mesg = $langs->trans("SupplierRemoved"); - } - else - { + } + else + { $_GET["action"] = ''; + } } - } } -if ($_POST["action"] == 'update_price' && - $_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->produit->creer) +if ($_POST["action"] == 'update_price' && +$_POST["cancel"] <> $langs->trans("Cancel") && $user->rights->produit->creer) { - $product = new Product($db); + $product = new Product($db); - $result = $product->fetch($_GET["id"]); + $result = $product->fetch($_GET["id"]); - $product->price = ereg_replace(" ","",$_POST["price"]); + $product->price = ereg_replace(" ","",$_POST["price"]); - if ( $product->update_price($product->id, $user) > 0 ) + if ( $product->update_price($product->id, $user) > 0 ) - { - $_GET["action"] = ''; - $mesg = 'Fiche mise à jour'; - } - else - { - $_GET["action"] = 'edit_price'; - $mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error; - } + { + $_GET["action"] = ''; + $mesg = 'Fiche mise à jour'; + } + else + { + $_GET["action"] = 'edit_price'; + $mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error; + } } if ($_POST["cancel"] == $langs->trans("Cancel")) { - $action = ''; - Header("Location: fiche.php?id=".$_POST["id"]); + $action = ''; + Header("Location: fiche.php?id=".$_POST["id"]); } @@ -203,407 +203,407 @@ llxHeader("","",$langs->trans("CardProduct0")); */ if ($_GET["action"] == 'create' && $user->rights->produit->creer) { - $html = new Form($db); - $nbligne=0; - $product = new Product($db); - if ($_error == 1) - { - $product = $e_product; - } - - print '
'; - print ''; - print ''."\n"; - print ''."\n"; - - if ($_GET["type"]!=1) { $title=$langs->trans("NewProduct"); } - if ($_GET["type"]==1) { $title=$langs->trans("NewService"); } - print_fiche_titre($title); - - print ''; - - if ($mesg) print $mesg; - - if ($conf->categorie->enabled) - { - print ''; + print ''; + + if ($_GET["type"] != 1 && $conf->stock->enabled) + { + print "".''; + } + else + { + print ''; + } + print '"; + if ($_GET["type"] == 1) + { + print ''; + } + + print ''; + print '
'.$langs->trans("Categorie"); - print ''; - - if (isset($_REQUEST["catid"])) + $html = new Form($db); + $nbligne=0; + $product = new Product($db); + if ($_error == 1) { + $product = $e_product; + } + + print ''; + print ''; + print ''."\n"; + print ''."\n"; + + if ($_GET["type"]!=1) { $title=$langs->trans("NewProduct"); } + if ($_GET["type"]==1) { $title=$langs->trans("NewService"); } + print_fiche_titre($title); + + print ''; + + if ($mesg) print $mesg; + + if ($conf->categorie->enabled) + { + print ''; } - print ''; - } - print ''; - print ''; - - if ($_GET["type"] != 1 && $conf->stock->enabled) - { - print "".''; - } - else - { - print ''; - } - print '"; - if ($_GET["type"] == 1) - { - print ''; - } - - print ''; - print '
'.$langs->trans("Categorie"); + print ''; + + if (isset($_REQUEST["catid"])) + { $c = new Categorie ($db, $_REQUEST["catid"]); $ways = $c->print_all_ways(' > ','fourn/product/liste.php'); print $ways[0]."
\n"; + } + print '
'.$langs->trans("Ref").''; - if ($_error == 1) - { - print $langs->trans("RefAlreadyExists"); - } - print '
'.$langs->trans("Label").'
Seuil stock'; - print ''; - print '
'.$langs->trans("Description").''; - print '
'.$langs->trans("Duration").'  '; - print ''.$langs->trans("Day").' '; - print ''.$langs->trans("Week").' '; - print ''.$langs->trans("Month").' '; - print ''.$langs->trans("Year").' '; - print '
 
'; - print ''; + print '
'.$langs->trans("Ref").''; + if ($_error == 1) + { + print $langs->trans("RefAlreadyExists"); + } + print '
'.$langs->trans("Label").'
Seuil stock'; + print ''; + print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Duration").'  '; + print ''.$langs->trans("Day").' '; + print ''.$langs->trans("Week").' '; + print ''.$langs->trans("Month").' '; + print ''.$langs->trans("Year").' '; + print '
 
'; + print ''; } else { - /* - * Fiche produit - */ - if ($_GET["id"]) - { - if ($_GET["action"] <> 're-edit') - { - $product = new Product($db); - $result = $product->fetch($_GET["id"]); - } - - if ( $product->id > 0 ) - { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { - /* - * En mode visu - */ - - $h=0; - - $head[$h][0] = DOL_URL_ROOT."/fourn/product/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans("Card"); - $hselected = $h; - $h++; - - if($product->isproduct()) - { - if ($conf->stock->enabled) - { - $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; - $head[$h][1] = $langs->trans("Stock"); - $h++; - } - } - - $head[$h][0] = DOL_URL_ROOT."/fourn/product/photos.php?id=".$product->id; - $head[$h][1] = $langs->trans("Photos"); - $h++; - - //Affichage onglet Catégories - if ($conf->categorie->enabled){ - $head[$h][0] = DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id; - $head[$h][1] = $langs->trans('Categories'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans("CommercialCard"); - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); - - if ($mesg) print($mesg); - - print ''; - - if ($conf->categorie->enabled) - { - print ''; - print ''; - print ''; - } - - print ""; - print ''; - print ''; - print ''; - print ''; - - $nblignefour=2; - if ($product->isproduct() && $conf->stock->enabled) $nblignefour++; - if ($product->isservice()) $nblignefour++; - - print ''; - - // Description - print ''; - - // Stock - if ($product->isproduct() && $conf->stock->enabled) + /* + * Fiche produit + */ + if ($_GET["id"]) + { + if ($_GET["action"] <> 're-edit') { - print ''; - if ($product->no_stock) - { - print "'; + $product = new Product($db); + $result = $product->fetch($_GET["id"]); } - - // Duration - if ($product->isservice()) + + if ( $product->id > 0 ) { - print ''; - } - print "
'; - $cat = new Categorie ($db); - $way = $cat->print_primary_way($product->id," > ",'fourn/product/liste.php',"product"); - if ($way == "") - { - print "Ce produit n'appartient à aucune catégorie"; - } - else - { - print $langs->trans("Categorie")." : "; - print $way; - } - print '
'.$langs->trans("Ref").''.$product->ref.''; - print $product->getLibStatut(2); - print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("SellingPrice").''.price($product->price).''; - $product->show_photos($conf->produit->dir_output,1,1,0); - print '
'.$langs->trans("Description").''.nl2br($product->description).'
'.$langs->trans("Stock").'Pas de définition de stock pour ce produit"; - } - else - { - if ($product->stock_reel <= $product->seuil_stock_alerte) - { - print ''.img_warning().' '.$product->stock_reel.' Seuil : '.$product->seuil_stock_alerte; - } - else - { - print "".$product->stock_reel; - } - } - print '
'.$langs->trans("Duration").''.$product->duration_value.' '; - - if ($product->duration_value > 1) - { - $dur=array("d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); - } - else - { - $dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); - } - print $langs->trans($dur[$product->duration_unit])." "; - - print '

\n"; - - // Liste des fournisseurs - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $sql = "SELECT s.nom, s.rowid as socid, pf.ref_fourn, pfp.price, pfp.quantity"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur as pf"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON s.rowid = pfp.fk_soc"; - $sql .= " AND pfp.fk_product =".$product->id; - $sql .= " WHERE pf.fk_soc = s.rowid AND pf.fk_product = ".$product->id; - $sql .= " ORDER BY pfp.price ASC, lower(s.nom)"; - - if ( $db->query($sql) ) - { - $num_fournisseur = $db->num_rows($resql); - $i = 0; - $var=True; - while ($i < $num_fournisseur) - { - $objp = $db->fetch_object($resql); - $var=!$var; - print ""; - print ''; - print ''; - - print ''; - print ''; - $i++; - } - $db->free(); - } - print '
'; - print $langs->trans("Suppliers").''.$langs->trans("Ref").''.$langs->trans("BuiingPrice").''.$langs->trans("Quantity").'
'.$objp->nom.''; - print ''; - print img_edit($langs->trans("Modify")); - print ' '; - print $objp->ref_fourn.''; - print price($objp->price); - print ''.$objp->quantity.'
'; - print "\n"; - - - /* - * Ajouter un fournisseur - * - */ - if ($_GET["action"] == 'ajout_fourn' && $user->rights->produit->creer) - { - $langs->load("suppliers"); - - print_titre($langs->trans("AddSupplier")); - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("Suppliers").''; + + if ($conf->categorie->enabled) + { + print ''; + print ''; + print ''; + } + + print ""; + print ''; + print ''; + print ''; + print ''; + + $nblignefour=2; + if ($product->isproduct() && $conf->stock->enabled) $nblignefour++; + if ($product->isservice()) $nblignefour++; + + print ''; + + // Description + print ''; + + // Stock + if ($product->isproduct() && $conf->stock->enabled) + { + print ''; + if ($product->no_stock) + { + print "'; + } + + // Duration + if ($product->isservice()) + { + print ''; + } + print "
'; + $cat = new Categorie ($db); + $way = $cat->print_primary_way($product->id," > ",'fourn/product/liste.php',"product"); + if ($way == "") + { + print "Ce produit n'appartient à aucune catégorie"; + } + else + { + print $langs->trans("Categorie")." : "; + print $way; + } + print '
'.$langs->trans("Ref").''.$product->ref.''; + print $product->getLibStatut(2); + print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("SellingPrice").''.price($product->price).''; + $product->show_photos($conf->produit->dir_output,1,1,0); + print '
'.$langs->trans("Description").''.nl2br($product->description).'
'.$langs->trans("Stock").'Pas de définition de stock pour ce produit"; + } + else + { + if ($product->stock_reel <= $product->seuil_stock_alerte) + { + print ''.img_warning().' '.$product->stock_reel.' Seuil : '.$product->seuil_stock_alerte; + } + else + { + print "".$product->stock_reel; + } + } + print '
'.$langs->trans("Duration").''.$product->duration_value.' '; + + if ($product->duration_value > 1) + { + $dur=array("d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); + } + else + { + $dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); + } + print $langs->trans($dur[$product->duration_unit])." "; + + print '

\n"; + + // Liste des fournisseurs + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $sql = "SELECT s.nom, s.rowid as socid, pf.ref_fourn, pfp.price, pfp.quantity"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur as pf"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON s.rowid = pfp.fk_soc"; + $sql .= " AND pfp.fk_product =".$product->id; + $sql .= " WHERE pf.fk_soc = s.rowid AND pf.fk_product = ".$product->id; + $sql .= " ORDER BY pfp.price ASC, lower(s.nom)"; + + if ( $db->query($sql) ) + { + $num_fournisseur = $db->num_rows($resql); + $i = 0; + $var=True; + while ($i < $num_fournisseur) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ""; + print ''; + print ''; + + print ''; + print ''; + $i++; + } + $db->free(); + } + print '
'; + print $langs->trans("Suppliers").''.$langs->trans("Ref").''.$langs->trans("BuiingPrice").''.$langs->trans("Quantity").'
'.$objp->nom.''; + print ''; + print img_edit($langs->trans("Modify")); + print ' '; + print $objp->ref_fourn.''; + print price($objp->price); + print ''.$objp->quantity.'
'; + print "\n"; + + + /* + * Ajouter un fournisseur + * + */ + if ($_GET["action"] == 'ajout_fourn' && $user->rights->produit->creer) + { + $langs->load("suppliers"); + + print_titre($langs->trans("AddSupplier")); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans("Suppliers").'
'.$langs->trans("SupplierRef").'
'; + print ' '; + print '
'; + print ''; + } } - $db->free($resql); - } - print '
'.$langs->trans("SupplierRef").'
'; - print ' '; - print '
'; - print ''; - } - } - + /* * Fiche en mode edition */ if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer) - { - - if ($product->isservice()) { - print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$product->ref, ""); - } else { - print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$product->ref, ""); - } - - if ($mesg) { - print '
'.$mesg.'

'; - } - - print "
\n"; - print ''; - print ''; - print ''; - print "".''; - print ''; - - - if ($product->isproduct() && $conf->stock->enabled) - { - print "".''; - } - else - { - print ''; - } - print '"; - - if ($product->isservice()) - { - print ''; - } - - print ''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
Seuil stock'; - print ''; - print '
'.$langs->trans("Description").''; - print '
'.$langs->trans("Duration").''; - print '  '; - print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); - print '  '; - print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); - print '  '; - print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); - print '  '; - print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); - - print '
 '; - print '
'; - print '
'; - } - - - - - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ - - print "\n
\n"; - - if ($_GET["action"] == '') - { - if ( $user->rights->produit->creer) - { - print ''.$langs->trans("Modify").''; - } - - if ($product->isproduct() && $conf->stock->enabled) - { - print ''.$langs->trans("CorrectStock").''; - } + { + + if ($product->isservice()) { + print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$product->ref, ""); + } else { + print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$product->ref, ""); + } + + if ($mesg) { + print '
'.$mesg.'

'; + } + + print "
\n"; + print ''; + print ''; + print ''; + print "".''; + print ''; + + + if ($product->isproduct() && $conf->stock->enabled) + { + print "".''; + } + else + { + print ''; + } + print '"; + + if ($product->isservice()) + { + print ''; + } + + print ''; + print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
Seuil stock'; + print ''; + print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Duration").''; + print '  '; + print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); + print '  '; + print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); + print '  '; + print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); + print '  '; + print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); - print ''.$langs->trans("AddSupplier").''; - - if ($product->isproduct() && $user->rights->commande->creer) - { - $langs->load('orders'); - print ''; - print $langs->trans("CreateOrder").''; - } - - } - + print '
 '; + print '
'; + print '
'; + } + + + + + /* ************************************************************************** */ + /* */ + /* Barre d'action */ + /* */ + /* ************************************************************************** */ + + print "\n
\n"; + + if ($_GET["action"] == '') + { + if ( $user->rights->produit->creer) + { + print ''.$langs->trans("Modify").''; + } + + if ($product->isproduct() && $conf->stock->enabled) + { + print ''.$langs->trans("CorrectStock").''; + } + + print ''.$langs->trans("AddSupplier").''; + + if ($product->isproduct() && $user->rights->commande->creer) + { + $langs->load('orders'); + print ''; + print $langs->trans("CreateOrder").''; + } + + } + print "\n
\n"; - - } - else - { + + } + else + { print $langs->trans("BadId"); - } - } - else - { - print $langs->trans("BadId"); - } + } + } + else + { + print $langs->trans("BadId"); + } } $db->close(); diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php index a33790492eb..14cd52ff3a6 100644 --- a/htdocs/fourn/product/photos.php +++ b/htdocs/fourn/product/photos.php @@ -111,7 +111,7 @@ if ($_GET["id"]) * Ajouter une photo * */ - if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $product->isproduct() && $conf->upload) + if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $conf->upload) { print_titre($langs->trans("AddPhoto")); @@ -195,7 +195,7 @@ if ($_GET["id"]) if ($_GET["action"] == '') { - if ( $user->rights->produit->creer && $product->isproduct() && $conf->upload) + if ( $user->rights->produit->creer && $conf->upload) { print ''; print $langs->trans("AddPhoto").''; diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index b645a5e02f6..fa3989389b1 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -425,6 +425,8 @@ class MenuLeft { } if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpayed"),2,$user->rights->facture->lire); + if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/retardspaiement.php?leftmenu=customers_bills",$langs->trans("BillsLate"),2,$user->rights->facture->lire); + if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),2,$user->rights->facture->lire); if (eregi("customers_bills_payments",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/paiement/avalider.php?leftmenu=customers_bills_payments",$langs->trans("MenuToValid"),3,$user->rights->facture->lire); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 13afbf4ca40..7b4ed98a250 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -826,7 +826,8 @@ ModifyProductDescAbility=Personalization of descriptions produced in the forms ViewProductDescInFormAbility=Visualization of product descriptions in the forms (otherwise as popup tooltip) UseSearchToSelectProduct=Use a search form to choose a product (intead of using a list box) UseEcoTaxeAbility=Support Eco-Taxe (WEEE) -SetDefaultBarcodeType=Default barcode type to use for products +SetDefaultBarcodeTypeProducts=Default barcode type to use for products +SetDefaultBarcodeTypeThirdParties=Default barcode type to use for third parties ##### Syslog ##### SyslogSetup=Syslog module setup SyslogOutput=Log output diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 0aa97db0be9..5b0b12b6158 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -930,7 +930,7 @@ ModifyProductDescAbility=Personalizaci ViewProductDescInFormAbility=Visualización de las descripciones de los productos en los formularios UseSearchToSelectProduct=Utilizar un formulario de búsqueda para la selección de un producto (en vez de la lista desplegable) UseEcoTaxeAbility=Asumir ecotasa (DEEE) -SetDefaultBarcodeType=tipo códigos de barra utiliazdos por defecto para los productos +SetDefaultBarcodeTypeProducts=tipo códigos de barra utiliazdos por defecto para los productos ##### Suppliers ##### diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 737a849b913..a770633e75f 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -826,7 +826,8 @@ ViewProductDescInFormAbility=Visualisation des descriptions produits dans les fo UseSearchToSelectProduct=Utiliser un formulaire de recherche pour choix d'un produit (plutôt que liste déroulante) UseEcoTaxeAbility=Prise en charge des éco-taxes (DEEE) UseMinPrice=Utilisation d'un prix minimum de vente -SetDefaultBarcodeType=Type de code barre utilisé par défaut pour les produits +SetDefaultBarcodeTypeProducts=Type de code barre utilisé par défaut pour les produits +SetDefaultBarcodeTypeThirdParties=Type de code barre utilisé par défaut pour les tiers ##### Suppliers ##### SuppliersSetup=Configuration du module Fournisseur ##### Syslog ##### diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index a572e0ec464..3c87ffa918c 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -7,6 +7,7 @@ BillsCustomersUnpayed=Factures clients impay BillsCustomersUnpayedForCompany=Factures clients impayées pour %s BillsSuppliersUnpayed=Factures fournisseurs impayées BillsUnpayed=Impayées +BillsLate=Retards de paiement BillsStatistics=Statistiques factures InvoiceStandard=Facture standard InvoiceStandardAsk=Facture standard @@ -233,6 +234,7 @@ InvoicePayed=Facture pay PaymentNumber=Numéro paiement RemoveDiscount=Supprimer remise WatermarkOnDraftBill=Filigrane sur les brouillons de factures (aucun si vide) +UnpayedNotChecked=Aucune facture impayées n'a été sélectionnée # PaymentConditions PaymentConditionShortRECEP=A réception diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index a78edc4a55b..846820a2568 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -19,233 +19,233 @@ */ /** - \file htdocs/lib/product.lib.php - \brief Ensemble de fonctions de base pour le module produit et service - \version $Id$ -*/ + \file htdocs/lib/product.lib.php + \brief Ensemble de fonctions de base pour le module produit et service + \version $Id$ + */ function product_prepare_head($product, $user) { - global $langs, $conf; - $h = 0; - $head = array(); - - $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans("Card"); - $head[$h][2] = 'card'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; - $head[$h][1] = $langs->trans("Price"); - $head[$h][2] = 'price'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; - $head[$h][1] = $langs->trans("Photos"); - $head[$h][2] = 'photos'; - $h++; - - //affichage onglet cat�gorie - if ($conf->categorie->enabled) - { - $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$product->id; - $head[$h][1] = $langs->trans('Categories'); - $head[$h][2] = 'category'; - $h++; - } - - // Affichage onglet code barre - if ($conf->global->MAIN_MODULE_BARCODE && $product->isproduct() && $user->rights->barcode->lire) - { - $head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id; - $head[$h][1] = $langs->trans("BarCode"); - $head[$h][2] = 'barcode'; - $h++; - } - - // Multilangs - if($conf->global->MAIN_MULTILANGS) - { - $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; - $head[$h][1] = $langs->trans("Translation"); - $head[$h][2] = 'translation'; - $h++; - } - - // sousproduits - if($conf->global->PRODUIT_SOUSPRODUITS == 1) - { - $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('AssociatedProducts'); - $head[$h][2] = 'subproduct'; - $h++; - } - - if ($conf->fournisseur->enabled) - { - $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; - $head[$h][1] = $langs->trans("Suppliers"); - $head[$h][2] = 'suppliers'; - $h++; - } - - $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('Statistics'); - $head[$h][2] = 'stats'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; - $head[$h][1] = $langs->trans('Referers'); - $head[$h][2] = 'referers'; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id; - $head[$h][1] = $langs->trans('Documents'); - $head[$h][2] = 'documents'; - $h++; - - if($product->isproduct()) // Si produit stockable - { - if ($conf->stock->enabled) + global $langs, $conf; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; + $head[$h][1] = $langs->trans("Price"); + $head[$h][2] = 'price'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][1] = $langs->trans("Photos"); + $head[$h][2] = 'photos'; + $h++; + + //affichage onglet cat�gorie + if ($conf->categorie->enabled) { + $head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$product->id; + $head[$h][1] = $langs->trans('Categories'); + $head[$h][2] = 'category'; + $h++; + } + + // Affichage onglet code barre + if ($conf->global->MAIN_MODULE_BARCODE) + { + $head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$product->id; + $head[$h][1] = $langs->trans("BarCode"); + $head[$h][2] = 'barcode'; + $h++; + } + + // Multilangs + if($conf->global->MAIN_MULTILANGS) + { + $head[$h][0] = DOL_URL_ROOT."/product/traduction.php?id=".$product->id; + $head[$h][1] = $langs->trans("Translation"); + $head[$h][2] = 'translation'; + $h++; + } + + // sousproduits + if($conf->global->PRODUIT_SOUSPRODUITS == 1) + { + $head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans('AssociatedProducts'); + $head[$h][2] = 'subproduct'; + $h++; + } + + if ($conf->fournisseur->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; + $head[$h][1] = $langs->trans("Suppliers"); + $head[$h][2] = 'suppliers'; + $h++; + } + + $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; + $head[$h][1] = $langs->trans('Statistics'); + $head[$h][2] = 'stats'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; + $head[$h][1] = $langs->trans('Referers'); + $head[$h][2] = 'referers'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id; + $head[$h][1] = $langs->trans('Documents'); + $head[$h][2] = 'documents'; + $h++; + + if($product->isproduct()) // Si produit stockable + { + if ($conf->stock->enabled) + { $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; $head[$h][1] = $langs->trans("Stock"); $head[$h][2] = 'stock'; $h++; + } } - } - /* - * Onglets additionnels pour les canvas - */ - if(is_array($product->onglets)) - { - foreach ($product->onglets as $onglet) + /* + * Onglets additionnels pour les canvas + */ + if(is_array($product->onglets)) { + foreach ($product->onglets as $onglet) + { $head[$h] = $onglet; $h++; + } } - } - return $head; + return $head; } function show_stats_for_company($product,$socid) { - global $conf,$langs,$user,$db; - - print ''; - print ''.$langs->trans("Referers").''; - print ''.$langs->trans("NbOfThirdParties").''; - print ''.$langs->trans("NbOfReferers").''; - print ''.$langs->trans("TotalQuantity").''; - print ''; - - // Propals - if ($conf->propal->enabled && $user->rights->propale->lire) - { - $ret=$product->load_stats_propale($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("propal"); - print ''; - print ''.img_object('','propal').' '.$langs->trans("Proposals").''; - print ''; - print $product->stats_propale['customers']; - print ''; - print $product->stats_propale['nb']; - print ''; - print $product->stats_propale['qty']; - print ''; - print ''; - } - // Commandes clients - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $ret=$product->load_stats_commande($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("orders"); - print ''; - print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; - print ''; - print $product->stats_commande['customers']; - print ''; - print $product->stats_commande['nb']; - print ''; - print $product->stats_commande['qty']; - print ''; - print ''; - } - // Commandes fournisseurs - if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) - { - $ret=$product->load_stats_commande_fournisseur($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("orders"); - print ''; - print ''.img_object('','order').' '.$langs->trans("SuppliersOrders").''; - print ''; - print $product->stats_commande_fournisseur['suppliers']; - print ''; - print $product->stats_commande_fournisseur['nb']; - print ''; - print $product->stats_commande_fournisseur['qty']; - print ''; - print ''; - } - // Contrats - if ($conf->contrat->enabled && $user->rights->contrat->lire) - { - $ret=$product->load_stats_contrat($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("contracts"); - print ''; - print ''.img_object('','contract').' '.$langs->trans("Contracts").''; - print ''; - print $product->stats_contrat['customers']; - print ''; - print $product->stats_contrat['nb']; - print ''; - print $product->stats_contrat['qty']; - print ''; - print ''; - } - // Factures clients - if ($conf->facture->enabled && $user->rights->facture->lire) - { - $ret=$product->load_stats_facture($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("bills"); - print ''; - print ''.img_object('','bill').' '.$langs->trans("CustomersInvoices").''; - print ''; - print $product->stats_facture['customers']; - print ''; - print $product->stats_facture['nb']; - print ''; - print $product->stats_facture['qty']; - print ''; - print ''; - } - // Factures fournisseurs - if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) - { - $ret=$product->load_stats_facture_fournisseur($socid); - if ($ret < 0) dolibarr_print_error($db); - $langs->load("bills"); - print ''; - print ''.img_object('','bill').' '.$langs->trans("SuppliersInvoices").''; - print ''; - print $product->stats_facture_fournisseur['suppliers']; - print ''; - print $product->stats_facture_fournisseur['nb']; - print ''; - print $product->stats_facture_fournisseur['qty']; - print ''; - print ''; - } + global $conf,$langs,$user,$db; - return 0; + print ''; + print ''.$langs->trans("Referers").''; + print ''.$langs->trans("NbOfThirdParties").''; + print ''.$langs->trans("NbOfReferers").''; + print ''.$langs->trans("TotalQuantity").''; + print ''; + + // Propals + if ($conf->propal->enabled && $user->rights->propale->lire) + { + $ret=$product->load_stats_propale($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("propal"); + print ''; + print ''.img_object('','propal').' '.$langs->trans("Proposals").''; + print ''; + print $product->stats_propale['customers']; + print ''; + print $product->stats_propale['nb']; + print ''; + print $product->stats_propale['qty']; + print ''; + print ''; + } + // Commandes clients + if ($conf->commande->enabled && $user->rights->commande->lire) + { + $ret=$product->load_stats_commande($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("orders"); + print ''; + print ''.img_object('','order').' '.$langs->trans("CustomersOrders").''; + print ''; + print $product->stats_commande['customers']; + print ''; + print $product->stats_commande['nb']; + print ''; + print $product->stats_commande['qty']; + print ''; + print ''; + } + // Commandes fournisseurs + if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) + { + $ret=$product->load_stats_commande_fournisseur($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("orders"); + print ''; + print ''.img_object('','order').' '.$langs->trans("SuppliersOrders").''; + print ''; + print $product->stats_commande_fournisseur['suppliers']; + print ''; + print $product->stats_commande_fournisseur['nb']; + print ''; + print $product->stats_commande_fournisseur['qty']; + print ''; + print ''; + } + // Contrats + if ($conf->contrat->enabled && $user->rights->contrat->lire) + { + $ret=$product->load_stats_contrat($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("contracts"); + print ''; + print ''.img_object('','contract').' '.$langs->trans("Contracts").''; + print ''; + print $product->stats_contrat['customers']; + print ''; + print $product->stats_contrat['nb']; + print ''; + print $product->stats_contrat['qty']; + print ''; + print ''; + } + // Factures clients + if ($conf->facture->enabled && $user->rights->facture->lire) + { + $ret=$product->load_stats_facture($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("bills"); + print ''; + print ''.img_object('','bill').' '.$langs->trans("CustomersInvoices").''; + print ''; + print $product->stats_facture['customers']; + print ''; + print $product->stats_facture['nb']; + print ''; + print $product->stats_facture['qty']; + print ''; + print ''; + } + // Factures fournisseurs + if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) + { + $ret=$product->load_stats_facture_fournisseur($socid); + if ($ret < 0) dolibarr_print_error($db); + $langs->load("bills"); + print ''; + print ''.img_object('','bill').' '.$langs->trans("SuppliersInvoices").''; + print ''; + print $product->stats_facture_fournisseur['suppliers']; + print ''; + print $product->stats_facture_fournisseur['nb']; + print ''; + print $product->stats_facture_fournisseur['qty']; + print ''; + print ''; + } + + return 0; }