From 6905e054712e42ca8d5c7a8cee8a7616bdd6ec05 Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 14 Feb 2013 14:58:09 +0100 Subject: [PATCH 01/23] Fix : bad method name for prospect status --- htdocs/comm/prospect/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 69aaab9e68e..37e97255fef 100755 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -398,7 +398,7 @@ if ($resql) print ''.dol_print_date($db->jdate($obj->datec)).''; // Level print ''; - print $prospectstatic->LibLevel($obj->fk_prospectlevel); + print $prospectstatic->getLibProspLevel($obj->fk_prospectlevel); print ""; // Statut print ''; From b57cb41d11fc047c79936da279dd3d5543d951b4 Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 14 Feb 2013 23:34:44 +0100 Subject: [PATCH 02/23] Add select list in extrafields type --- htdocs/core/admin_extrafields.inc.php | 19 ++++- htdocs/core/class/extrafields.class.php | 72 +++++++++++++++---- htdocs/core/tpl/admin_extrafields_add.tpl.php | 35 ++++++--- .../install/mysql/migration/3.3.0-3.4.0.sql | 5 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/langs/fr_FR/errors.lang | 1 + 8 files changed, 113 insertions(+), 22 deletions(-) diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 46ed7d0c051..29c71f9ba45 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -28,6 +28,7 @@ $extrasize=GETPOST('size'); if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8'; if (GETPOST('type')=='date') $extrasize=''; if (GETPOST('type')=='datetime') $extrasize=''; +if (GETPOST('type')=='select') $extrasize=''; // Add attribute @@ -58,13 +59,29 @@ if ($action == 'add') $mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $action = 'create'; } + if (GETPOST('type')=='select' && !GETPOST('extra_value')) + { + $error++; + $langs->load("errors"); + $mesg=$langs->trans("ErrorNoValueForSelectType"); + $action = 'create'; + } if (! $error) { // Type et taille non encore pris en compte => varchar(255) if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { - $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0)); + // Construct array for parameter (value of select list) + $parameters = GETPOST('extra_value'); + $parameters_array = explode("\r\n",$parameters); + foreach($parameters_array as $param_ligne) + { + list($key,$value) = explode(',',$param_ligne); + $params['options'][$key] = $value; + } + + $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 799200ca5bf..0fd57fed96d 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -38,6 +38,8 @@ class ExtraFields var $attribute_label; // Tableau contenant le nom des champs en clef et la taille de ces champs en value var $attribute_size; + // Tableau contenant le nom des choix en clef et la valeur de ces choix en value + var $attribute_choice; // Array to store if attribute is unique or not var $attribute_unique; // Array to store if attribute is required or not @@ -56,7 +58,8 @@ class ExtraFields 'boolean'=>'Boolean', 'price'=>'ExtrafieldPrice', 'phone'=>'ExtrafieldPhone', - 'mail'=>'ExtrafieldMail' + 'mail'=>'ExtrafieldMail', + 'select' => 'ExtrafieldSelect' ); /** @@ -87,20 +90,22 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'company', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not + * @param array $param Params for field * @return int <=0 if KO, >0 if OK */ - function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0) + function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0,$default_value='', $param=0) { if (empty($attrname)) return -1; if (empty($label)) return -1; + // Create field into database - $result=$this->create($attrname,$type,$size,$elementtype, $unique, $required); + $result=$this->create($attrname,$type,$size,$elementtype, $unique, $required, $default_value,$param); $err1=$this->errno; if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS') { // Add declaration of field into table - $result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required); + $result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param); $err2=$this->errno; if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { @@ -126,12 +131,15 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not + * @param string $default_value Default value for field + * @param array $param Params for field (ex for select list : array('options'=>array('value'=>'label of option')) + * * @return int <=0 if KO, >0 if OK */ - private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0) + private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='') { $table=$elementtype.'_extrafields'; - + // Special case for not normalized table names if ($elementtype == 'member') $table='adherent_extrafields'; elseif ($elementtype == 'company') $table='societe_extrafields'; @@ -151,11 +159,20 @@ class ExtraFields }elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; + } elseif ($type=='select') { + $typedb='text'; + $lengthdb=''; } else { $typedb=$type; $lengthdb=$length; } - $field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL')); + $field_desc = array( + 'type'=>$typedb, + 'value'=>$lengthdb, + 'null'=>($required?'NOT NULL':'NULL'), + 'default' => $default_value + ); + $result=$this->db->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc); if ($result > 0) { @@ -190,19 +207,33 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'company', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not + * @param array $param Params for field (ex for select list : array('value'=>'label of option') ) * @return int <=0 if KO, >0 if OK */ - private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0) + private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0,$param) { global $conf; // Clean parameters if (empty($pos)) $pos=0; - + if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired)"; + if(is_array($param) and count($param) > 0) + { + $params = $this->db->escape(serialize($param)); + } + elseif (strlen($param) > 0) + { + $params = trim($param); + } + else + { + $params=''; + } + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param)"; $sql.= " VALUES('".$attrname."',"; $sql.= " '".$this->db->escape($label)."',"; $sql.= " '".$type."',"; @@ -211,7 +242,8 @@ class ExtraFields $sql.= " ".$conf->entity.","; $sql.= " '".$elementtype."',"; $sql.= " '".$unique."',"; - $sql.= " '".$required."'"; + $sql.= " '".$required."',"; + $sql.= " '".$params."'"; $sql.=')'; dol_syslog(get_class($this)."::create_label sql=".$sql); @@ -480,7 +512,7 @@ class ExtraFields if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; - $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired"; + $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity = ".$conf->entity; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; @@ -502,6 +534,7 @@ class ExtraFields $this->attribute_elementtype[$tab->name]=$tab->elementtype; $this->attribute_unique[$tab->name]=$tab->fieldunique; $this->attribute_required[$tab->name]=$tab->fieldrequired; + $this->attribute_param[$tab->name]=unserialize($tab->param); } } return $array_name_label; @@ -531,6 +564,7 @@ class ExtraFields $elementtype=$this->attribute_elementtype[$key]; $unique=$this->attribute_unique[$key]; $required=$this->attribute_required[$key]; + $param=$this->attribute_param[$key]; if ($type == 'date') { $showsize=10; @@ -593,6 +627,15 @@ class ExtraFields { $out=' '.$langs->getCurrencySymbol($conf->currency); } + elseif ($type == 'select') + { + $out=''; + } // Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; @@ -617,6 +660,7 @@ class ExtraFields $elementtype=$this->attribute_elementtype[$key]; $unique=$this->attribute_unique[$key]; $required=$this->attribute_required[$key]; + $params=$this->attribute_param[$key]; if ($type == 'date') { $showsize=10; @@ -649,6 +693,10 @@ class ExtraFields { $value=price($value).' '.$langs->getCurrencySymbol($conf->currency); } + elseif ($type == 'select') + { + $value=$params['options'][$value]; + } else { $showsize=round($size); diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 01190bf4405..0af2b782912 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -25,14 +25,22 @@ var size = jQuery("#size"); var unique = jQuery("#unique"); var required = jQuery("#required"); - if (type == 'date') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); } - else if (type == 'datetime') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); } - else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); } - else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); } - else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); } - else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); } - else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');} - else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');} + + + if (type == 'date') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); } + else if (type == 'datetime') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); } + else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); } + else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); } + else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); jQuery("#value_choice").hide(); } + else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); } + else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();} + else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();} + else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();} else size.val('').attr('disabled','disabled'); } init_typeoffields(''); @@ -56,6 +64,17 @@ trans("Type"); ?> selectarray('type',$type2label,GETPOST('type')); ?> + + + + trans("Value"); ?> + + + + + + +trans("DefaultValue"); ?>"> trans("Size"); ?> diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 093265e217c..1c17efb697c 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -35,4 +35,7 @@ ALTER TABLE llx_user add COLUMN fk_user integer; -- margin on contracts alter table llx_contratdet add column fk_product_fournisseur_price integer after info_bits; -alter table llx_contratdet add column buy_price_ht double(24,8) DEFAULT 0 after fk_product_fournisseur_price; \ No newline at end of file +alter table llx_contratdet add column buy_price_ht double(24,8) DEFAULT 0 after fk_product_fournisseur_price; + +-- serialised array, to store value of select list choices for example +alter table llx_extrafields add column param text DEFAULT '' after pos; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 42924eb253f..090064ab0ec 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -356,6 +356,7 @@ Boolean=Boolean (Checkbox) ExtrafieldPhone = Phone ExtrafieldPrice = Price ExtrafieldMail = Email +ExtrafieldSelect = Select list LibraryToBuildPDF=Library used to build PDF WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
1 : local tax apply on products and services without vat (vat is not applied on local tax)
2 : local tax apply on products and services before vat (vat is calculated on amount + localtax)
3 : local tax apply on products without vat (vat is not applied on local tax)
4 : local tax apply on products before vat (vat is calculated on amount + localtax)
5 : local tax apply on services without vat (vat is not applied on local tax)
6 : local tax apply on services before vat (vat is calculated on amount + localtax) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 2c5f634fff6..a4c5251bb69 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -58,6 +58,7 @@ ErrorUploadBlockedByAddon=Upload blocked by a PHP/Apache plugin. ErrorFileSizeTooLarge=File size is too large. ErrorSizeTooLongForIntType=Size too long for int type (%s digits maximum) ErrorSizeTooLongForVarcharType=Size too long for string type (%s chars maximum) +ErrorNoValueForSelectType=Please fill value for select list ErrorFieldCanNotContainSpecialCharacters=Field %s must not contains special characters. ErrorNoAccountancyModuleLoaded=No accountancy module activated ErrorExportDuplicateProfil=This profil name already exists for this export set. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 802bbb28191..ee773c9ba46 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -351,6 +351,7 @@ Boolean=Booleen (Checkbox) ExtrafieldPhone = Téléphone ExtrafieldPrice = Prix ExtrafieldMail = Email +ExtrafieldSelect = Liste de sélection LibraryToBuildPDF=Bibliothèque utilisée pour la génération des PDF WarningUsingFPDF=Attention: Votre fichier conf.php contient la directive dolibarr_pdf_force_fpdf=1. Cela signifie que vous utilisez la librairie FPDF pour générer vos fichiers PDF. Cette librairie est ancienne et ne couvre pas de nombreuses fonctionnalitée (Unicode, transparence des images, langues cyrillic, arabes ou asiatiques...), aussi vous pouvez rencontrez des problèmes durant la génération des PDF.
Pour résoudre cela et avoir un support complet de PDF, vous pouvez télécharger la librairie TCPDF puis commenter ou supprimer la ligne $dolibarr_pdf_force_fpdf=1, et ajouter à la place $dolibarr_lib_TCPDF_PATH='chemin_vers_TCPDF' LocalTaxDesc=Certains pays appliquent 2 voir 3 taux sur chaque ligne de facture. Si c'est le cas, choisissez le type du deuxième et troisième taux et sa valeur. Les types possibles sont:
1 : taxe locale sur les produits et services hors tva (la tva n'est pas appliquée sur la taxe locale)
2 : taxe locale sur les produits et services avant tva (la tva est appliquée sur le montant + la taxe locale)
3 : taxe locale uniquement sur les produits hors tva (la tva n'est pas appliquée sur la taxe locale)
4 : taxe locale uniquement sur les produits avant tva (la tva est appliquée sur le montant + la taxe locale)
5 : taxe locale uniquement sur les services hors tva (la tva n'est pas appliquée sur la taxe locale)
6 : taxe locale uniquement sur les service avant tva (la tva est appliquée sur le montant + la taxe locale) diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 99112a0db96..3c7d1e275ed 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -59,6 +59,7 @@ ErrorUploadBlockedByAddon=Upload bloqué par un plugin PHP/Apache. ErrorFileSizeTooLarge=La taille du fichier est trop grande. ErrorSizeTooLongForIntType=Longueur de champ trop longue pour le type int (%s chiffres maximum) ErrorSizeTooLongForVarcharType=Longueur de champ trop longue pour le type chaine (%s caractères maximum) +ErrorNoValueForSelectType=Les valeurs de la liste doivent être renseignées ErrorFieldCanNotContainSpecialCharacters=Le champ %s ne peut contenir de caractères spéciaux. ErrorNoAccountancyModuleLoaded=Aucun module de comptabilité activé ErrorExportDuplicateProfil=Ce nom de profil existe déjà pour ce lot d'export. From 06398d907732df09a5dcc261a6468c974d020e2b Mon Sep 17 00:00:00 2001 From: jfefe Date: Sun, 17 Feb 2013 14:37:33 +0100 Subject: [PATCH 03/23] Fix : bad name of property when retrieve extrafields for thirdparty --- htdocs/core/class/commondocgenerator.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index ec9ae1d2870..d64a7c2710b 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -169,7 +169,7 @@ abstract class CommonDocGenerator { foreach($object->array_options as $key=>$label) { - $extrafields['company_options_'.$key] = $label; + $extrafields['company_'.$key] = $label; } $array_thirdparty = array_merge($array_thirdparty,$extrafields); } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index dfeec3eaab7..7688eec0d66 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -865,7 +865,7 @@ class Societe extends CommonObject } foreach($extrafields->attribute_label as $key=>$label) { - $this->array_options[$key]=$label; + $this->array_options['options_'.$key]=$label; } } else From d5f0eac9082d78c1ea7824f822b10324206a421e Mon Sep 17 00:00:00 2001 From: jfefe Date: Sun, 17 Feb 2013 20:14:18 +0100 Subject: [PATCH 04/23] Missing object $langs when showing extrafield of type 'price' --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4f583a667f9..ec02f906e70 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -669,7 +669,7 @@ class ExtraFields */ function showOutputField($key,$value,$moreparam='') { - global $conf; + global $conf,$langs; $label=$this->attribute_label[$key]; $type=$this->attribute_type[$key]; From a5279499ef040930bd79963d0403adc82130d245 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sun, 17 Feb 2013 21:14:00 +0100 Subject: [PATCH 05/23] Fix : in ODT show value and not label of company extrafield --- htdocs/core/class/commondocgenerator.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index d64a7c2710b..3b815e962c0 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -164,14 +164,20 @@ abstract class CommonDocGenerator 'company_note'=>$object->note ); - $extrafields = array(); + // Retrieve extrafields if(is_array($object->array_options) && count($object->array_options)) { - foreach($object->array_options as $key=>$label) + if(!class_exists('Extrafields')) + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label('company',true); + //Get extrafield values + $object->fetch_optionals($object->id,$extralabels); + + foreach($extrafields->attribute_label as $key=>$label) { - $extrafields['company_'.$key] = $label; + $array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key])); } - $array_thirdparty = array_merge($array_thirdparty,$extrafields); } return $array_thirdparty; } From b913d186bdadbe606a0d5b5ea428b9370d733291 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 20 Feb 2013 18:32:14 +0100 Subject: [PATCH 06/23] Qual: Try to delete no more used addpropal.php --- htdocs/comm/addpropal.php | 350 -------------------------------------- 1 file changed, 350 deletions(-) delete mode 100644 htdocs/comm/addpropal.php diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php deleted file mode 100644 index 8c5a07df0c3..00000000000 --- a/htdocs/comm/addpropal.php +++ /dev/null @@ -1,350 +0,0 @@ - - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2011 Philippe Grand - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/comm/addpropal.php - * \ingroup propal - * \brief Page to add a new commercial proposal - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php'; -if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; -} - -$langs->load("propal"); -if (! empty($conf->projet->enabled)) - $langs->load("projects"); -$langs->load("companies"); -$langs->load("bills"); -$langs->load("orders"); -$langs->load("deliveries"); - -$action=GETPOST('action','alpha'); -$origin=GETPOST('origin','alpha'); -$originid=GETPOST('originid','int'); - -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('propalcard')); - -/* - * Actions - */ - -// None - - - -/* - * View - */ - -llxHeader(); - -print_fiche_titre($langs->trans("NewProp")); - -$form=new Form($db); - -// Add new proposal -if ($action == 'create') -{ - $soc = new Societe($db); - $result=$soc->fetch($_GET["socid"]); - if ($result < 0) - { - dol_print_error($db,$soc->error); - exit; - } - - $object = new Propal($db); - - $numpr=''; - $obj = $conf->global->PROPALE_ADDON; - if ($obj) - { - if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) - { - require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php'; - $modPropale = new $obj; - $numpr = $modPropale->getNextValue($soc,$object); - } - } - - // Fix pour modele numerotation qui deconne - // Si numero deja pris (ne devrait pas arriver), on incremente par .num+1 - $sql = "SELECT count(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."propal"; - $sql.= " WHERE ref LIKE '".$numpr."%'"; - $sql.= " AND entity = ".$conf->entity; - - $resql=$db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - $num = $obj->nb; - $db->free($resql); - if ($num > 0) - { - $numpr .= "." . ($num + 1); - } - } - - print '
'; - print ''; - print ''; - - if ($origin != 'project' && $originid) - { - print ''; - print ''; - } - - print ''; - - // Ref - print ''; - print ''; - print ''; - print ''; - - // Ref customer - print ''; - print ''; - - // Third party - print ''; - print ''; - - // Contacts - print "'; - - // Ligne info remises tiers - print ''; - - // Date - print ''; - - // Validaty duration - print ''; - - // Terms of payment - print ''; - - // Mode of payment - print ''; - - // What trigger creation - print ''; - - // Delivery delay - print ''; - - // Delivery date (or manufacturing) - print ''; - print ''; - - // Model - print ''; - print ''; - print '"; - - // Project - if (! empty($conf->projet->enabled)) - { - $projectid = 0; - if ($origin == 'project') $projectid = ($originid?$originid:0); - - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters=array('colspan' => ' colspan="3"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''."\n"; - } - } - - print "
'.$langs->trans("Ref").''.$numpr.'
'.$langs->trans('RefCustomer').''; - print '
'.$langs->trans('Company').''.$soc->getNomUrl(1); - print ''; - print '
".$langs->trans("DefaultContact")."\n"; - $form->select_contacts($soc->id,'','contactidp',1); - print '
'.$langs->trans('Discounts').''; - if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount=$soc->getAvailableDiscounts(); - print '. '; - if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency)); - else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.'; - print '
'.$langs->trans('Date').''; - $form->select_date('','','','','',"addprop"); - print '
'.$langs->trans("ValidityDuration").' '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id'); - print '
'.$langs->trans('PaymentMode').''; - $form->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); - print '
'.$langs->trans('Source').''; - $form->select_demand_reason('','demand_reason_id',"SRC_PROP",1); - print '
'.$langs->trans('AvailabilityPeriod').''; - $form->select_availability('','availability_id','',1); - print '
'.$langs->trans("DeliveryDate").''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") - { - $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - $syear = date("Y", $tmpdte); - $smonth = date("m", $tmpdte); - $sday = date("d", $tmpdte); - $form->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"addprop"); - } - else - { - $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; - $form->select_date($datepropal,'liv_','','','',"addprop"); - } - print '
'.$langs->trans("DefaultModel").''; - $liste=ModelePDFPropales::liste_modeles($db); - print $form->selectarray('model',$liste,$conf->global->PROPALE_ADDON_PDF); - print "
'.$langs->trans("Project").''; - - $numprojet=select_projects($soc->id,$projectid); - if ($numprojet==0) - { - print '   '.$langs->trans("AddProject").''; - } - print '
'; - print $extrafields->showInputField($key,$value); - print '
"; - print '
'; - - /* - * Combobox pour la fonction de copie - */ - - if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) - { - print ''; - } - - print ''; - if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) - { - // For backward compatibility - print ''; - print ''; - print ''; - print ''; - - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print ''; - - print ''; - print ''; - } - - if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) - { - print ''; - } - print '
'.$langs->trans("CopyPropalFrom").' '; - $liste_propal = array(); - $liste_propal[0] = ''; - - $sql ="SELECT p.rowid as id, p.ref, s.nom"; - $sql.=" FROM ".MAIN_DB_PREFIX."propal p"; - $sql.= ", ".MAIN_DB_PREFIX."societe s"; - $sql.= " WHERE s.rowid = p.fk_soc"; - $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut <> 0"; - $sql.= " ORDER BY Id"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $propalRefAndSocName = $row[1]." - ".$row[2]; - $liste_propal[$row[0]]=$propalRefAndSocName; - $i++; - } - print $form->selectarray("copie_propal",$liste_propal, 0); - } - else - { - dol_print_error($db); - } - print '
 
'.$langs->trans("CreateEmptyPropal").'
'; - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - $lib=$langs->trans("ProductsAndServices"); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - for ($i = 1 ; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i++) - { - print ''; - print ''; - print ''; - print ''; - } - - print "
'.$lib.''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'
'; - // multiprix - if($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - $form->select_produits('',"idprod".$i,'',$conf->product->limit_size,$soc->price_level); - else - $form->select_produits('',"idprod".$i,'',$conf->product->limit_size); - print '%
"; - - } - print '
'; - print '
'; - - $langs->load("bills"); - print '
'; - print ''; - print ' '; - print '
'; - - print "
"; -} - - -llxFooter(); -$db->close(); -?> From 9d28a1de750ed22b588ade365ec6de155c29a180 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Thu, 21 Feb 2013 09:35:05 +0100 Subject: [PATCH 07/23] fix : english normalization --- htdocs/adherents/cartes/carte.php | 4 ++-- htdocs/adherents/class/adherent.class.php | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index edfe7dbd0de..27fde653695 100755 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -62,7 +62,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg // requete en prenant que les adherents a jour de cotisation $sql = "SELECT d.rowid, d.prenom as firstname, d.nom as lastname, d.login, d.societe as company, d.datefin,"; - $sql.= " d.adresse as address, d.cp as zip, d.ville as town, d.naiss, d.email, d.photo,"; + $sql.= " d.address, d.cp as zip, d.ville as town, d.naiss, d.email, d.photo,"; $sql.= " t.libelle as type,"; $sql.= " p.code as country_code, p.libelle as country"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; @@ -112,7 +112,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg '%PRENOM%'=>$objp->firstname, '%NOM%'=>$objp->lastname, '%SOCIETE%'=>$objp->company, - '%ADRESSE%'=>$objp->address, + '%ADDRESS%'=>$objp->address, '%CP%'=>$objp->zip, '%VILLE%'=>$objp->town, '%PAYS%'=>$objp->country, diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 8e9c75e2423..c59d54d1508 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -51,7 +51,6 @@ class Adherent extends CommonObject var $login; var $pass; var $societe; - //var $adresse; var $address; var $cp; var $zip; @@ -233,7 +232,7 @@ class Adherent extends CommonObject '%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '%NOM%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, '%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, - '%ADRESSE%'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address, + '%ADDRESS%'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address, '%CP%'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip, '%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, '%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, @@ -404,7 +403,7 @@ class Adherent extends CommonObject // Clean parameters $this->lastname=trim($this->lastname)?trim($this->lastname):trim($this->nom); $this->firstname=trim($this->firstname)?trim($this->firstname):trim($this->prenom); - $this->address=($this->address?$this->address:$this->adresse); + $this->address=($this->address?$this->address:$this->address); $this->zip=($this->zip?$this->zip:$this->cp); $this->town=($this->town?$this->town:$this->ville); $this->country_id=($this->country_id > 0?$this->country_id:$this->fk_pays); @@ -1065,7 +1064,6 @@ class Adherent extends CommonObject $this->pass = $obj->pass; $this->societe = $obj->societe; $this->fk_soc = $obj->fk_soc; - //$this->adresse = $obj->address; // deprecated $this->address = $obj->address; $this->cp = $obj->zip; // deprecated $this->zip = $obj->zip; @@ -1201,7 +1199,7 @@ class Adherent extends CommonObject * Insert subscription into database and eventually add links to banks, mailman, etc... * * @param timestamp $date Date d'effet de la cotisation - * @param amount $montant Montant cotisation (accepte 0 pour les adherents non soumis e cotisation) + * @param amount $montant Montant cotisation (accepte 0 pour les adherents non soumis a cotisation) * @param int $accountid Id compte bancaire * @param string $operation Type operation (si Id compte bancaire fourni) * @param string $label Label operation (si Id compte bancaire fourni) @@ -1386,7 +1384,7 @@ class Adherent extends CommonObject /** - * Fonction qui ajoute l'adherent au abonnements automatiques mailing-list, spip, etc. + * Fonction qui ajoute l'adherent aux abonnements automatiques mailing-list, spip, etc. * TODO Move this into member creation trigger (trigger of mailmanspip module) * * @return int <0 if KO, >0 if OK @@ -1479,7 +1477,7 @@ class Adherent extends CommonObject /** - * Return label of a civility of a contact + * Return civility label of a contact * * @param int $nohtmlentities 0=Encode with htmlentities for HTML output, 1=No htmlentities for memory translation * @return string Name translated of civility From dc4c013d10e6165e3e8d36ad1e7287eafedef5f1 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Thu, 21 Feb 2013 09:44:49 +0100 Subject: [PATCH 08/23] fix : english normalization --- htdocs/adherents/fiche.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index d1c8beb6426..b0bb18511e9 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García - * Copyright (C) 2012 Philippe Grand + * Copyright (C) 2012-2013 Philippe Grand * * 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 @@ -98,9 +98,9 @@ if ($rowid > 0) } } -// Define variables to know what current user can do on members +// Define variables to determine what the current user can do on the members $canaddmember=$user->rights->adherent->creer; -// Define variables to know what current user can do on properties of a member +// Define variables to determine what the current user can do on the properties of a member if ($rowid) { $caneditfieldmember=$user->rights->adherent->creer; @@ -259,7 +259,6 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $object->pass = trim($_POST["pass"]); $object->societe = trim($_POST["societe"]); - //$object->adresse = trim($_POST["address"]); // deprecated $object->address = trim($_POST["address"]); $object->cp = trim($_POST["zipcode"]); // deprecated $object->zip = trim($_POST["zipcode"]); @@ -440,7 +439,6 @@ if ($action == 'add' && $user->rights->adherent->creer) $object->firstname = $prenom; $object->lastname = $nom; $object->societe = $societe; - //$object->adresse = $address; // deprecated $object->address = $address; $object->cp = $zip; // deprecated $object->zip = $zip; From 4cb6072f030d7cbf1e4673e10ba90a09c7015ae5 Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 21 Feb 2013 11:03:14 +0100 Subject: [PATCH 09/23] New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice --- ChangeLog | 1 + htdocs/compta/facture.php | 18 +++++++++++++++- htdocs/langs/ca_ES/admin.lang | 3 ++- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/es_ES/admin.lang | 3 ++- htdocs/langs/fr_FR/admin.lang | 3 ++- htdocs/societe/admin/societe.php | 35 +++++++++++++++++++++++++++++++- 7 files changed, 60 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1a44ef58e0..69f6556871d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ For users: - New: total per vat rate are available as tags for ODT templates. - New: Add more types for extra parameters (lists, phone, emails, checkbox, prices) - New: Some part of interface use more CSS3 (ie: agenda) +- New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice For developers: - System of menu managers has been rewritten to reduce code to do same things. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 212429be67e..1753eb4b75a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -366,6 +366,22 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu $object->fetch_thirdparty(); // Check parameters + + // Check for mandatory prof id + for ($i = 1; $i < 5; $i++) + { + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_INVOICE_MANDATORY'; + if (! $object->thirdparty->idprof.$i && ! empty($conf->global->$idprof_mandatory)) + { + if (! $error) $langs->load("errors"); + $error++; + + setEventMessage($langs->trans('ErrorProdIdIsMandatory',$langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)),'errors'); + } + } + + //Check for warehouse if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->hasProductsOrServices(1)) { if (! $idwarehouse || $idwarehouse == -1) @@ -375,7 +391,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu $action=''; } } - + if (! $error) { $result = $object->validate($user,'',$idwarehouse); diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 5bbc3472c98..a80324836cc 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -962,7 +962,8 @@ DocumentModelOdt=Generació des dels documents amb format OpenDocument (Arxiu .O WatermarkOnDraft=Marca d'aigua en els documents esborrany CompanyIdProfChecker=Règles sobre els ID professionals MustBeUnique=Ha de ser únic? -MustBeMandatory=Ha de ser obligatori? +MustBeMandatory=Ha de ser obligatori per a crear tercers? +MustBeInvoiceMandatory=Ha de ser obligatori per a validar factures? Miscellanous=Miscel·lània ##### Webcal setup ##### WebCalSetup=Configuració d'enllaç amb el calendari webcalendar diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cc5d50c5139..ce66a55f944 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -978,7 +978,8 @@ DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for WatermarkOnDraft=Watermark on draft document CompanyIdProfChecker=Rules ono Professional Ids MustBeUnique=Must be unique ? -MustBeMandatory=Must be mandatory ? +MustBeMandatory=Must be mandatory to create thirds? +MustBeInvoiceMandatory=Must be mandatory to validate invoices? Miscellanous=Miscellaneous ##### Webcal setup ##### WebCalSetup=Webcalendar link setup diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index cbf15193742..8013b56c2fb 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -964,7 +964,8 @@ DocumentModelOdt=Generación desde los documentos OpenDocument (Archivo .ODT Ope WatermarkOnDraft=Marca de agua en los documentos borrador CompanyIdProfChecker=Reglas sobre los ID profesionales MustBeUnique=¿Debe ser único? -MustBeMandatory=¿Debe ser obligatorio? +MustBeMandatory=¿Debe ser obligatorio para crear terceros? +MustBeInvoiceMandatory=¿Debe ser obligatorio para validar facturas? Miscellanous=Miscelánea ##### Webcal setup ##### WebCalSetup=Configuración de enlace con el calendario Webcalendar diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 46df03e5c63..f0e8198086d 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -975,7 +975,8 @@ DocumentModelOdt=Genération depuis des modèles OpenDocument (Fichier .ODT Open WatermarkOnDraft=Filigrane sur les documents brouillons CompanyIdProfChecker=Règles sur les Ids professionnels MustBeUnique=Doit être unique ? -MustBeMandatory=Doit être obligatoire? +MustBeMandatory=Doit être obligatoire pour creer tiers ? +MustBeInvoiceMandatory=Doit être obligatoire pour valider factures ? Miscellanous=Divers ##### Webcal setup ##### WebCalSetup= Configuration du lien vers le calendrier Webcalendar diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 1b0efa2c4b2..1cd6fef8b4b 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -210,7 +210,7 @@ if ($action == 'setprofid') } } -//Activate ProfId +//Activate ProfId mandatory if ($action == 'setprofidmandatory') { $status = GETPOST('status','alpha'); @@ -227,6 +227,22 @@ if ($action == 'setprofidmandatory') } } +//Activate ProfId invoice mandatory +if ($action == 'setprofidinvoicemandatory') +{ + $status = GETPOST('status','alpha'); + + $idprof="SOCIETE_IDPROF".$value."_INVOICE_MANDATORY"; + if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} /* * View @@ -554,6 +570,7 @@ print ''.$langs->trans("Name").''; print ''.$langs->trans("Description").''; print ''.$langs->trans("MustBeUnique").''; print ''.$langs->trans("MustBeMandatory").''; +print ''.$langs->trans("MustBeInvoiceMandatory").''; print "\n"; $profid[0][0]=$langs->trans("ProfId1"); @@ -586,8 +603,10 @@ while ($i < $nbofloop) $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; + $idprof_invoice_mandatory ='SOCIETE_IDPROF'.($i+1).'_INVOICE_MANDATORY'; $verif=(empty($conf->global->$idprof_unique)?false:true); $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); + $invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true); if ($verif) { @@ -614,6 +633,20 @@ while ($i < $nbofloop) print img_picto($langs->trans("Disabled"),'switch_off'); print ''; } + + if ($invoice_mandatory) + { + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + } + else + { + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + } + print "\n"; } $i++; From d7f83c35207672ce76eb47a782665d87c2278617 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Thu, 21 Feb 2013 11:23:12 +0100 Subject: [PATCH 10/23] New: Add some carrier --- .../methode_expedition_chrono.modules.php | 55 +++++++++++++++++++ .../methode_expedition_gls.modules.php | 55 +++++++++++++++++++ .../methode_expedition_kiala.modules.php | 55 +++++++++++++++++++ .../methode_expedition_ups.modules.php | 54 ++++++++++++++++++ .../mysql/data/llx_c_shipment_mode.sql | 4 ++ .../install/mysql/migration/3.3.0-3.4.0.sql | 5 ++ 6 files changed, 228 insertions(+) create mode 100644 htdocs/core/modules/expedition/methode_expedition_chrono.modules.php create mode 100644 htdocs/core/modules/expedition/methode_expedition_gls.modules.php create mode 100644 htdocs/core/modules/expedition/methode_expedition_kiala.modules.php create mode 100644 htdocs/core/modules/expedition/methode_expedition_ups.modules.php diff --git a/htdocs/core/modules/expedition/methode_expedition_chrono.modules.php b/htdocs/core/modules/expedition/methode_expedition_chrono.modules.php new file mode 100644 index 00000000000..acebea53430 --- /dev/null +++ b/htdocs/core/modules/expedition/methode_expedition_chrono.modules.php @@ -0,0 +1,55 @@ +. + */ + +/** + * \file htdocs/core/modules/expedition/methode_expedition_chrono.modules.php + * \ingroup expedition + */ + +include_once "methode_expedition.modules.php"; + +/** + * Class to manage shipment Chronopost + */ +class methode_expedition_chrono extends ModeleShippingMethod +{ + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db=0) + { + $this->db = $db; + $this->id = 8; // Do not change this value + $this->code = "COLCHRONO"; // Do not change this value + $this->name = "Chronopost"; + $this->description = "Chronopost"; + } + + /** + * Return URL of provider + * + * @param string $tracking_number Tracking number + * @return string URL for tracking + */ + function provider_url_status($tracking_number) + { + return sprintf("http://www.chronopost.fr/expedier/inputLTNumbersNoJahia.do?listeNumeros=%s",$tracking_number); + } +} + +?> diff --git a/htdocs/core/modules/expedition/methode_expedition_gls.modules.php b/htdocs/core/modules/expedition/methode_expedition_gls.modules.php new file mode 100644 index 00000000000..2f63ff927af --- /dev/null +++ b/htdocs/core/modules/expedition/methode_expedition_gls.modules.php @@ -0,0 +1,55 @@ +. + */ + +/* + * \file htdocs/core/modules/expedition/methode_expedition_gls.modules.php + * \ingroup expedition + */ + +include_once "methode_expedition.modules.php"; + +/** + * Class to manage shipment GLS + */ +class methode_expedition_gls extends ModeleShippingMethod +{ + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db=0) + { + $this->db = $db; + $this->id = 7; // Do not change this value + $this->code = "COLGLS"; // Do not change this value + $this->name = "GLS"; + $this->description = "General Logistics Systems"; + } + + /** + * Return URL of provider + * + * @param string $tracking_number Tracking number + * @return string URL for tracking + */ + function provider_url_status($tracking_number) + { + return sprintf("http://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/FR01/FR/5004.htm?txtAction=71000&txtRefNo=%s",$tracking_number); + } +} + +?> diff --git a/htdocs/core/modules/expedition/methode_expedition_kiala.modules.php b/htdocs/core/modules/expedition/methode_expedition_kiala.modules.php new file mode 100644 index 00000000000..fa8072ecda3 --- /dev/null +++ b/htdocs/core/modules/expedition/methode_expedition_kiala.modules.php @@ -0,0 +1,55 @@ +. + * or see http://www.gnu.org/ + */ + +/* + * \file htdocs/core/modules/expedition/methode_expedition_kiala.modules.php + * \ingroup expedition + */ + +include_once "methode_expedition.modules.php"; + + +Class methode_expedition_kiala extends ModeleShippingMethod + +{ + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function methode_expedition_kiala($db=0) + { + $this->db = $db; + $this->id = 6; // Do not change this value + $this->code = "COLKIALA"; // Do not change this value + $this->name = "KIALA"; + $this->description = "KIALA"; + } + + /** + * Return URL of provider + * + * @param string $tracking_number Tracking number + * @return string URL for tracking + */ + function provider_url_status($tracking_number) + { + return sprintf("http://www.kiala.fr/tnt/delivery/%s",$tracking_number); + } +} + +?> diff --git a/htdocs/core/modules/expedition/methode_expedition_ups.modules.php b/htdocs/core/modules/expedition/methode_expedition_ups.modules.php new file mode 100644 index 00000000000..582f23c9e0a --- /dev/null +++ b/htdocs/core/modules/expedition/methode_expedition_ups.modules.php @@ -0,0 +1,54 @@ +. + * or see http://www.gnu.org/ + */ + +/* + * \file htdocs/core/modules/expedition/methode_expedition_ups.modules.php + * \ingroup expedition + */ + +include_once "methode_expedition.modules.php"; + + +class methode_expedition_ups extends ModeleShippingMethod +{ + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function methode_expedition_ups($db=0) + { + $this->db = $db; + $this->id = 5; // Do not change this value + $this->code = "COLUPS"; // Do not change this value + $this->name = "UPS"; + $this->description = "United Parcel Service"; + } + + /** + * Return URL of provider + * + * @param string $tracking_number Tracking number + * @return string URL for tracking + */ + function provider_url_status($tracking_number) + { + return sprintf("http://wwwapps.ups.com/etracking/tracking.cgi?InquiryNumber2=&InquiryNumber3=&tracknums_displayed=3&loc=fr_FR&TypeOfInquiryNumber=T&HTMLVersion=4.0&InquiryNumber22=&InquiryNumber32=&track=Track&Suivi.x=64&Suivi.y=7&Suivi=Valider&InquiryNumber1=%s",$tracking_number); + } +} + +?> diff --git a/htdocs/install/mysql/data/llx_c_shipment_mode.sql b/htdocs/install/mysql/data/llx_c_shipment_mode.sql index e78f25a0ac2..ba625191e3d 100644 --- a/htdocs/install/mysql/data/llx_c_shipment_mode.sql +++ b/htdocs/install/mysql/data/llx_c_shipment_mode.sql @@ -33,3 +33,7 @@ INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES ( INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (2,'TRANS','Transporter','Generic transporter',1); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (3,'COLSUI','Colissimo Suivi','Colissimo Suivi',0); INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (4,'LETTREMAX','Lettre Max','Courrier Suivi et Lettre Max',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (5,'COLUPS','UPS','United Parcel Service',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (6,'COLKIALA','KIALA','Relais Kiala',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (7,'COLGLS','GLS','General Logistics Systems',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (8,'COLCHRONO','Chronopost','Chronopost',0); diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index cad2ac40bb4..00d50ad51d7 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -45,3 +45,8 @@ alter table llx_propal CHANGE COLUMN fk_adresse_livraison fk_delivery_address alter table llx_commande CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; alter table llx_don CHANGE COLUMN adresse address text; alter table llx_adherent CHANGE COLUMN adresse address text; + +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (5,'COLUPS','UPS','United Parcel Service',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (6,'COLKIALA','KIALA','Relais Kiala',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (7,'COLGLS','GLS','General Logistics Systems',0); +INSERT INTO llx_c_shipment_mode (rowid,code,libelle,description,active) VALUES (8,'COLCHRONO','Chronopost','Chronopost',0); From 8e6cde61c07e8fca3b00fa9b787cb630727122e4 Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 21 Feb 2013 18:44:11 +0100 Subject: [PATCH 11/23] Trad: Update translations --- htdocs/langs/ca_ES/main.lang | 1 + htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/es_ES/main.lang | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/ca_ES/main.lang b/htdocs/langs/ca_ES/main.lang index e1f2413c829..bfb93f9ca0c 100644 --- a/htdocs/langs/ca_ES/main.lang +++ b/htdocs/langs/ca_ES/main.lang @@ -565,6 +565,7 @@ ThisLimitIsDefinedInSetup=Límit Dolibarr (Menú inici-configuració-seguretat): NoFileFound=No hi ha documents guardats en aquesta carpeta CurrentUserLanguage=Idioma actual CurrentTheme=Tema actual +CurrentMenuManager=Gestor menú actual DisabledModules=Mòduls desactivats For=Per a ForCustomer=Per a client diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c24a0bd4ceb..0bc8e8d9451 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -566,7 +566,7 @@ ThisLimitIsDefinedInSetup=Dolibarr limit (Menu home-setup-security): %s Kb, PHP NoFileFound=No documents saved in this directory CurrentUserLanguage=Current language CurrentTheme=Current theme -CurrentMenuManager=current men manager +CurrentMenuManager=current menu manager DisabledModules=Disabled modules For=For ForCustomer=For customer diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index dbafcb393b2..4cc16bc5e55 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -567,6 +567,7 @@ ThisLimitIsDefinedInSetup=Límite Dolibarr (Menú inicio-configuración-segurida NoFileFound=No hay documentos guardados en este directorio CurrentUserLanguage=Idioma actual CurrentTheme=Tema actual +CurrentMenuManager=Gestor menú actual DisabledModules=Módulos desactivados For=Para ForCustomer=Para cliente From 5d357c7736b03b1159f53c43d343bad91b623dae Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 21 Feb 2013 18:48:56 +0100 Subject: [PATCH 12/23] Trad: Fix activity box translation --- htdocs/core/boxes/box_activity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 3a9a5a484ec..1977e41970a 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -71,7 +71,7 @@ class box_activity extends ModeleBoxes $nbofyears=2; if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION; - $textHead = $langs->trans("Activity").' ('.$nbofyears.' '.$langs->trans("years").')'; + $textHead = $langs->trans("Activity").' ('.$nbofyears.' '.$langs->trans("DurationYears").')'; $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // compute the year limit to show From bfc4df5169e87595988259a3b3ceebce5a892d39 Mon Sep 17 00:00:00 2001 From: eldy Date: Thu, 21 Feb 2013 20:23:39 +0100 Subject: [PATCH 13/23] protection to avoid to take external modules --- build/makepack-dolibarr.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index dbe55f2f80c..23d806bb72d 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -320,7 +320,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootsrap*`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; From 3d80a6ebfc93a71c14dc9306e89429cf07834385 Mon Sep 17 00:00:00 2001 From: eldy Date: Thu, 21 Feb 2013 21:04:20 +0100 Subject: [PATCH 14/23] Fix: Enhance pgsql driver --- htdocs/core/db/mssql.class.php | 4 +--- htdocs/core/db/pgsql.class.php | 9 ++++----- htdocs/core/db/sqlite.class.php | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 9a9daff5583..cfa8e858f70 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -25,9 +25,7 @@ /** - * \class DoliDBMssql - * \brief Classe de gestion de la database de dolibarr - * \remarks Works with PHP5 Only + * Classe de gestion de la database de dolibarr */ class DoliDBMssql { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index ecb17b8a9f0..2c05625e383 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -29,8 +29,7 @@ /** - * \class DoliDBPgsql - * \brief Class to drive a Postgresql database for Dolibarr + * Class to drive a Postgresql database for Dolibarr */ class DoliDBPgsql { @@ -245,17 +244,17 @@ class DoliDBPgsql $line=preg_replace('/\sAFTER [a-z0-9_]+/i','',$line); // We remove start of requests "ALTER TABLE tablexxx" if this is a DROP INDEX - $line=preg_replace('/ALTER TABLE [a-z0-9_]+ DROP INDEX/i','DROP INDEX',$line); + $line=preg_replace('/ALTER TABLE [a-z0-9_]+\s+DROP INDEX/i','DROP INDEX',$line); // Translate order to rename fields - if (preg_match('/ALTER TABLE ([a-z0-9_]+) CHANGE(?: COLUMN)? ([a-z0-9_]+) ([a-z0-9_]+)(.*)$/i',$line,$reg)) + if (preg_match('/ALTER TABLE ([a-z0-9_]+)\s+CHANGE(?: COLUMN)? ([a-z0-9_]+) ([a-z0-9_]+)(.*)$/i',$line,$reg)) { $line = "-- ".$line." replaced by --\n"; $line.= "ALTER TABLE ".$reg[1]." RENAME COLUMN ".$reg[2]." TO ".$reg[3]; } // Translate order to modify field format - if (preg_match('/ALTER TABLE ([a-z0-9_]+) MODIFY(?: COLUMN)? ([a-z0-9_]+) (.*)$/i',$line,$reg)) + if (preg_match('/ALTER TABLE ([a-z0-9_]+)\s+MODIFY(?: COLUMN)? ([a-z0-9_]+) (.*)$/i',$line,$reg)) { $line = "-- ".$line." replaced by --\n"; $newreg3=$reg[3]; diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 1c9d02277e6..4cc217d24ad 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -26,8 +26,7 @@ /** - * \class DoliDBSqlite - * \brief Class to manage Dolibarr database access for a Sqlite database + * Class to manage Dolibarr database access for a Sqlite database */ class DoliDBSqlite { From e99b0dd96f445cf3ea4fee13fb62720898bab616 Mon Sep 17 00:00:00 2001 From: eldy Date: Thu, 21 Feb 2013 21:11:21 +0100 Subject: [PATCH 15/23] Fix: Select prospect, customer or both --- htdocs/comm/propal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 90c37aaaa6f..92e63c6fa67 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1247,7 +1247,7 @@ if ($action == 'create') else { print ''; - print $form->select_company('','socid','s.client = 1',1); + print $form->select_company('','socid','s.client = 1 OR s.client = 2 OR s.client = 3',1); print ''; } print ''."\n"; From 2ecb113d30c08e2a5178f50ffbe0c8a05751b71e Mon Sep 17 00:00:00 2001 From: eldy Date: Fri, 22 Feb 2013 00:11:34 +0100 Subject: [PATCH 16/23] Fix: categories are set onto category tab --- .../canvas/actions_card_common.class.php | 2 -- htdocs/societe/class/societe.class.php | 9 ++--- htdocs/societe/soc.php | 34 ------------------- 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 0a46e2c31e2..e2752cebf90 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -168,7 +168,6 @@ abstract class ActionsCardCommon } $this->object->client = $_POST["client"]; $this->object->fournisseur = $_POST["fournisseur"]; - $this->object->fournisseur_categorie = $_POST["fournisseur_categorie"]; $this->object->commercial_id = $_POST["commercial_id"]; $this->object->default_lang = $_POST["default_lang"]; @@ -488,7 +487,6 @@ abstract class ActionsCardCommon $this->object->LoadSupplierCateg(); $this->tpl['suppliercategory'] = $this->object->SupplierCategories; - $this->tpl['select_suppliercategory'] = $form->selectarray("fournisseur_categorie",$this->object->SupplierCategories,$_POST["fournisseur_categorie"],1); } // Zip diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7688eec0d66..4d45d8d01f9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -143,7 +143,8 @@ class Societe extends CommonObject var $array_options; var $oldcopy; - + + /** * Constructor * @@ -242,9 +243,6 @@ class Societe extends CommonObject $this->add_commercial($user, $user->id); } - // si le fournisseur est classe on l'ajoute - $this->AddFournisseurInCategory($this->fournisseur_categorie); - if ($ret >= 0) { // Appel des triggers @@ -610,9 +608,6 @@ class Societe extends CommonObject } } - // Si le fournisseur est classe on l'ajoute - $this->AddFournisseurInCategory($this->fournisseur_categorie); - // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('thirdpartydao')); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index cb62e16ab80..11056d4381a 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -162,7 +162,6 @@ if (empty($reshook)) $object->client = GETPOST('client'); $object->fournisseur = GETPOST('fournisseur'); - $object->fournisseur_categorie = GETPOST('fournisseur_categorie'); $object->commercial_id = GETPOST('commercial_id'); $object->default_lang = GETPOST('default_lang'); @@ -794,23 +793,6 @@ else print $form->textwithpicto('',$s,1); print ''; print ''; - - // Category - /* This must be set into category tab, like for customer category - if ($object->fournisseur) - { - $load = $object->LoadSupplierCateg(); - if ( $load == 0) - { - if (count($object->SupplierCategories) > 0) - { - print ''; - print ''.$langs->trans('SupplierCategory').''; - print $form->selectarray("fournisseur_categorie",$object->SupplierCategories,GETPOST('fournisseur_categorie'),1); - print ''; - } - } - }*/ } // Status @@ -1256,22 +1238,6 @@ else print ''; print ''; - - // Category - if (! empty($conf->categorie->enabled) && $object->fournisseur) - { - $load = $object->LoadSupplierCateg(); - if ( $load == 0) - { - if (count($object->SupplierCategories) > 0) - { - print ''; - print ''.$langs->trans('SupplierCategory').''; - print $form->selectarray("fournisseur_categorie",$object->SupplierCategories,'',1); - print ''; - } - } - } } // Barcode From 8fd3d9375ddb955fcdf21c965c4cc642be083ebc Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 21 Feb 2013 14:29:06 +0100 Subject: [PATCH 17/23] Fix: Pagination at bottom not work correctly with filters applied --- htdocs/product/liste.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index f5e6581d804..1a7cba82d68 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -442,18 +442,12 @@ else $i++; } - if ($num > $conf->liste_limit) - { - if ($sref || $snom || $sall || $sbarcode || GETPOST('search')) - { - print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); - } - else - { - print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); - } - } - + $param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy; + $param.=($fourn_id?"&fourn_id=".$fourn_id:""); + $param.=($search_categ?"&search_categ=".$search_categ:""); + $param.=isset($type)?"&type=".$type:""; + print_barre_liste('', $page, "liste.php", $param, $sortfield, $sortorder,'',$num); + $db->free($resql); print ""; From e1683f5f2209ff0eb2432ec790d34860e1a6d5a5 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 22 Feb 2013 08:57:28 +0100 Subject: [PATCH 18/23] Fix: Pagination at bottom not work correctly with filters applied --- htdocs/product/liste.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 1a7cba82d68..bef33a022b1 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García + * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From a17b6c6d0df58bbb3171f39907da0bc4414f8bbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Feb 2013 09:44:05 +0100 Subject: [PATCH 19/23] Doc --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f1a44ef58e0..a8672b6cfdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,7 +24,7 @@ For developers: - A mymodule can bring its own core/modules/mymodule/modules_mymodule.php file. - Removed not used libraries. - More web services. -- Renamed some french fields into english. +- Renamed some database fields, code variables and parameters from french to english. - First change to manage margins on contracts. - Add hook getFormMail. From 289ff4fe1acb12768e1d3a013931cf5948e75a52 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 11:03:20 +0100 Subject: [PATCH 20/23] Fix: regression, the product discount overwrites the default customer discount ! --- htdocs/core/tpl/objectline_add.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index 2abeb380f75..a575034aa1e 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -80,8 +80,8 @@ if (! empty($conf->margin->enabled)) { 'origin_price_ht_cache' => 'price_ht', 'origin_tva_tx_cache' => 'tva_tx', 'origin_price_ttc_cache' => 'price_ttc', - 'qty' => 'qty', - 'remise_percent' => 'discount' + 'qty' => 'qty' + //'remise_percent' => 'discount' ), 'update_textarea' => array( 'product_desc' => 'desc' @@ -242,7 +242,7 @@ $(document).ready(function() { $('#select_type').val(data.type).attr('disabled','disabled').trigger('change'); //$('#price_base_type_area').show(); $('#qty').val(data.qty); - $('#remise_percent').val(data.discount); + //$('#remise_percent').val(data.discount); if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances['product_desc'] != "undefined") { CKEDITOR.instances['product_desc'].setData(data.desc).focus(); From 8136244d87cc7b5d08c06f4381d45da802f7f8dc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 11:25:29 +0100 Subject: [PATCH 21/23] Fix: hide blocs with multi-page --- .../livraison/pdf/pdf_typhon.modules.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 2be7a5afc63..a88d2ca06f4 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -490,17 +490,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); - // Modif Seb cadres signatures - $pdf->SetFont('','', $default_font_size); - $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; - $pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); - $pdf->SetXY($this->marge_gauche + 2, $tab_top + $tab_height + 5); - $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L'); - - $pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); - $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5); - $pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L'); + if (!empty($hidebottom)) { + // Modif Seb cadres signatures + $pdf->SetFont('','', $default_font_size); + $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; + $pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + $tab_height + 5); + $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L'); + $pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); + $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5); + $pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L'); + } } /** From 8a5f68de9c90b1aaf702d6c984756eaea5095b94 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 12:21:49 +0100 Subject: [PATCH 22/23] Fix: wrong hidden --- htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index a88d2ca06f4..f402045a471 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -323,11 +323,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -355,12 +355,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 1); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 1); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } From 7d0f02eb8b1bcf73297d639b60f3f8bf0ce75b12 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 13:14:04 +0100 Subject: [PATCH 23/23] Fix: pdf models are unstable and time consuming. --- .../livraison/pdf/pdf_typhon.modules.php | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index f402045a471..0e65800698a 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -214,7 +214,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?22:10); $tab_height = 130; $tab_height_newpage = 150; @@ -252,7 +252,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line @@ -323,11 +323,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -355,12 +355,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } @@ -472,25 +472,32 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Rect prend une longueur en 3eme param $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); // line prend une position y en 3eme param - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); + if (empty($hidetop)) + $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($this->posxdesc-1, $tab_top+1); - $pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L'); + if (empty($hidetop)) { + $pdf->SetXY($this->posxdesc-1, $tab_top+1); + $pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L'); + } // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); - $pdf->SetXY($this->posxcomm, $tab_top+1); - $pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L'); + if (empty($hidetop)) { + $pdf->SetXY($this->posxcomm, $tab_top+1); + $pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L'); + } // Qty $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); + if (empty($hidetop)) { + $pdf->SetXY($this->posxqty-1, $tab_top+1); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); + } - if (!empty($hidebottom)) { + if (empty($hidebottom)) { // Modif Seb cadres signatures $pdf->SetFont('','', $default_font_size); $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;