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 ($action == 'update' && $user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
if (empty($_POST["cancel"]))
|
if (empty($_POST["cancel"]))
|
||||||
@ -134,7 +135,7 @@ if ($action == 'update' && $user->rights->deplacement->creer)
|
|||||||
$object->socid = $_POST["socid"];
|
$object->socid = $_POST["socid"];
|
||||||
$object->note_private = $_POST["note_private"];
|
$object->note_private = $_POST["note_private"];
|
||||||
$object->note_public = $_POST["note_public"];
|
$object->note_public = $_POST["note_public"];
|
||||||
|
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -162,6 +163,14 @@ if ($action == 'classin')
|
|||||||
if ($result < 0) dol_print_error($db, $object->error);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -285,24 +294,24 @@ else if ($id)
|
|||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||||
print $form->select_date($object->date,'','','','','update');
|
print $form->select_date($object->date,'','','','','update');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km
|
// Km
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
|
||||||
print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
|
print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Where
|
// Where
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||||
print $form->select_societes($soc->id,'socid','',1);
|
print $form->select_societes($soc->id,'socid','',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
print '<textarea name="note_public" cols="80" rows="8">'.$object->note_public."</textarea><br>";
|
print '<textarea name="note_public" cols="80" rows="8">'.$object->note_public."</textarea><br>";
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Private note
|
// Private note
|
||||||
if (! $user->societe_id)
|
if (! $user->societe_id)
|
||||||
{
|
{
|
||||||
@ -311,15 +320,15 @@ else if ($id)
|
|||||||
print '<textarea name="note_private" cols="80" rows="8">'.$object->note_private."</textarea><br>";
|
print '<textarea name="note_private" cols="80" rows="8">'.$object->note_private."</textarea><br>";
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</center>';
|
print '</center>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -342,7 +351,7 @@ else if ($id)
|
|||||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>';
|
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>';
|
||||||
print $form->showrefnav($object,'id','',1,'rowid','ref','');
|
print $form->showrefnav($object,'id','',1,'rowid','ref','');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
||||||
print $form->editInPlace($langs->trans($object->type), 'type', $user->rights->deplacement->creer, 'select', 'types_fees');
|
print $form->editInPlace($langs->trans($object->type), 'type', $user->rights->deplacement->creer, 'select', 'types_fees');
|
||||||
@ -356,20 +365,24 @@ else if ($id)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td>';
|
print '<tr><td>';
|
||||||
print $form->editInPlace($object->date, 'dated', $user->rights->deplacement->creer, 'datepicker');
|
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>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Km/Price
|
// Km/Price
|
||||||
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td>';
|
print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td>';
|
||||||
print '<td>'.$form->editInPlace($object->km, 'km', $user->rights->deplacement->creer, 'numeric').'</td></tr>';
|
print '<td>'.$form->editInPlace($object->km, 'km', $user->rights->deplacement->creer, 'numeric').'</td></tr>';
|
||||||
|
|
||||||
// Where
|
// Where
|
||||||
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($soc->id) print $soc->getNomUrl(1);
|
if ($soc->id) print $soc->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if ($conf->projet->enabled)
|
if ($conf->projet->enabled)
|
||||||
{
|
{
|
||||||
@ -402,13 +415,13 @@ else if ($id)
|
|||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||||
print '<td valign="top" colspan="3">';
|
print '<td valign="top" colspan="3">';
|
||||||
print $form->editInPlace($object->note_public, 'note_public', $user->rights->deplacement->creer, 'ckeditor', 'dolibarr_notes');
|
print $form->editInPlace($object->note_public, 'note_public', $user->rights->deplacement->creer, 'ckeditor', 'dolibarr_notes');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Private note
|
// Private note
|
||||||
if (! $user->societe_id)
|
if (! $user->societe_id)
|
||||||
{
|
{
|
||||||
@ -421,13 +434,13 @@ else if ($id)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($user->rights->deplacement->creer)
|
if ($user->rights->deplacement->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||||
@ -444,7 +457,7 @@ else if ($id)
|
|||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -223,7 +223,8 @@ if ($action == 'valid')
|
|||||||
|
|
||||||
if ($action == 'set_thirdparty')
|
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);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -51,30 +51,30 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
$fk_element = GETPOST('fk_element');
|
$fk_element = GETPOST('fk_element');
|
||||||
$value = GETPOST('value');
|
$value = GETPOST('value');
|
||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
|
|
||||||
$format='text';
|
$format='text';
|
||||||
$return=array();
|
$return=array();
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
|
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
|
||||||
{
|
{
|
||||||
$element = $regs[1];
|
$element = $regs[1];
|
||||||
$subelement = $regs[2];
|
$subelement = $regs[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($element == 'fichinter') $element = 'ficheinter';
|
if ($element == 'fichinter') $element = 'ficheinter';
|
||||||
|
|
||||||
if ($user->rights->$element->creer || $user->rights->$element->write)
|
if ($user->rights->$element->creer || $user->rights->$element->write)
|
||||||
{
|
{
|
||||||
$object = new GenericObject($db);
|
$object = new GenericObject($db);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$newvalue = trim($value);
|
$newvalue = trim($value);
|
||||||
|
|
||||||
if ($type == 'numeric')
|
if ($type == 'numeric')
|
||||||
{
|
{
|
||||||
$newvalue = price2num($newvalue);
|
$newvalue = price2num($newvalue);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! is_numeric($newvalue))
|
if (! is_numeric($newvalue))
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
{
|
{
|
||||||
$methodname = 'load_cache_'.GETPOST('method');
|
$methodname = 'load_cache_'.GETPOST('method');
|
||||||
$cachename = 'cache_'.GETPOST('method');
|
$cachename = 'cache_'.GETPOST('method');
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$ret = $form->$methodname();
|
$ret = $form->$methodname();
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
@ -101,15 +101,15 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
$value = $cache[$newvalue];
|
$value = $cache[$newvalue];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
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 ($ret > 0)
|
||||||
{
|
{
|
||||||
if ($type == 'numeric') $value = price($newvalue);
|
if ($type == 'numeric') $value = price($newvalue);
|
||||||
else if ($type == 'textarea') $value = dol_nl2br($newvalue);
|
else if ($type == 'textarea') $value = dol_nl2br($newvalue);
|
||||||
|
|
||||||
$return['value'] = $value;
|
$return['value'] = $value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -117,7 +117,7 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
$return['error'] = $object->error;
|
$return['error'] = $object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -618,17 +618,20 @@ abstract class CommonObject
|
|||||||
/**
|
/**
|
||||||
* Update a specific field from an object
|
* 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 string $field Field to update
|
||||||
* @param mixte $value New value
|
* @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
|
* @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;
|
global $conf;
|
||||||
|
|
||||||
|
if (empty($table)) $table=$this->table_element;
|
||||||
|
if (empty($id)) $id=$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
$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 $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 string $paramvalue Value of parameter for Url
|
||||||
* @param boolean $perm Permission to allow button to edit parameter
|
* @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
|
* @return string HTML edit field
|
||||||
* TODO no GET or POST in class file, use a param
|
* 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 $text Text of label (not used in this function)
|
||||||
* @param string $htmlname Name of select field
|
* @param string $htmlname Name of select field
|
||||||
* @param string $preselected Value to show/edit
|
* @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 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
|
* @param string $editvalue Use this value instead $preselected
|
||||||
* @return string HTML edit field
|
* @return string HTML edit field
|
||||||
* TODO no GET or POST in class file, use a param
|
* 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>';
|
$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);
|
$html=new Form($db);
|
||||||
$ret.=$html->form_date($_SERVER['PHP_SELF'].($paramkey?'?'.$paramkey.'='.$paramvalue:''),$preselected,$htmlname);
|
$ret.=$html->form_date($_SERVER['PHP_SELF'].($paramkey?'?'.$paramkey.'='.$paramvalue:''),$preselected,$htmlname);
|
||||||
}
|
}
|
||||||
$ret.='</td>';
|
$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.='</tr></table>'."\n";
|
||||||
$ret.='</form>'."\n";
|
$ret.='</form>'."\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($typeofdata == 'email') $ret.=dol_print_email($preselected,0,0,0,0,1);
|
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);
|
elseif ($typeofdata == 'text' || $typeofdata == 'textarea') $ret.=dol_htmlentitiesbr($preselected);
|
||||||
else $ret.=$preselected;
|
else $ret.=$preselected;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,14 +81,15 @@ class InterfacePaypalWorkflow
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fonction appelee lors du declenchement d'un evenement Dolibarr.
|
* Fonction appelee lors du declenchement d'un evenement Dolibarr.
|
||||||
* D'autres fonctions run_trigger peuvent etre presentes dans core/triggers
|
* D'autres fonctions run_trigger peuvent etre presentes dans core/triggers
|
||||||
* \param action Code de l'evenement
|
*
|
||||||
* \param object Objet concerne
|
* @param string $action Code de l'evenement
|
||||||
* \param user Objet user
|
* @param CommonObject $object Objet concerne
|
||||||
* \param lang Objet lang
|
* @param User $user Objet user
|
||||||
* \param conf Objet conf
|
* @param Translate $lang Objet lang
|
||||||
* \return int <0 if fatal error, 0 si nothing done, >0 if ok
|
* @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)
|
function run_trigger($action,$object,$user,$langs,$conf)
|
||||||
{
|
{
|
||||||
@ -123,10 +124,10 @@ class InterfacePaypalWorkflow
|
|||||||
if ($ret < 0) return -1;
|
if ($ret < 0) return -1;
|
||||||
|
|
||||||
// Add payer id
|
// Add payer id
|
||||||
$soc->setValueFrom('societe', $obj->socid, 'ref_int', $object->payerID);
|
$soc->setValueFrom('ref_int', $object->payerID, 'societe', $obj->socid);
|
||||||
|
|
||||||
// Add transaction id
|
// 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