diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php
index f9b10c3ce3b..5a589756feb 100644
--- a/htdocs/adherents/admin/member.php
+++ b/htdocs/adherents/admin/member.php
@@ -205,16 +205,16 @@ print '
| '.$langs->trans("MemberSendInformationByMailByDefault").' | ';
print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 9c04463cfc2..f6a512eaa11 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -124,8 +124,23 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
+ $backurlforlist = DOL_URL_ROOT.'/adherents/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.'/adherents/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
+ }
+ }
+ }
+
if ($cancel) {
- if (!empty($backtopage)) {
+ if (!empty($backtopageforcancel)) {
+ header("Location: ".$backtopageforcancel);
+ exit;
+ } elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
@@ -1813,7 +1828,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Show link to invoices
$tmparray = $company->getOutstandingBills('customer');
if (!empty($tmparray['refs'])) {
- print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").': '.count($tmparray['refs']);
+ print ' - '.img_picto($langs->trans("Invoices"), 'bill', 'class="paddingright"').''.$langs->trans("Invoices").' ('.count($tmparray['refs']).')';
// TODO Add alert if warning on at least one invoice late
print '';
}
@@ -1937,7 +1952,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->societe->enabled) && !$object->socid) {
if ($user->rights->societe->creer) {
if (Adherent::STATUS_DRAFT != $object->statut) {
- print 'id.'&action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").''."\n";;
+ print 'id.'&action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").''."\n";
} else {
print ''.$langs->trans("CreateDolibarrThirdParty").''."\n";
}
@@ -1950,7 +1965,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!$user->socid && !$object->user_id) {
if ($user->rights->user->user->creer) {
if (Adherent::STATUS_DRAFT != $object->statut) {
- print 'id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").''."\n";
+ print 'id.'&action=create_user" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrLoginDesc")).'">'.$langs->trans("CreateDolibarrLogin").''."\n";
} else {
print ''.$langs->trans("CreateDolibarrLogin").''."\n";
}
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 78deca61028..bdb77982733 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -2185,6 +2185,9 @@ class Adherent extends CommonObject
if (!empty($this->ref)) {
$label .= ' '.$langs->trans('Ref').': '.$this->ref;
}
+ if (!empty($this->login)) {
+ $label .= ' '.$langs->trans('Login').': '.$this->login;
+ }
if (!empty($this->firstname) || !empty($this->lastname)) {
$label .= ' '.$langs->trans('Name').': '.$this->getFullName($langs);
}
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index fd667ad6a2f..d55845b40c1 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -318,6 +318,7 @@ $sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.p
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql .= " d.note_private, d.note_public,";
$sql .= " s.nom,";
+$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
$sql .= " t.libelle as type, t.subscription,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
// Add fields from extrafields
@@ -492,7 +493,7 @@ if (GETPOSTISSET("search_status")) {
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
$titre = $langs->trans("MembersListNotUpToDate");
}
- if ($search_status == Adherent::STATUS_RESILIATED) {
+ if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
$titre = $langs->trans("MembersListResiliated");
}
if ($search_status == Adherent::STATUS_EXCLUDED) {
@@ -601,7 +602,7 @@ if ($user->rights->societe->creer) {
if ($user->rights->adherent->creer && $user->rights->user->user->creer) {
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
}
-if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
+if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@@ -833,7 +834,7 @@ if (!empty($arrayfields['d.gender']['checked'])) {
print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.company']['checked'])) {
- print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'd.societe', '', $param, '', $sortfield, $sortorder);
+ print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'companyname', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.login']['checked'])) {
print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder);
@@ -906,6 +907,7 @@ while ($i < min($num, $limit)) {
$memberstatic->id = $obj->rowid;
$memberstatic->ref = $obj->ref;
$memberstatic->civility_id = $obj->civility;
+ $memberstatic->login = $obj->login;
$memberstatic->lastname = $obj->lastname;
$memberstatic->firstname = $obj->firstname;
$memberstatic->gender = $obj->gender;
@@ -920,9 +922,13 @@ while ($i < min($num, $limit)) {
if (!empty($obj->fk_soc)) {
$memberstatic->fetch_thirdparty();
- $companyname = $memberstatic->thirdparty->name;
+ if ($memberstatic->thirdparty->id > 0) {
+ $companyname = $memberstatic->thirdparty->name;
+ $companynametoshow = $memberstatic->thirdparty->getNomUrl(1);
+ }
} else {
$companyname = $obj->company;
+ $companynametoshow = $obj->company;
}
$memberstatic->company = $companyname;
@@ -956,7 +962,8 @@ while ($i < min($num, $limit)) {
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print ' | ';
- print $obj->firstname;
+ print $memberstatic->getNomUrl(0, 0, 'card', 'fistname');
+ //print $obj->firstname;
print " | \n";
if (!$i) {
$totalarray['nbfield']++;
@@ -965,7 +972,8 @@ while ($i < min($num, $limit)) {
// Lastname
if (!empty($arrayfields['d.lastname']['checked'])) {
print '';
- print $obj->lastname;
+ print $memberstatic->getNomUrl(0, 0, 'card', 'lastname');
+ //print $obj->lastname;
print " | \n";
if (!$i) {
$totalarray['nbfield']++;
@@ -985,7 +993,7 @@ while ($i < min($num, $limit)) {
// Company
if (!empty($arrayfields['d.company']['checked'])) {
print '';
- print $companyname;
+ print $companynametoshow;
print " | \n";
}
// Login
@@ -1095,7 +1103,9 @@ while ($i < min($num, $limit)) {
}
// EMail
if (!empty($arrayfields['d.email']['checked'])) {
- print "".dol_print_email($obj->email, 0, 0, 1)." | \n";
+ print '';
+ print dol_print_email($obj->email, 0, 0, 1, 64, 1, 1);
+ print " | \n";
}
// End of subscription date
$datefin = $db->jdate($obj->datefin);
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index 16dfc3ccff6..e751a7b5c65 100644
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -308,7 +308,7 @@ if ($mode) {
print '
';
foreach ($data as $val) {
- $year = isset($val['year']) ? $val['year'] : '';;
+ $year = isset($val['year']) ? $val['year'] : '';
print '| '.$langs->trans("Status").' / '.$langs->trans("Percentage").' | ';
print '';
- $percent = GETPOST('complete')!=='' ? GETPOST('complete') : -1;
+ $percent = $complete !=='' ? $complete : -1;
if (GETPOSTISSET('status')) {
$percent = GETPOST('status');
} elseif (GETPOSTISSET('percentage')) {
- $percent = GETPOST('percentage');
+ $percent = GETPOST('percentage', 'int');
} else {
- if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) {
+ if ($complete == '0' || GETPOST("afaire") == 1) {
$percent = '0';
- } elseif (GETPOST('complete') == 100 || GETPOST("afaire") == 2) {
+ } elseif ($complete == 100 || GETPOST("afaire") == 2) {
$percent = 100;
}
}
@@ -1340,7 +1344,7 @@ if ($id > 0) {
$result5 = $object->fetch_optionals();
if ($listUserAssignedUpdated || $donotclearsession) {
- $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
+ $percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
@@ -1534,7 +1538,7 @@ if ($id > 0) {
// Status
print ' |
';
diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css
index bdfdf45e116..2b0cf62797f 100644
--- a/htdocs/takepos/css/phone.css
+++ b/htdocs/takepos/css/phone.css
@@ -151,7 +151,7 @@ button.publicphonebutton {
float:left;
width: 50%;
text-align:center;
- height:150px;;
+ height:150px;
overflow:hidden;
margin-bottom:5px;
font-size:18px;
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index e2872004323..0e9015ec95f 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -144,17 +144,31 @@ if (empty($reshook)) {
$search_agenda_label = '';
}
+ $backurlforlist = DOL_URL_ROOT.'/ticket/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.'/ticket/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
+ }
+ }
+ }
+
if ($cancel) {
- if (!empty($backtopage)) {
+ if (!empty($backtopageforcancel)) {
+ header("Location: ".$backtopageforcancel);
+ exit;
+ } elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
-
$action = 'view';
}
// Action to add an action (not a message)
- if (GETPOST('add', 'alpha') && !empty($user->rights->ticket->write)) {
+ if (GETPOST('save', 'alpha') && !empty($user->rights->ticket->write)) {
$error = 0;
if (!GETPOST("subject", 'alphanohtml')) {
@@ -276,9 +290,13 @@ if (empty($reshook)) {
$db->commit();
if (!empty($backtopage)) {
- $url = $backtopage;
+ if (empty($id)) {
+ $url = $backtopage;
+ } else {
+ $url = 'card.php?track_id='.urlencode($object->track_id);
+ }
} else {
- $url = 'card.php?track_id='.$object->track_id;
+ $url = 'card.php?track_id='.urlencode($object->track_id);
}
header("Location: ".$url);
@@ -342,9 +360,13 @@ if (empty($reshook)) {
$action = 'edit';
} else {
if (!empty($backtopage)) {
- $url = $backtopage;
+ if (empty($id)) {
+ $url = $backtopage;
+ } else {
+ $url = 'card.php?track_id='.urlencode($object->track_id);
+ }
} else {
- $url = 'card.php?track_id='.$object->track_id;
+ $url = 'card.php?track_id='.urlencode($object->track_id);
}
header('Location: '.$url);
@@ -427,9 +449,13 @@ if (empty($reshook)) {
if ($ret > 0) {
if (!empty($backtopage)) {
- $url = $backtopage;
+ if (empty($id)) {
+ $url = $backtopage;
+ } else {
+ $url = 'card.php?track_id='.urlencode($object->track_id);
+ }
} else {
- $url = 'card.php?action=view&track_id='.$object->track_id;
+ $url = 'card.php?action=view&track_id='.urlencode($object->track_id);
}
header("Location: ".$url);
@@ -707,6 +733,8 @@ if ($action == 'create' || $action == 'presend') {
$formticket->withextrafields = 1;
$formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid'));
+ $formticket->withcancel = 1;
+
$formticket->showForm(1, 'create', 0);
/*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) {
$formticket = new FormTicket($db);
diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php
index 34321b5b898..efd9b84330b 100644
--- a/htdocs/ticket/class/cticketcategory.class.php
+++ b/htdocs/ticket/class/cticketcategory.class.php
@@ -408,7 +408,7 @@ class CTicketCategory extends CommonObject
}
}
if (count($sqlwhere) > 0) {
- $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
+ $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
if (!empty($sortfield)) {
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 625503538b5..4b048d54671 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -897,7 +897,7 @@ print ''."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
-if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
+if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index be91f302b97..ee1ebf71493 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -138,6 +138,29 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
+ $backurlforlist = DOL_URL_ROOT.'/user/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.'/user/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 = '';
+ }
+
if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) {
if ($id != $user->id) { // A user can't disable itself
$object->fetch($id);
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index db2d4583177..f229cd80637 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -3526,7 +3526,7 @@ class User extends CommonObject
}
}
if (count($sqlwhere) > 0) {
- $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
+ $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index 69e94e1cfdc..89f9191751b 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -858,7 +858,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$canreadhrmdata = 1;
}
$canreadsecretapi = 0;
- if ($user->id = $obj->rowid || !empty($user->admin)) { // Current user or admin
+ if ($user->id == $obj->rowid || !empty($user->admin)) { // Current user or admin
$canreadsecretapi = 1;
}
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index f48fada2eb9..f80a705c3f2 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -419,7 +419,7 @@ class Website extends CommonObject
}
}
if (count($sqlwhere) > 0) {
- $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
+ $sql .= ' AND '.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
}
if (!empty($sortfield)) {
@@ -1091,8 +1091,8 @@ class Website extends CommonObject
}
}
- $line .= "\n-- For Dolibarr v14+ --\n";
- $line .= "UPDATE llx_website SET fk_default_lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n";
+ $line = "\n-- For Dolibarr v14+ --;\n";
+ $line .= "UPDATE llx_website SET lang = '".$this->db->escape($this->fk_default_lang)."' WHERE rowid = __WEBSITE_ID__;\n";
$line .= "UPDATE llx_website SET otherlang = '".$this->db->escape($this->otherlang)."' WHERE rowid = __WEBSITE_ID__;\n";
$line .= "\n";
fputs($fp, $line);
diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php
index 275c3c94afe..19fa8b8d12d 100644
--- a/htdocs/website/class/websitepage.class.php
+++ b/htdocs/website/class/websitepage.class.php
@@ -441,7 +441,7 @@ class WebsitePage extends CommonObject
}
}
if (count($sqlwhere) > 0) {
- $sql .= " AND (".implode(' '.$filtermode.' ', $sqlwhere).')';
+ $sql .= " AND (".implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
if (!empty($sortfield)) {
@@ -543,7 +543,7 @@ class WebsitePage extends CommonObject
}
}
if (count($sqlwhere) > 0) {
- $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
+ $sql .= ' AND ('.implode(' '.$this->db->escape($filtermode).' ', $sqlwhere).')';
}
$resql = $this->db->query($sql);
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index d8a479d5923..d4058ccdb47 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -2602,7 +2602,7 @@ if (!GETPOST('hide_websitemenu')) {
print $langs->trans("Website").' : ';
print '';
- $urltocreatenewwebsite = $_SERVER["PHP_SEFL"].'?action=createsite';
+ $urltocreatenewwebsite = $_SERVER["PHP_SELF"].'?action=createsite';
if (empty($conf->use_javascript_ajax)) {
print '