diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index fc601cf8a53..39557a6e455 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -32,8 +32,13 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -$langs->load("companies"); -$langs->load("suppliers"); +$langs->loadLangs(array("companies", "suppliers")); + +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); // Security check $id = GETPOST('id','int'); @@ -177,7 +182,7 @@ if (empty($reshook)) // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - // Purge search criteria + // Did we click on 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 { $sall=""; @@ -198,6 +203,7 @@ if (empty($reshook)) $search_categ=''; $search_categ_thirdparty=''; $search_categ_supplier=''; + $toselect=''; $search_array_options=array(); } @@ -205,7 +211,7 @@ if (empty($reshook)) $objectclass='Contact'; $objectlabel='Contact'; $permtoread = $user->rights->societe->lire; - $permtodelete = $user->rights->societe->delete; + $permtodelete = $user->rights->societe->supprimer; $uploaddir = $conf->societe->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -224,7 +230,7 @@ $contactstatic=new Contact($db); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $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, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,"; $sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql.= " co.code as country_code"; // Add fields from extrafields @@ -374,8 +380,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit+1, $offset); -//print $sql; -dol_syslog("contact/list.php", LOG_DEBUG); $result = $db->query($sql); if (! $result) { @@ -385,15 +389,18 @@ if (! $result) $num = $db->num_rows($result); +$arrayofselected=is_array($toselect)?$toselect:array(); + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { $obj = $db->fetch_object($resql); - $id = $obj->cidp; + $id = $obj->rowid; header("Location: ".DOL_URL_ROOT.'/contact/card.php?id='.$id); exit; } -llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'); +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas'; +llxHeader('',$title,$help_url); $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; @@ -426,16 +433,26 @@ foreach ($search_array_options as $key => $val) if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } -print '
'; -$db->free($result); - llxFooter(); $db->close(); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 73f0a815413..e674aea6d5c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -859,7 +859,7 @@ if (! defined('NOLOGIN')) } -dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]); +dol_syslog("--- Access to ".$_SERVER["PHP_SELF"].' - action='.GETPOST('action','az09').', massaction='.GETPOST('massaction','az09')); //Another call for easy debugg //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST)); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 40ca07783c4..48e1b67a69c 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -187,6 +187,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } } +$object = new Societe($db); + /* * Actions @@ -196,7 +198,7 @@ if (GETPOST('cancel')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters); // 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 (empty($reshook)) @@ -204,7 +206,7 @@ if (empty($reshook)) // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - // Do we click on purge search criteria ? + // Did we click on 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 { $search_nom=''; @@ -603,7 +605,7 @@ if ($user->rights->societe->client->voir || $socid) $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); $moreforfilter.=''; } -if (! empty($moreforfilter)) +if ($moreforfilter) { print '