From af849a5ab05aac93f23b96ee3bee03c9d8eff903 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 12 Feb 2013 10:33:10 +0100 Subject: [PATCH 01/34] fix contact address autofill --- htdocs/contact/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 9097584bfb5..2926ec75b75 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -383,7 +383,7 @@ else }); $("#copyaddressfromsoc").click(function() { - $(\'textarea[name="address"]\').text("'.dol_escape_js($objsoc->address).'"); + $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).'"); $(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'"); $(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'"); $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'"); From c6b263c586681541782f58f34a7c8c5189280649 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 13 Feb 2013 09:53:26 +0100 Subject: [PATCH 02/34] fix bug in contract update line (wrong vat variable name) --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8cdd11fcb3c..224617c2f44 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1016,7 +1016,7 @@ class Contrat extends CommonObject // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; From 031bc911ea5b2e25efc06c7f8f418379baf5a239 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Feb 2013 16:46:28 +0100 Subject: [PATCH 03/34] Fix: Mass save or update of const fails. --- htdocs/admin/const.php | 46 +++++++++++++++++++++++++++++------- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 1 + 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 0d263991714..77534fd0d76 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -35,7 +35,7 @@ $rowid=GETPOST('rowid','int'); $entity=GETPOST('entity','int'); $action=GETPOST('action','alpha'); $update=GETPOST('update','alpha'); -$delete=GETPOST('delete','alpha'); +$delete=GETPOST('delete'); // Do not use alpha here $debug=GETPOST('debug','int'); $consts=GETPOST('const'); $constname=GETPOST('constname','alpha'); @@ -47,6 +47,7 @@ $typeconst=array('yesno' => 'yesno', 'texte' => 'texte', 'chaine' => 'chaine'); $mesg=''; + /* * Actions */ @@ -68,46 +69,70 @@ if ($action == 'add') if (! $error) { - if (dolibarr_set_const($db, $constname, $constvalue, $typeconst[$consttype], 1, $constnote, $entity) < 0) + if (dolibarr_set_const($db, $constname, $constvalue, $typeconst[$consttype], 1, $constnote, $entity) >= 0) + { + setEventMessage($langs->trans("RecordSaved")); + } + else { dol_print_error($db); } } } -if (! empty($consts) && $update == $langs->trans("Modify")) +// Mass update +if (! empty($consts) && $action == 'update') { + $nbmodified=0; foreach($consts as $const) { if (! empty($const["check"])) { - if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) < 0) + if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) >= 0) + { + $nbmodified++; + } + else { dol_print_error($db); } } } + if ($nbmodified > 0) setEventMessage($langs->trans("RecordSaved")); + $action=''; } -// Delete several lines at once -if (! empty($consts) && $delete == $langs->trans("Delete")) +// Mass delete +if (! empty($consts) && $action == 'delete') { + + $nbdeleted=0; foreach($consts as $const) { if (! empty($const["check"])) // Is checkbox checked { - if (dolibarr_del_const($db, $const["rowid"], -1) < 0) + if (dolibarr_del_const($db, $const["rowid"], -1) >= 0) + { + $nbdeleted++; + } + else { dol_print_error($db); } } } + if ($nbdeleted > 0) setEventMessage($langs->trans("RecordDeleted")); + $action=''; } // Delete line from delete picto if ($action == 'delete') { - if (dolibarr_del_const($db, $rowid, $entity) < 0) + if (dolibarr_del_const($db, $rowid, $entity) >= 0) + { + setEventMessage($langs->trans("RecordDeleted")); + } + else { dol_print_error($db); } @@ -130,11 +155,13 @@ jQuery(document).ready(function() { jQuery("#delconst").hide(); jQuery(".checkboxfordelete").click(function() { jQuery("#delconst").show(); + jQuery("#action").val('delete'); }); jQuery(".inputforupdate").keypress(function() { var field_id = jQuery(this).attr("id"); var row_num = field_id.split("_"); jQuery("#updateconst").show(); + jQuery("#action").val('update'); jQuery("#check_" + row_num[1]).attr("checked",true); }); }); @@ -195,7 +222,8 @@ print ''; print "\n"; print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; -print ''; +print ''; +print ''; // Show constants $sql = "SELECT"; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index dc2ee6b225e..98c28b231b2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -58,6 +58,7 @@ NbOfEntries=Nb of entries GoToWikiHelpPage=Read online help (need Internet access) GoToHelpPage=Read help RecordSaved=Record saved +RecordDeleted=Record deleted LevelOfFeature=Level of features NotDefined=Not defined DefinedAndHasThisValue=Defined and value to diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index e402a8cd1fe..301b97c1e3a 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -58,6 +58,7 @@ NbOfEntries=Nb d'entrées GoToWikiHelpPage=Consulter l'aide (nécessite un accès internet) GoToHelpPage=Consulter l'aide RecordSaved=Enregistrement sauvegardé +RecordDeleted=Enregistrement supprimé LevelOfFeature=Niveau de fonctionnalités NotDefined=Non défini DolibarrInHttpAuthenticationSoPasswordUseless=Dolibarr est configuré en mode authentification %s dans son fichier de configuration conf.php.
Cela signifie que la base des mots de passe est externe à Dolibarr, aussi toute modification de ce champ peut s'avérer sans effet. From 365680d90eab9faee8d37b4bdc21e0ee2b0873a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Feb 2013 21:25:17 +0100 Subject: [PATCH 04/34] Fix: Missing vat rates --- htdocs/install/mysql/data/llx_c_tva.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 8b840baf392..4e301564db8 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -67,6 +67,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 2 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (141, 14, '7','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (142, 14, '0','0','VAT Rate 0',1); +-- CAMEROUN (id country=24) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (241, 24, '19.25','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (242, 24, '0','0','VAT Rate 0',1); + -- CHILE (id country=67) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (671, 67, '19','0','VAT standard rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (672, 67, '0','0','VAT Rate 0',1); @@ -151,6 +155,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (17 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1662, 166, '15','0','VAT standard rate', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1663, 166, '0','0','VAT Rate 0', 1); +-- NIGERIA (id country=169) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1692, 169, '5','0','VAT standard rate', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1693, 169, '0','0','VAT Rate 0', 1); + -- NORWAY (id country=173) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1731, 173, '25','0','VAT standard rate', 1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1732, 173, '14','0','VAT reduced rate', 1); From f043fcfaf7c99644c96ff5d84874dd24d5a8fb3e Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 14 Feb 2013 13:55:05 +0100 Subject: [PATCH 05/34] Fix bug [ bug #709 ] --- htdocs/comm/action/listactions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index f369b25ab3b..341d430f2ac 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -143,6 +143,7 @@ if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; if ($type) $param.="&type=".$type; +if ($actioncode) $param.="&actioncode=".$actioncode; $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; From 14f21bc9f1d11326f804d942734bf2fb9f85a941 Mon Sep 17 00:00:00 2001 From: jfefe Date: Thu, 14 Feb 2013 23:34:44 +0100 Subject: [PATCH 06/34] 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 f847558363296ddf41bfe5a16149545973a27f4e Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Fri, 15 Feb 2013 07:21:10 +0100 Subject: [PATCH 07/34] Update htdocs/product/class/product.class.php fetch_prod_arbo / recursive call of the child product test --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8724671c20d..fc0c08e736f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2185,10 +2185,10 @@ class Product extends CommonObject $this->res[]= array($compl_path.$nom_pere,$desc_pere); } - // Recursive call - if (is_array($desc_pere)>2) + // Recursive call if child is an array + if (is_array($desc_pere[0])) { - $this ->fetch_prod_arbo($desc_pere, $nom_pere." -> ", $desc_pere[1]*$multiply, $level+1); + $this ->fetch_prod_arbo($desc_pere[0], $nom_pere." -> ", $desc_pere[1]*$multiply, $level+1); } } } From bbb18b317568b0ea21fb3b56cf572a07bc34147b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Feb 2013 10:42:35 +0100 Subject: [PATCH 08/34] Look: More CSS3 --- htdocs/comm/action/index.php | 19 +++++++++++++++---- htdocs/theme/eldy/style.css.php | 11 +++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index dc48f407c03..cbf8ef0840e 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -941,7 +941,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print '
'."\n"; $curtime = dol_mktime(0, 0, 0, $month, $day, $year); print ''; - print ''; - print ''; From b434f58af3458744e4357c03e9b0db4c553b34c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 17:12:06 +0100 Subject: [PATCH 28/34] Fix: When creating invoice from other object, type must be standard only --- htdocs/compta/facture.php | 51 +++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 0d46ca1efcd..5bc85030f99 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1919,32 +1919,35 @@ if ($action == 'create') $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); print $desc; print ''."\n"; + } - // Replacement - print ''."\n"; + // Replacement + print ''."\n"; - // Credit note + if (empty($origin)) + { + // Credit note print ''."\n"; + } - if ($socid > 0) - { - // Replacement - print ''."\n"; + if ($socid > 0) + { + // Replacement + print ''."\n"; + } - // Credit note - print ''."\n"; - } + if (empty($origin) && $socid > 0) + { + // Credit note + print ''."\n"; } print '
'; + print '
'; print ''; } print '
'; + print '
'; //$curtime = dol_mktime (0, 0, 0, $month, $day, $year); $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); @@ -1004,8 +1004,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Show rect of event print '
'; - print ''; - print ''; @@ -1256,29 +1226,6 @@ else print "\n"; } - // Module Webcalendar - // TODO external module - if (! empty($conf->webcalendar->enabled)) - { - $langs->load("other"); - print ''; - print ''; - print ''."\n"; - } - - // Module Phenix - // TODO external module - if (! empty($conf->phenix->enabled)) - { - $langs->load("other"); - print ''; - print ''; - print "\n"; - print ''; - print ''; - print ''."\n"; - } - // Company / Contact if (! empty($conf->societe->enabled)) { @@ -1575,8 +1522,6 @@ else if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; - if (! empty($conf->webcalendar->enabled)) $rowspan++; // TODO external module - if (! empty($conf->phenix->enabled)) $rowspan+=2; // TODO external module print ''; print ''; - // Module Webcalendar - // TODO external module - if (! empty($conf->webcalendar->enabled)) - { - $langs->load("other"); - print "".''; - print ''; - } - - // Module Phenix - // TODO external module - if (! empty($conf->phenix->enabled)) - { - $langs->load("other"); - print "".''; - print ''; - print "".''; - print ''; - } - // Company / Contact if (! empty($conf->societe->enabled)) { From b1ee14ce6012a108257c20055d4fdc8cf8132eae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Feb 2013 18:39:27 +0100 Subject: [PATCH 17/34] New: Can define a hierarchical responsible on users. --- ChangeLog | 1 + htdocs/core/class/html.form.class.php | 4 +- htdocs/langs/en_US/users.lang | 3 +- htdocs/langs/fr_FR/users.lang | 3 +- htdocs/user/class/user.class.php | 1 + htdocs/user/fiche.php | 101 ++++++++++++++++---------- 6 files changed, 69 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 294c09a6997..68452e0ca4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ For users: - New: Some performance enhancements. - New: Can attach files onto trip and expenses modules. - New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR +- New: Can define a hierarchical responsible on user For developers: - System of menu managers has been rewritten to reduce code to do same things. diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 28dee6f9383..dcf70443fd8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -994,7 +994,7 @@ class Form global $conf,$user,$langs; // If no preselected user defined, we take current user - if ($selected < -1 && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id; + if ((is_numeric($selected) && ($selected < -1 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id; // Permettre l'exclusion d'utilisateurs if (is_array($exclude)) $excludeUsers = implode("','",$exclude); @@ -1043,7 +1043,7 @@ class Form if ($num) { $out.= '
'; + print '
  • '; + print ''; + print '
    '; if ($event->type_code == 'BIRTHDAY') // It's a birthday { print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact'); @@ -1130,6 +1131,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1); else print ' '; print '
    '; + print '
'; print ''; $i++; } @@ -1174,4 +1176,13 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print ''."\n"; } +function dol_color_minus($color, $minus) +{ + $newcolor=$color; + $newcolor[0]=((hexdec($newcolor[0])-$minus)<0)?0:dechex((hexdec($newcolor[0])-$minus)); + $newcolor[2]=((hexdec($newcolor[2])-$minus)<0)?0:dechex((hexdec($newcolor[2])-$minus)); + $newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus)); + return $newcolor; +} + ?> diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0225c9d6cb8..ce27fdc40f1 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2059,8 +2059,15 @@ td.hidden { .cal_current_month { background: #FFFFFF; border: solid 1px #C0C0C0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FFFFFF; border: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_past { } -table.cal_event { border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px; } -table.cal_event td { border: 0px; padding-: 0px; padding-: 2px; padding-top: 0px; padding-bottom: 0px; } +table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); + moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); + background: -webkit-gradient(linear, left top, left bottom, from(#006aac), to(#00438d)); + } +table.cal_event td { border: none; padding-: 2px; padding-: 2px; padding-top: 0px; padding-bottom: 0px; } +ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; -webkit-padding-start: 2px !important; } +li.cal_event { border: none; list-style-type: none; } .cal_event a:link { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } From 7b9fc49deaaa81b492bf8543f34c09d4a7ccd1f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Feb 2013 10:46:50 +0100 Subject: [PATCH 09/34] More CSS3 --- htdocs/theme/amarok/style.css.php | 5 ++++- htdocs/theme/eldy/style.css.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 115a63d7e66..71a1c47b375 100755 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -1168,7 +1168,7 @@ div.error { .product_line_stock_ok { color: #002200; } .product_line_stock_too_low { color: #664400; } - + .fieldrequired { font-weight:bold; color:#333333; @@ -1469,6 +1469,9 @@ table.cal_event { margin-bottom:1px; } +ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; -webkit-padding-start: 2px !important; } +li.cal_event { border: none; list-style-type: none; } + .cal_event a:link { color:#232323; font-size:11px; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index ce27fdc40f1..6e51e2d257e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2071,7 +2071,7 @@ li.cal_event { border: none; list-style-type: none; } .cal_event a:link { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } -.cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; } +.cal_event a:hover { color: #111111; font-size: 11px; font-weight: normal !important; color:rgba(255,255,255,.75); } /* ============================================================================== */ From 3d8197ce4be0d36ee7de7a5dc11fe9c7ac0db1cf Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 15 Feb 2013 11:19:49 +0100 Subject: [PATCH 10/34] Work on extrafields : position management & new type : select list --- htdocs/core/admin_extrafields.inc.php | 15 +++++-- htdocs/core/class/extrafields.class.php | 33 +++++++++++---- htdocs/core/tpl/admin_extrafields_add.tpl.php | 5 ++- .../core/tpl/admin_extrafields_edit.tpl.php | 42 ++++++++++++++++--- htdocs/societe/admin/societe_extrafields.php | 2 + 5 files changed, 79 insertions(+), 18 deletions(-) diff --git a/htdocs/core/admin_extrafields.inc.php b/htdocs/core/admin_extrafields.inc.php index 29c71f9ba45..975fa94d308 100644 --- a/htdocs/core/admin_extrafields.inc.php +++ b/htdocs/core/admin_extrafields.inc.php @@ -59,7 +59,7 @@ if ($action == 'add') $mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint); $action = 'create'; } - if (GETPOST('type')=='select' && !GETPOST('extra_value')) + if (GETPOST('type')=='select' && !GETPOST('param')) { $error++; $langs->load("errors"); @@ -73,7 +73,7 @@ if ($action == 'add') if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { // Construct array for parameter (value of select list) - $parameters = GETPOST('extra_value'); + $parameters = GETPOST('param'); $parameters_array = explode("\r\n",$parameters); foreach($parameters_array as $param_ligne) { @@ -136,7 +136,16 @@ if ($action == 'update') { if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) { - $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0)); + $pos = GETPOST('pos','int'); + // Construct array for parameter (value of select list) + $parameters = GETPOST('param'); + $parameters_array = explode("\r\n",$parameters); + foreach($parameters_array as $param_ligne) + { + list($key,$value) = explode(',',$param_ligne); + $params['options'][$key] = $value; + } + $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$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 0fd57fed96d..4f583a667f9 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -207,7 +207,7 @@ 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') ) + * @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_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0,$param) @@ -343,9 +343,11 @@ 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 int $pos Position of attribute + * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @return int >0 if OK, <=0 if KO */ - function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0) + function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos,$param='') { $table=$elementtype.'_extrafields'; @@ -368,6 +370,9 @@ class ExtraFields }elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; + } elseif ($type=='select') { + $typedb='text'; + $lengthdb=''; } else { $typedb=$type; $lengthdb=$length; @@ -378,7 +383,7 @@ class ExtraFields { if ($label) { - $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required); + $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param); } if ($result > 0) { @@ -424,9 +429,11 @@ 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 int $pos Position of attribute + * @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 update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0) + private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='') { global $conf; dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required); @@ -434,7 +441,12 @@ class ExtraFields if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { $this->db->begin(); - + + if(is_array($param) && count($param) > 0) + { + $param = serialize($param); + } + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; $sql_del.= " WHERE name = '".$attrname."'"; $sql_del.= " AND entity = ".$conf->entity; @@ -450,7 +462,9 @@ class ExtraFields $sql.= " size,"; $sql.= " elementtype,"; $sql.= " fieldunique,"; - $sql.= " fieldrequired"; + $sql.= " fieldrequired,"; + $sql.= " pos,"; + $sql.= " param"; $sql.= ") VALUES ("; $sql.= "'".$attrname."',"; $sql.= " ".$conf->entity.","; @@ -459,7 +473,9 @@ class ExtraFields $sql.= " '".$size."',"; $sql.= " '".$elementtype."',"; $sql.= " '".$unique."',"; - $sql.= " '".$required."'"; + $sql.= " '".$required."',"; + $sql.= " '".$pos."',"; + $sql.= " '".$param."'"; $sql.= ")"; dol_syslog(get_class($this)."::update_label sql=".$sql); $resql2=$this->db->query($sql); @@ -512,7 +528,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,param"; + $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity = ".$conf->entity; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; @@ -535,6 +551,7 @@ class ExtraFields $this->attribute_unique[$tab->name]=$tab->fieldunique; $this->attribute_required[$tab->name]=$tab->fieldrequired; $this->attribute_param[$tab->name]=unserialize($tab->param); + $this->attribute_pos[$tab->name]=$tab->pos; } } return $array_name_label; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 0af2b782912..d4f5cf9ae40 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -55,7 +55,8 @@ - + + @@ -70,7 +71,7 @@ trans("Value"); ?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 8eed3b96c37..c2112b636f2 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -47,21 +47,53 @@
trans("Position"); ?>
trans("Label"); ?>
- +
- - - - -attribute_type[$attrname]; $size=$extrafields->attribute_size[$attrname]; $unique=$extrafields->attribute_unique[$attrname]; $required=$extrafields->attribute_required[$attrname]; +$pos=$extrafields->attribute_pos[$attrname]; +$param=$extrafields->attribute_param[$attrname]; + +if($type == 'select' && is_array($param)) +{ + $param_chain = ''; + foreach ($param['options'] as $key => $value) + { + if(strlen($key)) + { + $param_chain .= $key.', '.$value."\n"; + } + } +} ?> + + + + + + + + + + + + + + diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index cbac832ee3b..66957c0314a 100755 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -84,6 +84,7 @@ $extrafields->fetch_name_optionals_label($elementtype); print "
trans("Label"); ?>
trans("AttributeCode"); ?>
trans("Position"); ?>
trans("Label"); ?>
trans("AttributeCode"); ?>
trans("Type"); ?>
+ trans("Value"); ?> + + +
trans("Size"); ?>
"; print ''; +print ''; print ''; print ''; print ''; @@ -98,6 +99,7 @@ foreach($extrafields->attribute_type as $key => $value) { $var=!$var; print ""; + print "\n"; print "\n"; print "\n"; print "\n"; From cddd59d98dfbe2f51c702445cb06c096a385b093 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 15 Feb 2013 14:23:35 +0100 Subject: [PATCH 11/34] fix : doesnt work with a \/ --- htdocs/langs/fr_FR/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 802bbb28191..d5c0daa97b8 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -283,7 +283,7 @@ GenericMaskCodes3= Tout autre caractère dans le masque sera laissé inchangé.< GenericMaskCodes4a= Exemple sur la 99eme %s du tiers LaCompanie faite le 31/03/2007:
GenericMaskCodes4b= Exemple sur un tiers créé le 31/03/2007:
GenericMaskCodes4c= Exemple sur un produit/service créé le 31/03/2007:
-GenericMaskCodes5= ABC{yy}{mm}-{000000} donnera ABC0703-000099
{0000+100}-XXX/{dd}/YYY donnera 0199-XXX/31/YYY +GenericMaskCodes5= ABC{yy}{mm}-{000000} donnera ABC0703-000099
{0000+100}-XXX-{dd}-YYY donnera 0199-XXX-31-YYY GenericNumRefModelDesc= Renvoie un numéro personnalisable selon un masque à définir. ServerAvailableOnIPOrPort= Serveur disponible à l'adresse %s sur le port %s ServerNotAvailableOnIPOrPort= Serveur non disponible à l'adresse %s sur le port %s From 7c1a4e6fdf49d4516adbfc338a6eaf8948843374 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 15 Feb 2013 15:48:53 +0100 Subject: [PATCH 12/34] fix trad to get better understanding --- htdocs/core/class/commonobject.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5c9b8d93122..5d6d869ad81 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1023,7 +1023,7 @@ abstract class CommonObject /** * Save a new position (field rang) for details lines. - * You can choose to ser position for lines with already a position or lines wihtout any position defined. + * You can choose to set position for lines with already a position or lines without any position defined. * Call this function only for table that contains a field fk_parent_line. * * @param boolean $renum true to renum all already ordered lines, false to renum only not already ordered lines. @@ -1064,7 +1064,7 @@ abstract class CommonObject // counter that parents. $rows=array(); - // We frist search all lines that are parent lines (for multilevel details lines) + // We first search all lines that are parent lines (for multilevel details lines) $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; $sql.= ' AND fk_parent_line IS NULL'; @@ -1080,10 +1080,10 @@ abstract class CommonObject { $row = $this->db->fetch_row($resql); $rows[] = $row[0]; // Add parent line into array rows - $childrens = $this->getChildrensOfLine($row[0]); - if (! empty($childrens)) + $childrens = $this->getChildrenOfLine($row[0]); + if (! empty($children)) { - foreach($childrens as $child) + foreach($children as $child) { array_push($rows, $child); } @@ -1108,12 +1108,12 @@ abstract class CommonObject } /** - * Get childrens of line + * Get children of line * * @param int $id Id of parent line - * @return array Array with list of child lines id + * @return array Array with list of children lines id */ - function getChildrensOfLine($id) + function getChildrenOfLine($id) { $rows=array(); @@ -1122,7 +1122,7 @@ abstract class CommonObject $sql.= ' AND fk_parent_line = '.$id; $sql.= ' ORDER BY rang ASC'; - dol_syslog(get_class($this)."::getChildrenOfLines search children lines for line ".$id." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id." sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { From 7260f39d2121a71a9d966411315660e68c3980e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Feb 2013 17:06:32 +0100 Subject: [PATCH 13/34] New: Support tag total_vat_x.y for vat rate x.y into ODT templates --- .../commande/doc/doc_generic_order_odt.modules.php | 11 ++++++++++- .../facture/doc/doc_generic_invoice_odt.modules.php | 11 ++++++++++- .../propale/doc/doc_generic_proposal_odt.modules.php | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 0ad0ecc0e7e..fff62466958 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -97,7 +97,7 @@ class doc_generic_order_odt extends ModelePDFCommandes { global $conf; - return array( + $resarray=array( 'object_id'=>$object->id, 'object_ref'=>$object->ref, 'object_ref_ext'=>$object->ref_ext, @@ -120,6 +120,15 @@ class doc_generic_order_odt extends ModelePDFCommandes 'object_note_private'=>$object->note, 'object_note'=>$object->note_public, ); + + // Add vat by rates + foreach ($object->lines as $line) + { + if (empty($resarray['object_total_vat_'.$line->tva_tx])) $resarray['object_total_vat_'.$line->tva_tx]=0; + $resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva; + } + + return $resarray; } /** diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index dcf8436636d..37e2b7e32b6 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -105,7 +105,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $sumpayed = $object->getSommePaiement(); $alreadypayed=price($sumpayed,0,$outputlangs); - return array( + $resarray=array( 'object_id'=>$object->id, 'object_ref'=>$object->ref, 'object_ref_ext'=>$object->ref_ext, @@ -132,6 +132,15 @@ class doc_generic_invoice_odt extends ModelePDFFactures 'object_already_payed'=>$alreadypayed, 'object_remain_to_pay'=>price($object->total_ttc - $sumpayed,0,$outputlangs) ); + + // Add vat by rates + foreach ($object->lines as $line) + { + if (empty($resarray['object_total_vat_'.$line->tva_tx])) $resarray['object_total_vat_'.$line->tva_tx]=0; + $resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva; + } + + return $resarray; } /** diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index be0ac3f7d3f..d18c17735ae 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -97,7 +97,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales { global $conf; - return array( + $resarray=array( 'object_id'=>$object->id, 'object_ref'=>$object->ref, 'object_ref_ext'=>$object->ref_ext, @@ -119,6 +119,15 @@ class doc_generic_proposal_odt extends ModelePDFPropales 'object_note_private'=>$object->note, 'object_note'=>$object->note_public, ); + + // Add vat by rates + foreach ($object->lines as $line) + { + if (empty($resarray['object_total_vat_'.$line->tva_tx])) $resarray['object_total_vat_'.$line->tva_tx]=0; + $resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva; + } + + return $resarray; } /** From e0bbb78f56de33605eafe6c600a2e4f9eeb72aa7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Feb 2013 17:28:07 +0100 Subject: [PATCH 14/34] Fix: Merge customer and prospect tab --- htdocs/comm/fiche.php | 49 +++++++++++++++++---------------- htdocs/core/lib/company.lib.php | 4 ++- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 397fb9da835..fcecbf0a552 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -386,29 +386,32 @@ if ($id > 0) } // Level of prospect - print '
"; - print ''; - - // Status - print ''; - print ''; + if ($object->client == 2 || $object->client == 3) + { + print '"; + print ''; + + // Status + print ''; + print ''; + } // Sales representative include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 4fb851ce4d3..afd9522801a 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -45,7 +45,9 @@ function societe_prepare_head($object) if ($object->client==1 || $object->client==2 || $object->client==3 || (isset($object->object) && $object->object->client==1) || (isset($object->object) && $object->object->client==3)) { $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Customer"); + if ($object->client==2 || $object->client==3) $head[$h][1] = $langs->trans("Prospect"); + if ($object->client==3) $head[$h][1] .= '/'; + if ($object->client==1 || $object->client==3) $head[$h][1] .= $langs->trans("Customer"); $head[$h][2] = 'customer'; $h++; } From 7c47dedbcee621211216c8ce3c3db316ec1ebfb6 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 15 Feb 2013 17:33:07 +0100 Subject: [PATCH 15/34] fix trad: begin change address instead of adresse --- htdocs/adherents/class/adherent.class.php | 10 +++++----- htdocs/adherents/fiche.php | 4 ++-- htdocs/adherents/liste.php | 2 +- htdocs/adherents/type.php | 2 +- htdocs/core/modules/modAdherent.class.php | 10 +++++----- htdocs/install/mysql/tables/llx_adherent.sql | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 0eea1c6f5d7..8e9c75e2423 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -51,7 +51,7 @@ class Adherent extends CommonObject var $login; var $pass; var $societe; - var $adresse; + //var $adresse; var $address; var $cp; var $zip; @@ -429,7 +429,7 @@ class Adherent extends CommonObject $sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null"); $sql.= ", societe=" .($this->societe?"'".$this->db->escape($this->societe)."'":"null"); $sql.= ", fk_soc=" .($this->fk_soc > 0?"'".$this->fk_soc."'":"null"); - $sql.= ", adresse=" .($this->address?"'".$this->db->escape($this->address)."'":"null"); + $sql.= ", address=" .($this->address?"'".$this->db->escape($this->address)."'":"null"); $sql.= ", cp=" .($this->zip?"'".$this->db->escape($this->zip)."'":"null"); $sql.= ", ville=" .($this->town?"'".$this->db->escape($this->town)."'":"null"); $sql.= ", pays=" .($this->country_id>0?"'".$this->country_id."'":"null"); @@ -1019,7 +1019,7 @@ class Adherent extends CommonObject { global $langs; - $sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as lastname, d.societe, d.fk_soc, d.statut, d.public, d.adresse as address, d.cp as zip, d.ville as town, d.note,"; + $sql = "SELECT d.rowid, d.civilite, d.prenom as firstname, d.nom as lastname, d.societe, d.fk_soc, d.statut, d.public, d.address, d.cp as zip, d.ville as town, d.note,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; @@ -1065,7 +1065,7 @@ class Adherent extends CommonObject $this->pass = $obj->pass; $this->societe = $obj->societe; $this->fk_soc = $obj->fk_soc; - $this->adresse = $obj->address; // deprecated + //$this->adresse = $obj->address; // deprecated $this->address = $obj->address; $this->cp = $obj->zip; // deprecated $this->zip = $obj->zip; @@ -1824,7 +1824,7 @@ class Adherent extends CommonObject if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; - if ($this->adresse && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->adresse; + if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; if ($this->cp && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->cp; if ($this->ville && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->ville; if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index f84990b94e5..d1c8beb6426 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -259,7 +259,7 @@ 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->adresse = trim($_POST["address"]); // deprecated $object->address = trim($_POST["address"]); $object->cp = trim($_POST["zipcode"]); // deprecated $object->zip = trim($_POST["zipcode"]); @@ -440,7 +440,7 @@ if ($action == 'add' && $user->rights->adherent->creer) $object->firstname = $prenom; $object->lastname = $nom; $object->societe = $societe; - $object->adresse = $address; // deprecated + //$object->adresse = $address; // deprecated $object->address = $address; $object->cp = $zip; // deprecated $object->zip = $zip; diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index 2363a3529d2..b19fcae8d85 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -104,7 +104,7 @@ if ($sall) $sql.=" AND ("; if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR "; $sql.=" d.prenom LIKE '%".$sall."%' OR d.nom LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'"; - $sql.=" OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.adresse LIKE '%".$sall."%'"; + $sql.=" OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.address LIKE '%".$sall."%'"; $sql.=" OR d.ville LIKE '%".$sall."%' OR d.note LIKE '%".$sall."%')"; } if ($type > 0) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 369f925bc7e..eaddb4866c4 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -416,7 +416,7 @@ if ($rowid > 0) if ($sall) { $sql.= " AND (d.prenom LIKE '%".$sall."%' OR d.nom LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'"; - $sql.= " OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.adresse LIKE '%".$sall."%'"; + $sql.= " OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.address LIKE '%".$sall."%'"; $sql.= " OR d.ville LIKE '%".$sall."%' OR d.note LIKE '%".$sall."%')"; } if ($status != '') diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 281a672c60d..4dea8571657 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -172,9 +172,9 @@ class modAdherent extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='MembersAndSubscriptions'; $this->export_permission[$r]=array(array("adherent","export")); - $this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civilite'=>"UserTitle",'a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.adresse'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount'); - $this->export_TypeFields_array[$r]=array('a.civilite'=>"Text",'a.nom'=>"Text",'a.prenom'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.adresse'=>"Text",'a.cp'=>"Text",'a.ville'=>"Text",'a.pays'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.naiss'=>"Date",'a.statut'=>"Status",'a.note'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:fk_adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Number'); - $this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.nom'=>"member",'a.prenom'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.adresse'=>"member",'a.cp'=>"member",'a.ville'=>"member",'a.pays'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); + $this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civilite'=>"UserTitle",'a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount'); + $this->export_TypeFields_array[$r]=array('a.civilite'=>"Text",'a.nom'=>"Text",'a.prenom'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.cp'=>"Text",'a.ville'=>"Text",'a.pays'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.naiss'=>"Date",'a.statut'=>"Status",'a.note'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:fk_adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Number'); + $this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.nom'=>"member",'a.prenom'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.cp'=>"member",'a.ville'=>"member",'a.pays'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); // Add extra fields $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'"; $resql=$this->db->query($sql); @@ -207,7 +207,7 @@ class modAdherent extends DolibarrModules $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent','extra'=>MAIN_DB_PREFIX.'adherent_extrafields'); $this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array('a.civilite'=>"UserTitle",'a.nom'=>"Lastname*",'a.prenom'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.adresse'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'); + $this->import_fields_array[$r]=array('a.civilite'=>"UserTitle",'a.nom'=>"Lastname*",'a.prenom'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'"; $resql=$this->db->query($sql); @@ -223,7 +223,7 @@ class modAdherent extends DolibarrModules // End add extra fields $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('a.civilite'=>'code@'.MAIN_DB_PREFIX.'c_civilite','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('a.civilite'=>"MR",'a.nom'=>'Smith','a.prenom'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.adresse'=>'21 jump street','a.cp'=>'55000','a.ville'=>'New York','a.pays'=>'1','a.email'=>'jsmith@example.com','a.naiss'=>'1972-10-10','a.statut'=>"0 or 1",'a.note'=>"This is a comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d')); + $this->import_examplevalues_array[$r]=array('a.civilite'=>"MR",'a.nom'=>'Smith','a.prenom'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.cp'=>'55000','a.ville'=>'New York','a.pays'=>'1','a.email'=>'jsmith@example.com','a.naiss'=>'1972-10-10','a.statut'=>"0 or 1",'a.note'=>"This is a comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d')); } diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 3ab580b5de2..90727f92419 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -39,7 +39,7 @@ create table llx_adherent morphy varchar(3) NOT NULL, -- personne morale / personne physique societe varchar(50), fk_soc integer NULL, -- Link to third party linked to member - adresse text, + address text, cp varchar(30), ville varchar(50), fk_departement integer, From 145573ea79756c81b4195cfc5c74af039ab7667a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Feb 2013 17:37:30 +0100 Subject: [PATCH 16/34] Qual: Removed useless code for old modules. There is hook now to do same job. --- htdocs/user/fiche.php | 84 ------------------------------------------- 1 file changed, 84 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index cf0e0170c94..451be57c976 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -196,11 +196,6 @@ if ($action == 'add' && $canadduser) } } - // FIXME external module - $object->webcal_login = $_POST["webcal_login"]; - $object->phenix_login = $_POST["phenix_login"]; - $object->phenix_pass = $_POST["phenix_pass"]; - // If multicompany is off, admin users must all be on entity 0. if (! empty($conf->multicompany->enabled)) { @@ -342,11 +337,6 @@ if ($action == 'update' && ! $_POST["cancel"]) } } - // FIXME external module - $object->webcal_login = $_POST["webcal_login"]; - $object->phenix_login = $_POST["phenix_login"]; - $object->phenix_pass = $_POST["phenix_pass"]; - if (! empty($conf->multicompany->enabled)) { if (! empty($_POST["superadmin"])) @@ -936,23 +926,6 @@ if (($action == 'create') || ($action == 'adduserldap')) } } - // Module Webcalendar - // TODO external module - if (! empty($conf->webcalendar->enabled)) - { - print "".''; - print ''; - } - - // Module Phenix - // TODO external module - if (! empty($conf->phenix->enabled)) - { - print "".''; - print ''; - print "".''; - print ''; - } print "
'.$langs->trans("Position").''.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").'
".$extrafields->attribute_pos[$key]."".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."
'; - print ''; - print '
'; - print $langs->trans('ProspectLevelShort'); - print ''; - if ($action != 'editlevel' && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'
'; - print '
'; - if ($action == 'editlevel') - $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1); - else - print $object->getLibProspLevel(); - print "
'.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4).''; - if ($object->stcomm_id != -1) print ''.img_action(0,-1).''; - if ($object->stcomm_id != 0) print ''.img_action(0,0).''; - if ($object->stcomm_id != 1) print ''.img_action(0,1).''; - if ($object->stcomm_id != 2) print ''.img_action(0,2).''; - if ($object->stcomm_id != 3) print ''.img_action(0,3).''; - print '
'; + print ''; + print '
'; + print $langs->trans('ProspectLevel'); + print ''; + if ($action != 'editlevel' && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'
'; + print '
'; + if ($action == 'editlevel') + $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1); + else + print $object->getLibProspLevel(); + print "
'.$langs->trans("StatusProsp").''.$object->getLibProspCommStatut(4).''; + if ($object->stcomm_id != -1) print ''.img_action(0,-1).''; + if ($object->stcomm_id != 0) print ''.img_action(0,0).''; + if ($object->stcomm_id != 1) print ''.img_action(0,1).''; + if ($object->stcomm_id != 2) print ''.img_action(0,2).''; + if ($object->stcomm_id != 3) print ''.img_action(0,3).''; + print '
'.$langs->trans("LoginWebcal").'
'.$langs->trans("LoginPenix").'
'.$langs->trans("PassPenix").'
\n"; print '

'; @@ -1089,9 +1062,6 @@ else if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; - if (! empty($conf->webcalendar->enabled)) $rowspan++; // TODO external module - if (! empty($conf->phenix->enabled)) $rowspan+=2; // TODO external module - // Lastname print '
'.$langs->trans("Lastname").'
'.$langs->trans("LoginWebcal").''.$object->webcal_login.' 
'.$langs->trans("LoginPhenix").''.$object->phenix_login.' 
'.$langs->trans("PassPhenix").''.preg_replace('/./i','*',$object->phenix_pass_crypted).' 
'.$langs->trans("Ref").''; @@ -1867,35 +1812,6 @@ else print $object->getLibStatut(4); print '
'.$langs->trans("LoginWebcal").''; - if ($caneditfield) print ''; - else print $object->webcal_login; - print '
'.$langs->trans("LoginPhenix").''; - if ($caneditfield) print ''; - else print $object->phenix_login; - print '
'.$langs->trans("PassPhenix").''; - if ($caneditfield) print ''; - else print preg_replace('/./i','*',$object->phenix_pass_crypted); - print '
'; // Ref @@ -1058,7 +1061,6 @@ else print ''; print ''."\n"; - $rowspan=15; if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; @@ -1146,22 +1148,6 @@ else } print ''."\n"; - // Multicompany - if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print '\n"; - } - // Type print ''."\n"; - // ldap sid + // Ldap sid if ($object->ldap_sid) { print '\n"; - + + // Hierarchy + print ''; + print ''; + print "\n"; + // Statut print ''; print ''; print "\n"; } - + // Company / Contact if (! empty($conf->societe->enabled)) { @@ -1274,6 +1272,22 @@ else print ''."\n"; } + // Multicompany + if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print '\n"; + } + // Other attributes $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1512,14 +1526,14 @@ else if ($action == 'edit' && ($canedituser || ($user->id == $object->id))) { - print ''; + $rowspan=14; + + print ''; print ''; print ''; print ''; print '
'.$langs->trans("Entity").''; - if ($object->admin && ! $object->entity) - { - print $langs->trans("AllEntities"); - } - else - { - $mc->getInfo($object->entity); - print $mc->label; - } - print "
'.$langs->trans("Type").''; $type=$langs->trans("Internal"); @@ -1170,7 +1156,7 @@ else if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; print '
'.$langs->trans("Type").''; @@ -1202,7 +1188,19 @@ else print '
'.$langs->trans('Signature').''; print dol_textishtml($object->signature)?$object->signature:dol_nl2br($object->signature,1,false); print "
'.$langs->trans("HierarchicalResponsible").''; + if (empty($object->fk_user)) print $langs->trans("None"); + else { + $huser=new User($db); + $huser->fetch($object->fk_user); + print $huser->getNomUrl(1); + } + print '
'.$langs->trans("Status").''; @@ -1225,7 +1223,7 @@ else print ''.$object->openid.'
'.$langs->trans("Entity").''; + if ($object->admin && ! $object->entity) + { + print $langs->trans("AllEntities"); + } + else + { + $mc->getInfo($object->entity); + print $mc->label; + } + print "
'; - $rowspan=13; - if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++; @@ -1693,21 +1707,6 @@ else print ''; } - // Multicompany - if (! empty($conf->multicompany->enabled)) - { - if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print "".''; - print "\n"; - } - else - { - print ''; - } - } - // Type print ''; print ''; - + // openid if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) { @@ -1806,12 +1805,34 @@ else print ''; } + // Hierarchy + print ''; + print ''; + print "\n"; + // Statut print ''; print ''; - + + // Multicompany + if (! empty($conf->multicompany->enabled)) + { + if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print "".''; + print "\n"; + } + else + { + print ''; + } + } + // Company / Contact if (! empty($conf->societe->enabled)) { From 12317d03711a65d7ae32ff94a1a4f9fba70a1aa6 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 15 Feb 2013 19:18:26 +0100 Subject: [PATCH 18/34] fix trad : change adresse versus address --- htdocs/commande/class/commande.class.php | 8 ++++---- htdocs/install/mysql/tables/llx_commande.sql | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 335757c59d6..15a42841002 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -66,7 +66,7 @@ class Commande extends CommonOrder var $demand_reason_id; var $demand_reason_code; var $fk_delivery_address; - var $adresse; + var $address; var $date; // Date commande var $date_commande; // Date commande (deprecated) var $date_livraison; // Date livraison souhaitee @@ -631,7 +631,7 @@ class Commande extends CommonOrder $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande ("; $sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note, note_public, ref_client, ref_int"; - $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_adresse_livraison"; + $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; $sql.= ", remise_absolue, remise_percent"; $sql.= ", entity"; $sql.= ")"; @@ -1240,7 +1240,7 @@ class Commande extends CommonOrder $sql.= ', c.date_commande'; $sql.= ', c.date_livraison'; $sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; - $sql.= ', c.note as note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_adresse_livraison, c.extraparams'; + $sql.= ', c.note as note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', ca.code as availability_code'; @@ -1301,7 +1301,7 @@ class Commande extends CommonOrder $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->fk_delivery_address = $obj->fk_adresse_livraison; + $this->fk_delivery_address = $obj->fk_delivery_address; $this->extraparams = (array) json_decode($obj->extraparams, true); diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index bc5312b1fe2..0ef0eddb739 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -63,7 +63,7 @@ create table llx_commande date_livraison date default NULL, fk_availability integer NULL, fk_input_reason integer, - fk_adresse_livraison integer, -- delivery address (deprecated) + fk_delivery_address integer, -- delivery address (deprecated) import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format From 2bfd6c40d0e7bba5f05f06a96580360057749b30 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 15 Feb 2013 19:26:09 +0100 Subject: [PATCH 19/34] fix trad : change adresse versus address --- htdocs/compta/dons/class/don.class.php | 20 +++++++++---------- htdocs/compta/dons/fiche.php | 10 +++++----- .../modules/dons/html_cerfafr.modules.php | 2 +- htdocs/install/mysql/tables/llx_don.sql | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index e4ee40df7c3..4942c8f3f7e 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -42,7 +42,7 @@ class Don extends CommonObject var $prenom; var $nom; var $societe; - var $adresse; + var $address; var $cp; var $ville; var $pays; @@ -188,7 +188,7 @@ class Don extends CommonObject $this->amount = 100; $this->public = 1; $this->societe = 'The Company'; - $this->adresse = 'Twist road'; + $this->address = 'Twist road'; $this->cp = '99999'; $this->ville = 'Town'; $this->note_public='SPECIMEN'; @@ -217,7 +217,7 @@ class Don extends CommonObject } } - if (dol_strlen(trim($this->adresse)) == 0) + if (dol_strlen(trim($this->address)) == 0) { $error_string[$err] = "L'adresse saisie est invalide"; $err++; @@ -297,7 +297,7 @@ class Don extends CommonObject global $conf; // Clean parameters - $this->address=($this->address>0?$this->address:$this->adresse); + $this->address=($this->address>0?$this->address:$this->address); $this->zip=($this->zip>0?$this->zip:$this->cp); $this->town=($this->town>0?$this->town:$this->ville); $this->country_id=($this->country_id>0?$this->country_id:$this->fk_pays); @@ -313,7 +313,7 @@ class Don extends CommonObject $sql.= ", prenom"; $sql.= ", nom"; $sql.= ", societe"; - $sql.= ", adresse"; + $sql.= ", address"; $sql.= ", cp"; $sql.= ", ville"; $sql.= ", pays"; @@ -334,7 +334,7 @@ class Don extends CommonObject $sql.= ", '".$this->db->escape($this->prenom)."'"; $sql.= ", '".$this->db->escape($this->nom)."'"; $sql.= ", '".$this->db->escape($this->societe)."'"; - $sql.= ", '".$this->db->escape($this->adresse)."'"; + $sql.= ", '".$this->db->escape($this->address)."'"; $sql.= ", '".$this->db->escape($this->zip)."'"; $sql.= ", '".$this->db->escape($this->town)."'"; $sql.= ", '".$this->db->escape($this->country)."'"; // TODO use country_id @@ -382,7 +382,7 @@ class Don extends CommonObject function update($user) { // Clean parameters - $this->address=($this->address>0?$this->address:$this->adresse); + $this->address=($this->address>0?$this->address:$this->address); $this->zip=($this->zip>0?$this->zip:$this->cp); $this->town=($this->town>0?$this->town:$this->ville); $this->country_id=($this->country_id>0?$this->country_id:$this->fk_pays); @@ -394,7 +394,7 @@ class Don extends CommonObject $sql .= ",prenom = '".$this->db->escape($this->prenom)."'"; $sql .= ",nom='".$this->db->escape($this->nom)."'"; $sql .= ",societe='".$this->db->escape($this->societe)."'"; - $sql .= ",adresse='".$this->db->escape($this->address)."'"; + $sql .= ",address='".$this->db->escape($this->address)."'"; $sql .= ",cp='".$this->db->escape($this->zip)."'"; $sql .= ",ville='".$this->db->escape($this->town)."'"; $sql .= ",pays='".$this->db->escape($this->country)."'"; // TODO use country_id @@ -463,7 +463,7 @@ class Don extends CommonObject global $conf; $sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,"; - $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.phone, d.phone_mobile, d.fk_don_projet,"; + $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.address, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.phone, d.phone_mobile, d.fk_don_projet,"; $sql.= " p.title as project_label"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_don_projet"; @@ -487,7 +487,7 @@ class Don extends CommonObject $this->nom = $obj->nom; $this->societe = $obj->societe; $this->statut = $obj->fk_statut; - $this->adresse = $obj->adresse; + $this->address = $obj->address; $this->cp = $obj->cp; $this->ville = $obj->ville; $this->zip = $obj->cp; diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index 6ba13a19631..5ea563fbf14 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -88,7 +88,7 @@ if ($action == 'update') $don->prenom = $_POST["prenom"]; $don->nom = $_POST["nom"]; $don->societe = $_POST["societe"]; - $don->adresse = $_POST["adresse"]; + $don->address = $_POST["address"]; $don->amount = price2num($_POST["amount"]); $don->cp = $_POST["zipcode"]; $don->ville = $_POST["town"]; @@ -140,7 +140,7 @@ if ($action == 'add') $don->prenom = $_POST["prenom"]; $don->nom = $_POST["nom"]; $don->societe = $_POST["societe"]; - $don->adresse = $_POST["adresse"]; + $don->address = $_POST["address"]; $don->amount = price2num($_POST["amount"]); $don->cp = $_POST["zipcode"]; $don->ville = $_POST["town"]; @@ -300,7 +300,7 @@ if ($action == 'create') print "".''; print "".''; print "".''; + print ''; // Zip / Town print '".''; print "".''; print "".''; + print ''; // Zip / Town print '".''; print "".''; print "".''; - print "".''; + print "".''; // Zip / Town print "".''; diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 47aa150dc4d..cf71f536593 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -144,7 +144,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__MAIN_INFO_SOCIETE_CP__',$mysoc->zip,$form); $form = str_replace('__MAIN_INFO_SOCIETE_VILLE__',$mysoc->town,$form); $form = str_replace('__DONATOR_NAME__',$don->nom,$form); - $form = str_replace('__DONATOR_ADDRESS__',$don->adresse,$form); + $form = str_replace('__DONATOR_ADDRESS__',$don->address,$form); $form = str_replace('__DONATOR_ZIP__',$don->cp,$form); $form = str_replace('__DONATOR_TOWN__',$don->ville,$form); $form = str_replace('__PAYMENTMODE_LIB__ ', $paymentmode,$form); diff --git a/htdocs/install/mysql/tables/llx_don.sql b/htdocs/install/mysql/tables/llx_don.sql index 60f977e886d..d23d112ee1b 100644 --- a/htdocs/install/mysql/tables/llx_don.sql +++ b/htdocs/install/mysql/tables/llx_don.sql @@ -33,7 +33,7 @@ create table llx_don prenom varchar(50), nom varchar(50), societe varchar(50), - adresse text, + address text, cp varchar(30), ville varchar(50), pays varchar(50), From 785e72d5339077aeb43bb36629dd9fe26bdf6fea Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 15 Feb 2013 19:36:09 +0100 Subject: [PATCH 20/34] fix trad : change adresse versus address --- htdocs/comm/propal/class/propal.class.php | 10 +++++----- htdocs/install/mysql/tables/llx_propal.sql | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 90ba3f93690..230e696bf10 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -90,7 +90,7 @@ class Propal extends CommonObject var $fk_delivery_address; // deprecated (for compatibility) var $fk_address; var $address_type; - var $adresse; + var $address; var $availability_id; var $availability_code; var $demand_reason_id; @@ -789,7 +789,7 @@ class Propal extends CommonObject if (! $error && $this->fk_delivery_address) { $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql.= " SET fk_adresse_livraison = ".$this->fk_delivery_address; + $sql.= " SET fk_delivery_address = ".$this->fk_delivery_address; $sql.= " WHERE ref = '".$this->ref."'"; $sql.= " AND entity = ".$conf->entity; @@ -985,7 +985,7 @@ class Propal extends CommonObject $sql.= ", p.note as note_private, p.note_public"; $sql.= ", p.fk_projet, p.fk_statut"; $sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; - $sql.= ", p.fk_adresse_livraison"; + $sql.= ", p.fk_delivery_address"; $sql.= ", p.fk_availability"; $sql.= ", p.fk_input_reason"; $sql.= ", p.fk_cond_reglement"; @@ -1049,8 +1049,8 @@ class Propal extends CommonObject $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; $this->demand_reason = $obj->demand_reason; - $this->fk_delivery_address = $obj->fk_adresse_livraison; // TODO obsolete - $this->fk_address = $obj->fk_adresse_livraison; + //$this->fk_delivery_address = $obj->fk_adresse_livraison; // TODO obsolete + $this->fk_address = $obj->fk_delivery_address; $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 9c4a440c23b..2964e768e47 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -65,6 +65,6 @@ create table llx_propal fk_input_reason integer, import_key varchar(14), extraparams varchar(255), -- for stock other parameters with json format - fk_adresse_livraison integer -- delivery address (deprecated) + fk_delivery_address integer -- delivery address (deprecated) )ENGINE=innodb; From ab2b06117bc390d3215011ba406e5cd46ebba2f9 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Fri, 15 Feb 2013 19:56:51 +0100 Subject: [PATCH 21/34] fix trad : change adresse versus address --- htdocs/contact/class/contact.class.php | 2 +- htdocs/core/class/CMailFile.class.php | 6 +++--- htdocs/core/class/commonobject.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 14c8630e1e5..411de5d5fcd 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -520,7 +520,7 @@ class Contact extends CommonObject $this->prenom = $obj->firstname; // TODO deprecated $this->address = $obj->address; - $this->adresse = $obj->address; // TODO deprecated + //$this->adresse = $obj->address; // TODO deprecated $this->cp = $obj->zip; // TODO deprecated $this->zip = $obj->zip; $this->ville = $obj->town; // TODO deprecated diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 9165b082679..a9337c87b8b 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1020,7 +1020,7 @@ class CMailFile /** * Return an address for SMTP protocol * - * @param string $adresses Example: 'John Doe ' or 'john@doe.com' + * @param string $address Example: 'John Doe ' or 'john@doe.com' * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between " * @param int $encode 1=Encode name to RFC2822 * @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= ' @@ -1028,13 +1028,13 @@ class CMailFile * If format 2: 'john@doe.com' * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" ' */ - function getValidAddress($adresses,$format,$encode='') + function getValidAddress($address,$format,$encode='') { global $conf; $ret=''; - $arrayaddress=explode(',',$adresses); + $arrayaddress=explode(',',$address); // Boucle sur chaque composant de l'adresse foreach($arrayaddress as $val) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5d6d869ad81..8184e186999 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -964,7 +964,7 @@ abstract class CommonObject */ function setDeliveryAddress($id) { - $fieldname = 'fk_adresse_livraison'; + $fieldname = 'fk_delivery_address'; if ($this->element == 'delivery' || $this->element == 'shipping') $fieldname = 'fk_address'; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ".$fieldname." = ".$id; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 7c9a5917727..1f890d2da3d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -675,7 +675,7 @@ class Expedition extends CommonObject if (isset($this->socid)) $this->socid=trim($this->socid); if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid); - if (isset($this->fk_adresse_livraison)) $this->fk_adresse_livraison=trim($this->fk_adresse_livraison); + if (isset($this->fk_delivery_address)) $this->fk_delivery_address=trim($this->fk_delivery_address); if (isset($this->expedition_method_id)) $this->expedition_method_id=trim($this->expedition_method_id); if (isset($this->tracking_number)) $this->tracking_number=trim($this->tracking_number); if (isset($this->statut)) $this->statut=trim($this->statut); @@ -706,7 +706,7 @@ class Expedition extends CommonObject $sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").","; $sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').","; $sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; - $sql.= " fk_address=".(isset($this->fk_adresse_livraison)?$this->fk_adresse_livraison:"null").","; + $sql.= " fk_address=".(isset($this->fk_delivery_address)?$this->fk_delivery_address:"null").","; $sql.= " fk_expedition_methode=".((isset($this->expedition_method_id) && $this->expedition_method_id > 0)?$this->expedition_method_id:"null").","; $sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").","; $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; From 50decdd941cb1e81788dd4c91b713f49492360fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Feb 2013 21:06:15 +0100 Subject: [PATCH 22/34] Fix: When creating user on other entity, no way to read user after creation. --- htdocs/core/class/html.form.class.php | 26 +++++------ htdocs/user/class/user.class.php | 6 +-- htdocs/user/fiche.php | 65 +++++++++++++++------------ 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index dcf70443fd8..2d46eec81dc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -689,7 +689,7 @@ class Form { //$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2); $out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); - /* + /* if ($selected && empty($selected_input_value)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -876,7 +876,7 @@ class Form if ($resql) { $num=$this->db->num_rows($resql); - + if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && ! $forcecombo) { $out.= ajax_combobox($htmlname, $event); @@ -968,10 +968,10 @@ class Form * @param int $disabled If select list must be disabled * @param array $include Array list of users id to include * @param int $enableonly Array list of users id to be enabled. All other must be disabled - * @param int $force_entity Possibility to force entity + * @param int $force_entity 0 or Id of environment to force * @return void */ - function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=false) + function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) { print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); } @@ -986,10 +986,10 @@ class Form * @param int $disabled If select list must be disabled * @param array $include Array list of users id to include * @param int $enableonly Array list of users id to be enabled. All other must be disabled - * @param int $force_entity Possibility to force entity + * @param int $force_entity 0 or Id of environment to force * @return string HTML select string */ - function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=false) + function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) { global $conf,$user,$langs; @@ -3946,17 +3946,17 @@ class Form /** * Return select list of groups * - * @param string $selected Id group preselected - * @param string $htmlname Field name in form - * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue - * @param string $exclude Array list of groups id to exclude + * @param string $selected Id group preselected + * @param string $htmlname Field name in form + * @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue + * @param string $exclude Array list of groups id to exclude * @param int $disabled If select list must be disabled - * @param string $include Array list of groups id to include + * @param string $include Array list of groups id to include * @param int $enableonly Array list of groups id to be enabled. All other must be disabled - * @param int $force_entity Possibility to force entity + * @param int $force_entity 0 or Id of environment to force * @return void */ - function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='') + function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0) { global $conf,$user,$langs; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6b144c79a08..59641c1bbc1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -154,13 +154,13 @@ class User extends CommonObject $sql.= " u.ref_int, u.ref_ext"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; - if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) + if ((empty($conf->multicompany->enabled) || empty($conf->multicompany->transverse_mode)) && (! empty($user->entity))) { - $sql.= " WHERE u.entity IS NOT NULL"; + $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; } else { - $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; + $sql.= " WHERE u.entity IS NOT NULL"; } if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 7988b68dfd2..4da27c64a55 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -819,21 +819,6 @@ if (($action == 'create') || ($action == 'adduserldap')) print "\n"; } - //Multicompany - if (! empty($conf->multicompany->enabled)) - { - if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) - { - print "".''; - print "\n"; - } - else - { - print ''; - } - } - // Type print ''; print ''; + // Multicompany + if (! empty($conf->multicompany->enabled)) + { + if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) + { + print "".''; + print "\n"; + } + else + { + print ''; + } + } + + // Hierarchy + print ''; + print ''; + print "\n"; + // Note print ''; From d2074d1a176c3ca57ce9480e89a1bb482c9a7c4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 17:06:55 +0100 Subject: [PATCH 27/34] Fix: When creating invoice from other object, type must be standard only --- htdocs/compta/facture.php | 109 ++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 86f03b2d040..0d46ca1efcd 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1899,14 +1899,6 @@ if ($action == 'create') print $desc; print ''."\n"; - // Deposit - print ''."\n"; - // Proforma if (! empty($conf->global->FACTURE_USE_PROFORMAT)) { @@ -1918,54 +1910,65 @@ if ($action == 'create') print ''."\n"; } - // Replacement - print ''."\n"; + // Deposit + print ''."\n"; - // Credit note - print ''."\n"; + + // Credit note + print ''."\n"; } - else - { - $text.=''; - } - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); - print $desc; - print ''."\n"; print '
'.$langs->trans("Entity").'".$mc->select_entities($object->entity); - print "
'.$langs->trans("Type").''; @@ -1788,7 +1787,7 @@ else print ''; print ''; print '
'.$langs->trans("HierarchicalResponsible").''; + print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id)); + print '
'.$langs->trans("Status").''; print $object->getLibStatut(4); print '
'.$langs->trans("Entity").'".$mc->select_entities($object->entity); + print "
'.$langs->trans("Firstname").'
'.$langs->trans("Lastname").'
'.$langs->trans("Address").''; - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; @@ -390,7 +390,7 @@ if (! empty($id) && $action == 'edit') print "
'.$langs->trans("Firstname").'
'.$langs->trans("Lastname").'
'.$langs->trans("Address").''; - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; @@ -485,7 +485,7 @@ if (! empty($id) && $action != 'edit') print "
'.$langs->trans("Company").''.$don->societe.'
'.$langs->trans("Firstname").''.$don->prenom.'
'.$langs->trans("Lastname").''.$don->nom.'
'.$langs->trans("Address").''.dol_nl2br($don->adresse).'
'.$langs->trans("Address").''.dol_nl2br($don->address).'
'.$langs->trans("Zip").' / '.$langs->trans("Town").''.$don->cp.($don->cp && $don->ville?' / ':'').$don->ville.'
'.$langs->trans("Entity").'".$mc->select_entities($conf->entity); - print "
'.$langs->trans("Type").''; @@ -902,6 +887,28 @@ if (($action == 'create') || ($action == 'adduserldap')) print ''; print '
'.$langs->trans("Entity").'".$mc->select_entities($conf->entity); + print "
'.$langs->trans("HierarchicalResponsible").''; + print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$conf->entity); + print '
'; print $langs->trans("Note"); @@ -941,7 +948,7 @@ else /* */ /* ************************************************************************** */ - if ($id) + if ($id > 0) { $object->fetch($id); if ($res < 0) { dol_print_error($db,$object->error); exit; } @@ -1051,7 +1058,7 @@ else if ($action != 'edit') { $rowspan=16; - + print ''; // Ref @@ -1188,7 +1195,7 @@ else print '\n"; - + // Hierarchy print ''; print ''; print "\n"; - - // Statut + + // Status print ''; print ''; print "\n"; } - + // Company / Contact if (! empty($conf->societe->enabled)) { @@ -1287,7 +1294,7 @@ else } print "\n"; } - + // Other attributes $parameters=array('colspan' => ' colspan="2"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1315,7 +1322,7 @@ else print '
'; - if ($caneditfield && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { @@ -1327,7 +1334,7 @@ else } } elseif ($caneditpassword && ! $object->ldap_sid && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) + (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->multicompany->transverse_mode && $conf->entity == 1))) { print ''.$langs->trans("EditPassword").''; } @@ -1787,7 +1794,7 @@ else print '
'; - + // openid if (isset($conf->authmode) && preg_match('/myopenid/',$conf->authmode)) { @@ -1808,16 +1815,16 @@ else // Hierarchy print ''; print ''; print "\n"; - // Statut + // Status print ''; print ''; - + // Multicompany if (! empty($conf->multicompany->enabled)) { @@ -1832,7 +1839,7 @@ else print ''; } } - + // Company / Contact if (! empty($conf->societe->enabled)) { From aff919fd10f5cb411139ae044344db6741c1da38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 12:45:46 +0100 Subject: [PATCH 23/34] Fix: Bad test --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a9c0439b220..49f1d495cde 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2187,10 +2187,10 @@ class Product extends CommonObject $this->res[]= array($compl_path.$nom_pere,$desc_pere); } - // Recursive call - if (is_array($desc_pere)) + // Recursive call if child is an array + if (is_array($desc_pere[0])) { - $this ->fetch_prod_arbo($desc_pere, $nom_pere." -> ", $desc_pere[1]*$multiply, $level+1); + $this ->fetch_prod_arbo($desc_pere[0], $nom_pere." -> ", $desc_pere[1]*$multiply, $level+1); } } } From aa8413d7cb907a0e547ecfb85cfa52e0d840b42b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 16:20:49 +0100 Subject: [PATCH 24/34] Fix: Missing migration Fix: Error management --- htdocs/comm/propal.php | 4 ++-- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index cc34443a622..90c37aaaa6f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -79,12 +79,12 @@ $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); -// Load object // Load object if ($id > 0 || ! empty($ref)) { $ret=$object->fetch($id, $ref); - $ret=$object->fetch_thirdparty(); + if ($ret > 0) $ret=$object->fetch_thirdparty(); + if ($ret < 0) dol_print_error('',$object->error); } // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array 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 1c17efb697c..a58eb45f1ba 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 @@ -39,3 +39,9 @@ alter table llx_contratdet add column buy_price_ht double(24,8) DEFAULT 0 after -- serialised array, to store value of select list choices for example alter table llx_extrafields add column param text DEFAULT '' after pos; + + +alter table llx_propal CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; +alter table llx_commande CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; +alter table llx_don CHANGE COLUMN adresse address text; + From 9f8ffe242aa1b0fbc5feb549f2331e261f70dce6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 16:26:06 +0100 Subject: [PATCH 25/34] Fix: A text field can not have a default value --- htdocs/install/mysql/migration/3.3.0-3.4.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a58eb45f1ba..f7fe723b9b6 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 @@ -38,7 +38,7 @@ alter table llx_contratdet add column fk_product_fournisseur_price integer after 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; +alter table llx_extrafields add column param text after pos; alter table llx_propal CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer; From e56e182fe90c52abf513c3fc0ba84bf3cffaf485 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 16:37:28 +0100 Subject: [PATCH 26/34] Fix: When creating invoice from other object, type must be "standard". --- htdocs/compta/facture.php | 111 +++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 54 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index bccac8d8354..7c42593f70b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1915,14 +1915,6 @@ if ($action == 'create') print $desc; print ''."\n"; - // Deposit - print ''."\n"; - // Proforma if (! empty($conf->global->FACTURE_USE_PROFORMAT)) { @@ -1934,56 +1926,67 @@ if ($action == 'create') print ''."\n"; } - if ($socid>0) - { - // Replacement - print ''."\n"; - // Credit note - print ''."\n"; + if ($socid > 0) + { + // Replacement + print ''."\n"; + + // Credit note + print ''."\n"; + } } print '
'.$langs->trans('Signature').''; print dol_textishtml($object->signature)?$object->signature:dol_nl2br($object->signature,1,false); print "
'.$langs->trans("HierarchicalResponsible").''; @@ -1200,8 +1207,8 @@ else } print '
'.$langs->trans("Status").''; print $object->getLibStatut(4); @@ -1223,7 +1230,7 @@ else print ''.$object->openid.'
'; print ''; print '
'.$langs->trans("HierarchicalResponsible").''; - print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id)); + print $form->select_dolusers($object->fk_user,'fk_user',1,array($object->id),0,'',0,$object->entity); print '
'.$langs->trans("Status").''; print $object->getLibStatut(4); print '
'; - print ''; - print ''; - $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); - print $desc; - print '
'; - print ''; + if (empty($origin)) + { + // Deposit + print '
'; + print ''; print ''; - $text=$langs->trans("InvoiceReplacementAsk").' '; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); + $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); print $desc; print '
'; - print ''; - print ''; - $text=$langs->transnoentities("InvoiceAvoirAsk").' '; - // $text.=''; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); - print $desc; - print '
'; + print ''; + print ''; + $text=$langs->trans("InvoiceReplacementAsk").' '; + $text.=''; + $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); + print $desc; + print '
'; + print ''; + print ''; + $text=$langs->transnoentities("InvoiceAvoirAsk").' '; + // $text.=''; + $text.=''; + $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); + print $desc; + print '
'; print '
'; - print ''; - print ''; - $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); - print $desc; - print '
'; - print ''; - print ''; - $text=$langs->trans("InvoiceReplacementAsk").' '; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); - print $desc; - print '
'; + print ''; + print ''; + $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); + print $desc; + print '
'; - print ''; - print ''; - $text=$langs->transnoentities("InvoiceAvoirAsk").' '; - // $text.=''; - $text.=''; + print ''; + print ''; + $text=$langs->trans("InvoiceReplacementAsk").' '; + $text.=''; + $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); + print $desc; + print '
'; + print ''; + print ''; + $text=$langs->transnoentities("InvoiceAvoirAsk").' '; + // $text.=''; + $text.=''; + $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); + print $desc; + print '
'; print '
'; - print ''; - print ''; - $text=$langs->trans("InvoiceReplacementAsk").' '; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); - print $desc; - print '
'; + print ''; + print ''; + $text=$langs->trans("InvoiceReplacementAsk").' '; + $text.=''; + $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); + print $desc; + print '
'; print ' Date: Sun, 17 Feb 2013 17:12:19 +0100 Subject: [PATCH 29/34] Fix: When creating invoice from other object, type must be standard only --- htdocs/compta/facture.php | 105 ++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7c42593f70b..49604013c19 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1935,63 +1935,66 @@ if ($action == 'create') $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); print $desc; print '
'; - print ''; - print ''; - $text=$langs->trans("InvoiceReplacementAsk").' '; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); - print $desc; - print '
'; + print ''; + print ''; + $text=$langs->trans("InvoiceReplacementAsk").' '; + $text.=''; + $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1); + print $desc; + print '
'; - print ''; - print ''; - $text=$langs->transnoentities("InvoiceAvoirAsk").' '; - // $text.=''; - $text.=''; - $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); - print $desc; - print '
'; + print ''; + print ''; + $text=$langs->transnoentities("InvoiceAvoirAsk").' '; + // $text.=''; + $text.=''; + $desc=$form->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1); + print $desc; + print '
'; print ''; - if($socid>0) + if ($socid > 0) { // Discounts for third party print ''.$langs->trans('Discounts').''; From df2fde3a68b747fe1df13a8bea848a3391dc4bc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 17:17:19 +0100 Subject: [PATCH 30/34] Prepare 3.3 release --- build/exe/doliwamp/doliwamp.iss | 4 ++-- build/makepack-dolibarr.pl | 2 +- build/makepack-howto.txt | 10 +++++----- build/pad/pad_dolibarr.xml | 6 +++--- build/pad/pad_doliwamp.xml | 6 +++--- htdocs/filefunc.inc.php | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 1dd37f24700..faafcf5ce6a 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -17,9 +17,9 @@ ; ----- Change this ----- AppName=DoliWamp ; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -AppVerName=DoliWamp-3.3.0-beta +AppVerName=DoliWamp-3.3.0 ; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -OutputBaseFilename=DoliWamp-3.3.0-beta +OutputBaseFilename=DoliWamp-3.3.0 ; Define full path from wich all relative path are defined ; You must modify this to put here your dolibarr root directory ;SourceDir=C:\Documents and Settings\ldestailleur\git\dolibarr_old diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 8fcf7946de7..aee377023ac 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -10,7 +10,7 @@ use Cwd; $PROJECT="dolibarr"; $MAJOR="3"; $MINOR="3"; -$BUILD="0-beta"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate +$BUILD="0"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate $RPMSUBVERSION="auto"; # auto use value found into BUILD @LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index a8a9471cc1b..fad028cfbf6 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -33,11 +33,11 @@ complete release of Dolibarr, step by step. - Check all files are commited. - Update version/info in /ChangeLog and /filefunc.inc.php -- Update version number with x.x.x-y in htdocs/filefunc.inc.php -- Update version number with x.x.x-y in build/makepack-dolibarr.pl -- Update version number with x.x.x-y in build/debian/changelog -- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss -- Update version number with x.x.x-y in build/rpm/*.spec +- Update version number with x.x.x in htdocs/filefunc.inc.php +- Update version number with x.x.x in build/makepack-dolibarr.pl +- Update version number with x.x.x in build/debian/changelog +- Update version number with x.x.x in build/exe/doliwamp/doliwamp.iss +- Update version number with x.x.x in build/rpm/*.spec - Update PAD files. - Commit all changes. - Add a Tag (DOLIBARR_x_y) diff --git a/build/pad/pad_dolibarr.xml b/build/pad/pad_dolibarr.xml index e8c88ca8968..dd80e1ef53c 100644 --- a/build/pad/pad_dolibarr.xml +++ b/build/pad/pad_dolibarr.xml @@ -35,9 +35,9 @@ Dolibarr 3.3.0 - 08 - 10 - 2012 + 02 + 17 + 2013 diff --git a/build/pad/pad_doliwamp.xml b/build/pad/pad_doliwamp.xml index e20d9563559..148c4a4e79b 100644 --- a/build/pad/pad_doliwamp.xml +++ b/build/pad/pad_doliwamp.xml @@ -35,9 +35,9 @@ DoliWamp 3.3.0 - 08 - 10 - 2012 + 02 + 17 + 2013 diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 6173ef70704..734526bedc6 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.3.0-beta'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.3.0'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From b0695d3bbb64ab46380cbc585d1a7affe527e551 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 17:20:05 +0100 Subject: [PATCH 31/34] Preapre 3.3 --- build/rpm/dolibarr_fedora.spec | 2 +- build/rpm/dolibarr_generic.spec | 2 +- build/rpm/dolibarr_mandriva.spec | 2 +- build/rpm/dolibarr_opensuse.spec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 3481164a0af..b894d8367d1 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -333,5 +333,5 @@ fi %changelog -* Wed Dec 19 2012 Laurent Destailleur 3.3.0-0.1.a +* Sun Feb 17 2013 Laurent Destailleur 3.3.0-0.3 - Initial version (#723326) diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 8d8949f1f83..f2aa80cf0e3 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -522,5 +522,5 @@ fi %changelog -* Wed Dec 19 2012 Laurent Destailleur 3.3.0-0.1.a +* Sun Feb 17 2013 Laurent Destailleur 3.3.0-0.3 - Initial version (#723326) diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 161bf9f7b0b..fa4e379e885 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -322,5 +322,5 @@ fi %changelog -* Wed Dec 19 2012 Laurent Destailleur 3.3.0-0.1.a +* Sun Feb 17 2013 Laurent Destailleur 3.3.0-0.3 - Initial version (#723326) diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 170b4d28813..9eaf86f1d3d 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -333,5 +333,5 @@ fi %changelog -* Wed Dec 19 2012 Laurent Destailleur 3.3.0-0.1.a +* Sun Feb 17 2013 Laurent Destailleur 3.3.0-0.3 - Initial version (#723326) From 8af34ee97ea7c012be8c9dabfb9e52e48b4aacf5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 18:40:09 +0100 Subject: [PATCH 32/34] Fix: Bad property --- htdocs/expedition/class/expedition.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1f890d2da3d..1840713b0e6 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -909,8 +909,8 @@ class Expedition extends CommonObject $line->volume = $obj->volume; $line->volume_units = $obj->volume_units; - //Invoicing - $line->desc = $obj->product_label; + // For invoicing + $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) $line->qty = $obj->qty_shipped; $line->total_ht = $obj->total_ht; $line->total_localtax1 = $obj->total_localtax1; From 660fd2e785da708d258a2bee2dcc7b639724399e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 18:46:46 +0100 Subject: [PATCH 33/34] Doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 68452e0ca4f..7c1b893fc12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ For users: - New: Can attach files onto trip and expenses modules. - New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR - New: Can define a hierarchical responsible on user +- New: Merge tab customer and prospect For developers: - System of menu managers has been rewritten to reduce code to do same things. From 2bad9c0d9a227662f77ca808bc2e6917c20e6e16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Feb 2013 19:25:55 +0100 Subject: [PATCH 34/34] Fix: Nb of holidays was not using correct user --- htdocs/holiday/index.php | 99 +++++++++++++++++++++++---------- htdocs/langs/en_US/holiday.lang | 2 +- htdocs/langs/fr_FR/holiday.lang | 2 +- 3 files changed, 71 insertions(+), 32 deletions(-) diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index 19944b16ae8..16d2edddf7e 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; + +$langs->load('users'); +$langs->load('holidays'); // Protection if external user if ($user->societe_id > 0) accessforbidden(); @@ -46,6 +51,8 @@ $offset = $conf->liste_limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; +$id = GETPOST('id'); + $search_ref = GETPOST('search_ref'); $month_create = GETPOST('month_create'); $year_create = GETPOST('year_create'); @@ -72,6 +79,7 @@ $search_statut = GETPOST('select_statut'); $holiday = new Holiday($db); $holidaystatic=new Holiday($db); +$fuser = new User($db); // Update sold $holiday->updateSold(); @@ -151,28 +159,22 @@ if(!empty($search_statut) && $search_statut != -1) { // Récupération de l'ID de l'utilisateur $user_id = $user->id; +if ($id > 0) +{ + // Charge utilisateur edite + $fuser->fetch($id); + $fuser->getrights(); + $user_id = $fuser->id; +} // Récupération des congés payés de l'utilisateur ou de tous les users -if (!$user->rights->holiday->lire_tous) +if (!$user->rights->holiday->lire_tous || $id > 0) { - $holiday_payes = $holiday->fetchByUser($user_id,$order,$filter); + $holiday_payes = $holiday->fetchByUser($user_id,$order,$filter); } else { $holiday_payes = $holiday->fetchAll($order,$filter); } - -// Si pas de congés payés -if ($holiday_payes == 0) -{ - print_fiche_titre($langs->trans('CPTitreMenu')); - - print '
'; - print ''.$langs->trans('NoCPforUser').'

'; - print ''.$langs->trans('AddCP').'
'; - print '
'; - exit(); -} - // Si erreur SQL if ($holiday_payes == '-1') { @@ -189,14 +191,48 @@ if ($holiday_payes == '-1') * Affichage du tableau des congés payés *************************************/ -$var=true; $num = count($holiday->holiday); -$html = new Form($db); -$htmlother = new FormOther($db); -print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num); +$var=true; $num = count($holiday->holiday); +$form = new Form($db); +$formother = new FormOther($db); -print '
'; +if ($id > 0) +{ + $head = user_prepare_head($fuser); + + $title = $langs->trans("User"); + dol_fiche_head($head, 'paidholidays', $title, 0, 'user'); -$nbaquis=$holiday->getCPforUser($user->id); + print ''; + + // Ref + print ''; + print ''; + print ''; + + // Nom + print ''; + print ''; + print "\n"; + + // Prenom + print ''; + print ''; + print "\n"; + + print '
'.$langs->trans("Ref").''; + print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user->admin); + print '
'.$langs->trans("LastName").''.$fuser->lastname.'
'.$langs->trans("FirstName").''.$fuser->firstname.'

'; + +} +else +{ + print_barre_liste($langs->trans("ListeCP"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, "", $num); + + print '
'; +} + + +$nbaquis=$holiday->getCPforUser($user_id); $nbdeduced=$holiday->getConfCP('nbHolidayDeducted'); $nb_holiday = $nbaquis / $nbdeduced; print $langs->trans('SoldeCPUser',round($nb_holiday,2)).($nbdeduced != 1 ? ' ('.$nbaquis.' / '.$nbdeduced.')' : ''); @@ -223,13 +259,13 @@ print ''; print ''; -$htmlother->select_year($year_create,'year_create',1, $min_year, $max_year); +$formother->select_year($year_create,'year_create',1, $min_year, $max_year); print ''; // UTILISATEUR if($user->rights->holiday->lire_tous) { print ''; - $html->select_users($search_employe,"search_employe",1,"",0,''); + $form->select_users($search_employe,"search_employe",1,"",0,''); print ''; } else { print ' '; @@ -246,7 +282,7 @@ if($user->rights->holiday->lire_tous){ $validator = new UserGroup($db,$idGroupValid); $valideur = $validator->listUsersForGroup(); - $html->select_users($search_valideur,"search_valideur",1,"",0,$valideur,''); + $form->select_users($search_valideur,"search_valideur",1,"",0,$valideur,''); print ''; } else { print ' '; @@ -255,13 +291,13 @@ if($user->rights->holiday->lire_tous){ // DATE DEBUT print ''; print ''; -$htmlother->select_year($year_start,'year_start',1, $min_year, $max_year); +$formother->select_year($year_start,'year_start',1, $min_year, $max_year); print ''; // DATE FIN print ''; print ''; -$htmlother->select_year($year_end,'year_end',1, $min_year, $max_year); +$formother->select_year($year_end,'year_end',1, $min_year, $max_year); print ''; // DUREE @@ -327,10 +363,13 @@ if($holiday_payes == '2') print ''; print ''; -print '
'; -print '
'; -print ''.$langs->trans('AddCP').''; -print '
'; +if ($user_id == $user->id) +{ + print '
'; + print '
'; + print ''.$langs->trans('AddCP').''; + print '
'; +} llxFooter(); diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 2b83b1fcb1d..abf2b1dc514 100755 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -26,7 +26,7 @@ SendRequestCP=Creating demand for holidays DelayToRequestCP=Applications for holidays must be made at least %s day(s) before them. MenuConfCP=Edit balance of holidays UpdateAllCP=Update the holidays -SoldeCPUser=Your balance of holidays is %s days. +SoldeCPUser=Holidays balance is %s days. ErrorEndDateCP=You must select an end date greater than the start date. ErrorSQLCreateCP=An SQL error occurred during the creation: ErrorIDFicheCP=An error has occurred, the request for holidays does not exist. diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index 60c7594fe90..ed8d339af75 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -26,7 +26,7 @@ SendRequestCP=Envoyer la demande de congés DelayToRequestCP=Les demandes de congés doivent être faites au moins %s jours avant la date de ceux-ci. MenuConfCP=Mettre à jour solde UpdateAllCP=Mettre à jour les congés -SoldeCPUser=Votre solde de congés est de %s jours. +SoldeCPUser=Solde de congés: %s jours. ErrorEndDateCP=Vous devez choisir une date de fin supérieur à la date de début. ErrorSQLCreateCP=Une erreur SQL est survenue durant la création : ErrorIDFicheCP=Une erreur est survenue, cette demande de congés n'existe pas.