|
@@ -102,14 +102,14 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
|
|
/**
|
|
/**
|
|
* Get list of entity id to use
|
|
* Get list of entity id to use
|
|
*
|
|
*
|
|
- * @param string $element Current element
|
|
|
|
- * 'societe', 'socpeople', 'actioncomm', 'agenda', 'resource',
|
|
|
|
|
|
+ * @param string $element Current element
|
|
|
|
+ * 'societe', 'socpeople', 'actioncomm', 'agenda', 'resource',
|
|
* 'product', 'productprice', 'stock',
|
|
* 'product', 'productprice', 'stock',
|
|
* 'propal', 'supplier_proposal', 'facture', 'facture_fourn',
|
|
* 'propal', 'supplier_proposal', 'facture', 'facture_fourn',
|
|
- * 'categorie', 'bank_account', 'bank_account', 'adherent', 'user',
|
|
|
|
|
|
+ * 'categorie', 'bank_account', 'bank_account', 'adherent', 'user',
|
|
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
|
|
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
|
|
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
|
|
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
|
|
- * 'email_template', 'event',
|
|
|
|
|
|
+ * 'email_template', 'event',
|
|
* @param int $shared 0=Return id of entity, 1=Return id entity + shared entities
|
|
* @param int $shared 0=Return id of entity, 1=Return id entity + shared entities
|
|
* @return mixed Entity id(s) to use
|
|
* @return mixed Entity id(s) to use
|
|
*/
|
|
*/
|
|
@@ -121,7 +121,7 @@ function getEntity($element=false, $shared=0)
|
|
if ($element == 'actioncomm') $element='agenda';
|
|
if ($element == 'actioncomm') $element='agenda';
|
|
if ($element == 'fichinter') $element='intervention';
|
|
if ($element == 'fichinter') $element='intervention';
|
|
if ($element == 'categorie') $element='category';
|
|
if ($element == 'categorie') $element='category';
|
|
-
|
|
|
|
|
|
+
|
|
if (is_object($mc))
|
|
if (is_object($mc))
|
|
{
|
|
{
|
|
return $mc->getEntity($element, $shared);
|
|
return $mc->getEntity($element, $shared);
|
|
@@ -240,7 +240,7 @@ function dol_shutdown()
|
|
* Return value of a param into GET or POST supervariable.
|
|
* Return value of a param into GET or POST supervariable.
|
|
* Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
|
* Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
|
* Note: The property $user->default_values is loaded by the main when loading the user.
|
|
* Note: The property $user->default_values is loaded by the main when loading the user.
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @param string $paramname Name of parameter to found
|
|
* @param string $paramname Name of parameter to found
|
|
* @param string $check Type of check
|
|
* @param string $check Type of check
|
|
* ''=no check (deprecated)
|
|
* ''=no check (deprecated)
|
|
@@ -257,29 +257,29 @@ function dol_shutdown()
|
|
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
|
|
* @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails)
|
|
* @param mixed $options Options to pass to filter_var when $check is set to 'custom'.
|
|
* @param mixed $options Options to pass to filter_var when $check is set to 'custom'.
|
|
* @return string|string[] Value found (string or array), or '' if check fails
|
|
* @return string|string[] Value found (string or array), or '' if check fails
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @TODO Set default value for check to alpha. Check all WYSIWYG edition (email and description...) is still ok with rich text.
|
|
* @TODO Set default value for check to alpha. Check all WYSIWYG edition (email and description...) is still ok with rich text.
|
|
*/
|
|
*/
|
|
function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|
function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|
{
|
|
{
|
|
global $mysoc,$user,$conf;
|
|
global $mysoc,$user,$conf;
|
|
-
|
|
|
|
|
|
+
|
|
if (empty($paramname)) return 'BadFirstParameterForGETPOST';
|
|
if (empty($paramname)) return 'BadFirstParameterForGETPOST';
|
|
-
|
|
|
|
|
|
+
|
|
if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
|
|
if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
|
|
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
|
|
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
|
|
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:'';
|
|
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:'';
|
|
elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:'');
|
|
elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:'');
|
|
elseif ($method==4) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:(isset($_COOKIE[$paramname])?$_COOKIE[$paramname]:''));
|
|
elseif ($method==4) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:(isset($_COOKIE[$paramname])?$_COOKIE[$paramname]:''));
|
|
else return 'BadThirdParameterForGETPOST';
|
|
else return 'BadThirdParameterForGETPOST';
|
|
-
|
|
|
|
|
|
+
|
|
if (empty($method) || $method == 3 || $method == 4)
|
|
if (empty($method) || $method == 3 || $method == 4)
|
|
{
|
|
{
|
|
$relativepathstring = $_SERVER["PHP_SELF"];
|
|
$relativepathstring = $_SERVER["PHP_SELF"];
|
|
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
|
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
|
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
|
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
|
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
|
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
|
-
|
|
|
|
|
|
+
|
|
// Code for search criteria persistence.
|
|
// Code for search criteria persistence.
|
|
// Retrieve values if restore_lastsearch_values is set and there is saved values
|
|
// Retrieve values if restore_lastsearch_values is set and there is saved values
|
|
if (! empty($_GET['restore_lastsearch_values']) && ! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // Keep $_GET here
|
|
if (! empty($_GET['restore_lastsearch_values']) && ! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // Keep $_GET here
|
|
@@ -347,16 +347,16 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
if (empty($check) && ! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|
if (empty($check) && ! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|
{
|
|
{
|
|
- dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and 2nd param not defined, when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
|
|
|
|
|
+ dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and 2nd param not defined, when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
|
// Enable this line to know who call the GETPOST with empty $check parameter.
|
|
// Enable this line to know who call the GETPOST with empty $check parameter.
|
|
//var_dump(debug_backtrace()[0]);
|
|
//var_dump(debug_backtrace()[0]);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (! empty($check))
|
|
if (! empty($check))
|
|
{
|
|
{
|
|
// Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
|
|
// Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
|
|
@@ -457,7 +457,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|
// We save search key only if:
|
|
// We save search key only if:
|
|
// - not empty, or
|
|
// - not empty, or
|
|
// - if value is empty and a default value exists that is not empty (it means we did a filter to an empty value when default was not).
|
|
// - if value is empty and a default value exists that is not empty (it means we did a filter to an empty value when default was not).
|
|
-
|
|
|
|
|
|
+
|
|
//if (! empty($out) || ! empty($user->default_values[$relativepathstring]['filters'][$paramname]))
|
|
//if (! empty($out) || ! empty($user->default_values[$relativepathstring]['filters'][$paramname]))
|
|
if (! empty($out))
|
|
if (! empty($out))
|
|
{
|
|
{
|
|
@@ -465,7 +465,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return $out;
|
|
return $out;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -475,13 +475,13 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
|
* This prefix is unique for instance and avoid conflict between multi-instances,
|
|
* This prefix is unique for instance and avoid conflict between multi-instances,
|
|
* even when having two instances with one root dir or two instances in virtual servers.
|
|
* even when having two instances with one root dir or two instances in virtual servers.
|
|
*
|
|
*
|
|
- * @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
|
|
|
|
|
|
+ * @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
|
|
* @return string A calculated prefix
|
|
* @return string A calculated prefix
|
|
*/
|
|
*/
|
|
function dol_getprefix($mode='')
|
|
function dol_getprefix($mode='')
|
|
{
|
|
{
|
|
global $conf;
|
|
global $conf;
|
|
-
|
|
|
|
|
|
+
|
|
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email
|
|
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email
|
|
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
|
|
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
|
|
{
|
|
{
|
|
@@ -629,7 +629,7 @@ function dol_clone($object)
|
|
|
|
|
|
//$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable
|
|
//$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable
|
|
$myclone=unserialize(serialize($object));
|
|
$myclone=unserialize(serialize($object));
|
|
-
|
|
|
|
|
|
+
|
|
return $myclone;
|
|
return $myclone;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1134,7 +1134,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|
global $conf, $form, $user, $langs;
|
|
global $conf, $form, $user, $langs;
|
|
|
|
|
|
$error = 0;
|
|
$error = 0;
|
|
-
|
|
|
|
|
|
+
|
|
$maxvisiblephotos=1;
|
|
$maxvisiblephotos=1;
|
|
$showimage=1;
|
|
$showimage=1;
|
|
$showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
|
|
$showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
|
|
@@ -1206,7 +1206,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
|
$fileimage = $file.'_preview.png'; // If PDF has 1 page
|
|
$fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
|
|
$fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
|
|
$relativepathimage = $relativepath.'_preview.png';
|
|
$relativepathimage = $relativepath.'_preview.png';
|
|
-
|
|
|
|
|
|
+
|
|
// Si fichier PDF existe
|
|
// Si fichier PDF existe
|
|
if (file_exists($file))
|
|
if (file_exists($file))
|
|
{
|
|
{
|
|
@@ -1249,7 +1249,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|
$morehtmlleft.='</div>';
|
|
$morehtmlleft.='</div>';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (! $phototoshow && $conf->browser->layout != 'phone') // Show No photo link (picto of pbject)
|
|
if (! $phototoshow && $conf->browser->layout != 'phone') // Show No photo link (picto of pbject)
|
|
{
|
|
{
|
|
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
|
|
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
|
|
@@ -1271,12 +1271,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
|
|
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
|
|
-
|
|
|
|
|
|
+
|
|
if ($object->element == 'societe')
|
|
if ($object->element == 'societe')
|
|
{
|
|
{
|
|
- if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE))
|
|
|
|
|
|
+ if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE))
|
|
{
|
|
{
|
|
$morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
|
|
$morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
|
|
}
|
|
}
|
|
@@ -1303,7 +1303,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
|
|
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
|
|
$morehtmlstatus.=$tmptxt;
|
|
$morehtmlstatus.=$tmptxt;
|
|
}
|
|
}
|
|
- elseif ($object->element == 'contrat' || $object->element == 'contract')
|
|
|
|
|
|
+ elseif ($object->element == 'contrat' || $object->element == 'contract')
|
|
{
|
|
{
|
|
if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2);
|
|
if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2);
|
|
else $morehtmlstatus.=$object->getLibStatut(4);
|
|
else $morehtmlstatus.=$object->getLibStatut(4);
|
|
@@ -1314,14 +1314,14 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|
$morehtmlstatus.=$tmptxt;
|
|
$morehtmlstatus.=$tmptxt;
|
|
}
|
|
}
|
|
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
|
|
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
|
|
-
|
|
|
|
|
|
+
|
|
// Add label
|
|
// Add label
|
|
if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
|
|
if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
|
|
{
|
|
{
|
|
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
|
|
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
|
|
}
|
|
}
|
|
-
|
|
|
|
- if ($object->element != 'product' && $object->element != 'bookmark')
|
|
|
|
|
|
+
|
|
|
|
+ if ($object->element != 'product' && $object->element != 'bookmark')
|
|
{
|
|
{
|
|
$morehtmlref.='<div class="refidno">';
|
|
$morehtmlref.='<div class="refidno">';
|
|
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
|
|
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
|
|
@@ -1333,7 +1333,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
|
$morehtmlref.=$langs->trans("TechnicalID").': '.$object->id;
|
|
$morehtmlref.=$langs->trans("TechnicalID").': '.$object->id;
|
|
$morehtmlref.='</div>';
|
|
$morehtmlref.='</div>';
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
print '<div class="'.($onlybanner?'arearefnobottom ':'arearef ').'heightref valignmiddle" width="100%">';
|
|
print '<div class="'.($onlybanner?'arearefnobottom ':'arearef ').'heightref valignmiddle" width="100%">';
|
|
print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
|
|
print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
|
|
print '</div>';
|
|
print '</div>';
|
|
@@ -3095,7 +3095,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv=0, $admin='1')
|
|
{
|
|
{
|
|
return img_picto($text, 'info', 'class="hideonsmartphone"');
|
|
return img_picto($text, 'info', 'class="hideonsmartphone"');
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return ($nodiv?'':'<div class="'.(empty($admin)?'':($admin=='1'?'info':$admin)).' hideonsmartphone">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin?$langs->trans('InfoAdmin'):$langs->trans('Note')).'"></span> '.$text.($nodiv?'':'</div>');
|
|
return ($nodiv?'':'<div class="'.(empty($admin)?'':($admin=='1'?'info':$admin)).' hideonsmartphone">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin?$langs->trans('InfoAdmin'):$langs->trans('Note')).'"></span> '.$text.($nodiv?'':'</div>');
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3293,7 +3293,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
|
$field1=trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep'
|
|
$field1=trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep'
|
|
|
|
|
|
//var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1);
|
|
//var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1);
|
|
-
|
|
|
|
|
|
+
|
|
// If field is used as sort criteria we use a specific css class liste_titre_sel
|
|
// If field is used as sort criteria we use a specific css class liste_titre_sel
|
|
// Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
|
|
// Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
|
|
if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./","",$field1))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>';
|
|
if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./","",$field1))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>';
|
|
@@ -3441,7 +3441,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
|
|
* @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder)
|
|
* @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder)
|
|
* @param string $sortfield Field to sort on ('' by default)
|
|
* @param string $sortfield Field to sort on ('' by default)
|
|
* @param string $sortorder Order to sort ('' by default)
|
|
* @param string $sortorder Order to sort ('' by default)
|
|
- * @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction()
|
|
|
|
|
|
+ * @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction()
|
|
* @param int $num Number of records found by select with limit+1
|
|
* @param int $num Number of records found by select with limit+1
|
|
* @param int|string $totalnboflines Total number of records/lines for all pages (if known). Use a negative value of number to not show number. Use '' if unknown.
|
|
* @param int|string $totalnboflines Total number of records/lines for all pages (if known). Use a negative value of number to not show number. Use '' if unknown.
|
|
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
|
|
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
|
|
@@ -3965,7 +3965,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
|
|
{
|
|
{
|
|
$conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1;
|
|
$conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// Search local taxes
|
|
// Search local taxes
|
|
if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
|
|
if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
|
|
{
|
|
{
|
|
@@ -4210,7 +4210,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|
/**
|
|
/**
|
|
* Return vat rate of a product in a particular selling country or default country vat if product is unknown
|
|
* Return vat rate of a product in a particular selling country or default country vat if product is unknown
|
|
* Function called by get_default_tva
|
|
* Function called by get_default_tva
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @param int $idprod Id of product or 0 if not a predefined product
|
|
* @param int $idprod Id of product or 0 if not a predefined product
|
|
* @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...)
|
|
* @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...)
|
|
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice)
|
|
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice)
|
|
@@ -4248,7 +4248,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- // TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet.
|
|
|
|
|
|
+ // TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet.
|
|
// May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on
|
|
// May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -5020,9 +5020,9 @@ function make_substitutions($text, $substitutionarray, $outputlangs=null)
|
|
global $conf, $langs;
|
|
global $conf, $langs;
|
|
|
|
|
|
if (! is_array($substitutionarray)) return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions';
|
|
if (! is_array($substitutionarray)) return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions';
|
|
-
|
|
|
|
|
|
+
|
|
if (empty($outputlangs)) $outputlangs=$langs;
|
|
if (empty($outputlangs)) $outputlangs=$langs;
|
|
-
|
|
|
|
|
|
+
|
|
// Make substitution for language keys
|
|
// Make substitution for language keys
|
|
if (is_object($outputlangs))
|
|
if (is_object($outputlangs))
|
|
{
|
|
{
|
|
@@ -5030,10 +5030,10 @@ function make_substitutions($text, $substitutionarray, $outputlangs=null)
|
|
{
|
|
{
|
|
$msgishtml = 0;
|
|
$msgishtml = 0;
|
|
if (dol_textishtml($text,1)) $msgishtml = 1;
|
|
if (dol_textishtml($text,1)) $msgishtml = 1;
|
|
- $text = preg_replace('/__\('.preg_quote($reg[1]).'\)__/', $msgishtml?dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])):$outputlangs->transnoentitiesnoconv($reg[1]), $text);
|
|
|
|
|
|
+ $text = preg_replace('/__\('.preg_quote($reg[1]).'\)__/', $msgishtml?dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])):$outputlangs->transnoentitiesnoconv($reg[1]), $text);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// Make substitition for array $substitutionarray
|
|
// Make substitition for array $substitutionarray
|
|
foreach ($substitutionarray as $key => $value)
|
|
foreach ($substitutionarray as $key => $value)
|
|
{
|
|
{
|
|
@@ -5046,7 +5046,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs=null)
|
|
|
|
|
|
/**
|
|
/**
|
|
* Complete the $substitutionarray with more entries.
|
|
* Complete the $substitutionarray with more entries.
|
|
- * Can also add substitution keys coming from external module that had set the "substitutions=1" into module_part array. In this case, method completesubstitutionarray provided by module is called.
|
|
|
|
|
|
+ * Can also add substitution keys coming from external module that had set the "substitutions=1" into module_part array. In this case, method completesubstitutionarray provided by module is called.
|
|
*
|
|
*
|
|
* @param array $substitutionarray Array substitution old value => new value value
|
|
* @param array $substitutionarray Array substitution old value => new value value
|
|
* @param Translate $outputlangs Output language
|
|
* @param Translate $outputlangs Output language
|
|
@@ -5067,7 +5067,7 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object
|
|
{
|
|
{
|
|
// TODO
|
|
// TODO
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// Add a substitution key for each extrafields, using key __EXTRA_XXX__
|
|
// Add a substitution key for each extrafields, using key __EXTRA_XXX__
|
|
if (is_object($object) && is_array($object->array_options))
|
|
if (is_object($object) && is_array($object->array_options))
|
|
{
|
|
{
|
|
@@ -5079,7 +5079,7 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object
|
|
$substitutionarray['%EXTRA_'.$keyshort.'%']=$val;
|
|
$substitutionarray['%EXTRA_'.$keyshort.'%']=$val;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// Check if there is external substitution to do, requested by plugins
|
|
// Check if there is external substitution to do, requested by plugins
|
|
$dirsubstitutions=array_merge(array(),(array) $conf->modules_parts['substitutions']);
|
|
$dirsubstitutions=array_merge(array(),(array) $conf->modules_parts['substitutions']);
|
|
|
|
|
|
@@ -5615,8 +5615,8 @@ function dol_eval($s, $returnvalue=0, $hideerrors=1)
|
|
global $rights;
|
|
global $rights;
|
|
global $object;
|
|
global $object;
|
|
global $mysoc;
|
|
global $mysoc;
|
|
-
|
|
|
|
- global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
|
|
|
|
|
|
+
|
|
|
|
+ global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
|
|
global $soc; // For backward compatibility
|
|
global $soc; // For backward compatibility
|
|
|
|
|
|
//print $s."<br>\n";
|
|
//print $s."<br>\n";
|
|
@@ -5827,7 +5827,7 @@ function printCommonFooter($zone='private')
|
|
this.href=this.href+\'&page_y=\'+page_y;
|
|
this.href=this.href+\'&page_y=\'+page_y;
|
|
});'."\n";
|
|
});'."\n";
|
|
print '});'."\n";
|
|
print '});'."\n";
|
|
-
|
|
|
|
|
|
+
|
|
if (empty($conf->dol_use_jmobile))
|
|
if (empty($conf->dol_use_jmobile))
|
|
{
|
|
{
|
|
print '<!-- Set handler to switch left menu page (menuhider) -->'."\n";
|
|
print '<!-- Set handler to switch left menu page (menuhider) -->'."\n";
|
|
@@ -5837,7 +5837,7 @@ function printCommonFooter($zone='private')
|
|
print " $('.login_block').toggle();";
|
|
print " $('.login_block').toggle();";
|
|
print '});'."\n";
|
|
print '});'."\n";
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
print '</script>'."\n";
|
|
print '</script>'."\n";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -6000,9 +6000,9 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
|
{
|
|
{
|
|
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
|
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$value = preg_replace('/\s*\|\s*/','|', $value);
|
|
$value = preg_replace('/\s*\|\s*/','|', $value);
|
|
-
|
|
|
|
|
|
+
|
|
$crits = explode(' ', $value);
|
|
$crits = explode(' ', $value);
|
|
$res = '';
|
|
$res = '';
|
|
if (! is_array($fields)) $fields = array($fields);
|
|
if (! is_array($fields)) $fields = array($fields);
|
|
@@ -6125,7 +6125,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
|
*
|
|
*
|
|
* @param string $modulepart propal, facture, facture_fourn, ...
|
|
* @param string $modulepart propal, facture, facture_fourn, ...
|
|
* @param string $relativepath Relative path of docs.
|
|
* @param string $relativepath Relative path of docs.
|
|
- * @param int $alldata Return array with all components (1 is recommended, then use a simple a href link with the class, target and mime attribute added. 'documentpreview' css class is handled by jquery code into main.inc.php)
|
|
|
|
|
|
+ * @param int $alldata Return array with all components (1 is recommended, then use a simple a href link with the class, target and mime attribute added. 'documentpreview' css class is handled by jquery code into main.inc.php)
|
|
* @param string $param More param on http links
|
|
* @param string $param More param on http links
|
|
* @return string|array Output string with href link or array with all components of link
|
|
* @return string|array Output string with href link or array with all components of link
|
|
*/
|
|
*/
|
|
@@ -6139,8 +6139,8 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param=''
|
|
//$mime_preview[]='vnd.oasis.opendocument.presentation';
|
|
//$mime_preview[]='vnd.oasis.opendocument.presentation';
|
|
//$mime_preview[]='archive';
|
|
//$mime_preview[]='archive';
|
|
$num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview);
|
|
$num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview);
|
|
-
|
|
|
|
- if ($alldata == 1)
|
|
|
|
|
|
+
|
|
|
|
+ if ($alldata == 1)
|
|
{
|
|
{
|
|
if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath), 'mime'=>dol_mimetype($relativepath), );
|
|
if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath), 'mime'=>dol_mimetype($relativepath), );
|
|
else return array();
|
|
else return array();
|