From f456a4d0fed79d579626f2a207361da5acc78376 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 27 Nov 2012 15:26:14 +0100 Subject: [PATCH 1/2] Update Common Object update_contact method to allow to change the fk_socppoeple linked --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0cb132d23c6..26d54111098 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -221,14 +221,16 @@ abstract class CommonObject * @param int $rowid Id of line contact-element * @param int $statut New status of link * @param int $type_contact_id Id of contact type (not modified if 0) + * @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @return int <0 if KO, >= 0 if OK */ - function update_contact($rowid, $statut, $type_contact_id=0) + function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) { // Insertion dans la base $sql = "UPDATE ".MAIN_DB_PREFIX."element_contact set"; $sql.= " statut = ".$statut; if ($type_contact_id) $sql.= ", fk_c_type_contact = '".$type_contact_id ."'"; + if ($fk_socpeople) $sql.= ", fk_socpeople = '".$fk_socpeople ."'"; $sql.= " where rowid = ".$rowid; $resql=$this->db->query($sql); if ($resql) @@ -3035,4 +3037,4 @@ abstract class CommonObject } } -?> +?> \ No newline at end of file From 5c94912e66392cad97334b82fba80bb58c663159 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 27 Nov 2012 18:35:51 +0100 Subject: [PATCH 2/2] Add datehourpicker in editfieldval method to allow display of hour --- htdocs/core/class/html.form.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2cce0fcbdfa..f5110f53bf6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -165,6 +165,10 @@ class Form { $ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname); } + else if ($typeofdata == 'datehourpicker') + { + $ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname,1,1); + } else if (preg_match('/^select;/',$typeofdata)) { $arraydata=explode(',',preg_replace('/^select;/','',$typeofdata)); @@ -183,7 +187,7 @@ class Form $ret.=$doleditor->Create(1); } $ret.=''; - if ($typeofdata != 'day' && $typeofdata != 'datepicker') $ret.=''; + if ($typeofdata != 'day' && $typeofdata != 'datepicker' && $typeofdata != 'datehourpicker') $ret.=''; $ret.=''."\n"; $ret.=''."\n"; } @@ -192,6 +196,7 @@ class Form if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1); elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value); elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day'); + elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour'); else if (preg_match('/^select;/',$typeofdata)) { $arraydata=explode(',',preg_replace('/^select;/','',$typeofdata)); @@ -272,7 +277,7 @@ class Form if (! empty($tmp[1])) $inputOption=$tmp[1]; if (! empty($tmp[2])) $savemethod=$tmp[2]; } - else if (preg_match('/^datepicker/',$inputType)) + else if ((preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType))) { $tmp=explode(':',$inputType); $inputType=$tmp[0]; @@ -2612,9 +2617,11 @@ class Form * @param string $page Page * @param string $selected Date preselected * @param string $htmlname Name of input html field + * @param int $displayhour Display hour selector + * @param int $displaymin Display minutes selector * @return void */ - function form_date($page, $selected, $htmlname) + function form_date($page, $selected, $htmlname,$displayhour=0,$displaymin=0) { global $langs; @@ -2625,7 +2632,7 @@ class Form print ''; print ''; print ''; print ''; print '
'; - print $this->select_date($selected,$htmlname,0,0,1,'form'.$htmlname); + print $this->select_date($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname); print '
';