Clean code
This commit is contained in:
parent
62b96b580a
commit
e6a95b2af9
@ -108,7 +108,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if ($cancel) $action='';
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||||
@ -952,47 +958,7 @@ if (empty($reshook))
|
|||||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
else if ($action == 'update_extras') {
|
||||||
* Ordonnancement des lignes
|
|
||||||
*/
|
|
||||||
|
|
||||||
else if ($action == 'up' && $user->rights->supplier_proposal->creer) {
|
|
||||||
$object->line_up(GETPOST('rowid'));
|
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
|
||||||
$outputlangs = new Translate("", $conf);
|
|
||||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ($action == 'down' && $user->rights->supplier_proposal->creer) {
|
|
||||||
$object->line_down(GETPOST('rowid'));
|
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
|
||||||
$outputlangs = new Translate("", $conf);
|
|
||||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
|
||||||
exit();
|
|
||||||
} else if ($action == 'update_extras') {
|
|
||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
|
|||||||
@ -89,21 +89,6 @@ $pagenext = $page + 1;
|
|||||||
if (! $sortfield) $sortfield='p.date_livraison';
|
if (! $sortfield) $sortfield='p.date_livraison';
|
||||||
if (! $sortorder) $sortorder='DESC';
|
if (! $sortorder) $sortorder='DESC';
|
||||||
|
|
||||||
if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both tests are required to be compatible with all browsers
|
|
||||||
{
|
|
||||||
$search_categ='';
|
|
||||||
$search_user='';
|
|
||||||
$search_sale='';
|
|
||||||
$search_ref='';
|
|
||||||
$search_societe='';
|
|
||||||
$search_montant_ht='';
|
|
||||||
$search_author='';
|
|
||||||
$year='';
|
|
||||||
$month='';
|
|
||||||
$viewstatut='';
|
|
||||||
$object_statut='';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($object_statut != '')
|
if($object_statut != '')
|
||||||
$viewstatut=$object_statut;
|
$viewstatut=$object_statut;
|
||||||
|
|
||||||
@ -127,11 +112,69 @@ $hookmanager->initHooks(array('supplier_proposallist'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$search_categ='';
|
||||||
|
$search_user='';
|
||||||
|
$search_sale='';
|
||||||
|
$search_ref='';
|
||||||
|
$search_societe='';
|
||||||
|
$search_montant_ht='';
|
||||||
|
$search_author='';
|
||||||
|
$year='';
|
||||||
|
$month='';
|
||||||
|
$viewstatut='';
|
||||||
|
$object_statut='';
|
||||||
|
}
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Mass actions. Controls on number of lines checked
|
||||||
|
$maxformassaction=1000;
|
||||||
|
if (! empty($massaction) && count($toselect) < 1)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||||
|
}
|
||||||
|
if (! $error && count($toselect) > $maxformassaction)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action to delete
|
||||||
|
/*
|
||||||
|
if ($action == 'confirm_delete')
|
||||||
|
{
|
||||||
|
$result=$object->delete($user);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
// Delete OK
|
||||||
|
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||||
|
header("Location: ".dol_buildpath('/mymodule/list.php',1));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
|
||||||
|
else setEventMessages($object->error,null,'errors');
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user