Merge pull request #496 from FHenry/develop
Update Common Object update_contact method to allow to change the
This commit is contained in:
commit
65110ead88
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@ -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.='</td>';
|
||||
if ($typeofdata != 'day' && $typeofdata != 'datepicker') $ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
if ($typeofdata != 'day' && $typeofdata != 'datepicker' && $typeofdata != 'datehourpicker') $ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
$ret.='</tr></table>'."\n";
|
||||
$ret.='</form>'."\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];
|
||||
@ -2613,9 +2618,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;
|
||||
|
||||
@ -2626,7 +2633,7 @@ class Form
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print $this->select_date($selected,$htmlname,0,0,1,'form'.$htmlname);
|
||||
print $this->select_date($selected,$htmlname,$displayhour,$displaymin,1,'form'.$htmlname);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user