From 39d89ef9aa7d67b2b66173b45973841f7f9dc066 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 15 Oct 2015 16:11:03 +0200 Subject: [PATCH 01/14] Fix: Parse error: syntax error, unexpected '}' --- htdocs/user/card.php | 49 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index aa27914e1d5..05ef3908b1b 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -264,22 +264,21 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) $editgroup->fetch($group); $editgroup->oldcopy=clone $editgroup; - $object->fetch($id); - if ($action == 'addgroup') { - $object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); - } - if ($action == 'removegroup') { - $object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); - } + $object->fetch($id); + if ($action == 'addgroup') { + $object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); + } + if ($action == 'removegroup') { + $object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); + } - if ($result > 0) { - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } else { - setEventMessage($object->error, 'errors'); - } - } - } + if ($result > 0) { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } else { + setEventMessage($object->error, 'errors'); + } + } if ($action == 'update' && !$_POST["cancel"]) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1154,14 +1153,14 @@ else dol_fiche_head($head, 'user', $title, 0, 'user'); dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin); - - + + print '
'; print '
'; - + print '
'; print ''; - + // Login print ''; if (! empty($object->ldap_sid) && $object->statut==0) @@ -1345,13 +1344,13 @@ else } print '
'.$langs->trans("Login").'
'; - + print '
'; print '
'; - + print '
'; print ''; - + print ''; print ''; print "\n"; @@ -1445,10 +1444,10 @@ else print "
'.$langs->trans("LastConnexion").''.dol_print_date($object->datelastlogin,"dayhour").'
\n"; print '
'; - + print '
'; print '
'; - + dol_fiche_end(); @@ -1694,7 +1693,7 @@ else print ''; print ''; } - + // Lastname print ""; print ''.$langs->trans("Lastname").''; From d44e961014aa917c0d272369a0ddd46ac132123d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 15 Oct 2015 16:16:50 +0200 Subject: [PATCH 02/14] Fix: Parse error: syntax error, unexpected '}' Fix: bad indentation !!! use tabulation instead spaces please !!! --- htdocs/user/card.php | 350 +++++++++++++++++++++---------------------- 1 file changed, 174 insertions(+), 176 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 05ef3908b1b..10772405db1 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -107,185 +107,184 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { - if ($id <> $user->id) { - $object->fetch($id); - $object->setstatus(0); - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } - } - if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { - $error = 0; - - if ($id <> $user->id) { - $object->fetch($id); - - if (!empty($conf->file->main_limit_users)) { - $nb = $object->getNbOfUsers("active"); - if ($nb >= $conf->file->main_limit_users) { - $error ++; - setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); - } - } - - if (!$error) { - $object->setstatus(1); - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } - } - } - - if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { - if ($id <> $user->id) { - $object = new User($db); - $object->id = $id; - $result = $object->delete(); - if ($result < 0) { - $langs->load("errors"); - setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors'); - } else { - header("Location: index.php"); - exit; - } - } - } - -// Action Add user - if ($action == 'add' && $canadduser) { - $error = 0; - - if (!$_POST["lastname"]) { - $error ++; - setEventMessage($langs->trans("NameNotDefined"), 'errors'); - $action = "create"; // Go back to create page - } - if (!$_POST["login"]) { - $error ++; - setEventMessage($langs->trans("LoginNotDefined"), 'errors'); - $action = "create"; // Go back to create page - } - - if (!empty($conf->file->main_limit_users)) // If option to limit users is set - { - $nb = $object->getNbOfUsers("active"); - if ($nb >= $conf->file->main_limit_users) { - $error ++; - setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); - $action = "create"; // Go back to create page - } - } - - if (!$error) { - $object->lastname = GETPOST("lastname", 'alpha'); - $object->firstname = GETPOST("firstname", 'alpha'); - $object->login = GETPOST("login", 'alpha'); - $object->api_key = GETPOST("api_key", 'alpha'); - $object->gender = GETPOST("gender", 'alpha'); - $object->admin = GETPOST("admin", 'alpha'); - $object->office_phone = GETPOST("office_phone", 'alpha'); - $object->office_fax = GETPOST("office_fax", 'alpha'); - $object->user_mobile = GETPOST("user_mobile"); - $object->skype = GETPOST("skype"); - $object->email = GETPOST("email", 'alpha'); - $object->job = GETPOST("job", 'alpha'); - $object->signature = GETPOST("signature"); - $object->accountancy_code = GETPOST("accountancy_code"); - $object->note = GETPOST("note"); - $object->ldap_sid = GETPOST("ldap_sid"); - $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0; - - $object->thm = GETPOST("thm") != '' ? GETPOST("thm") : ''; - $object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : ''; - $object->salary = GETPOST("salary") != '' ? GETPOST("salary") : ''; - $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; - $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; - - $object->color = GETPOST("color") != '' ? GETPOST("color") : ''; - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - if ($ret < 0) { - $error ++; - } - - // Set entity property - $entity = GETPOST('entity', 'int'); - if (!empty($conf->multicompany->enabled)) { - if (!empty($_POST["superadmin"])) { - $object->entity = 0; - } else { - if ($conf->multicompany->transverse_mode) { - $object->entity = 1; // all users are forced into master entity - } else { - $object->entity = ($entity == '' ? 1 : $entity); - } - } - } else { - $object->entity = ($entity == '' ? 1 : $entity); - /*if ($user->admin && $user->entity == 0 && GETPOST("admin",'alpha')) - { - }*/ - } - - $db->begin(); - - $id = $object->create($user); - if ($id > 0) { - if (isset($_POST['password']) && trim($_POST['password'])) { - $object->setPassword($user, trim($_POST['password'])); - } - - $db->commit(); - - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); - exit; - } else { - $langs->load("errors"); - $db->rollback(); - if (is_array($object->errors) && count($object->errors)) { - setEventMessage($object->errors, 'errors'); - } else { - setEventMessage($object->error, 'errors'); - } - $action = "create"; // Go back to create page - } - - } - } - -// Action add usergroup -if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) -{ - if ($group) - { - $editgroup = new UserGroup($db); - $editgroup->fetch($group); - $editgroup->oldcopy=clone $editgroup; - - $object->fetch($id); - if ($action == 'addgroup') { - $object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); - } - if ($action == 'removegroup') { - $object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); - } - - if ($result > 0) { + if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) { + if ($id <> $user->id) { + $object->fetch($id); + $object->setstatus(0); header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; - } else { - setEventMessage($object->error, 'errors'); + } + } + if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) { + $error = 0; + + if ($id <> $user->id) { + $object->fetch($id); + + if (!empty($conf->file->main_limit_users)) { + $nb = $object->getNbOfUsers("active"); + if ($nb >= $conf->file->main_limit_users) { + $error ++; + setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); + } + } + + if (!$error) { + $object->setstatus(1); + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } } } - if ($action == 'update' && !$_POST["cancel"]) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { + if ($id <> $user->id) { + $object = new User($db); + $object->id = $id; + $result = $object->delete(); + if ($result < 0) { + $langs->load("errors"); + setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors'); + } else { + header("Location: index.php"); + exit; + } + } + } - if ($caneditfield) // Case we can edit all field - { - $error = 0; + // Action Add user + if ($action == 'add' && $canadduser) { + $error = 0; + + if (!$_POST["lastname"]) { + $error ++; + setEventMessage($langs->trans("NameNotDefined"), 'errors'); + $action = "create"; // Go back to create page + } + if (!$_POST["login"]) { + $error ++; + setEventMessage($langs->trans("LoginNotDefined"), 'errors'); + $action = "create"; // Go back to create page + } + + if (!empty($conf->file->main_limit_users)) { // If option to limit users is set + $nb = $object->getNbOfUsers("active"); + if ($nb >= $conf->file->main_limit_users) { + $error ++; + setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors'); + $action = "create"; // Go back to create page + } + } + + if (!$error) { + $object->lastname = GETPOST("lastname", 'alpha'); + $object->firstname = GETPOST("firstname", 'alpha'); + $object->login = GETPOST("login", 'alpha'); + $object->api_key = GETPOST("api_key", 'alpha'); + $object->gender = GETPOST("gender", 'alpha'); + $object->admin = GETPOST("admin", 'alpha'); + $object->office_phone = GETPOST("office_phone", 'alpha'); + $object->office_fax = GETPOST("office_fax", 'alpha'); + $object->user_mobile = GETPOST("user_mobile"); + $object->skype = GETPOST("skype"); + $object->email = GETPOST("email", 'alpha'); + $object->job = GETPOST("job", 'alpha'); + $object->signature = GETPOST("signature"); + $object->accountancy_code = GETPOST("accountancy_code"); + $object->note = GETPOST("note"); + $object->ldap_sid = GETPOST("ldap_sid"); + $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0; + + $object->thm = GETPOST("thm") != '' ? GETPOST("thm") : ''; + $object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : ''; + $object->salary = GETPOST("salary") != '' ? GETPOST("salary") : ''; + $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; + $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; + + $object->color = GETPOST("color") != '' ? GETPOST("color") : ''; + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + } + + // Set entity property + $entity = GETPOST('entity', 'int'); + if (!empty($conf->multicompany->enabled)) { + if (!empty($_POST["superadmin"])) { + $object->entity = 0; + } else { + if ($conf->multicompany->transverse_mode) { + $object->entity = 1; // all users are forced into master entity + } else { + $object->entity = ($entity == '' ? 1 : $entity); + } + } + } else { + $object->entity = ($entity == '' ? 1 : $entity); + /*if ($user->admin && $user->entity == 0 && GETPOST("admin",'alpha')) + { + }*/ + } + + $db->begin(); + + $id = $object->create($user); + if ($id > 0) { + if (isset($_POST['password']) && trim($_POST['password'])) { + $object->setPassword($user, trim($_POST['password'])); + } + + $db->commit(); + + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } else { + $langs->load("errors"); + $db->rollback(); + if (is_array($object->errors) && count($object->errors)) { + setEventMessage($object->errors, 'errors'); + } else { + setEventMessage($object->error, 'errors'); + } + $action = "create"; // Go back to create page + } + } + } + + // Action add usergroup + if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) + { + if ($group) + { + $editgroup = new UserGroup($db); + $editgroup->fetch($group); + $editgroup->oldcopy=clone $editgroup; + + $object->fetch($id); + if ($action == 'addgroup') { + $object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); + } + if ($action == 'removegroup') { + $object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity)); + } + + if ($result > 0) { + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); + exit; + } else { + setEventMessage($object->error, 'errors'); + } + } + } + + if ($action == 'update' && !$_POST["cancel"]) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + if ($caneditfield) // Case we can edit all field + { + $error = 0; if (!$_POST["lastname"]) { setEventMessage($langs->trans("NameNotDefined"), 'errors'); @@ -492,9 +491,8 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) setEventMessage($object->error, 'errors'); } } -} -// Change password with a new generated one + // Change password with a new generated one if ((($action == 'confirm_password' && $confirm == 'yes') || ($action == 'confirm_passwordsend' && $confirm == 'yes')) && $caneditpassword ) { @@ -518,7 +516,7 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield) } } -// Action initialisation donnees depuis record LDAP + // Action initialisation donnees depuis record LDAP if ($action == 'adduserldap') { $selecteduser = $_POST['users']; From 87c12717a742d313b408f27cf3bd4613040b9ba0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Oct 2015 20:16:28 +0200 Subject: [PATCH 03/14] NEW The thirdparties tabs, the contacts tabs and the members tabs are now presented using a new top banner, saving space and using a same way to show address, status and navigation arrows. --- htdocs/adherents/agenda.php | 14 +- htdocs/adherents/card.php | 23 ++- htdocs/adherents/card_subscriptions.php | 230 ++++++++++++++---------- htdocs/adherents/document.php | 59 +++--- htdocs/adherents/fiche_subscription.php | 37 ++-- htdocs/adherents/info.php | 25 ++- htdocs/adherents/ldap.php | 49 +++-- htdocs/adherents/note.php | 42 ++--- htdocs/contact/document.php | 2 + htdocs/core/class/html.form.class.php | 10 +- 10 files changed, 258 insertions(+), 233 deletions(-) diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 74036ec8e8d..77fa8022968 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -96,11 +96,11 @@ if ($object->id > 0) // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy print ''.$langs->trans("Nature").''.$object->getmorphylib().''; @@ -116,16 +116,6 @@ if ($object->id > 0) print ''.$langs->trans("UserTitle").''.$object->getCivilityLabel().' '; print ''; - // Lastname - print ''.$langs->trans("Lastname").''.$object->lastname.' '; - print ''; - - // Firstname - print ''.$langs->trans("Firstname").''.$object->firstname.' '; - - // Status - print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; - print ''; print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 2123b59ab8d..b9224253bac 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1432,13 +1432,6 @@ else print ''.$langs->trans("UserTitle").''.$object->getCivilityLabel().' '; print ''; - // Lastname - print ''.$langs->trans("Lastname").''.$object->lastname.' '; - print ''; - - // Firstname - print ''.$langs->trans("Firstname").''.$object->firstname.' '; - // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { @@ -1559,6 +1552,22 @@ else } print ''; + // Date end subscription + print ''.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + } + print ''; + print "\n"; print "\n"; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index fb3807fcc5c..fa440c3bac4 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -572,46 +572,150 @@ if ($rowid > 0) dol_banner_tab($object, 'rowid', $linkback); print '
'; + print '
'; print '
'; print ''; - // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - print $showphoto; $showphoto=''; - print ''; - } + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } - // Type - print '\n"; + // Type + print '\n"; - // Morphy - print ''; - print $showphoto; $showphoto=''; - print ''; + // Morphy + print ''; + print ''; - // Company - print ''; + // Company + print ''; - // Civility - print ''; - print ''; + // Civility + print ''; + print ''; - // Lastname - print ''; - print ''; + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } - // Firstname - print ''; - print ''; + // Skype + if (! empty($conf->skype->enabled)) + { + print ''; + } - // EMail - print ''; + print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass); + if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id)) + { + $langs->load("errors"); + $htmltext=$langs->trans("WarningPasswordSetWithNoAccount"); + print ' '.$form->textwithpicto('', $htmltext,1,'warning'); + } + print '
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Skype").''.dol_print_skype($object->skype,0,$object->fk_soc,1).'
'.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).'
'; + + print '
'; + print '
'; + + print '
'; + print ''; + + // Birthday + print ''; - // Status - print ''; + // Public + print ''; + + // Categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan'=>2); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields, 'view', $parameters); + } + + // Third party Dolibarr + if (! empty($conf->societe->enabled)) + { + print ''; + } + + // Login Dolibarr + print ''; // Date end subscription print ''; - // Third party Dolibarr - if (! empty($conf->societe->enabled)) - { - print ''; - } - - // Login Dolibarr - print ''; - print "
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("Public").''.yn($object->public).'
' . $langs->trans("Categories") . ''; + print $form->showCategories($object->id, 'member', 1); + print '
'; + print ''; + if ($action != 'editthirdparty' && $user->rights->adherent->creer) print ''; + print '
'; + print $langs->trans("LinkedToDolibarrThirdParty"); + print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; + print '
'; + if ($action == 'editthirdparty') + { + $htmlname='socid'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->select_company($object->fk_soc,'socid','',1); + print '
'; + } + else + { + if ($object->fk_soc) + { + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + print $company->getNomUrl(1); + } + else + { + print $langs->trans("NoThirdPartyAssociatedToMember"); + } + } + print '
'; + print ''; + if ($action != 'editlogin' && $user->rights->adherent->creer) + { + print ''; + } + print '
'; + print $langs->trans("LinkedToDolibarrUser"); + print ''; + if ($user->rights->user->user->creer) + { + print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).''; + } + print '
'; + print '
'; + if ($action == 'editlogin') + { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); + } + else + { + if ($object->user_id) + { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + } + else print $langs->trans("NoDolibarrAccess"); + } + print '
'.$langs->trans("SubscriptionEndDate").''; @@ -629,76 +733,10 @@ if ($rowid > 0) } print '
'; - print ''; - if ($action != 'editthirdparty' && $user->rights->adherent->creer) print ''; - print '
'; - print $langs->trans("LinkedToDolibarrThirdParty"); - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; - print '
'; - if ($action == 'editthirdparty') - { - $htmlname='socid'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $form->select_company($object->fk_soc,'socid','',1); - print '
'; - } - else - { - if ($object->fk_soc) - { - $company=new Societe($db); - $result=$company->fetch($object->fk_soc); - print $company->getNomUrl(1); - } - else - { - print $langs->trans("NoThirdPartyAssociatedToMember"); - } - } - print '
'; - print ''; - if ($action != 'editlogin' && $user->rights->adherent->creer) print ''; - print '
'; - print $langs->trans("LinkedToDolibarrUser"); - print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'
'; - print '
'; - if ($action == 'editlogin') - { - /*$include=array(); - if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only - { - $include=array($object->user_id,$user->id); - }*/ - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); - } - else - { - if ($object->user_id) - { - $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); - } - else print $langs->trans("NoDolibarrAccess"); - } - print '
\n"; - print '
'; + print "
\n"; + print '
'; dol_fiche_end(); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 71f1df22937..4dd5fd9bf64 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -83,6 +83,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php * View */ +$form = new Form($db); llxHeader(); @@ -91,19 +92,7 @@ if ($id > 0) $result=$membert->fetch($object->typeid); if ($result > 0) { - /* - * Affichage onglets - */ - if (! empty($conf->notification->enabled)) - $langs->load("mails"); - - $head = member_prepare_head($object); - - $form=new Form($db); - - dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user'); - - + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -111,34 +100,41 @@ if ($id > 0) { $totalsize+=$file['size']; } + + if (! empty($conf->notification->enabled)) + $langs->load("mails"); + $head = member_prepare_head($object); - print ''; + dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'rowid', $linkback); + + print '
'; + + print '
'; + print '
'; $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - print ''; - // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; + print ''; } + // Type + print '\n"; + // Morphy - print ''; + print ''; /*print '';*/ print ''; - // Type - print '\n"; - // Company print ''; @@ -146,17 +142,6 @@ if ($id > 0) print ''; print ''; - // Lastname - print ''; - print ''; - - // Firstname - print ''; - print ''; - - // Status - print ''; - // Nbre fichiers print ''; @@ -166,6 +151,8 @@ if ($id > 0) print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'rowid', $linkback); - print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$membert->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Nature").''.$object->getmorphylib().''; print $form->showphoto('memberphoto',$object); print '
'.$langs->trans("Type").''.$membert->getNomUrl(1)."
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; print ''; + + dol_fiche_end(); $modulepart = 'member'; $permission = $user->rights->adherent->creer; diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 6f0177d4b6f..6b980a4df1c 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -180,18 +180,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') $head[$h][2] = 'info'; $h++; - dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); - - print "\n"; print '
'; print ''; print ""; print ""; print "fk_bank."\">"; + + dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); + + print "\n"; print ''; + $linkback = ''.$langs->trans("BackToList").''; + // Ref - print ''; + print ''; + print ''; // Member $adh->ref=$adh->getFullName($langs); @@ -239,18 +245,18 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') } } - print '
'.$langs->trans("Ref").''.$subscription->ref.' 
'.$langs->trans("Ref").''; + print $form->showrefnav($subscription, 'rowid', $linkback, 1); + print '
'; - print ''; + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; print '       '; print ''; - print ''; - - print ''; + print '
'; + print '
'; print "\n"; - - print ''; - print "\n"; } if ($rowid && $action != 'edit') @@ -355,8 +361,7 @@ if ($rowid && $action != 'edit') print "\n"; print ''; - print "\n"; - + dol_fiche_end(); /* * Barre d'actions @@ -388,6 +393,6 @@ if ($rowid && $action != 'edit') } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/adherents/info.php b/htdocs/adherents/info.php index 27f36e9a843..36ed504dd73 100644 --- a/htdocs/adherents/info.php +++ b/htdocs/adherents/info.php @@ -42,23 +42,34 @@ $result=restrictedArea($user,'adherent',$id); * View */ +$form = new Form($db); + llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); -$adh = new Adherent($db); -$adh->fetch($id); -$adh->info($id); +$object = new Adherent($db); +$object->fetch($id); +$object->info($id); -$head = member_prepare_head($adh); +$head = member_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user'); -print '
'; -dol_print_object_info($adh); -print '
'; +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'rowid', $linkback); + +print '
'; + +print '
'; + +print '
'; +dol_print_object_info($object); print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 89572525c32..a2848b655b3 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -44,12 +44,11 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -$adh = new Adherent($db); -$adh->id = $rowid; -$result=$adh->fetch($rowid); +$object = new Adherent($db); +$result=$object->fetch($rowid); if (! $result) { - dol_print_error($db,"Failed to get adherent: ".$adh->error); + dol_print_error($db,"Failed to get adherent: ".$object->error); exit; } @@ -65,8 +64,8 @@ if ($action == 'dolibarr2ldap') $ldap=new Ldap(); $result=$ldap->connect_bind(); - $info=$adh->_load_ldap_info(); - $dn=$adh->_load_ldap_dn($info); + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info); $olddn=$dn; // We can say that old dn = dn as we force synchro $result=$ldap->update($dn,$info,$user,$olddn); @@ -93,35 +92,27 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé $form = new Form($db); -$head = member_prepare_head($adh); +$head = member_prepare_head($object); dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user'); +$linkback = ''.$langs->trans("BackToList").''; -print ''; +dol_banner_tab($object, 'rowid', $linkback); -// Ref -print ''; -print ''; +print '
'; -// Lastname -print '
'; -print ''; - -// Firstname -print ''; -print ''; +print '
'; +print '
'.$langs->trans("Ref").''; -print $form->showrefnav($adh,'id'); -print '
'.$langs->trans("Lastname").''.$adh->lastname.' 
'.$langs->trans("Firstname").''.$adh->firstname.' 
'; // Login -print ''; +print ''; // Password not crypted if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) { print ''; - print ''; + print ''; print "\n"; } @@ -129,12 +120,12 @@ if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) { print ''; - print ''; + print ''; print "\n"; } // Type -print '\n"; +print '\n"; $langs->load("admin"); @@ -155,6 +146,8 @@ print '
'.$langs->trans("Login").''.$adh->login.' 
'.$langs->trans("Login").''.$object->login.' 
'.$langs->trans("LDAPFieldPasswordNotCrypted").''.$adh->pass.''.$object->pass.'
'.$langs->trans("LDAPFieldPasswordCrypted").''.$adh->pass_crypted.''.$object->pass_crypted.'
'.$langs->trans("Type").''.$adh->type."
'.$langs->trans("Type").''.$object->type."
'; print ''; +dol_fiche_end(); + /* * Barre d'actions */ @@ -163,7 +156,7 @@ print '
'; if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') { - print ''; + print ''; } print "
\n"; @@ -187,9 +180,9 @@ $ldap=new Ldap(); $result=$ldap->connect_bind(); if ($result > 0) { - $info=$adh->_load_ldap_info(); - $dn=$adh->_load_ldap_dn($info,1); - $search = "(".$adh->_load_ldap_dn($info,2).")"; + $info=$object->_load_ldap_info(); + $dn=$object->_load_ldap_dn($info,1); + $search = "(".$object->_load_ldap_dn($info,2).")"; if (empty($dn)) { diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 79b7db086e6..a895d6cfef8 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -73,33 +73,31 @@ if ($id) print "
"; print ''; - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Reference - print ''; - print ''; - print ''; + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'rowid', $linkback); + + print '
'; + + print '
'; + print '
'.$langs->trans('Ref').''; - print $form->showrefnav($object, 'id', $linkback); - print '
'; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''; + print ''; } + // Type + print '\n"; + // Morphy - print ''; + print ''; /*print '';*/ print ''; - // Type - print '\n"; - // Company print ''; @@ -107,21 +105,13 @@ if ($id) print ''; print ''; - // Lastname - print ''; - print ''; - - // Firstname - print ''; - - // Status - print ''; - print "
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Nature").''.$object->getmorphylib().''; print $form->showphoto('memberphoto',$member); print '
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Status").''.$object->getLibStatut(4).'
"; + + print ''; print '
'; - $colwidth='20'; + $cssclass='titlefield'; $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 62822a97690..6cf3daf5cad 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -95,6 +95,8 @@ if ($object->id) $totalsize+=$file['size']; } + $linkback = ''.$langs->trans("BackToList").''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '
'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bc1bdf7e790..6b541760a55 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5265,9 +5265,9 @@ class Form $dir=$conf->societe->multidir_output[$entity]; $smallfile=$object->logo; $smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile); - if ($object->logo) $file=$id.'/logos/thumbs/'.$smallfile; + if (! empty($object->logo)) $file=$id.'/logos/thumbs/'.$smallfile; } - if ($modulepart=='contact') + else if ($modulepart=='contact') { $dir=$conf->societe->multidir_output[$entity].'/contact'; $file=$id.'/photos/'.$object->photo; @@ -5275,19 +5275,19 @@ class Form else if ($modulepart=='userphoto') { $dir=$conf->user->dir_output; - if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; + if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; } else if ($modulepart=='memberphoto') { $dir=$conf->adherent->dir_output; - if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo; + if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; } else { $dir=$conf->$modulepart->dir_output; - if ($object->photo) $file=get_exdir($id, 2, 0, 0, $adherent, 'member').'photos/'.$object->photo; + if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo; if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; } From d1d6c72d7d6fc96356cec4c33f765e0f3f69dec3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Oct 2015 22:21:26 +0200 Subject: [PATCH 04/14] NEW Uniformize way of working for search filters. One filter per object. --- htdocs/compta/index.php | 66 +++++++++++++------------------- htdocs/contact/list.php | 7 ++-- htdocs/core/search.php | 33 ++++++++++++++++ htdocs/core/search_page.php | 8 ++-- htdocs/don/list.php | 10 ++++- htdocs/main.inc.php | 14 +++---- htdocs/product/index.php | 43 +++++++++++---------- htdocs/product/list.php | 1 + htdocs/societe/index.php | 75 ++++++++++++++++--------------------- htdocs/societe/list.php | 62 ++++++++++++------------------ 10 files changed, 161 insertions(+), 158 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 59ed9afc504..076b6a9b209 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -90,56 +90,40 @@ print '
'; $max=3; -/* - * Search invoices - */ +// Search customer invoices if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - print ''; - print ''; - print ''; - print ""; - print ''; - print "'; - print ''; - print "'; - print ''; - print "
'.$langs->trans("SearchACustomerInvoice").'
:
:

"; + $listofsearchfields['search_invoice']=array('text'=>'CustomerInvoice'); } - -/* - * Search supplier invoices - */ +// Search supplier invoices if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) { - print '
'; - print ''; - print ''; - print ''; - print ""; - print "'; - print ''; - print "'; - print ''; - print "
'.$langs->trans("SearchASupplierInvoice").'
:
:

"; + $listofsearchfields['search_supplier_invoice']=array('text'=>'SupplierInvoice'); } - -/* - * Search donations - */ if (! empty($conf->don->enabled) && $user->rights->don->lire) { $langs->load("donations"); - print '
'; - print ''; - print ''; - print ''; - print ""; - print "'; - print ''; - //print "'; - print ''; - print "
'.$langs->trans("SearchADonation").'
:
:

"; + $listofsearchfields['search_donation']=array('text'=>'Donation'); +} + +if (count($listofsearchfields)) +{ + print '
'; + print ''; + print ''; + $i=0; + foreach($listofsearchfields as $key => $value) + { + if ($i == 0) print ''; + print ''; + print ''; + if ($i == 0) print ''; + print ''; + $i++; + } + print '
'.$langs->trans("Search").'
:
'; + print '
'; + print '
'; } /** diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 4082ebbae80..51c834522c8 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -40,6 +40,7 @@ $contactid = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid,''); +$sall=GETPOST("sall"); $search_firstlast_only=GETPOST("search_firstlast_only"); $search_lastname=GETPOST("search_lastname"); $search_firstname=GETPOST("search_firstname"); @@ -56,13 +57,13 @@ $search_priv=GETPOST("search_priv"); $search_categ=GETPOST("search_categ",'int'); $search_status=GETPOST("search_status",'int'); if ($search_status=='') $search_status=1; // always display activ customer first + $optioncss = GETPOST('optioncss','alpha'); $type=GETPOST("type"); $view=GETPOST("view"); -$sall=GETPOST("contactname"); $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); @@ -98,8 +99,9 @@ else if ($type == "o") $urlfiche=""; } -if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both 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=""; $search_firstlast_only=""; $search_lastname=""; $search_firstname=""; @@ -113,7 +115,6 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both $search_email=""; $search_skype=""; $search_priv=""; - $sall=""; $seach_status=1; } if ($search_priv < 0) $search_priv=''; diff --git a/htdocs/core/search.php b/htdocs/core/search.php index 6dd5d46c72f..5413ae0d162 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -64,7 +64,40 @@ if (GETPOST('search_contract') != '') header("Location: ".DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode(GETPOST('search_contract'))); exit; } +if (GETPOST('search_invoice') != '') +{ + header("Location: ".DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode(GETPOST('search_invoice'))); + exit; +} +if (GETPOST('search_supplier_invoice') != '') +{ + header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode(GETPOST('search_supplier_invoice'))); + exit; +} +if (GETPOST('search_donation') != '') +{ + header("Location: ".DOL_URL_ROOT.'/don/list.php?sall='.urlencode(GETPOST('search_donation'))); + exit; +} +if (GETPOST('search_product') != '') +{ + header("Location: ".DOL_URL_ROOT.'/product/list.php?sall='.urlencode(GETPOST('search_product'))); + exit; +} +if (GETPOST('search_thirdparty') != '') +{ + header("Location: ".DOL_URL_ROOT.'/societe/list.php?mode=search&sall='.urlencode(GETPOST('search_thirdparty'))); + exit; +} +if (GETPOST('search_contact') != '') +{ + header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact'))); + exit; +} + + + // If we are here, search was called with no supported criteria if (! empty($_SERVER['HTTP_REFERER'])) { diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index dc90a7c3853..fa63a9e9c06 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -70,14 +70,14 @@ $searchform = ''; if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'sall', '', 'company'); $nbofsearch++; } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'sall', '', 'contact'); $nbofsearch++; } @@ -85,7 +85,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'sall'.rand(0,10)); + $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'product'); $nbofsearch++; } @@ -100,7 +100,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'sall'.rand(0,10)); + $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', '', 'member'); $nbofsearch++; } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 55b7d9377a3..9227b1a26eb 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -43,6 +43,7 @@ if (! $sortfield) $sortfield="d.datedon"; $limit = $conf->liste_limit; $statut=isset($_GET["statut"])?$_GET["statut"]:"-1"; +$search_all=GETPOST('sall','alpha'); $search_ref=GETPOST('search_ref','alpha'); $search_company=GETPOST('search_company','alpha'); $search_name=GETPOST('search_name','alpha'); @@ -51,9 +52,10 @@ $optioncss = GETPOST('optioncss','alpha'); if (!$user->rights->don->lire) accessforbidden(); -if (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")) // Both test are required to be compatible with all browsers { - $search_ref=""; + $search_all=""; + $search_ref=""; $search_company=""; $search_name=""; $search_amount=""; @@ -83,6 +85,10 @@ if (trim($search_ref) != '') { $sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\''; } +if (trim($search_all) != '') +{ + $sql .= natural_search(array('d.rowid', 'd.ref', 'd.lastname', 'd.firstname', 'd.societe'), $search_all); +} if (trim($search_company) != '') { $sql .= natural_search('d.societe', $search_company); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 638ddbc91a4..9e6869f7302 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1575,13 +1575,13 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt', img_object('','company')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company')); } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleftc', img_object('','contact')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact')); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) @@ -1607,7 +1607,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if (! empty($conf->projet->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PROJECT) && $user->rights->projet->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'M', 'searchleftproj', img_object('','projectpub')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub')); } // Execute hook printSearchForm @@ -1851,11 +1851,11 @@ function getHelpParamFor($helppagename,$langs) * @param string $htmlmodesearch Value to set into parameter "mode_search" ('soc','contact','products','member',...) * @param string $htmlinputname Field Name input form * @param string $accesskey Accesskey - * @param string $idname Complement for id to avoid multiple same id in the page + * @param string $prefhtmlinputname Complement for id to avoid multiple same id in the page * @param string $img Image to use * @return string */ -function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='',$img='') +function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $prefhtmlinputname='',$img='') { global $conf,$langs; @@ -1868,7 +1868,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput $ret.='