From 99f817b69a88fc1985d9f95a75fa1cf1f22c1df8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 5 Dec 2014 21:40:55 +0100 Subject: [PATCH 01/15] - New: Add Option to not change date on cloning project --- ChangeLog | 2 ++ htdocs/langs/en_US/projects.lang | 1 + htdocs/langs/fr_FR/projects.lang | 1 + htdocs/projet/card.php | 4 +++- htdocs/projet/class/project.class.php | 16 +++++++++------- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5d67d88d7f..7178312ca7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ -------------------------------------------------------------- English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.8 compared to 3.7.* ***** +- New: Add Option to not change date on cloning project ***** ChangeLog for 3.7 compared to 3.6.* ***** diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 8d5d7c26a53..c038429043e 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -103,6 +103,7 @@ CloneContacts=Clone contacts CloneNotes=Clone notes CloneProjectFiles=Clone project joined files CloneTaskFiles=Clone task(s) joined files (if task(s) cloned) +CloneMoveDate=Update project/tasks dates from now ? ConfirmCloneProject=Are you sure to clone this project ? ProjectReportDate=Change task date according project start date ErrorShiftTaskDate=Impossible to shift task date according to new project start date diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 7148ae0c1c0..639049b0c3e 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -101,6 +101,7 @@ CloneContacts=Cloner les contacts CloneNotes=Cloner les notes CloneProjectFiles=Cloner les pièces jointes du projet CloneTaskFiles=Cloner les pièces jointes des tâche(s) (si tâche(s) cloner) +CloneMoveDate=Deplacer les date projets/taches sur maintenant ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ? ProjectReportDate=Reporter les dates des tâches en fonction de la date de départ. ErrorShiftTaskDate=Une erreur s'est produite dans le report des dates des tâches. diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1f6f430fccb..9b5f70e4dce 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -353,7 +353,8 @@ if (empty($reshook)) $clone_project_files = GETPOST('clone_project_files') ? 1 : 0; $clone_task_files = GETPOST('clone_task_files') ? 1 : 0; $clone_notes=GETPOST('clone_notes')?1:0; - $result=$object->createFromClone($object->id,$clone_contacts,$clone_tasks,$clone_project_files,$clone_task_files,$clone_notes); + $move_date=GETPOST('move_date')?1:0; + $result=$object->createFromClone($object->id,$clone_contacts,$clone_tasks,$clone_project_files,$clone_task_files,$clone_notes,$move_date); if ($result <= 0) { setEventMessage($object->error, 'errors'); @@ -538,6 +539,7 @@ else 'text' => $langs->trans("ConfirmClone"), array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_tasks', 'label' => $langs->trans("CloneTasks"), 'value' => true), + array('type' => 'checkbox', 'name' => 'move_date', 'label' => $langs->trans("CloneMoveDate"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_notes', 'label' => $langs->trans("CloneNotes"), 'value' => true), array('type' => 'checkbox', 'name' => 'clone_project_files','label' => $langs->trans("CloneProjectFiles"), 'value' => false), array('type' => 'checkbox', 'name' => 'clone_task_files', 'label' => $langs->trans("CloneTaskFiles"), 'value' => false) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 738eec46ec0..b70c2c59764 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -984,7 +984,7 @@ class Project extends CommonObject * @param bool $notrigger no trigger flag * @return int New id of clone */ - function createFromClone($fromid,$clone_contact=false,$clone_task=true,$clone_project_file=false,$clone_task_file=false,$clone_note=true,$notrigger=0) + function createFromClone($fromid,$clone_contact=false,$clone_task=true,$clone_project_file=false,$clone_task_file=false,$clone_note=true,$move_date=true,$notrigger=0) { global $user,$langs,$conf; @@ -1006,11 +1006,13 @@ class Project extends CommonObject $orign_project_ref=$clone_project->ref; $clone_project->id=0; - $clone_project->date_start = $now; - if (!(empty($clone_project->date_end))) - { - $clone_project->date_end = $clone_project->date_end + ($now - $orign_dt_start); - } + if ($move_date) { + $clone_project->date_start = $now; + if (!(empty($clone_project->date_end))) + { + $clone_project->date_end = $clone_project->date_end + ($now - $orign_dt_start); + } + } $clone_project->datec = $now; @@ -1164,7 +1166,7 @@ class Project extends CommonObject foreach ($tasksarray as $tasktoclone) { - $result_clone = $taskstatic->createFromClone($tasktoclone->id,$clone_project_id,$tasktoclone->fk_parent,true,true,false,$clone_task_file,true,false); + $result_clone = $taskstatic->createFromClone($tasktoclone->id,$clone_project_id,$tasktoclone->fk_parent,$move_date,true,false,$clone_task_file,true,false); if ($result_clone <= 0) { $this->error.=$result_clone->error; From c8db8f001bc747b7660145595e669a52208e8d6b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 18 Jan 2015 12:06:05 +0100 Subject: [PATCH 02/15] fix travis --- htdocs/projet/class/project.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6be870543e5..4eef74b0dc1 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1002,6 +1002,7 @@ class Project extends CommonObject * @param bool $clone_project_file clone file of project * @param bool $clone_task_file clone file of task (if task are copied) * @param bool $clone_note clone note of project + * @param bool $move_date move task date on clone * @param bool $notrigger no trigger flag * @return int New id of clone */ @@ -1011,7 +1012,7 @@ class Project extends CommonObject $error=0; - dol_syslog("createFromClone clone_contact=".$clone_contact." clone_task=".$clone_task." clone_project_file=".$clone_project_file." clone_note=".$clone_note); + dol_syslog("createFromClone clone_contact=".$clone_contact." clone_task=".$clone_task." clone_project_file=".$clone_project_file." clone_note=".$clone_note." move_date=".$move_date,LOG_DEBUG); $now = dol_mktime(0,0,0,idate('m',dol_now()),idate('d',dol_now()),idate('Y',dol_now())); From 22c253cfc192266082b2cec41a7219750d28f0ea Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 18 Jan 2015 16:02:31 +0100 Subject: [PATCH 03/15] add extrafield type, check box from table --- ChangeLog | 1 + htdocs/core/class/extrafields.class.php | 209 +++++++++++++++++- htdocs/core/tpl/admin_extrafields_add.tpl.php | 30 +-- .../core/tpl/admin_extrafields_edit.tpl.php | 6 +- htdocs/langs/en_US/admin.lang | 4 +- htdocs/langs/fr_FR/admin.lang | 2 + 6 files changed, 230 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4bac5ca622b..0f4f3b83a1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 3.8 compared to 3.7.* ***** - New: Add Option to not change date on cloning project +- New: Add check list from table for extrafield type ***** ChangeLog for 3.8 compared to 3.7.* ***** diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 30c97e9f1ef..364307468a7 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -72,7 +72,7 @@ class ExtraFields 'separate' => 'ExtrafieldSeparator', 'checkbox' => 'ExtrafieldCheckBox', 'radio' => 'ExtrafieldRadio', - + 'chkbxlst' => 'ExtrafieldCheckBoxFromList', ); /** @@ -171,7 +171,7 @@ class ExtraFields }elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; - } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox')){ + } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){ $typedb='text'; $lengthdb=''; } else { @@ -373,7 +373,7 @@ class ExtraFields }elseif($type=='mail') { $typedb='varchar'; $lengthdb='128'; - } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox')) { + } elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) { $typedb='text'; $lengthdb=''; } else { @@ -864,6 +864,140 @@ class ExtraFields $out.='/>'.$val.'
'; } } + elseif ($type == 'chkbxlst') + { + $value_arr = explode(',', $value); + + if (is_array($param['options'])) { + $param_list = array_keys($param['options']); + $InfoFieldList = explode(":", $param_list[0]); + // 0 : tableName + // 1 : label field name + // 2 : key fields name (if differ of rowid) + // 3 : key field parent (for dependent lists) + // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value + $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid'); + + if (count($InfoFieldList) > 3 && ! empty($InfoFieldList[3])) { + list ( $parentName, $parentField ) = explode('|', $InfoFieldList[3]); + $keyList .= ', ' . $parentField; + } + if (count($InfoFieldList) > 4 && ! empty($InfoFieldList[4])) { + if (strpos($InfoFieldList[4], 'extra.') !== false) { + $keyList = 'main.' . $InfoFieldList[2] . ' as rowid'; + } else { + $keyList = $InfoFieldList[2] . ' as rowid'; + } + } + + $fields_label = explode('|', $InfoFieldList[1]); + if (is_array($fields_label)) { + $keyList .= ', '; + $keyList .= implode(', ', $fields_label); + } + + $sqlwhere = ''; + $sql = 'SELECT ' . $keyList; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; + if (! empty($InfoFieldList[4])) { + // We have to join on extrafield table + if (strpos($InfoFieldList[4], 'extra') !== false) { + $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; + $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4]; + } else { + $sqlwhere .= ' WHERE ' . $InfoFieldList[4]; + } + } else { + $sqlwhere .= ' WHERE 1'; + } + if (in_array($InfoFieldList[0], array ( + 'tablewithentity' + ))) + $sqlwhere .= ' AND entity = ' . $conf->entity; // Some tables may have field, some other not. For the moment we disable it. + // $sql.=preg_replace('/^ AND /','',$sqlwhere); + // print $sql; + $sql .= $sqlwhere; + dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ( $i < $num ) { + $labeltoshow = ''; + $obj = $this->db->fetch_object($resql); + + // Several field into label (eq table:code|libelle:rowid) + $fields_label = explode('|', $InfoFieldList[1]); + if (is_array($fields_label)) { + $notrans = true; + foreach ( $fields_label as $field_toshow ) { + $labeltoshow .= $obj->$field_toshow . ' '; + } + } else { + $labeltoshow = $obj->$InfoFieldList[1]; + } + $labeltoshow = dol_trunc($labeltoshow, 45); + + if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { + foreach ( $fields_label as $field_toshow ) { + $translabel = $langs->trans($obj->$field_toshow); + if ($translabel != $obj->$field_toshow) { + $labeltoshow = dol_trunc($translabel, 18) . ' '; + } else { + $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; + } + } + $out .= 'rowid . '"'; + + $out .= 'checked="checked"'; + + $out .= '/>' . $labeltoshow . '
'; + } else { + if (! $notrans) { + $translabel = $langs->trans($obj->$InfoFieldList[1]); + if ($translabel != $obj->$InfoFieldList[1]) { + $labeltoshow = dol_trunc($translabel, 18); + } else { + $labeltoshow = dol_trunc($obj->$InfoFieldList[1], 18); + } + } + if (empty($labeltoshow)) + $labeltoshow = '(not defined)'; + + if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { + $out .= 'rowid . '"'; + + $out .= 'checked="checked"'; + $out .= ''; + + $out .= '/>' . $labeltoshow . '
'; + } + + if (! empty($InfoFieldList[3])) { + $parent = $parentName . ':' . $obj->{$parentField}; + } + + $out .= 'rowid . '"'; + + $out .= ((is_array($value_arr) && in_array($obj->rowid, $value_arr)) ? ' checked="checked" ' : ''); + ; + $out .= ''; + + $out .= '/>' . $labeltoshow . '
'; + } + + $i ++; + } + $this->db->free($resql); + } else { + print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.
'; + } + } + $out .= ''; + } /* Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; @@ -1019,6 +1153,73 @@ class ExtraFields } } } + elseif ($type == 'chkbxlst') + { + $value_arr = explode(',', $value); + + $param_list = array_keys($params['options']); + $InfoFieldList = explode(":", $param_list[0]); + + $selectkey = "rowid"; + $keyList = 'rowid'; + + if (count($InfoFieldList) >= 3) { + $selectkey = $InfoFieldList[2]; + $keyList = $InfoFieldList[2] . ' as rowid'; + } + + $fields_label = explode('|', $InfoFieldList[1]); + if (is_array($fields_label)) { + $keyList .= ', '; + $keyList .= implode(', ', $fields_label); + } + + $sql = 'SELECT ' . $keyList; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; + if (strpos($InfoFieldList[4], 'extra') !== false) { + $sql .= ' as main'; + } + // $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; + // $sql.= ' AND entity = '.$conf->entity; + + dol_syslog(get_class($this) . ':showOutputField:$type=chkbxlst',LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $value = ''; // value was used, so now we reste it to use it to build final output + + while ( $obj = $this->db->fetch_object($resql) ) { + + // Several field into label (eq table:code|libelle:rowid) + $fields_label = explode('|', $InfoFieldList[1]); + if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { + if (is_array($fields_label) && count($fields_label) > 1) { + foreach ( $fields_label as $field_toshow ) { + $translabel = ''; + if (! empty($obj->$field_toshow)) { + $translabel = $langs->trans($obj->$field_toshow); + } + if ($translabel != $field_toshow) { + $value .= dol_trunc($translabel, 18) . '
'; + } else { + $value .= $obj->$field_toshow . '
'; + } + } + } else { + $translabel = ''; + if (! empty($obj->$InfoFieldList[1])) { + $translabel = $langs->trans($obj->$InfoFieldList[1]); + } + if ($translabel != $obj->$InfoFieldList[1]) { + $value .= dol_trunc($translabel, 18) . '
'; + } else { + $value .= $obj->$InfoFieldList[1] . '
'; + } + } + } + } + } else + dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING); + } else { $showsize=round($size); @@ -1074,7 +1275,7 @@ class ExtraFields // Clean parameters $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); } - else if (in_array($key_type,array('checkbox'))) + else if (in_array($key_type,array('checkbox','chkbxlst'))) { $value_arr=GETPOST("options_".$key); if (!empty($value_arr)) { diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 56cca5af04f..8f14bff797f 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -39,19 +39,20 @@ } ?> - 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();jQuery("#helpselect").show();jQuery("#helpsellist").hide();} - else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();} - else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();} - else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();} - else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();} + if (type == 'date') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'datetime') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } + else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();} + else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'chkbxlst') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide(); jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();} else size.val('').attr('disabled','disabled'); } init_typeoffields(''); @@ -90,7 +91,8 @@ textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?> -textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?> +textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?> +textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 493634c84a5..9cf186de39f 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -57,7 +57,7 @@ $pos=$extrafields->attribute_pos[$attrname]; $alwayseditable=$extrafields->attribute_alwayseditable[$attrname]; $param=$extrafields->attribute_param[$attrname]; -if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_array($param)) +if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) { $param_chain = ''; foreach ($param['options'] as $key => $value) @@ -68,7 +68,7 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a } } } -elseif ($type== 'sellist') +elseif (($type== 'sellist') || ($type == 'chkbxlst')) { $paramlist=array_keys($param['options']); $param_chain = $paramlist[0]; @@ -89,7 +89,7 @@ elseif ($type== 'sellist') trans("Position"); ?> diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0b328e705a7..2dda463b91c 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -382,10 +382,12 @@ ExtrafieldSelectList = Select from table ExtrafieldSeparator=Separator ExtrafieldCheckBox=Checkbox ExtrafieldRadio=Radio button +ExtrafieldCheckBoxFromList= Checkbox from table ExtrafieldParamHelpselect=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
...

In order to have the list depending on another :
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... -ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpchkbxlst=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter 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/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4397bb313fa..4e783fafce1 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -382,10 +382,12 @@ ExtrafieldSelectList = Liste issue d'une table ExtrafieldSeparator=Séparateur de champ ExtrafieldCheckBox=Case à cocher ExtrafieldRadio=Bouton radio +ExtrafieldCheckBoxFromList= Case à cocher issue d'une table ExtrafieldParamHelpselect=La liste doit être de la forme clef,valeur

par exemple :
1,valeur1
2,valeur2
3,valeur3
...

Pour que la liste soit dépendante d'une autre :
1,valeur1|code_liste_parent:clef_parent
2,valeur2|code_liste_parent:clef_parent ExtrafieldParamHelpcheckbox=La liste doit être de la forme clef,valeur

par exemple :
1,valeur1
2,valeur2
3,valeur3
... ExtrafieldParamHelpradio=La liste doit être de la forme clef,valeur

par exemple :
1,valeur1
2,valeur2
3,valeur3
... ExtrafieldParamHelpsellist=La liste vient d'une table
Syntaxe:
nom_de_table:nom_de_champ:id_champ::filtre
Exemple :
c_typent:libelle:id::filter

filter peux être un test simple (exemple active=1 pour ne proposer que les valeur active)
si vous voulez faire un filtre sur des attributs supplémentaires, utilisez la syntax extra.champ=... (où champ est la code de l'attribut supplémentaire)

Pour que la liste soit dépendante d'une autre :
c_typent:libelle:id:code_liste_parent|colonne_parent:filter +ExtrafieldParamHelpchkbxlst=Les cases à cocher viennent d'une table
Syntaxe:
nom_de_table:nom_de_champ:id_champ::filtre
Exemple :
c_typent:libelle:id::filter

filter peux être un test simple (exemple active=1 pour ne proposer que les valeur active)
si vous voulez faire un filtre sur des attributs supplémentaires, utilisez la syntax extra.champ=... (où champ est la code de l'attribut supplémentaire)

Pour que la liste soit dépendante d'une autre :
c_typent:libelle:id:code_liste_parent|colonne_parent:filter 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és (Unicode, transparence des images, langues cyrilliques, arabes ou asiatiques...), aussi vous pouvez rencontrer des problèmes durant la génération des PDF.
Pour résoudre cela et avoir une prise en charge complète de PDF, vous pouvez télécharger la bibliothèque 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 voire 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) From b171975d186d44ce0124bded8eedb825e2657997 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 18 Jan 2015 16:08:10 +0100 Subject: [PATCH 04/15] Fix travis --- htdocs/compta/facture/class/facture.class.php | 15 +++++++++------ htdocs/core/class/html.form.class.php | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3388bbdbfe7..c6558247215 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2335,8 +2335,12 @@ class Facture extends CommonInvoice } /** + * Update_percent + * * @param FactureLigne $line Invoice line * @param int $percent + * + * @return void */ function update_percent($line, $percent) { @@ -2545,9 +2549,9 @@ class Facture extends CommonInvoice /** - * Return amount (with tax) of all credit notes and deposits invoices used by invoice + * Return amount (with tax) of all credit notes and deposits invoices used by invoice * - * @return int <0 if KO, Sum of credit notes and deposits amount otherwise + * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ function getSumCreditNotesUsed() { @@ -2567,9 +2571,9 @@ class Facture extends CommonInvoice } /** - * Return amount (with tax) of all deposits invoices used by invoice + * Return amount (with tax) of all deposits invoices used by invoice * - * @return int <0 if KO, Sum of deposits amount otherwise + * @return int <0 if KO, Sum of deposits amount otherwise */ function getSumDepositsUsed() { @@ -3460,6 +3464,7 @@ class Facture extends CommonInvoice /** * Returns an array containing the previous situations as Facture objects * + * @return array array of prev_sits */ function get_prev_sits() { @@ -3514,7 +3519,6 @@ class Facture extends CommonInvoice * @return int 0 or 1 if OK, -1 if error * */ - function is_last_in_cycle() { $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref; @@ -4096,7 +4100,6 @@ class FactureLigne extends CommonInvoiceLine * * @return int >= 0 */ - function get_prev_progress() { if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c4b025878c5..72220f0a4e0 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2666,7 +2666,7 @@ class Form * * @return string HTML select */ - function load_situation_invoices($selected = '', $socid) + function load_situation_invoices($selected = '', $socid=null) { global $langs; From d6778b9ed60a4c0ad286cdb22f2c76afe77e3b38 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 18 Jan 2015 16:25:43 +0100 Subject: [PATCH 05/15] fix travis --- htdocs/compta/facture/class/facture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c6558247215..58720101874 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2338,7 +2338,7 @@ class Facture extends CommonInvoice * Update_percent * * @param FactureLigne $line Invoice line - * @param int $percent + * @param int $percent percent * * @return void */ @@ -3455,6 +3455,7 @@ class Facture extends CommonInvoice /** * Checks if the invoice is the first of a cycle * + * @return boolean ($this->situation_counter == 1) */ function is_first() { From e872c40cc7a94e978a02fa1fd9df6995a52d35c9 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 18 Jan 2015 16:44:53 +0100 Subject: [PATCH 06/15] fix class actioncomm for travis and feature userassigned --- htdocs/comm/action/class/actioncomm.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index b58123578dd..31cad75cffd 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -144,13 +144,12 @@ class ActionComm extends CommonObject $this->userassigned=array(); $this->userassigned[$tmpid]=array('id'=>$tmpid); } - $userownerid=$this->userownerid; $userdoneid=$this->userdoneid; // Be sure assigned user array is not empty. - if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$userownerid); - + if (count($this->userassigned) == 0) $this->userassigned[] = array('id'=>$userownerid); + if (! $this->type_id || ! $this->type_code) { $key=empty($this->type_id)?$this->type_code:$this->type_id; From a4561ab4ad8c388774f7d8dce9d7ddbd6ce06359 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 19 Jan 2015 09:41:31 +0100 Subject: [PATCH 07/15] merge --- htdocs/comm/action/class/actioncomm.class.php | 5 +- htdocs/compta/facture/class/facture.class.php | 91 ++++++++++--------- 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 0934e42db1f..7c828f4fa59 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -151,13 +151,14 @@ class ActionComm extends CommonObject $this->userassigned=array(); $this->userassigned[$tmpid]=array('id'=>$tmpid); } + $userownerid=$this->userownerid; $userdoneid=$this->userdoneid; // Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...). if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned)) $this->userassigned = array($userownerid=>array('id'=>$userownerid)); - + if (! $this->type_id || ! $this->type_code) { $key=empty($this->type_id)?$this->type_code:$this->type_id; @@ -243,7 +244,7 @@ class ActionComm extends CommonObject { foreach($this->userassigned as $key => $val) { - if (! is_array($val)) // For backward compatibility when valid + if (! is_array($val)) // For backward compatibility when val=id { $tmpid=$val; $val=array('id'=>$val); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0a1f3118c77..a1fe6ee1c4d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -279,17 +279,17 @@ class Facture extends CommonInvoice $sql.= ", '".$this->type."'"; $sql.= ", '".$socid."'"; $sql.= ", '".$this->db->idate($now)."'"; - $sql.= ",".($this->remise_absolue>0?$this->remise_absolue:'NULL'); - $sql.= ",".($this->remise_percent>0?$this->remise_percent:'NULL'); + $sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL'); + $sql.= ", ".($this->remise_percent>0?$this->remise_percent:'NULL'); $sql.= ", '".$this->db->idate($this->date)."'"; - $sql.= ",".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); - $sql.= ",".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); - $sql.= ",".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); - $sql.= ",".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); + $sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); + $sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); + $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); + $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); - $sql.= ",".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null"); - $sql.= ",".($user->id > 0 ? "'".$user->id."'":"null"); - $sql.= ",".($this->fk_project?$this->fk_project:"null"); + $sql.= ", ".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null"); + $sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null"); + $sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".$this->cond_reglement_id; $sql.= ", ".$this->mode_reglement_id; $sql.= ", '".$this->db->idate($datelim)."', '".$this->modelpdf."'"; @@ -2537,9 +2537,9 @@ class Facture extends CommonInvoice /** - * Return amount (with tax) of all credit notes and deposits invoices used by invoice + * Return amount (with tax) of all credit notes and deposits invoices used by invoice * - * @return int <0 if KO, Sum of credit notes and deposits amount otherwise + * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ function getSumCreditNotesUsed() { @@ -2559,9 +2559,9 @@ class Facture extends CommonInvoice } /** - * Return amount (with tax) of all deposits invoices used by invoice + * Return amount (with tax) of all deposits invoices used by invoice * - * @return int <0 if KO, Sum of deposits amount otherwise + * @return int <0 if KO, Sum of deposits amount otherwise */ function getSumDepositsUsed() { @@ -2600,52 +2600,53 @@ class Facture extends CommonInvoice if (! empty($conf->global->FACTURE_ADDON)) { - $mybool=false; + $mybool=false; - $file = $conf->global->FACTURE_ADDON.".php"; - $classname = $conf->global->FACTURE_ADDON; - // Include file with class + $file = $conf->global->FACTURE_ADDON.".php"; + $classname = $conf->global->FACTURE_ADDON; + + // Include file with class $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/facture/"); - // Load file with numbering class (if found) - $mybool|=@include_once $dir.$file; - } - - // For compatibility - if (! $mybool) - { - $file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php"; - $classname = "mod_facture_".$conf->global->FACTURE_ADDON; - $classname = preg_replace('/\-.*$/','',$classname); - // Include file with class - foreach ($conf->file->dol_document_root as $dirroot) - { - $dir = $dirroot."/core/modules/facture/"; // Load file with numbering class (if found) $mybool|=@include_once $dir.$file; } - } - if (! $mybool) - { - dol_print_error('',"Failed to include file ".$file); - return ''; - } + // For compatibility + if (! $mybool) + { + $file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php"; + $classname = "mod_facture_".$conf->global->FACTURE_ADDON; + $classname = preg_replace('/\-.*$/','',$classname); + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot."/core/modules/facture/"; + // Load file with numbering class (if found) + $mybool|=@include_once $dir.$file; + } + } - $obj = new $classname(); - $numref = ""; + if (! $mybool) + { + dol_print_error('',"Failed to include file ".$file); + return ''; + } + + $obj = new $classname(); + $numref = ""; $numref = $obj->getNextValue($soc,$this,$mode); - if ($numref != "") - { - return $numref; - } - else - { + if ($numref != "") + { + return $numref; + } + else + { dol_print_error($db,"Facture::getNextNumRef ".$obj->error); return ""; } From 388697b73eeae0ee4685eddc83ff98c25cd58240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 18:55:55 +0100 Subject: [PATCH 08/15] Use getNomUrl on every list to uniformize display --- htdocs/comm/card.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a775408e9a8..42478175dfa 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -531,11 +531,13 @@ if ($id > 0) $objp = $db->fetch_object($resql); $var=!$var; print ""; - print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; - if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) - { - print " ".img_warning(); - } + print ''; + $propal_static->id=$objp->propalid; + $propal_static->ref=$objp->ref; + print $propal_static->getNomUrl(1); + if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { + print " ".img_warning(); + } print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; print ''.price($objp->total_ht).''; print ''.$propal_static->LibStatut($objp->fk_statut,5).''; @@ -606,7 +608,10 @@ if ($id > 0) $objp = $db->fetch_object($resql); $var=!$var; print ""; - print ''.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."\n"; + print ''; + $commande_static->id=$objp->cid; + $commande_static->ref=$objp->ref; + print $commande_static->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dc),'day')."\n"; print ''.price($objp->total_ht).''; print ''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).''; From e82301e001a3014204a7f32e798bfb29428dcd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 19:07:34 +0100 Subject: [PATCH 09/15] Update card.php --- htdocs/fourn/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 205d1a89ea6..154800125bf 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -367,7 +367,11 @@ if ($object->id > 0) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.''; + print ''; + $orderstatic->id=$obj->rowid; + $orderstatic->ref=$obj->ref; + print $orderstatic->getNomUrl(1); + print ''; print ''; if ($obj->dc) { From 1fc9517200ad6f69414478ff05ba6df967deeae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 19:18:57 +0100 Subject: [PATCH 10/15] Use css badge --- htdocs/fourn/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 205d1a89ea6..192bdff9abb 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -299,7 +299,7 @@ if ($object->id > 0) print ''; print ''; print '
'.$langs->trans("ProductsAndServices").''; - print ''.$langs->trans("All").' ('.$object->nbOfProductRefs().')'; + print ''.$langs->trans("All").' '.$object->nbOfProductRefs().''; print '
'; } @@ -355,7 +355,7 @@ if ($object->id > 0) print ''; print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("LastOrders",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; @@ -422,7 +422,7 @@ if ($object->id > 0) print ''; print ''; - print ''; + print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' ('.$num.')
'; print ''; print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; From 2d911e1a8f2897e1e34900458616b772b7dd41f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:19:36 +0100 Subject: [PATCH 11/15] Update card.php --- htdocs/comm/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a775408e9a8..b0ae3beef6b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -519,7 +519,7 @@ if ($id > 0) print ''; print ''; - print '
'; + print ''; print ''; @@ -592,7 +592,7 @@ if ($id > 0) print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')'; print ''; print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - print '
'; + print ''; print ''; } $i = 0; @@ -706,7 +706,7 @@ if ($id > 0) print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'; print ''; //if($num2 > 0) print ''; //else print ''; @@ -647,7 +647,7 @@ if ($id > 0) print ''; print ''; + print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; - print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' ('.$num.')
'.$langs->trans("AllContracts").' '.$num.'
'; print ''; - print ''; + print ''; print ''; $var=!$var; } @@ -769,7 +769,7 @@ if ($id > 0) $tableaushown=1; print ''; - print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
'; + print ''; print ''; From 0a41a025aed155dfeaa94e83b78f348346f79925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:35:29 +0100 Subject: [PATCH 12/15] Update index.php --- htdocs/commande/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 0d2815a6d67..40b39ccb666 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -303,7 +303,7 @@ if (! empty($conf->commande->enabled)) print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' ('.$num.')'; print ''; print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - print ''; + print ''; if ($num) { @@ -374,7 +374,7 @@ if (! empty($conf->commande->enabled)) print '
'.$langs->trans("OrdersToProcess").' ('.$num.')
'.$langs->trans("OrdersToProcess").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { From fb9f53010fc08af62a64f03f29996dc4f9052288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:36:38 +0100 Subject: [PATCH 13/15] Update index.php --- htdocs/fourn/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 9da28281779..29f12fed38f 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -126,7 +126,7 @@ if (! empty($conf->fournisseur->enabled)) { print '
'.$langs->trans("OnProcessOrders").' ('.$num.')
'.$langs->trans("OnProcessOrders").' '.$num.'
'; print ''; - print ''; + print ''; $i = 0; $var = true; @@ -183,7 +183,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { print '
'.$langs->trans("DraftOrders").' ('.$num.')
'.$langs->trans("DraftOrders").' '.$num.'
'; print ''; - print ''; + print ''; $i = 0; $tot_ttc = 0; $var = True; From 229f7888caac4b93638db34f8b2cff03bcc99f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:38:33 +0100 Subject: [PATCH 14/15] Update index.php --- htdocs/comm/propal/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index de51cf63104..a0e8a3409ab 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -313,7 +313,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $var=true; print '
'.$langs->trans("DraftBills").' ('.$num.')
'.$langs->trans("DraftBills").' '.$num.'
'; - print ''; + print ''; $nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) @@ -399,7 +399,7 @@ if (! empty($conf->propal->enabled)) print '
'.$langs->trans("ProposalsOpened").' ('.$num.')
'.$langs->trans("ProposalsOpened").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { @@ -471,7 +471,7 @@ if (! empty($conf->propal->enabled)) print '
'.$langs->trans("ProposalsToProcess").' ('.$num.')
'.$langs->trans("ProposalsToProcess").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { From 3ab6ac601eb6ff3b6a1a7dcf713c3810a63ed29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 20 Jan 2015 17:55:20 +0100 Subject: [PATCH 15/15] Type of supplier invoice was broken --- htdocs/core/class/commoninvoice.class.php | 42 +++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 991601a4fbd..6087a5a0adb 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -30,6 +30,36 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; */ abstract class CommonInvoice extends CommonObject { + /** + * Standard invoice + */ + const TYPE_STANDARD = 0; + + /** + * Replacement invoice + */ + const TYPE_REPLACEMENT = 1; + + /** + * Credit note invoice + */ + const TYPE_CREDIT_NOTE = 2; + + /** + * Deposit invoice + */ + const TYPE_DEPOSIT = 3; + + /** + * Proforma invoice + */ + const TYPE_PROFORMA = 4; + + /** + * Situation invoice + */ + const TYPE_SITUATION = 5; + /** * Return amount of payments already done * @@ -145,12 +175,12 @@ abstract class CommonInvoice extends CommonObject function getLibType() { global $langs; - if ($this->type == Facture::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); - if ($this->type == Facture::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); - if ($this->type == Facture::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); - if ($this->type == Facture::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); - if ($this->type == Facture::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); - if ($this->type == Facture::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); + if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); + if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); + if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); + if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); + if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); + if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); return $langs->trans("Unknown"); }
'.$langs->trans("OnProcessOrders").' ('.$num.')
'.$langs->trans("OnProcessOrders").' '.$num.'