| ';
@@ -589,23 +648,29 @@ class FormTicket
/**
* Return html list of ticket anaytic codes
*
- * @param string $selected Id categorie pre-selectionnée
- * @param string $htmlname Name of select component
- * @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users.
- * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
- * @param int $empty 1=peut etre vide, 0 sinon
- * @param int $noadmininfo 0=Add admin info, 1=Disable admin info
- * @param int $maxlength Max length of label
- * @param string $morecss More CSS
- * @param int $use_multilevel If > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes.
+ * @param string $selected Id categorie pre-selectionnée
+ * @param string $htmlname Name of select component
+ * @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users.
+ * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
+ * @param int $empty 1=peut etre vide, 0 sinon
+ * @param int $noadmininfo 0=Add admin info, 1=Disable admin info
+ * @param int $maxlength Max length of label
+ * @param string $morecss More CSS
+ * @param int $use_multilevel If > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes.
+ * @param Translate $outputlangs Output lnaguage
* @return void
*/
- public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0)
+ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0, $outputlangs = null)
{
- global $langs, $user;
+ global $conf, $langs, $user;
dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
+ if (empty($outputlangs)) {
+ $outputlangs = $langs;
+ }
+ $outputlangs->load("ticket");
+
$ticketstat = new Ticket($this->db);
$ticketstat->loadCacheCategoriesTickets();
@@ -629,6 +694,13 @@ class FormTicket
continue;
}
+ $label = ($arraycategories['label'] != '-' ? $arraycategories['label'] : '');
+ if ($outputlangs->trans("TicketCategoryShort".$arraycategories['code']) != ("TicketCategoryShort".$arraycategories['code'])) {
+ $label = $outputlangs->trans("TicketCategoryShort".$arraycategories['code']);
+ } elseif ($outputlangs->trans($arraycategories['code']) != $arraycategories['code']) {
+ $label = $outputlangs->trans($arraycategories['code']);
+ }
+
if ($format == 0) {
print ' |
';
}
-
// Discount qty min
print '| '.$langs->trans("DiscountQtyMin").' | ';
print ' %';
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 2ffaf43ea90..fc394d6203a 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -104,6 +104,29 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
+ $backurlforlist = DOL_URL_ROOT.'/product/stock/list.php';
+
+ if (empty($backtopage) || ($cancel && empty($id))) {
+ if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
+ if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
+ $backtopage = $backurlforlist;
+ } else {
+ $backtopage = DOL_URL_ROOT.'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
+ }
+ }
+ }
+
+ if ($cancel) {
+ if (!empty($backtopageforcancel)) {
+ header("Location: ".$backtopageforcancel);
+ exit;
+ } elseif (!empty($backtopage)) {
+ header("Location: ".$backtopage);
+ exit;
+ }
+ $action = '';
+ }
+
// Ajout entrepot
if ($action == 'add' && $user->rights->stock->creer) {
$object->ref = (string) GETPOST("ref", "alpha");
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 00394dda384..ff406e33131 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1525,7 +1525,7 @@ class Project extends CommonObject
}
}
- $clone_project->datec = $now;
+ $clone_project->date_c = $now;
if (!$clone_note) {
$clone_project->note_private = '';
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 71219be4e57..fa6884ee920 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -1387,7 +1387,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
}
print ' | ';
- print '';
+ $form->buttonsSaveCancel();
+ print '';
print '';
print ' |
';
diff --git a/htdocs/public/eventorganization/attendee_registration.php b/htdocs/public/eventorganization/attendee_register.php
similarity index 90%
rename from htdocs/public/eventorganization/attendee_registration.php
rename to htdocs/public/eventorganization/attendee_register.php
index 385152e420a..0cfdf1dabc0 100644
--- a/htdocs/public/eventorganization/attendee_registration.php
+++ b/htdocs/public/eventorganization/attendee_register.php
@@ -16,7 +16,7 @@
*/
/**
- * \file htdocs/public/eventorganization/attendee_registration.php
+ * \file htdocs/public/eventorganization/attendee_register.php
* \ingroup project
* \brief Example of form to subscribe to an event
*
@@ -251,10 +251,10 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$confattendee = new ConferenceOrBoothAttendee($db);
if ($type == 'global') {
- $filter = array('t.fk_project'=>$id, 'customsql'=>'t.email="'.$email.'"');
+ $filter = array('t.fk_project'=>((int) $id), 'customsql'=>'t.email="'.$db->escape($email).'"');
}
if ($action == 'conf') {
- $filter = array('t.fk_actioncomm'=>$id, 'customsql'=>'t.email="'.$email.'"');
+ $filter = array('t.fk_actioncomm'=>((int) $id), 'customsql'=>'t.email="'.$db->escape($email).'"');
}
// Check if there is already an attendee into table eventorganization_conferenceorboothattendee for same event (or conference/booth)
@@ -279,16 +279,25 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
// At this point, we have an existing $confattendee. It may not be linked to a thirdparty.
//var_dump($confattendee);
- // If the attendee has already been paid
- if (!empty($confattendee->date_subscription)) {
- $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
+ // If the registration has already been paid for this attendee
+ if (!empty($confattendee->date_subscription) && !empty($confattendee->amount)) {
+ $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'master');
$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl);
+
+ $mesg = $langs->trans("RegistrationAndPaymentWereAlreadyRecorder", $email);
+ setEventMessages($mesg, null, 'mesgs');
+
+ $db->commit();
+
Header("Location: ".$redirection);
exit;
}
+ $resultfetchthirdparty = -1;
+
// Getting the thirdparty or creating it
$thirdparty = new Societe($db);
+ $contact = new Contact($db);
// Fetch using fk_soc if the attendee was already found
if (!empty($confattendee->fk_soc) && $confattendee->fk_soc > 0) {
$resultfetchthirdparty = $thirdparty->fetch($confattendee->fk_soc);
@@ -298,10 +307,19 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if (!empty($societe)) {
$resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $email);
if ($resultfetchthirdparty <= 0) {
- // Need to create a new one (not found or multiple with the same name/email)
- $resultfetchthirdparty = 0;
+ // Try to find the thirdparty from the contact
+ $resultfetchcontact = $contact->fetch('', null, '', $email);
+ if ($resultfetchcontact <= 0 || $contact->fk_soc <= 0) {
+ // Need to create a new one (not found or multiple with the same name/email)
+ $resultfetchthirdparty = 0;
+ } else {
+ $thirdparty->fetch($contact->fk_soc);
+ $confattendee->fk_soc = $thirdparty->id;
+ $confattendee->update($user);
+ $resultfetchthirdparty = 1;
+ }
} else {
- // We found an unique result with that name/email, so we set the fk_soc of attendee
+ // We found a unique result with that name/email, so we set the fk_soc of attendee
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
}
@@ -310,6 +328,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$resultfetchthirdparty = 0;
}
} else {
+ // Need to create a thirdparty (put number>0 if we do not want to create a thirdparty for free-conferences)
$resultfetchthirdparty = 0;
}
}
@@ -359,6 +378,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs);
$thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs);
+ // Update attendee country to match country of thirdparty
$confattendee->fk_soc = $thirdparty->id;
$confattendee->update($user);
}
@@ -370,6 +390,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$outputlangs = $langs;
// TODO Use default language of $thirdparty->default_lang to build $outputlang
+ // Get product to use for invoice
$productforinvoicerow = new Product($db);
$productforinvoicerow->id = 0;
@@ -378,6 +399,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION);
}
+ // Create invoice
if ($resultprod < 0) {
$error++;
$errmsg .= $productforinvoicerow->error;
@@ -428,8 +450,10 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if (!$error) {
$db->commit();
- // Registration was recorded and invoice was generated, so we send an email
+ // Registration was recorded and invoice was generated, but payment not yet done.
// TODO
+ // Send an email to says registration shas been received and that we are waiting for the payment.
+ // Should send email template (EventOrganizationEmailRegistrationEvent) saved into conf EVENTORGANIZATION_TEMPLATE_EMAIL_REGISTRATION_EVENT.
// Now we redirect to the payment page
$sourcetouse = 'organizedeventregistration';
@@ -442,6 +466,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$redirection .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
}
}
+
Header("Location: ".$redirection);
exit;
} else {
@@ -585,13 +610,15 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print '' . "\n";
// Email
- print '| ' . $langs->trans("Email") . '* | |
' . "\n";
+ print '| ' . $langs->trans("Email") . '* | |
' . "\n";
// Company
print '| ' . $langs->trans("Company");
if (!empty(floatval($project->price_registration))) {
- print '*';
+ print '*';
}
- print ' | |
' . "\n";
+ print ' ';
+ print img_picto('', 'company', 'class="pictofixedwidth"');
+ print ' | ' . "\n";
// Address
print '| ' . $langs->trans("Address") . ' | ' . "\n";
print ' |
' . "\n";
@@ -602,7 +629,8 @@ if (!empty($conference->id) && $conference->status==ConferenceOrBooth::STATUS_CO
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
print '';
// Country
- print '| ' . $langs->trans('Country') . '* | ';
+ print ' |
| ' . $langs->trans('Country') . '* | ';
+ print img_picto('', 'country', 'class="pictofixedwidth"');
$country_id = GETPOST('country_id');
if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
$country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index f84fce1a2b6..b6498ca4032 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -536,15 +536,16 @@ jQuery(document).ready(function () {
jQuery(document).ready(function () {
function initmorphy()
{
- if (jQuery("#morphy").val()==\'phy\') {
- jQuery("#trcompany").hide();
- }
- if (jQuery("#morphy").val()==\'mor\') {
- jQuery("#trcompany").show();
- }
+ console.log("Call initmorphy");
+ if (jQuery("#morphy").val() == \'phy\') {
+ jQuery("#trcompany").hide();
+ }
+ if (jQuery("#morphy").val() == \'mor\') {
+ jQuery("#trcompany").show();
+ }
};
initmorphy();
- jQuery("#morphy").click(function() {
+ jQuery("#morphy").change(function() {
initmorphy();
});
jQuery("#selectcountry_id").change(function() {
@@ -592,21 +593,33 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) {
print '';
}
-// Civility
+// Company
+print ' |
| '.$langs->trans("Company").' | ';
+print img_picto('', 'company', 'class="pictofixedwidth"');
+print ' |
'."\n";
+// Title
print '| '.$langs->trans('UserTitle').' | ';
print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').' |
'."\n";
// Lastname
print '| '.$langs->trans("Lastname").' * | |
'."\n";
// Firstname
print '| '.$langs->trans("Firstname").' * | |
'."\n";
+// EMail
+print '| '.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').' | ';
+//print img_picto('', 'email', 'class="pictofixedwidth"');
+print ' |
'."\n";
+// Login
+if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
+ print '| '.$langs->trans("Login").' * | |
'."\n";
+ print '| '.$langs->trans("Password").' * | |
'."\n";
+ print '| '.$langs->trans("PasswordAgain").' * | |
'."\n";
+}
// Gender
print '| '.$langs->trans("Gender").' | ';
print '';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1);
print ' |
';
-// Company
-print '| '.$langs->trans("Company").' | |
'."\n";
// Address
print '| '.$langs->trans("Address").' | '."\n";
print ' |
'."\n";
@@ -618,7 +631,8 @@ print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'se
print '';
// Country
print '| '.$langs->trans('Country').' | ';
-$country_id = GETPOST('country_id');
+print img_picto('', 'country', 'class="pictofixedwidth"');
+$country_id = GETPOST('country_id', 'int');
if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
$country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
}
@@ -644,14 +658,6 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
}
print ' |
';
}
-// EMail
-print '| '.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').' | |
'."\n";
-// Login
-if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
- print '| '.$langs->trans("Login").' * | |
'."\n";
- print '| '.$langs->trans("Password").' * | |
'."\n";
- print '| '.$langs->trans("PasswordAgain").' * | |
'."\n";
-}
// Birthday
print '| '.$langs->trans("DateOfBirth").' | ';
print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0);
@@ -669,7 +675,8 @@ print ' | '.$langs->trans("Comments").' | ';
print ' | ';
print '
'."\n";
- // Add specific fields used by Dolibarr foundation for example
+// Add specific fields used by Dolibarr foundation for example
+// TODO Move this into generic feature.
if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
$arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+');
print '| '.$langs->trans("TurnoverOrBudget").' * | ';
@@ -712,6 +719,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
';
print ' |
'."\n";
}
+
if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) {
// $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 702c910ea01..d7bf9b3d565 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -1834,7 +1834,8 @@ if ($source == 'organizedeventregistration') {
// Debitor
print '| '.$langs->trans("Attendee");
print ' | ';
- print $thirdparty->name;
+ print $attendee->email;
+ print ($thirdparty->name ? ' ('.$thirdparty->name.')' : '');
print '';
print ' |
'."\n";
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 2f139748cba..20a5239153a 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -1445,6 +1445,7 @@ if ($ispaymentok) {
$key = 'ONLINE_PAYMENT_MESSAGE_OK';
if (!empty($conf->global->$key)) {
+ print '
';
print $conf->global->$key;
}
diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php
index 37635d27048..fa7df34af14 100644
--- a/htdocs/recruitment/class/recruitmentcandidature.class.php
+++ b/htdocs/recruitment/class/recruitmentcandidature.class.php
@@ -893,7 +893,7 @@ class RecruitmentCandidature extends CommonObject
$this->lines = array();
$objectline = new RecruitmentCandidatureLine($this->db);
- $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_recruitmentcandidature = '.$this->id));
+ $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_recruitmentcandidature = '.((int) $this->id)));
if (is_numeric($result)) {
$this->error = $this->error;
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index c87ef8f2f1b..4110e59d4de 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -1759,7 +1759,7 @@ class Societe extends CommonObject
$this->country_id = $obj->country_id;
$this->country_code = $obj->country_id ? $obj->country_code : '';
- $this->country = $obj->country_id ? ($langs->transnoentities('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
+ $this->country = $obj->country_id ? (($langs->transnoentities('Country'.$obj->country_code) != 'Country'.$obj->country_code) ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
$this->state_id = $obj->state_id;
$this->state_code = $obj->state_code;
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 985fd7d82fe..ea273064840 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1166,22 +1166,22 @@ class Ticket extends CommonObject
}
/**
- * Charge dans cache la liste des catégories de tickets (paramétrable dans dictionnaire)
+ * Load into a cache array, the list of ticket categories (setup done into dictionary)
*
* @return int Number of lines loaded, 0 if already loaded, <0 if KO
*/
public function loadCacheCategoriesTickets()
{
- global $langs;
+ global $conf, $langs;
if (!empty($this->cache_category_ticket) && count($this->cache_category_tickets)) {
+ // Cache already loaded
return 0;
}
- // Cache deja charge
$sql = "SELECT rowid, code, label, use_default, pos, description, public, active, force_severity, fk_parent";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category";
- $sql .= " WHERE active > 0";
+ $sql .= " WHERE active > 0 AND entity = ".((int) $conf->entity);
$sql .= " ORDER BY pos";
dol_syslog(get_class($this)."::load_cache_categories_tickets", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1191,15 +1191,18 @@ class Ticket extends CommonObject
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$this->cache_category_tickets[$obj->rowid]['code'] = $obj->code;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
- $label = ($langs->trans("TicketCategoryShort".$obj->code) != ("TicketCategoryShort".$obj->code) ? $langs->trans("TicketCategoryShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
- $this->cache_category_tickets[$obj->rowid]['label'] = $label;
$this->cache_category_tickets[$obj->rowid]['use_default'] = $obj->use_default;
$this->cache_category_tickets[$obj->rowid]['pos'] = $obj->pos;
$this->cache_category_tickets[$obj->rowid]['public'] = $obj->public;
$this->cache_category_tickets[$obj->rowid]['active'] = $obj->active;
$this->cache_category_tickets[$obj->rowid]['force_severity'] = $obj->force_severity;
$this->cache_category_tickets[$obj->rowid]['fk_parent'] = $obj->fk_parent;
+
+ // If translation exists, we use it to store already translated string.
+ // Warning: You should not use this and recompute the translated string into caller code to get the value into expected language
+ $label = ($langs->trans("TicketCategoryShort".$obj->code) != ("TicketCategoryShort".$obj->code) ? $langs->trans("TicketCategoryShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
+ $this->cache_category_tickets[$obj->rowid]['label'] = $label;
+
$i++;
}
return $num;
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 8d03d1d1cfb..480ff3a8a74 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -1805,7 +1805,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print ''."\n";
// API key
- if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin)) {
+ if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) {
print '| '.$langs->trans("ApiKey").' | ';
print '';
if (!empty($object->api_key)) {
@@ -1972,7 +1972,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $object->entity);
print ' ';
print '';
- print '';
+ print '';
}
print ' |
'."\n";
@@ -2328,7 +2328,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print "\n";
// API key
- if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin)) {
+ if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) {
print '| '.$langs->trans("ApiKey").' | ';
print '';
print '';
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index fe1c6993558..649b8b55502 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -455,8 +455,9 @@ class User extends CommonObject
}
}
- if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba
- $sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1";
+ if ($sid) {
+ // permet une recherche du user par son SID ActiveDirectory ou Samba
+ $sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."')";
} elseif ($login) {
$sql .= " AND u.login = '".$this->db->escape($login)."'";
} elseif ($email) {
@@ -466,6 +467,11 @@ class User extends CommonObject
}
$sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities
+ if ($sid) {
+ // permet une recherche du user par son SID ActiveDirectory ou Samba
+ $sql .= ' '.$this->db->plimit(1);
+ }
+
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php
index 1f20b018f2e..186d8463549 100644
--- a/htdocs/user/group/card.php
+++ b/htdocs/user/group/card.php
@@ -418,7 +418,7 @@ if ($action == 'create') {
print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300');
print ' ';
print '';
- print '';
+ print '';
print ' |
'."\n";
print '
'."\n";
print '