Qual: Revert parameter order (optionnal at end)
This commit is contained in:
parent
3f30cebce3
commit
cf365593dc
@ -121,6 +121,7 @@ if ($action == 'add' && $user->rights->deplacement->creer)
|
||||
}
|
||||
}
|
||||
|
||||
// Update record
|
||||
if ($action == 'update' && $user->rights->deplacement->creer)
|
||||
{
|
||||
if (empty($_POST["cancel"]))
|
||||
@ -162,6 +163,14 @@ if ($action == 'classin')
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
// Set fields
|
||||
if ($action == 'setdated')
|
||||
{
|
||||
$dated=dol_mktime($_POST['datedhour'], $_POST['datedmin'], $_POST['datedsec'], $_POST['datedmonth'], $_POST['datedday'], $_POST['datedyear']);
|
||||
$object->fetch($id);
|
||||
$result=$object->setValueFrom('dated',$dated,'','','date');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -356,8 +365,12 @@ else if ($id)
|
||||
print '</td></tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
||||
print $form->editInPlace($object->date, 'dated', $user->rights->deplacement->creer, 'datepicker');
|
||||
print '<tr><td>';
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $langs->trans('Date');
|
||||
else print $form->editfieldkey("Date",'dated',$object->date,'id',$object->id,$user->rights->deplacement->creer,'datepicker');
|
||||
print '</td><td colspan="3">';
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) print $form->editInPlace($object->date, 'dated', $user->rights->deplacement->creer, 'datepicker');
|
||||
else print $form->editfieldval("Date",'dated',$object->date,'id',$object->id,$user->rights->deplacement->creer,'datepicker');
|
||||
print '</td></tr>';
|
||||
|
||||
// Km/Price
|
||||
|
||||
@ -223,7 +223,8 @@ if ($action == 'valid')
|
||||
|
||||
if ($action == 'set_thirdparty')
|
||||
{
|
||||
$object->setValueFrom('facture',$id,'fk_soc',$socid);
|
||||
$object->fetch($id);
|
||||
$object->setValueFrom('fk_soc',$socid);
|
||||
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
|
||||
exit;
|
||||
|
||||
@ -104,7 +104,7 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$ret=$object->setValueFrom($table_element, $fk_element, $field, $newvalue, $format);
|
||||
$ret=$object->setValueFrom($field, $newvalue, $table_element, $fk_element, $format);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($type == 'numeric') $value = price($newvalue);
|
||||
|
||||
@ -618,17 +618,20 @@ abstract class CommonObject
|
||||
/**
|
||||
* Update a specific field from an object
|
||||
*
|
||||
* @param string $table Table element or element line
|
||||
* @param int $id Object id
|
||||
* @param string $field Field to update
|
||||
* @param mixte $value New value
|
||||
* @param string $format Data format
|
||||
* @param string $table To force other table element or element line
|
||||
* @param int $id To force other object id
|
||||
* @param string $format Data format ('text' by default, 'date')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setValueFrom($table, $id, $field, $value, $format='text')
|
||||
function setValueFrom($field, $value, $table='', $id='', $format='text')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($table)) $table=$this->table_element;
|
||||
if (empty($id)) $id=$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||
|
||||
@ -74,7 +74,7 @@ class Form
|
||||
* @param string $paramkey Key of parameter for Url (unique if there is several parameter to show). In most cases "id".
|
||||
* @param string $paramvalue Value of parameter for Url
|
||||
* @param boolean $perm Permission to allow button to edit parameter
|
||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day', ...)
|
||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day' or 'datepicker', ...)
|
||||
* @return string HTML edit field
|
||||
* TODO no GET or POST in class file, use a param
|
||||
*/
|
||||
@ -96,9 +96,9 @@ class Form
|
||||
* @param string $text Text of label (not used in this function)
|
||||
* @param string $htmlname Name of select field
|
||||
* @param string $preselected Value to show/edit
|
||||
* @param string $paramkey Key of parameter (unique if there is several parameter to show)
|
||||
* @param string $paramkey Key of parameter (unique if there is several parameter to show). In most cases "id".
|
||||
* @param boolean $perm Permission to allow button to edit parameter
|
||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day', ...)
|
||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'text' or 'textarea', 'day' or 'datepicker', ...)
|
||||
* @param string $editvalue Use this value instead $preselected
|
||||
* @return string HTML edit field
|
||||
* TODO no GET or POST in class file, use a param
|
||||
@ -124,20 +124,20 @@ class Form
|
||||
{
|
||||
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" cols="70">'.($editvalue?$editvalue:$preselected).'</textarea>';
|
||||
}
|
||||
else if ($typeofdata == 'day')
|
||||
else if ($typeofdata == 'day' || $typeofdata == 'datepicker')
|
||||
{
|
||||
$html=new Form($db);
|
||||
$ret.=$html->form_date($_SERVER['PHP_SELF'].($paramkey?'?'.$paramkey.'='.$paramvalue:''),$preselected,$htmlname);
|
||||
}
|
||||
$ret.='</td>';
|
||||
if ($typeofdata != 'day') $ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
if ($typeofdata != 'day' && $typeofdata != 'datepicker') $ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
$ret.='</tr></table>'."\n";
|
||||
$ret.='</form>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($typeofdata == 'email') $ret.=dol_print_email($preselected,0,0,0,0,1);
|
||||
elseif ($typeofdata == 'day') $ret.=dol_print_date($preselected,'day');
|
||||
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($preselected,'day');
|
||||
elseif ($typeofdata == 'text' || $typeofdata == 'textarea') $ret.=dol_htmlentitiesbr($preselected);
|
||||
else $ret.=$preselected;
|
||||
}
|
||||
|
||||
@ -81,14 +81,15 @@ class InterfacePaypalWorkflow
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction appelee lors du declenchement d'un evenement Dolibarr.
|
||||
* D'autres fonctions run_trigger peuvent etre presentes dans core/triggers
|
||||
* \param action Code de l'evenement
|
||||
* \param object Objet concerne
|
||||
* \param user Objet user
|
||||
* \param lang Objet lang
|
||||
* \param conf Objet conf
|
||||
* \return int <0 if fatal error, 0 si nothing done, >0 if ok
|
||||
* Fonction appelee lors du declenchement d'un evenement Dolibarr.
|
||||
* D'autres fonctions run_trigger peuvent etre presentes dans core/triggers
|
||||
*
|
||||
* @param string $action Code de l'evenement
|
||||
* @param CommonObject $object Objet concerne
|
||||
* @param User $user Objet user
|
||||
* @param Translate $lang Objet lang
|
||||
* @param Conf $conf Objet conf
|
||||
* @return int <0 if fatal error, 0 si nothing done, >0 if ok
|
||||
*/
|
||||
function run_trigger($action,$object,$user,$langs,$conf)
|
||||
{
|
||||
@ -123,10 +124,10 @@ class InterfacePaypalWorkflow
|
||||
if ($ret < 0) return -1;
|
||||
|
||||
// Add payer id
|
||||
$soc->setValueFrom('societe', $obj->socid, 'ref_int', $object->payerID);
|
||||
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
|
||||
|
||||
// Add transaction id
|
||||
$obj->setValueFrom($obj->table_element,$obj->id,'ref_int',$object->resArray["TRANSACTIONID"]);
|
||||
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user