';
// List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'propal', $socid);
- // print '
';
print '
';
}
diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php
index 95698154870..84a7a1a1a1c 100644
--- a/htdocs/comm/propal/class/api_proposals.class.php
+++ b/htdocs/comm/propal/class/api_proposals.class.php
@@ -90,10 +90,10 @@ class Proposals extends DolibarrApi
* @param int $limit Limit for list
* @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter commercial proposal of. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
- *
- * @return array Array of order objects
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
+ * @return array Array of order objects
*/
- function index($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '') {
+ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
@@ -103,30 +103,32 @@ class Proposals extends DolibarrApi
// If the internal user must only see his customers, force searching by him
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
- $sql = "SELECT s.rowid";
+ $sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
- $sql.= " FROM ".MAIN_DB_PREFIX."propal as s";
+ $sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
- $sql.= ' WHERE s.entity IN ('.getEntity('propal', 1).')';
- if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc";
- if ($socids) $sql.= " AND s.fk_soc IN (".$socids.")";
- if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
-
+ $sql.= ' WHERE t.entity IN ('.getEntity('propal', 1).')';
+ if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
+ if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
+ if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
-
- $nbtotalofrecords = 0;
- if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+ // Add sql filters
+ if ($sqlfilters)
{
- $result = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($result);
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
-
+
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 8df81f942ed..df2c1cef9fc 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -3214,44 +3214,67 @@ class Propal extends CommonObject
* @param int $withpicto Add picto into link
* @param string $option Where point the link ('expedition', 'document', ...)
* @param string $get_params Parametres added to url
+ * @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
- function getNomUrl($withpicto=0,$option='', $get_params='')
+ function getNomUrl($withpicto=0,$option='', $get_params='', $notooltip=0)
{
- global $langs, $conf;
+ global $langs, $conf, $user;
+ if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
+
$result='';
- $label = '' . $langs->trans("ShowPropal") . '';
- if (! empty($this->ref))
- $label.= ' '.$langs->trans('Ref').': '.$this->ref;
- if (! empty($this->ref_client))
- $label.= ' '.$langs->trans('RefCustomer').': '.$this->ref_client;
- if (! empty($this->total_ht))
- $label.= ' ' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- if (! empty($this->total_tva))
- $label.= ' ' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- if (! empty($this->total_ttc))
- $label.= ' ' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
- if ($option == '') {
- $link = '';
+ if (! empty($this->ref))
+ $label.= ' '.$langs->trans('Ref').': '.$this->ref;
+ if (! empty($this->ref_client))
+ $label.= ' '.$langs->trans('RefCustomer').': '.$this->ref_client;
+ if (! empty($this->total_ht))
+ $label.= ' ' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ if (! empty($this->total_tva))
+ $label.= ' ' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ if (! empty($this->total_ttc))
+ $label.= ' ' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ if ($option == '') {
+ $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params;
+ }
+ if ($option == 'compta') { // deprecated
+ $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params;
+ }
+ if ($option == 'expedition') {
+ $url = DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params;
+ }
+ if ($option == 'document') {
+ $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params;
+ }
}
- if ($option == 'compta') { // deprecated
- $link = 'id. $get_params .$linkclose;
- }
- if ($option == 'document') {
- $link = '';
$linkend='';
if ($withpicto)
- $result.=($link.img_object($label, $this->picto, 'class="classfortooltip"').$linkend);
+ $result.=($linkstart.img_object(($notooltip?'':$label), $this->picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2)
$result.=' ';
- $result.=$link.$this->ref.$linkend;
+ $result.=$linkstart.$this->ref.$linkend;
return $result;
}
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 6730bf99750..313fef16e2c 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2563,7 +2563,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->commande->creer;
$delallowed = $user->rights->commande->supprimer;
- $somethingshown = $formfile->show_documents('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
+ print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
// Show links to link elements
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 6ba66a78013..f000e4ce201 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -80,20 +80,22 @@ class Orders extends DolibarrApi
return $this->_cleanObjectDatas($this->commande);
}
+
+
/**
* List orders
*
* Get a list of orders
*
- * @param string $sortfield Sort field
- * @param string $sortorder Sort order
- * @param int $limit Limit for list
- * @param int $page Page number
- * @param string $thirdparty_ids Thirdparty ids to filter orders of. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
- *
- * @return array Array of order objects
+ * @param string $sortfield Sort field
+ * @param string $sortorder Sort order
+ * @param int $limit Limit for list
+ * @param int $page Page number
+ * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
+ * @return array Array of order objects
*/
- function index($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '') {
+ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
@@ -103,30 +105,32 @@ class Orders extends DolibarrApi
// If the internal user must only see his customers, force searching by him
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
- $sql = "SELECT s.rowid";
+ $sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
- $sql.= " FROM ".MAIN_DB_PREFIX."commande as s";
+ $sql.= " FROM ".MAIN_DB_PREFIX."commande as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
- $sql.= ' WHERE s.entity IN ('.getEntity('commande', 1).')';
- if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc";
- if ($socids) $sql.= " AND s.fk_soc IN (".$socids.")";
- if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
-
+ $sql.= ' WHERE t.entity IN ('.getEntity('commande', 1).')';
+ if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
+ if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
+ if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
-
- $nbtotalofrecords = 0;
- if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+ // Add sql filters
+ if ($sqlfilters)
{
- $result = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($result);
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
-
+
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@@ -138,6 +142,7 @@ class Orders extends DolibarrApi
$sql.= $db->plimit($limit + 1, $offset);
}
+ dol_syslog("API Rest request");
$result = $db->query($sql);
if ($result)
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 49092d6e58e..1d46b62d8d0 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3326,12 +3326,15 @@ class Commande extends CommonOrder
* @param int $option Where point the link (0=> main card, 1,2 => shipment)
* @param int $max Max length to show
* @param int $short Use short labels
+ * @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
- function getNomUrl($withpicto=0,$option=0,$max=0,$short=0)
+ function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0)
{
global $conf, $langs, $user;
+ if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
+
$result='';
if (! empty($conf->expedition->enabled) && ($option == 1 || $option == 2)) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
@@ -3351,23 +3354,33 @@ class Commande extends CommonOrder
$label .= ' '.$langs->trans('RefCustomer').': '.$this->ref_client;
}
if (!empty($this->total_ht)) {
- $label .= ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1,
- $conf->currency);
+ $label .= ' '.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_tva)) {
- $label .= ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1,
- $conf->currency);
+ $label .= ' '.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_ttc)) {
- $label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1,
- $conf->currency);
+ $label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
}
- $linkstart = '';
+ $linkclose='';
+ if (empty($notooltip) && $user->rights->commande->lire)
+ {
+ if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ {
+ $label=$langs->trans("ShowOrder");
+ $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ }
+ $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose.=' class="classfortooltip"';
+ }
+
+ $linkstart = '';
$linkend='';
- if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend);
+ if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$linkstart.$this->ref.$linkend;
return $result;
diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php
index 250faea5a5d..0350e2b28a0 100644
--- a/htdocs/compta/bank/class/api_bankaccounts.class.php
+++ b/htdocs/compta/bank/class/api_bankaccounts.class.php
@@ -56,11 +56,12 @@ class BankAccounts extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
- * @return array List of account objects
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')"
+ * @return array List of account objects
*
* @throws RestException
*/
- function index($sortfield = "rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
+ function index($sortfield = "rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '')
{
$list = array();
@@ -68,13 +69,17 @@ class BankAccounts extends DolibarrApi
throw new RestException(401);
}
- $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account";
-
- $nbtotalofrecords = 0;
- if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
+ $sql.= ' WHERE t.entity IN ('.getEntity('banque', 1).')';
+ // Add sql filters
+ if ($sqlfilters)
{
- $result = $this->db->query($sql);
- $nbtotalofrecords = $this->db->num_rows($result);
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $this->db->order($sortfield, $sortorder);
@@ -88,6 +93,7 @@ class BankAccounts extends DolibarrApi
$sql.= $this->db->plimit($limit + 1, $offset);
}
+ dol_syslog("API Rest request");
$result = $this->db->query($sql);
if ($result) {
@@ -100,7 +106,7 @@ class BankAccounts extends DolibarrApi
}
}
} else {
- throw new RestException(503, 'Error when retrieving list of accounts: ' . $account->error);
+ throw new RestException(503, 'Error when retrieving list of accounts: ' . $this->db->lasterror());
}
return $list;
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index e3951b4dca7..97bd64f35ee 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -89,11 +89,12 @@ class Invoices extends DolibarrApi
* @param int $page Page number
* @param int $socid Filter list with thirdparty ID
* @param string $status Filter by invoice status : draft | unpaid | paid | cancelled
- * @return array Array of invoice objects
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
+ * @return array Array of invoice objects
*
* @throws RestException
*/
- function index($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid=0, $status='') {
+ function index($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid=0, $status='', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
@@ -103,38 +104,38 @@ class Invoices extends DolibarrApi
// If the internal user must only see his customers, force searching by him
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
- $sql = "SELECT s.rowid";
+ $sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
- $sql.= " FROM ".MAIN_DB_PREFIX."facture as s";
+ $sql.= " FROM ".MAIN_DB_PREFIX."facture as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
- $sql.= ' WHERE s.entity IN ('.getEntity('facture', 1).')';
- if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc";
- if ($socid) $sql.= " AND s.fk_soc = ".$socid;
- if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
-
+ $sql.= ' WHERE t.entity IN ('.getEntity('facture', 1).')';
+ if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
+ if ($socid) $sql.= " AND t.fk_soc = ".$socid;
+ if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Filter by status
- if ($status == 'draft') $sql.= " AND s.fk_statut IN (0)";
- if ($status == 'unpaid') $sql.= " AND s.fk_statut IN (1)";
- if ($status == 'paid') $sql.= " AND s.fk_statut IN (2)";
- if ($status == 'cancelled') $sql.= " AND s.fk_statut IN (3)";
-
+ if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
+ if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
+ if ($status == 'paid') $sql.= " AND t.fk_statut IN (2)";
+ if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (3)";
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
-
- // TODO remove this, useless for WS
- $nbtotalofrecords = 0;
- if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+ // Add sql filters
+ if ($sqlfilters)
{
- $result = $db->query($sql);
- $nbtotalofrecords = $db->num_rows($result);
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
-
+
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index bea5571730f..7171e06c7ee 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -998,12 +998,15 @@ class Facture extends CommonInvoice
* @param int $max Maxlength of ref
* @param int $short 1=Return just URL
* @param string $moretitle Add more text to title tooltip
+ * @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
- function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='')
+ function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0)
{
global $langs, $conf;
+ if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
+
$result='';
if ($option == 'withdraw') $url = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$this->id;
@@ -1015,28 +1018,44 @@ class Facture extends CommonInvoice
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice
-
- $label = '' . $langs->trans("ShowInvoice") . '';
- if (! empty($this->ref))
- $label .= ' '.$langs->trans('Ref') . ': ' . $this->ref;
- if (! empty($this->ref_client))
- $label .= ' ' . $langs->trans('RefCustomer') . ': ' . $this->ref_client;
- if (! empty($this->total_ht))
- $label.= ' ' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
- if (! empty($this->total_tva))
- $label.= ' ' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
- if (! empty($this->total_ttc))
- $label.= ' ' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
- if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
- if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
- if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
- if ($moretitle) $label.=' - '.$moretitle;
-
- $linkstart='';
+ $label='';
+
+ if ($user->rights->facture->lire) {
+ $label = '' . $langs->trans("ShowInvoice") . '';
+ if (! empty($this->ref))
+ $label .= ' '.$langs->trans('Ref') . ': ' . $this->ref;
+ if (! empty($this->ref_client))
+ $label .= ' ' . $langs->trans('RefCustomer') . ': ' . $this->ref_client;
+ if (! empty($this->total_ht))
+ $label.= ' ' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
+ if (! empty($this->total_tva))
+ $label.= ' ' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
+ if (! empty($this->total_ttc))
+ $label.= ' ' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
+ if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
+ if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
+ if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
+ if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
+ if ($moretitle) $label.=' - '.$moretitle;
+ }
+
+ $linkclose='';
+ if (empty($notooltip) && $user->rights->facture->lire)
+ {
+ if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ {
+ $label=$langs->trans("ShowInvoice");
+ $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ }
+ $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose.=' class="classfortooltip"';
+ }
+
+ $linkstart='';
$linkend='';
- if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label), $picto, 'class="classfortooltip"').$linkend);
+ if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend;
return $result;
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index 3ca8eb21e6e..94686162687 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -801,7 +801,7 @@ if ($action != 'new')
$filedir=$dir.get_exdir($object->ref,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref);
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
- $formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);
+ print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1);
print ' ';
}
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 31eb96d633f..23242559f1f 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -54,7 +54,6 @@ $confirm = GETPOST('confirm','alpha');
$backtopage = GETPOST('backtopage','alpha');
$id = GETPOST('id','int');
$socid = GETPOST('socid','int');
-if ($user->societe_id) $socid=$user->societe_id;
$object = new Contact($db);
$extrafields = new ExtraFields($db);
@@ -74,6 +73,7 @@ if (! empty($canvas))
}
// Security check
+if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php
index 8c79dfd1580..825c1e8dab5 100644
--- a/htdocs/contact/document.php
+++ b/htdocs/contact/document.php
@@ -37,9 +37,22 @@ $id = GETPOST('id','int');
$action = GETPOST("action");
$confirm = GETPOST('confirm', 'alpha');
+$object = new Contact($db);
+
+// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
+$object->getCanvas($id);
+$objcanvas=null;
+$canvas = (! empty($object->canvas)?$object->canvas:GETPOST("canvas"));
+if (! empty($canvas))
+{
+ require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
+ $objcanvas = new Canvas($db, $action);
+ $objcanvas->getCanvas('contact', 'contactcard', $canvas);
+}
+
// Security check
if ($user->societe_id) $socid=$user->societe_id;
-$result = restrictedArea($user, 'contact', $id, '','');
+$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');
@@ -54,7 +67,6 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
-$object = new Contact($db);
if ($id > 0) $object->fetch($id);
$upload_dir = $conf->societe->dir_output.'/contact/'.dol_sanitizeFileName($object->ref);
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index e8b8a990417..86e45ade086 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -2038,7 +2038,7 @@ else
$var = true;
- $somethingshown = $formfile->show_documents('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
+ print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
// Show links to link elements
diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php
index 5ad8b3aa646..ef750e70253 100644
--- a/htdocs/core/class/doleditor.class.php
+++ b/htdocs/core/class/doleditor.class.php
@@ -81,7 +81,7 @@ class DolEditor
// Check if extended editor is ok. If not we force textarea
if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea';
- //if ($conf->browser->phone) $this->tool = 'textarea';
+ if ($conf->dol_use_jmobile) $this->tool = 'textarea'; // TODO ckeditor ko with jmobile
// Define content and some properties
if ($this->tool == 'ckeditor')
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b5d9ead05e3..bb022b7767c 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -512,15 +512,16 @@ class Form
if (count($arrayofaction) == 0) return;
$disabled=0;
- $ret='';
}
llxFooter();
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index b64d40eeb4a..fb45993f567 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1295,7 +1295,7 @@ else if ($id || $ref)
$totalVolume=$tmparray['volume'];
- // Warehouse card
+ // Shipment card
$linkback = ''.$langs->trans("BackToList").'';
$morehtmlref='