Uniformize code
This commit is contained in:
parent
019125f258
commit
ef03f59e50
@ -141,10 +141,13 @@ $parameters=array();
|
|||||||
$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))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_field1='';
|
$search_field1='';
|
||||||
$search_field2='';
|
$search_field2='';
|
||||||
@ -154,9 +157,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
|
|||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
if (empty($reshook))
|
|
||||||
{
|
|
||||||
$objectclass='Skeleton';
|
$objectclass='Skeleton';
|
||||||
$objectlabel='Skeleton';
|
$objectlabel='Skeleton';
|
||||||
$permtoread = $user->rights->skeleton->read;
|
$permtoread = $user->rights->skeleton->read;
|
||||||
@ -180,7 +181,6 @@ $form=new Form($db);
|
|||||||
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||||
$help_url='';
|
$help_url='';
|
||||||
$title = $langs->trans('MyModuleListTitle');
|
$title = $langs->trans('MyModuleListTitle');
|
||||||
llxHeader('', $title, $help_url);
|
|
||||||
|
|
||||||
// Put here content of your page
|
// Put here content of your page
|
||||||
|
|
||||||
@ -250,10 +250,25 @@ $sql.= $db->plimit($limit+1, $offset);
|
|||||||
|
|
||||||
dol_syslog($script_file, LOG_DEBUG);
|
dol_syslog($script_file, LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
// Direct jump if only one record found
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->rowid;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/skeleton/card.php?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
@ -537,13 +552,6 @@ if ($resql)
|
|||||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -161,10 +161,13 @@ $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))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_categ='';
|
$search_categ='';
|
||||||
$search_user='';
|
$search_user='';
|
||||||
@ -194,8 +197,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($reshook))
|
// Mass actions
|
||||||
{
|
|
||||||
$objectclass='Commande';
|
$objectclass='Commande';
|
||||||
$objectlabel='Orders';
|
$objectlabel='Orders';
|
||||||
$permtoread = $user->rights->commande->lire;
|
$permtoread = $user->rights->commande->lire;
|
||||||
|
|||||||
@ -1254,9 +1254,9 @@ else
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),$out,'');
|
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),$out,'');
|
||||||
|
|
||||||
print show_actions_todo($conf,$langs,$db,$objsoc,$object);
|
//print show_actions_todo($conf,$langs,$db,$objsoc,$object);
|
||||||
|
|
||||||
print show_actions_done($conf,$langs,$db,$objsoc,$object);
|
print show_actions_done($conf,$langs,$db,$objsoc,$object,0,'','');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,17 +165,19 @@ if (($id > 0 || ! empty($ref)) && $action != 'add')
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$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');
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
}
|
// Purge search criteria
|
||||||
|
|
||||||
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$sall="";
|
$sall="";
|
||||||
@ -198,6 +200,16 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETP
|
|||||||
$search_categ_supplier='';
|
$search_categ_supplier='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mass actions
|
||||||
|
$objectclass='Contact';
|
||||||
|
$objectlabel='Contact';
|
||||||
|
$permtoread = $user->rights->societe->lire;
|
||||||
|
$permtodelete = $user->rights->societe->delete;
|
||||||
|
$uploaddir = $conf->societe->dir_output;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
if ($search_priv < 0) $search_priv='';
|
if ($search_priv < 0) $search_priv='';
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +222,6 @@ $formother=new FormOther($db);
|
|||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
|
|
||||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
|
||||||
|
|
||||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||||
$sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,";
|
$sql.= " p.rowid as cidp, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,";
|
||||||
@ -343,7 +354,6 @@ foreach ($search_array_options as $key => $val)
|
|||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
|
|
||||||
// Add order
|
// Add order
|
||||||
if ($view == "recent")
|
if ($view == "recent")
|
||||||
{
|
{
|
||||||
@ -367,10 +377,23 @@ $sql.= $db->plimit($limit+1, $offset);
|
|||||||
//print $sql;
|
//print $sql;
|
||||||
dol_syslog("contact/list.php", LOG_DEBUG);
|
dol_syslog("contact/list.php", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->cidp;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/contact/card.php?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
@ -622,6 +645,7 @@ if ($result)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
|
$i = 0;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
@ -777,13 +801,6 @@ if ($result)
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -181,28 +181,20 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters); // 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');
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($action == 'setstcomm')
|
// Selection of new fields
|
||||||
{
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
$object = new Client($db);
|
|
||||||
$result=$object->fetch(GETPOST('stcommsocid'));
|
|
||||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
|
||||||
$result=$object->update($object->id, $user);
|
|
||||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
|
||||||
|
|
||||||
$action='';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Do we click on purge search criteria ?
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_nom='';
|
$search_nom='';
|
||||||
$search_categ=0;
|
$search_categ=0;
|
||||||
@ -231,6 +223,18 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setstcomm')
|
||||||
|
{
|
||||||
|
$object = new Client($db);
|
||||||
|
$result=$object->fetch(GETPOST('stcommsocid'));
|
||||||
|
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||||
|
$result=$object->update($object->id, $user);
|
||||||
|
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||||
|
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($search_status=='') $search_status=1; // always display active thirdparty first
|
if ($search_status=='') $search_status=1; // always display active thirdparty first
|
||||||
|
|
||||||
|
|
||||||
@ -439,7 +443,7 @@ if (! $resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -848,7 +852,7 @@ print '</td>';
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
|
$i = 0;
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user