Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW/add_real_payments_on_salaries
This commit is contained in:
commit
e598b49545
@ -21,6 +21,8 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* API /setup/shipment_methods has been replaced with API /setup/shipping_methods
|
||||
* Field "tva" renamed into "total_tva" in llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency
|
||||
* Field "total" renamed into "total_ttc" in llx_propal, llx_supplier_proposal for better field name consistency
|
||||
* If your database is PostgreSql, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT)
|
||||
* If your database is MySql or MariaDB, you need at least version 5.1
|
||||
|
||||
|
||||
***** ChangeLog for 13.0.1 compared to 13.0.0 *****
|
||||
|
||||
@ -41,8 +41,7 @@ $langs->load("admin");
|
||||
*/
|
||||
|
||||
// Enable and test if module Api is enabled
|
||||
if (empty($conf->global->MAIN_MODULE_API))
|
||||
{
|
||||
if (empty($conf->global->MAIN_MODULE_API)) {
|
||||
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
|
||||
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
|
||||
print $langs->trans("ToActivateModule");
|
||||
@ -59,20 +58,16 @@ $api->r->addAuthenticationClass('DolibarrApiAccess', '');
|
||||
$listofapis = array();
|
||||
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
foreach ($modulesdir as $dir) {
|
||||
/*
|
||||
* Search available module
|
||||
*/
|
||||
* Search available module
|
||||
*/
|
||||
//dol_syslog("Scan directory ".$dir." for API modules");
|
||||
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg))
|
||||
{
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg)) {
|
||||
$modulename = $reg[1];
|
||||
|
||||
// Defined if module is enabled
|
||||
@ -96,60 +91,58 @@ foreach ($modulesdir as $dir)
|
||||
$module = 'fichinter';
|
||||
}
|
||||
|
||||
if (empty($conf->$module->enabled)) $enabled = false;
|
||||
if (empty($conf->$module->enabled)) {
|
||||
$enabled = false;
|
||||
}
|
||||
|
||||
if ($enabled) {
|
||||
/*
|
||||
* If exists, load the API class for enable module
|
||||
*
|
||||
* Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
||||
*
|
||||
* @todo : take care of externals module!
|
||||
* @todo : use getElementProperties() function ?
|
||||
*/
|
||||
* If exists, load the API class for enable module
|
||||
*
|
||||
* Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
||||
*
|
||||
* @todo : take care of externals module!
|
||||
* @todo : use getElementProperties() function ?
|
||||
*/
|
||||
$dir_part = DOL_DOCUMENT_ROOT.'/'.$part.'/class/';
|
||||
|
||||
$handle_part = @opendir(dol_osencode($dir_part));
|
||||
if (is_resource($handle_part))
|
||||
{
|
||||
while (($file_searched = readdir($handle_part)) !== false)
|
||||
{
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $reg))
|
||||
{
|
||||
if (is_resource($handle_part)) {
|
||||
while (($file_searched = readdir($handle_part)) !== false) {
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $reg)) {
|
||||
$classname = ucwords($reg[1]);
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
{
|
||||
if (class_exists($classname)) {
|
||||
dol_syslog("Found API classname=".$classname." into ".$dir);
|
||||
$listofapis[] = $classname;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg))
|
||||
{
|
||||
$classname=$reg[1];
|
||||
$classname = str_replace('Api_','',ucwords($reg[1])).'Api';
|
||||
//$classname = str_replace('Api_','',ucwords($reg[1]));
|
||||
$classname = ucfirst($classname);
|
||||
require_once $dir_part.$file_searched;
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^(api_.*)\.class\.php$/i",$file_searched,$reg))
|
||||
{
|
||||
$classname=$reg[1];
|
||||
$classname = str_replace('Api_','',ucwords($reg[1])).'Api';
|
||||
//$classname = str_replace('Api_','',ucwords($reg[1]));
|
||||
$classname = ucfirst($classname);
|
||||
require_once $dir_part.$file_searched;
|
||||
|
||||
// if (class_exists($classname))
|
||||
// {
|
||||
// dol_syslog("Found API classname=".$classname);
|
||||
// $api->r->addAPIClass($classname,'');
|
||||
// if (class_exists($classname))
|
||||
// {
|
||||
// dol_syslog("Found API classname=".$classname);
|
||||
// $api->r->addAPIClass($classname,'');
|
||||
|
||||
// require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Routes.php';
|
||||
// $tmpclass = new ReflectionClass($classname);
|
||||
// try {
|
||||
// $classMetadata = CommentParser::parse($tmpclass->getDocComment());
|
||||
// } catch (Exception $e) {
|
||||
// throw new RestException(500, "Error while parsing comments of `$classname` class. " . $e->getMessage());
|
||||
// }
|
||||
// require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Routes.php';
|
||||
// $tmpclass = new ReflectionClass($classname);
|
||||
// try {
|
||||
// $classMetadata = CommentParser::parse($tmpclass->getDocComment());
|
||||
// } catch (Exception $e) {
|
||||
// throw new RestException(500, "Error while parsing comments of `$classname` class. " . $e->getMessage());
|
||||
// }
|
||||
|
||||
// //$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched);
|
||||
// }
|
||||
}*/
|
||||
// //$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched);
|
||||
// }
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -186,21 +179,23 @@ print '<br>';
|
||||
$oldclass = '';
|
||||
|
||||
print $langs->trans("ListOfAvailableAPIs").':<br>';
|
||||
foreach ($listofapis['v1'] as $key => $val)
|
||||
{
|
||||
if ($key == 'login') continue;
|
||||
if ($key == 'index') continue;
|
||||
foreach ($listofapis['v1'] as $key => $val) {
|
||||
if ($key == 'login') {
|
||||
continue;
|
||||
}
|
||||
if ($key == 'index') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($key)
|
||||
{
|
||||
foreach ($val as $method => $val2)
|
||||
{
|
||||
if ($key) {
|
||||
foreach ($val as $method => $val2) {
|
||||
$newclass = $val2['className'];
|
||||
|
||||
if (preg_match('/restler/i', $newclass)) continue;
|
||||
if (preg_match('/restler/i', $newclass)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($oldclass != $newclass)
|
||||
{
|
||||
if ($oldclass != $newclass) {
|
||||
print "\n<br>\n".$langs->trans("Class").': '.$newclass.'<br>'."\n";
|
||||
$oldclass = $newclass;
|
||||
}
|
||||
|
||||
@ -51,7 +51,9 @@ class DolibarrApi
|
||||
{
|
||||
global $conf, $dolibarr_main_url_root;
|
||||
|
||||
if (empty($cachedir)) $cachedir = $conf->api->dir_temp;
|
||||
if (empty($cachedir)) {
|
||||
$cachedir = $conf->api->dir_temp;
|
||||
}
|
||||
Defaults::$cacheDirectory = $cachedir;
|
||||
|
||||
$this->db = $db;
|
||||
@ -140,7 +142,7 @@ class DolibarrApi
|
||||
unset($object->labelStatusShort);
|
||||
|
||||
unset($object->stats_propale);
|
||||
unset($object->stats_commande);
|
||||
unset($object->stats_commande);
|
||||
unset($object->stats_contrat);
|
||||
unset($object->stats_facture);
|
||||
unset($object->stats_commande_fournisseur);
|
||||
@ -191,8 +193,7 @@ class DolibarrApi
|
||||
// If object has lines, remove $db property
|
||||
if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
|
||||
$nboflines = count($object->lines);
|
||||
for ($i = 0; $i < $nboflines; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nboflines; $i++) {
|
||||
$this->_cleanObjectDatas($object->lines[$i]);
|
||||
|
||||
unset($object->lines[$i]->contact);
|
||||
@ -284,12 +285,14 @@ class DolibarrApi
|
||||
$ok = 0;
|
||||
$i = 0; $nb = strlen($tmp);
|
||||
$counter = 0;
|
||||
while ($i < $nb)
|
||||
{
|
||||
if ($tmp[$i] == '(') $counter++;
|
||||
if ($tmp[$i] == ')') $counter--;
|
||||
if ($counter < 0)
|
||||
{
|
||||
while ($i < $nb) {
|
||||
if ($tmp[$i] == '(') {
|
||||
$counter++;
|
||||
}
|
||||
if ($tmp[$i] == ')') {
|
||||
$counter--;
|
||||
}
|
||||
if ($counter < 0) {
|
||||
$error = "Bad sqlfilters=".$sqlfilters;
|
||||
dol_syslog($error, LOG_WARNING);
|
||||
return false;
|
||||
@ -313,14 +316,17 @@ class DolibarrApi
|
||||
global $db;
|
||||
|
||||
//dol_syslog("Convert matches ".$matches[1]);
|
||||
if (empty($matches[1])) return '';
|
||||
if (empty($matches[1])) {
|
||||
return '';
|
||||
}
|
||||
$tmp = explode(':', $matches[1]);
|
||||
if (count($tmp) < 3) return '';
|
||||
if (count($tmp) < 3) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tmpescaped = $tmp[2];
|
||||
$regbis = array();
|
||||
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
|
||||
{
|
||||
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||
} else {
|
||||
$tmpescaped = $db->escape($tmpescaped);
|
||||
|
||||
@ -35,7 +35,6 @@ use \Luracast\Restler\Resources;
|
||||
use \Luracast\Restler\Defaults;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
* Dolibarr API access class
|
||||
*
|
||||
@ -90,28 +89,24 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
|
||||
/*foreach ($_SERVER as $key => $val)
|
||||
{
|
||||
dol_syslog($key.' - '.$val);
|
||||
dol_syslog($key.' - '.$val);
|
||||
}*/
|
||||
|
||||
// api key can be provided in url with parameter api_key=xxx or ni header with header DOLAPIKEY:xxx
|
||||
$api_key = '';
|
||||
if (isset($_GET['api_key'])) // For backward compatibility
|
||||
{
|
||||
if (isset($_GET['api_key'])) { // For backward compatibility
|
||||
// TODO Add option to disable use of api key on url. Return errors if used.
|
||||
$api_key = $_GET['api_key'];
|
||||
}
|
||||
if (isset($_GET['DOLAPIKEY']))
|
||||
{
|
||||
if (isset($_GET['DOLAPIKEY'])) {
|
||||
// TODO Add option to disable use of api key on url. Return errors if used.
|
||||
$api_key = $_GET['DOLAPIKEY']; // With GET method
|
||||
}
|
||||
if (isset($_SERVER['HTTP_DOLAPIKEY'])) // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
||||
{
|
||||
if (isset($_SERVER['HTTP_DOLAPIKEY'])) { // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
||||
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
||||
}
|
||||
|
||||
if ($api_key)
|
||||
{
|
||||
if ($api_key) {
|
||||
$userentity = 0;
|
||||
|
||||
$sql = "SELECT u.login, u.datec, u.api_key, ";
|
||||
@ -121,17 +116,14 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
// TODO Check if 2 users has same API key.
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$login = $obj->login;
|
||||
$stored_key = $obj->api_key;
|
||||
$userentity = $obj->entity;
|
||||
|
||||
if (!defined("DOLENTITY") && $conf->entity != ($obj->entity ? $obj->entity : 1)) // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user
|
||||
{
|
||||
if (!defined("DOLENTITY") && $conf->entity != ($obj->entity ? $obj->entity : 1)) { // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user
|
||||
$conf->entity = ($obj->entity ? $obj->entity : 1);
|
||||
// We must also reload global conf to get params from the entity
|
||||
dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity.") and we have to reload configuration.", LOG_WARNING);
|
||||
@ -147,8 +139,7 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$login)
|
||||
{
|
||||
if (!$login) {
|
||||
throw new RestException(503, 'Error when searching login user from api key');
|
||||
}
|
||||
$fuser = new User($this->db);
|
||||
@ -173,7 +164,9 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
$userClass::setCacheIdentifier(static::$role);
|
||||
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
|
||||
$requirefortest = static::$requires;
|
||||
if (!is_array($requirefortest)) $requirefortest = explode(',', $requirefortest);
|
||||
if (!is_array($requirefortest)) {
|
||||
$requirefortest = explode(',', $requirefortest);
|
||||
}
|
||||
return in_array(static::$role, (array) $requirefortest) || static::$role == 'admin';
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
use Luracast\Restler\RestException;
|
||||
use Luracast\Restler\Format\UploadFormat;
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
@ -36,7 +35,7 @@ class Documents extends DolibarrApi
|
||||
/**
|
||||
* @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $DOCUMENT_FIELDS = array(
|
||||
public static $DOCUMENT_FIELDS = array(
|
||||
'modulepart'
|
||||
);
|
||||
|
||||
@ -106,8 +105,7 @@ class Documents extends DolibarrApi
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
if (!file_exists($original_file_osencoded)) {
|
||||
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
@ -148,8 +146,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$outputlangs = $langs;
|
||||
if ($langcode && $langs->defaultlang != $langcode)
|
||||
{
|
||||
if ($langcode && $langs->defaultlang != $langcode) {
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($langcode);
|
||||
}
|
||||
@ -187,8 +184,7 @@ class Documents extends DolibarrApi
|
||||
|
||||
$templateused = '';
|
||||
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$this->invoice = new Facture($this->db);
|
||||
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
@ -201,9 +197,7 @@ class Documents extends DolibarrApi
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'commande' || $modulepart == 'order')
|
||||
{
|
||||
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$this->order = new Commande($this->db);
|
||||
$result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
@ -215,9 +209,7 @@ class Documents extends DolibarrApi
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
|
||||
{
|
||||
} elseif ($modulepart == 'propal' || $modulepart == 'proposal') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$this->propal = new Propal($this->db);
|
||||
$result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
@ -236,8 +228,7 @@ class Documents extends DolibarrApi
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
if (!file_exists($original_file_osencoded)) {
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
|
||||
@ -278,8 +269,7 @@ class Documents extends DolibarrApi
|
||||
$recursive = 0;
|
||||
$type = 'files';
|
||||
|
||||
if ($modulepart == 'societe' || $modulepart == 'thirdparty')
|
||||
{
|
||||
if ($modulepart == 'societe' || $modulepart == 'thirdparty') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
@ -293,9 +283,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
elseif ($modulepart == 'user')
|
||||
{
|
||||
} elseif ($modulepart == 'user') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
// Can get doc if has permission to read all user or if it is user itself
|
||||
@ -310,9 +298,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id;
|
||||
}
|
||||
elseif ($modulepart == 'adherent' || $modulepart == 'member')
|
||||
{
|
||||
} elseif ($modulepart == 'adherent' || $modulepart == 'member') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
|
||||
@ -326,9 +312,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
}
|
||||
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
|
||||
{
|
||||
} elseif ($modulepart == 'propal' || $modulepart == 'proposal') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
@ -342,9 +326,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
|
||||
}
|
||||
elseif ($modulepart == 'commande' || $modulepart == 'order')
|
||||
{
|
||||
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
@ -358,9 +340,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
|
||||
}
|
||||
elseif ($modulepart == 'shipment' || $modulepart == 'expedition')
|
||||
{
|
||||
} elseif ($modulepart == 'shipment' || $modulepart == 'expedition') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->expedition->lire) {
|
||||
@ -374,9 +354,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
|
||||
}
|
||||
elseif ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
} elseif ($modulepart == 'facture' || $modulepart == 'invoice') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
@ -390,9 +368,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
|
||||
}
|
||||
elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice')
|
||||
{
|
||||
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') {
|
||||
$modulepart = 'supplier_invoice';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
@ -408,9 +384,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
elseif ($modulepart == 'produit' || $modulepart == 'product')
|
||||
{
|
||||
} elseif ($modulepart == 'produit' || $modulepart == 'product') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->produit->lire) {
|
||||
@ -426,9 +400,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product');
|
||||
}
|
||||
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
|
||||
{
|
||||
} elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->read && !DolibarrApiAccess::$user->rights->agenda->allactions->read) {
|
||||
@ -442,9 +414,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
elseif ($modulepart == 'expensereport')
|
||||
{
|
||||
} elseif ($modulepart == 'expensereport') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->expensereport->read && !DolibarrApiAccess::$user->rights->expensereport->read) {
|
||||
@ -458,9 +428,7 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
elseif ($modulepart == 'categorie' || $modulepart == 'category')
|
||||
{
|
||||
} elseif ($modulepart == 'categorie' || $modulepart == 'category') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
@ -523,9 +491,9 @@ class Documents extends DolibarrApi
|
||||
* @throws RestException
|
||||
*/
|
||||
/*
|
||||
public function get($id) {
|
||||
return array('note'=>'xxx');
|
||||
}*/
|
||||
public function get($id) {
|
||||
return array('note'=>'xxx');
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
@ -557,12 +525,11 @@ class Documents extends DolibarrApi
|
||||
global $db, $conf;
|
||||
|
||||
/*var_dump($modulepart);
|
||||
var_dump($filename);
|
||||
var_dump($filecontent);
|
||||
exit;*/
|
||||
var_dump($filename);
|
||||
var_dump($filecontent);
|
||||
exit;*/
|
||||
|
||||
if (empty($modulepart))
|
||||
{
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'Modulepart not provided.');
|
||||
}
|
||||
|
||||
@ -571,41 +538,39 @@ class Documents extends DolibarrApi
|
||||
}
|
||||
|
||||
$newfilecontent = '';
|
||||
if (empty($fileencoding)) $newfilecontent = $filecontent;
|
||||
if ($fileencoding == 'base64') $newfilecontent = base64_decode($filecontent);
|
||||
if (empty($fileencoding)) {
|
||||
$newfilecontent = $filecontent;
|
||||
}
|
||||
if ($fileencoding == 'base64') {
|
||||
$newfilecontent = base64_decode($filecontent);
|
||||
}
|
||||
|
||||
$original_file = dol_sanitizeFileName($filename);
|
||||
|
||||
// Define $uploadir
|
||||
$object = null;
|
||||
$entity = DolibarrApiAccess::$user->entity;
|
||||
if (empty($entity)) $entity = 1;
|
||||
if (empty($entity)) {
|
||||
$entity = 1;
|
||||
}
|
||||
|
||||
if ($ref)
|
||||
{
|
||||
if ($ref) {
|
||||
$tmpreldir = '';
|
||||
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice') {
|
||||
$modulepart = 'facture';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice')
|
||||
{
|
||||
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') {
|
||||
$modulepart = 'supplier_invoice';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$object = new FactureFournisseur($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'project')
|
||||
{
|
||||
} elseif ($modulepart == 'project') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
$object = new Project($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'task' || $modulepart == 'project_task')
|
||||
{
|
||||
} elseif ($modulepart == 'task' || $modulepart == 'project_task') {
|
||||
$modulepart = 'project_task';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
@ -614,36 +579,26 @@ class Documents extends DolibarrApi
|
||||
$task_result = $object->fetch('', $ref);
|
||||
|
||||
// Fetching the tasks project is required because its out_dir might be a sub-directory of the project
|
||||
if ($task_result > 0)
|
||||
{
|
||||
if ($task_result > 0) {
|
||||
$project_result = $object->fetch_projet();
|
||||
|
||||
if ($project_result >= 0)
|
||||
{
|
||||
if ($project_result >= 0) {
|
||||
$tmpreldir = dol_sanitizeFileName($object->project->ref).'/';
|
||||
}
|
||||
} else {
|
||||
throw new RestException(500, 'Error while fetching Task '.$ref);
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service')
|
||||
{
|
||||
} elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$object = new Product($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'expensereport')
|
||||
{
|
||||
} elseif ($modulepart == 'expensereport') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
$object = new ExpenseReport($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'adherent' || $modulepart == 'member')
|
||||
{
|
||||
} elseif ($modulepart == 'adherent' || $modulepart == 'member') {
|
||||
$modulepart = 'adherent';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$object = new Adherent($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'proposal' || $modulepart == 'propal' || $modulepart == 'propale')
|
||||
{
|
||||
} elseif ($modulepart == 'proposal' || $modulepart == 'propal' || $modulepart == 'propale') {
|
||||
$modulepart = 'propale';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$object = new Propal($this->db);
|
||||
@ -652,22 +607,18 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
}
|
||||
|
||||
if (is_object($object))
|
||||
{
|
||||
if (is_object($object)) {
|
||||
$result = $object->fetch('', $ref);
|
||||
|
||||
if ($result == 0)
|
||||
{
|
||||
if ($result == 0) {
|
||||
throw new RestException(404, "Object with ref '".$ref."' was not found.");
|
||||
}
|
||||
elseif ($result < 0)
|
||||
{
|
||||
} elseif ($result < 0) {
|
||||
throw new RestException(500, 'Error while fetching object: '.$object->error);
|
||||
}
|
||||
}
|
||||
|
||||
if (!($object->id > 0)) {
|
||||
throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||
throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||
}
|
||||
|
||||
// Special cases that need to use get_exdir to get real dir of object
|
||||
@ -681,13 +632,16 @@ class Documents extends DolibarrApi
|
||||
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write');
|
||||
$upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir
|
||||
|
||||
if (empty($upload_dir) || $upload_dir == '/')
|
||||
{
|
||||
if (empty($upload_dir) || $upload_dir == '/') {
|
||||
throw new RestException(500, 'This value of modulepart ('.$modulepart.') does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.');
|
||||
}
|
||||
} else {
|
||||
if ($modulepart == 'invoice') $modulepart = 'facture';
|
||||
if ($modulepart == 'member') $modulepart = 'adherent';
|
||||
if ($modulepart == 'invoice') {
|
||||
$modulepart = 'facture';
|
||||
}
|
||||
if ($modulepart == 'member') {
|
||||
$modulepart = 'adherent';
|
||||
}
|
||||
|
||||
$relativefile = $subdir;
|
||||
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
@ -771,12 +725,12 @@ class Documents extends DolibarrApi
|
||||
// Special cases that need to use get_exdir to get real dir of object
|
||||
// If future, all object should use this to define path of documents.
|
||||
/*
|
||||
$tmpreldir = '';
|
||||
if ($modulepart == 'supplier_invoice') {
|
||||
$tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier');
|
||||
}
|
||||
$tmpreldir = '';
|
||||
if ($modulepart == 'supplier_invoice') {
|
||||
$tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier');
|
||||
}
|
||||
|
||||
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */
|
||||
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */
|
||||
$relativefile = $original_file;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
@ -794,8 +748,7 @@ class Documents extends DolibarrApi
|
||||
$filename = basename($original_file);
|
||||
$original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
if (!file_exists($original_file_osencoded))
|
||||
{
|
||||
if (!file_exists($original_file_osencoded)) {
|
||||
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
@ -825,8 +778,9 @@ class Documents extends DolibarrApi
|
||||
// phpcs:enable
|
||||
$result = array();
|
||||
foreach (Documents::$DOCUMENT_FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
if (!isset($data[$field])) {
|
||||
throw new RestException(400, "$field field missing");
|
||||
}
|
||||
$result[$field] = $data[$field];
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -61,14 +61,16 @@ class Login
|
||||
// TODO Remove the API login. The token must be generated from backoffice only.
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'dolibarr';
|
||||
if (empty($dolibarr_main_authentication)) {
|
||||
$dolibarr_main_authentication = 'dolibarr';
|
||||
}
|
||||
|
||||
// Authentication mode: forceuser
|
||||
if ($dolibarr_main_authentication == 'forceuser')
|
||||
{
|
||||
if (empty($dolibarr_auto_user)) $dolibarr_auto_user = 'auto';
|
||||
if ($dolibarr_auto_user != $login)
|
||||
{
|
||||
if ($dolibarr_main_authentication == 'forceuser') {
|
||||
if (empty($dolibarr_auto_user)) {
|
||||
$dolibarr_auto_user = 'auto';
|
||||
}
|
||||
if ($dolibarr_auto_user != $login) {
|
||||
dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. API usage is forbidden in this mode.");
|
||||
throw new RestException(403, "Your instance is set to use the automatic login '".$dolibarr_auto_user."' that is not the requested login. API usage is forbidden in this mode.");
|
||||
}
|
||||
@ -77,16 +79,16 @@ class Login
|
||||
// Set authmode
|
||||
$authmode = explode(',', $dolibarr_main_authentication);
|
||||
|
||||
if ($entity != '' && !is_numeric($entity))
|
||||
{
|
||||
if ($entity != '' && !is_numeric($entity)) {
|
||||
throw new RestException(403, "Bad value for entity, must be the numeric ID of company.");
|
||||
}
|
||||
if ($entity == '') $entity = 1;
|
||||
if ($entity == '') {
|
||||
$entity = 1;
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$login = checkLoginPassEntity($login, $password, $entity, $authmode, 'api');
|
||||
if (empty($login))
|
||||
{
|
||||
if (empty($login)) {
|
||||
throw new RestException(403, 'Access denied');
|
||||
}
|
||||
|
||||
@ -94,17 +96,14 @@ class Login
|
||||
|
||||
$tmpuser = new User($this->db);
|
||||
$tmpuser->fetch(0, $login, 0, 0, $entity);
|
||||
if (empty($tmpuser->id))
|
||||
{
|
||||
if (empty($tmpuser->id)) {
|
||||
throw new RestException(500, 'Failed to load user');
|
||||
}
|
||||
|
||||
// Renew the hash
|
||||
if (empty($tmpuser->api_key) || $reset)
|
||||
{
|
||||
if (empty($tmpuser->api_key) || $reset) {
|
||||
$tmpuser->getrights();
|
||||
if (empty($tmpuser->rights->user->self->creer))
|
||||
{
|
||||
if (empty($tmpuser->rights->user->self->creer)) {
|
||||
throw new RestException(403, 'User need write permission on itself to reset its API token');
|
||||
}
|
||||
|
||||
@ -118,8 +117,7 @@ class Login
|
||||
|
||||
dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when updating api_key for user :'.$this->db->lasterror());
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -310,7 +310,7 @@ class Setup extends DolibarrApi
|
||||
* Get state by ID.
|
||||
*
|
||||
* @param int $id ID of state
|
||||
* @return array Array of cleaned object properties
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @url GET dictionary/states/{id}
|
||||
*
|
||||
|
||||
@ -26,22 +26,42 @@
|
||||
|
||||
use Luracast\Restler\Format\UploadFormat;
|
||||
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
||||
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
if (!defined("NOSESSION")) define("NOSESSION", '1');
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
||||
}
|
||||
if (!defined("NOLOGIN")) {
|
||||
define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
}
|
||||
if (!defined("NOSESSION")) {
|
||||
define("NOSESSION", '1');
|
||||
}
|
||||
|
||||
|
||||
// Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used.
|
||||
if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||
if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
|
||||
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||
}
|
||||
|
||||
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../main.inc.php")) $res = include '../main.inc.php';
|
||||
if (!$res) die("Include of main fails");
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
$res = include '../main.inc.php';
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php';
|
||||
|
||||
@ -61,14 +81,12 @@ if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF']
|
||||
$url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO'];
|
||||
}
|
||||
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
|
||||
if (!empty($conf->global->MAIN_NGINX_FIX))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_NGINX_FIX)) {
|
||||
$url = (isset($_SERVER['SCRIPT_URI']) && $_SERVER["SCRIPT_URI"] !== null) ? $_SERVER["SCRIPT_URI"] : $_SERVER['PHP_SELF'];
|
||||
}
|
||||
|
||||
// Enable and test if module Api is enabled
|
||||
if (empty($conf->global->MAIN_MODULE_API))
|
||||
{
|
||||
if (empty($conf->global->MAIN_MODULE_API)) {
|
||||
$langs->load("admin");
|
||||
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
|
||||
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
|
||||
@ -78,8 +96,7 @@ if (empty($conf->global->MAIN_MODULE_API))
|
||||
}
|
||||
|
||||
// Test if explorer is not disabled
|
||||
if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED))
|
||||
{
|
||||
if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED)) {
|
||||
$langs->load("admin");
|
||||
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
|
||||
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
|
||||
@ -112,8 +129,7 @@ preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg);
|
||||
// using the explorer. And when we make another call for another API, the API is not into the api/temp/routes.php and a 404 is returned.
|
||||
// So we force refresh to each call.
|
||||
$refreshcache = (empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
|
||||
if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) {
|
||||
$refreshcache = true;
|
||||
}
|
||||
|
||||
@ -132,12 +148,10 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
|
||||
|
||||
|
||||
// Restrict API to some IPs
|
||||
if (!empty($conf->global->API_RESTRICT_ON_IP))
|
||||
{
|
||||
if (!empty($conf->global->API_RESTRICT_ON_IP)) {
|
||||
$allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (!in_array($ipremote, $allowedip))
|
||||
{
|
||||
if (!in_array($ipremote, $allowedip)) {
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
|
||||
print 'APIs are not allowed from the IP '.$ipremote;
|
||||
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
|
||||
@ -148,65 +162,64 @@ if (!empty($conf->global->API_RESTRICT_ON_IP))
|
||||
|
||||
|
||||
// Call Explorer file for all APIs definitions (this part is slow)
|
||||
if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) {
|
||||
// Scan all API files to load them
|
||||
|
||||
$listofapis = array();
|
||||
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
foreach ($modulesdir as $dir) {
|
||||
// Search available module
|
||||
dol_syslog("Scan directory ".$dir." for module descriptor files, then search for API files");
|
||||
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$regmod = array();
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i", $file, $regmod))
|
||||
{
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i", $file, $regmod)) {
|
||||
$module = strtolower($regmod[1]);
|
||||
$moduledirforclass = getModuleDirForApiClass($module);
|
||||
$modulenameforenabled = $module;
|
||||
if ($module == 'propale') { $modulenameforenabled = 'propal'; }
|
||||
if ($module == 'supplierproposal') { $modulenameforenabled = 'supplier_proposal'; }
|
||||
if ($module == 'ficheinter') { $modulenameforenabled = 'ficheinter'; }
|
||||
if ($module == 'propale') {
|
||||
$modulenameforenabled = 'propal';
|
||||
}
|
||||
if ($module == 'supplierproposal') {
|
||||
$modulenameforenabled = 'supplier_proposal';
|
||||
}
|
||||
if ($module == 'ficheinter') {
|
||||
$modulenameforenabled = 'ficheinter';
|
||||
}
|
||||
|
||||
dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass);
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled = true;
|
||||
if (empty($conf->$modulenameforenabled->enabled)) $enabled = false;
|
||||
if (empty($conf->$modulenameforenabled->enabled)) {
|
||||
$enabled = false;
|
||||
}
|
||||
|
||||
if ($enabled)
|
||||
{
|
||||
if ($enabled) {
|
||||
// If exists, load the API class for enable module
|
||||
// Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
||||
// @todo : use getElementProperties() function ?
|
||||
$dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
|
||||
|
||||
$handle_part = @opendir(dol_osencode($dir_part));
|
||||
if (is_resource($handle_part))
|
||||
{
|
||||
while (($file_searched = readdir($handle_part)) !== false)
|
||||
{
|
||||
if ($file_searched == 'api_access.class.php') continue;
|
||||
if (is_resource($handle_part)) {
|
||||
while (($file_searched = readdir($handle_part)) !== false) {
|
||||
if ($file_searched == 'api_access.class.php') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$regapi = array();
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi))
|
||||
{
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi)) {
|
||||
$classname = ucwords($regapi[1]);
|
||||
$classname = str_replace('_', '', $classname);
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname.'Api'))
|
||||
{
|
||||
if (class_exists($classname.'Api')) {
|
||||
//dol_syslog("Found API by index.php: classname=".$classname."Api for module ".$dir." into ".$dir_part.$file_searched);
|
||||
$listofapis[strtolower($classname.'Api')] = $classname.'Api';
|
||||
} elseif (class_exists($classname))
|
||||
{
|
||||
} elseif (class_exists($classname)) {
|
||||
//dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
||||
$listofapis[strtolower($classname)] = $classname;
|
||||
} else {
|
||||
@ -224,8 +237,7 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
||||
// Sort the classes before adding them to Restler.
|
||||
// The Restler API Explorer shows the classes in the order they are added and it's a mess if they are not sorted.
|
||||
asort($listofapis);
|
||||
foreach ($listofapis as $apiname => $classname)
|
||||
{
|
||||
foreach ($listofapis as $apiname => $classname) {
|
||||
$api->r->addAPIClass($classname, $apiname);
|
||||
}
|
||||
//var_dump($api->r);
|
||||
@ -233,11 +245,9 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
||||
|
||||
// Call one APIs or one definition of an API
|
||||
$regbis = array();
|
||||
if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root')))
|
||||
{
|
||||
if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root'))) {
|
||||
$moduleobject = $reg[1];
|
||||
if ($moduleobject == 'explorer') // If we call page to explore details of a service
|
||||
{
|
||||
if ($moduleobject == 'explorer') { // If we call page to explore details of a service
|
||||
$moduleobject = $regbis[2];
|
||||
}
|
||||
|
||||
@ -248,21 +258,27 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
dol_syslog("Load a dedicated API file moduleobject=".$moduleobject." moduledirforclass=".$moduledirforclass);
|
||||
|
||||
$tmpmodule = $moduleobject;
|
||||
if ($tmpmodule != 'api')
|
||||
if ($tmpmodule != 'api') {
|
||||
$tmpmodule = preg_replace('/api$/i', '', $tmpmodule);
|
||||
}
|
||||
$classfile = str_replace('_', '', $tmpmodule);
|
||||
|
||||
// Special cases that does not match name rules conventions
|
||||
if ($moduleobject == 'supplierproposals')
|
||||
if ($moduleobject == 'supplierproposals') {
|
||||
$classfile = 'supplier_proposals';
|
||||
if ($moduleobject == 'supplierorders')
|
||||
}
|
||||
if ($moduleobject == 'supplierorders') {
|
||||
$classfile = 'supplier_orders';
|
||||
if ($moduleobject == 'supplierinvoices')
|
||||
}
|
||||
if ($moduleobject == 'supplierinvoices') {
|
||||
$classfile = 'supplier_invoices';
|
||||
if ($moduleobject == 'ficheinter')
|
||||
}
|
||||
if ($moduleobject == 'ficheinter') {
|
||||
$classfile = 'interventions';
|
||||
if ($moduleobject == 'interventions')
|
||||
}
|
||||
if ($moduleobject == 'interventions') {
|
||||
$classfile = 'interventions';
|
||||
}
|
||||
|
||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2);
|
||||
|
||||
@ -271,8 +287,9 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
dol_syslog('Search api file /'.$moduledirforclass.'/class/api_'.$classfile.'.class.php => dir_part_file='.$dir_part_file.' classname='.$classname);
|
||||
|
||||
$res = false;
|
||||
if ($dir_part_file)
|
||||
if ($dir_part_file) {
|
||||
$res = include_once $dir_part_file;
|
||||
}
|
||||
if (!$res) {
|
||||
dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING);
|
||||
print 'API not found (failed to include API file)';
|
||||
@ -281,8 +298,9 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (class_exists($classname))
|
||||
if (class_exists($classname)) {
|
||||
$api->r->addAPIClass($classname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,10 +41,11 @@ $action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
if (!count($actioncode)) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
@ -59,12 +60,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = 'a.datep,a.id';
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'a.datep,a.id';
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC';
|
||||
}
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new BOM($db);
|
||||
@ -76,7 +83,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -86,20 +95,19 @@ if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->
|
||||
|
||||
$parameters = array('id'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage))
|
||||
{
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$actioncode = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
@ -115,14 +123,15 @@ $contactstatic = new Contact($db);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$title = $langs->trans("Agenda");
|
||||
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url = '';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
$langs->load("mails");
|
||||
}
|
||||
$head = bomPrepareHead($object);
|
||||
|
||||
|
||||
@ -147,31 +156,31 @@ if ($object->id > 0)
|
||||
if ($user->rights->bom->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
@ -196,10 +205,11 @@ if ($object->id > 0)
|
||||
|
||||
$out = '&origin='.$object->element.'&originid='.$object->id;
|
||||
$permok = $user->rights->agenda->myactions->create;
|
||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok)
|
||||
{
|
||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') $out .= '&socid='.$objthirdparty->id;
|
||||
if (get_class($objthirdparty) == 'Societe') {
|
||||
$out .= '&socid='.$objthirdparty->id;
|
||||
}
|
||||
$out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage=1&percentage=-1';
|
||||
//$out.=$langs->trans("AddAnAction").' ';
|
||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
@ -209,10 +219,8 @@ if ($object->id > 0)
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (!empty($conf->agenda->enabled))
|
||||
{
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>';
|
||||
@ -221,11 +229,14 @@ if ($object->id > 0)
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
$param = '&id='.$object->id.'&socid='.$socid;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
|
||||
|
||||
//print load_fiche_titre($langs->trans("ActionsOnBom"), '', '');
|
||||
|
||||
@ -37,10 +37,10 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
// PDF
|
||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
@ -59,12 +59,15 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
// Initialize array of search criterias
|
||||
$search_all = GETPOST("search_all", 'alpha');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
||||
if (empty($action) && empty($id) && empty($ref)) {
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
@ -88,18 +91,22 @@ $upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->enti
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
$error = 0;
|
||||
|
||||
$backurlforlist = DOL_URL_ROOT.'/bom/bom_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_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
|
||||
$backtopage = $backurlforlist;
|
||||
} else {
|
||||
$backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,8 +134,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Add line
|
||||
if ($action == 'addline' && $user->rights->bom->write)
|
||||
{
|
||||
if ($action == 'addline' && $user->rights->bom->write) {
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
|
||||
@ -153,8 +159,7 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fk_bom = $id;
|
||||
$bomline->fk_product = $idprod;
|
||||
@ -164,10 +169,10 @@ if (empty($reshook))
|
||||
$bomline->efficiency = $efficiency;
|
||||
|
||||
// Rang to use
|
||||
$rangmax = $object->line_max(0);
|
||||
$ranktouse = $rangmax + 1;
|
||||
$rangmax = $object->line_max(0);
|
||||
$ranktouse = $rangmax + 1;
|
||||
|
||||
$bomline->position = ($ranktouse + 1);
|
||||
$bomline->position = ($ranktouse + 1);
|
||||
|
||||
$result = $bomline->create($user);
|
||||
if ($result <= 0) {
|
||||
@ -179,16 +184,15 @@ if (empty($reshook))
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
|
||||
$object->fetchLines();
|
||||
$object->fetchLines();
|
||||
|
||||
$object->calculateCosts();
|
||||
}
|
||||
$object->calculateCosts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add line
|
||||
if ($action == 'updateline' && $user->rights->bom->write)
|
||||
{
|
||||
if ($action == 'updateline' && $user->rights->bom->write) {
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
|
||||
@ -211,8 +215,7 @@ if (empty($reshook))
|
||||
$bomline->efficiency = $efficiency;
|
||||
|
||||
$result = $bomline->update($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
if ($result <= 0) {
|
||||
setEventMessages($bomline->error, $bomline->errors, 'errors');
|
||||
$action = '';
|
||||
} else {
|
||||
@ -221,9 +224,9 @@ if (empty($reshook))
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
|
||||
$object->fetchLines();
|
||||
$object->fetchLines();
|
||||
|
||||
$object->calculateCosts();
|
||||
$object->calculateCosts();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,8 +258,7 @@ jQuery(document).ready(function() {
|
||||
|
||||
|
||||
// Part to create
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans("NewBOM"), '', 'bom');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -288,8 +290,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Part to edit record
|
||||
if (($id || $ref) && $action == 'edit')
|
||||
{
|
||||
if (($id || $ref) && $action == 'edit') {
|
||||
print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -322,8 +323,7 @@ if (($id || $ref) && $action == 'edit')
|
||||
}
|
||||
|
||||
// Part to show record
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||
{
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
$head = bomPrepareHead($object);
|
||||
@ -332,19 +332,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$formconfirm = '';
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete')
|
||||
{
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
// Confirmation to delete line
|
||||
if ($action == 'deleteline')
|
||||
{
|
||||
if ($action == 'deleteline') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of validation
|
||||
if ($action == 'validate')
|
||||
{
|
||||
if ($action == 'validate') {
|
||||
// We check that object has a temporary ref
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV') {
|
||||
@ -364,13 +361,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}*/
|
||||
|
||||
$formquestion = array();
|
||||
if (!empty($conf->bom->enabled))
|
||||
{
|
||||
if (!empty($conf->bom->enabled)) {
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo = 0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
if ($conf->browser->name == 'ie') {
|
||||
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
}
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
@ -382,8 +380,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Confirmation of closing
|
||||
if ($action == 'close')
|
||||
{
|
||||
if ($action == 'close') {
|
||||
$text = $langs->trans('ConfirmCloseBom', $object->ref);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
@ -394,13 +391,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}*/
|
||||
|
||||
$formquestion = array();
|
||||
if (!empty($conf->bom->enabled))
|
||||
{
|
||||
if (!empty($conf->bom->enabled)) {
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo = 0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
if ($conf->browser->name == 'ie') {
|
||||
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
}
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
@ -412,8 +410,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Confirmation of reopen
|
||||
if ($action == 'reopen')
|
||||
{
|
||||
if ($action == 'reopen') {
|
||||
$text = $langs->trans('ConfirmReopenBom', $object->ref);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
@ -424,13 +421,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}*/
|
||||
|
||||
$formquestion = array();
|
||||
if (!empty($conf->bom->enabled))
|
||||
{
|
||||
if (!empty($conf->bom->enabled)) {
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo = 0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
if ($conf->browser->name == 'ie') {
|
||||
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
}
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
@ -449,8 +447,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Confirmation of action xxxx
|
||||
if ($action == 'setdraft')
|
||||
{
|
||||
if ($action == 'setdraft') {
|
||||
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
|
||||
|
||||
$formquestion = array();
|
||||
@ -460,8 +457,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Call Hook formConfirm
|
||||
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$formconfirm .= $hookmanager->resPrint;
|
||||
} elseif ($reshook > 0) {
|
||||
$formconfirm = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
@ -481,32 +481,32 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.=$proj->getNomUrl();
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.=$proj->getNomUrl();
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
$morehtmlref .= '</div>';
|
||||
@ -544,8 +544,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
* Lines
|
||||
*/
|
||||
|
||||
if (!empty($object->table_element_line))
|
||||
{
|
||||
if (!empty($object->table_element_line)) {
|
||||
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '').'" method="POST">
|
||||
<input type="hidden" name="token" value="' . newToken().'">
|
||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
|
||||
@ -558,21 +557,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
{
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||
}
|
||||
|
||||
if (!empty($object->lines))
|
||||
{
|
||||
if (!empty($object->lines)) {
|
||||
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
|
||||
}
|
||||
|
||||
// Form to add new line
|
||||
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
|
||||
if ($action != 'editline') {
|
||||
// Add products/services form
|
||||
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
||||
|
||||
@ -581,8 +576,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
|
||||
{
|
||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||
print '</table>';
|
||||
}
|
||||
print '</div>';
|
||||
@ -597,29 +591,26 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
//if (empty($user->socid)) {
|
||||
// print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
|
||||
//}
|
||||
|
||||
// Back to draft
|
||||
if ($object->status == $object::STATUS_VALIDATED)
|
||||
{
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($object->status == $object::STATUS_VALIDATED) {
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($object->status == $object::STATUS_DRAFT)
|
||||
{
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($object->status == $object::STATUS_DRAFT) {
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
|
||||
@ -627,12 +618,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Validate
|
||||
if ($object->status == $object::STATUS_DRAFT)
|
||||
{
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if (is_array($object->lines) && count($object->lines) > 0)
|
||||
{
|
||||
if ($object->status == $object::STATUS_DRAFT) {
|
||||
if ($permissiontoadd) {
|
||||
if (is_array($object->lines) && count($object->lines) > 0) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate&token='.newToken().'">'.$langs->trans("Validate").'</a>';
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
@ -642,48 +630,42 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Re-open
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
|
||||
{
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
}
|
||||
|
||||
// Create MO
|
||||
if ($conf->mrp->enabled)
|
||||
{
|
||||
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
|
||||
{
|
||||
if ($conf->mrp->enabled) {
|
||||
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Close / Cancel
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
|
||||
{
|
||||
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close">'.$langs->trans("Disable").'</a>';
|
||||
}
|
||||
|
||||
/*
|
||||
if ($user->rights->bom->write)
|
||||
{
|
||||
if ($object->status == 1)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($permissiontodelete)
|
||||
if ($user->rights->bom->write)
|
||||
{
|
||||
if ($object->status == 1)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=disable">'.$langs->trans("Disable").'</a>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=enable">'.$langs->trans("Enable").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($permissiontodelete) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
|
||||
@ -698,8 +680,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
if ($action != 'presend') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
@ -734,7 +715,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
//Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) $action = 'presend';
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail = 'bom';
|
||||
|
||||
@ -50,12 +50,18 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "name";
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "name";
|
||||
}
|
||||
//if (! $sortfield) $sortfield="position_name";
|
||||
|
||||
// Initialize technical objects
|
||||
@ -69,7 +75,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".get_exdir(0, 0, 0, 1, $object);
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".get_exdir(0, 0, 0, 1, $object);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -90,8 +98,7 @@ $help_url = '';
|
||||
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
if ($object->id) {
|
||||
/*
|
||||
* Show tabs
|
||||
*/
|
||||
@ -103,8 +110,7 @@ if ($object->id)
|
||||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file)
|
||||
{
|
||||
foreach ($filearray as $key => $file) {
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,9 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -67,14 +69,20 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (empty($conf->bom->enabled)) accessforbidden('Module not enabled');
|
||||
if (empty($conf->bom->enabled)) {
|
||||
accessforbidden('Module not enabled');
|
||||
}
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) // Protection if external user
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
// Protection if external user
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
@ -83,30 +91,31 @@ if ($user->socid > 0) // Protection if external user
|
||||
// Initialize array of search criterias
|
||||
$search_all = GETPOST("search_all", 'alpha');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['searchall']) {
|
||||
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||
}
|
||||
}
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
if (!empty($val['visible'])) {
|
||||
$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
@ -129,31 +138,33 @@ $permissiontodelete = $user->rights->bom->delete;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
|
||||
{
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
@ -167,22 +178,17 @@ if (empty($reshook))
|
||||
|
||||
|
||||
// Validate records
|
||||
if (!$error && $massaction == 'disable' && $permissiontoadd)
|
||||
{
|
||||
if (!$error && $massaction == 'disable' && $permissiontoadd) {
|
||||
$objecttmp = new $objectclass($db);
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid)
|
||||
{
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($objecttmp->status != $objecttmp::STATUS_VALIDATED)
|
||||
{
|
||||
if ($result > 0) {
|
||||
if ($objecttmp->status != $objecttmp::STATUS_VALIDATED) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorObjectMustHaveStatusActiveToBeDisabled", $objecttmp->ref), null, 'errors');
|
||||
$error++;
|
||||
@ -191,12 +197,13 @@ if (empty($reshook))
|
||||
|
||||
// Can be 'cancel()' or 'close()'
|
||||
$result = $objecttmp->cancel($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} else $nbok++;
|
||||
} else {
|
||||
$nbok++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
@ -204,10 +211,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
if (!$error) {
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
}
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
@ -217,22 +226,17 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Validate records
|
||||
if (!$error && $massaction == 'enable' && $permissiontoadd)
|
||||
{
|
||||
if (!$error && $massaction == 'enable' && $permissiontoadd) {
|
||||
$objecttmp = new $objectclass($db);
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid)
|
||||
{
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED)
|
||||
{
|
||||
if ($result > 0) {
|
||||
if ($objecttmp->status != $objecttmp::STATUS_DRAFT && $objecttmp->status != $objecttmp::STATUS_CANCELED) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated", $objecttmp->ref), null, 'errors');
|
||||
$error++;
|
||||
@ -241,12 +245,13 @@ if (empty($reshook))
|
||||
|
||||
// Can be 'cancel()' or 'close()'
|
||||
$result = $objecttmp->validate($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} else $nbok++;
|
||||
} else {
|
||||
$nbok++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
@ -254,10 +259,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
if (!$error) {
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
}
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
@ -284,13 +291,14 @@ $title = $langs->trans('ListOfBOMs');
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$sql .= 't.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
@ -298,21 +306,33 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
else $sql .= " WHERE 1 = 1";
|
||||
foreach ($search as $key => $val)
|
||||
{
|
||||
if ($key == 'status' && $search[$key] == -1) continue;
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
}
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
} else {
|
||||
$sql .= " WHERE 1 = 1";
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
continue;
|
||||
}
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||
if ($search[$key] == '-1') $search[$key] = '';
|
||||
if ($search[$key] == '-1') {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -341,26 +361,24 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
|
||||
{
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
@ -369,8 +387,7 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit
|
||||
}
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page)
|
||||
{
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/bom/bom_card.php?id='.$id);
|
||||
@ -386,14 +403,24 @@ llxHeader('', $title, $help_url);
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
foreach ($search as $key => $val)
|
||||
{
|
||||
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
else $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
} else {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -403,12 +430,18 @@ $arrayofmassactions = array(
|
||||
'enable'=>$langs->trans("Enable"),
|
||||
'disable'=>$langs->trans("Disable"),
|
||||
);
|
||||
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
if ($permissiontodelete) {
|
||||
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
@ -427,9 +460,10 @@ $objecttmp = new BOM($db);
|
||||
$trackid = 'bom'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
if ($search_all) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
@ -440,11 +474,13 @@ $moreforfilter.= '</div>';*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
@ -461,20 +497,26 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
@ -496,15 +538,18 @@ print '</tr>'."\n";
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
}
|
||||
}
|
||||
@ -521,11 +566,11 @@ print '</tr>'."\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)
|
||||
{
|
||||
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
|
||||
if (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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -534,38 +579,53 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
}
|
||||
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif ($key == 'ref') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) {
|
||||
$cssforfield = 'tdoverflowmax100';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') print $object->getLibStatut(5);
|
||||
else print $object->showOutputField($val, $key, $object->$key, '');
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} else {
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!empty($val['isameasure']))
|
||||
{
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
@ -578,14 +638,17 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($object->id, $arrayofselected)) $selected = 1;
|
||||
if (in_array($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -597,10 +660,13 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
@ -617,10 +683,11 @@ print '</div>'."\n";
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
{
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
|
||||
$hidegeneratedfilelistifempty = 0;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
@ -34,7 +34,7 @@ $langs->loadLangs(array("mrp", "companies"));
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
@ -53,7 +53,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
|
||||
$permissionnote = 1;
|
||||
//$permissionnote=$user->rights->bom->creer; // Used by the include of actions_setnotes.inc.php
|
||||
@ -77,8 +79,7 @@ $form = new Form($db);
|
||||
$help_url = '';
|
||||
llxHeader('', $langs->trans('BillOfMaterials'), $help_url);
|
||||
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = bomPrepareHead($object);
|
||||
@ -99,35 +100,35 @@ if ($id > 0 || !empty($ref))
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->bom->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->bom->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
@ -108,30 +108,42 @@ class Boms extends DolibarrApi
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) {
|
||||
$search_sale = DolibarrApiAccess::$user->id;
|
||||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ($restrictonsocid && (!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)
|
||||
if ($restrictonsocid && (!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.$tmpobject->table_element." as t";
|
||||
|
||||
if ($restrictonsocid && (!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
|
||||
if ($restrictonsocid && (!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 1 = 1";
|
||||
|
||||
// Example of use $mode
|
||||
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
|
||||
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
|
||||
|
||||
if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid;
|
||||
if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
if ($tmpobject->ismultientitymanaged) {
|
||||
$sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
|
||||
}
|
||||
if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
|
||||
$sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
}
|
||||
if ($restrictonsocid && $socid) {
|
||||
$sql .= " AND t.fk_soc = ".$socid;
|
||||
}
|
||||
if ($restrictonsocid && $search_sale > 0) {
|
||||
$sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
}
|
||||
// Insert sale filter
|
||||
if ($restrictonsocid && $search_sale > 0)
|
||||
{
|
||||
if ($restrictonsocid && $search_sale > 0) {
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
@ -141,8 +153,7 @@ class Boms extends DolibarrApi
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
@ -151,12 +162,10 @@ class Boms extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$bom_static = new BOM($this->db);
|
||||
if ($bom_static->fetch($obj->rowid)) {
|
||||
@ -220,7 +229,9 @@ class Boms extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
$this->bom->$field = $value;
|
||||
}
|
||||
|
||||
@ -251,8 +262,7 @@ class Boms extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!$this->bom->delete(DolibarrApiAccess::$user))
|
||||
{
|
||||
if (!$this->bom->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when deleting BOM : '.$this->bom->error);
|
||||
}
|
||||
|
||||
@ -316,8 +326,7 @@ class Boms extends DolibarrApi
|
||||
// If object has lines, remove $db property
|
||||
if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
|
||||
$nboflines = count($object->lines);
|
||||
for ($i = 0; $i < $nboflines; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nboflines; $i++) {
|
||||
$this->_cleanObjectDatas($object->lines[$i]);
|
||||
|
||||
unset($object->lines[$i]->lines);
|
||||
@ -340,9 +349,12 @@ class Boms extends DolibarrApi
|
||||
{
|
||||
$myobject = array();
|
||||
foreach ($this->bom->fields as $field => $propfield) {
|
||||
if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) continue; // Not a mandatory field
|
||||
if (!isset($data[$field]))
|
||||
if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) {
|
||||
continue; // Not a mandatory field
|
||||
}
|
||||
if (!isset($data[$field])) {
|
||||
throw new RestException(400, "$field field missing");
|
||||
}
|
||||
$myobject[$field] = $data[$field];
|
||||
}
|
||||
return $myobject;
|
||||
|
||||
@ -230,25 +230,24 @@ class BOM extends CommonObject
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
// Unset fields that are disabled
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled']))
|
||||
{
|
||||
foreach ($this->fields as $key => $val) {
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) {
|
||||
unset($this->fields[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Translate some data of arrayofkeyval
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
|
||||
{
|
||||
foreach ($val['arrayofkeyval'] as $key2 => $val2)
|
||||
{
|
||||
foreach ($this->fields as $key => $val) {
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
foreach ($val['arrayofkeyval'] as $key2 => $val2) {
|
||||
$this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
|
||||
}
|
||||
}
|
||||
@ -264,7 +263,9 @@ class BOM extends CommonObject
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
if ($this->efficiency <= 0 || $this->efficiency > 1) $this->efficiency = 1;
|
||||
if ($this->efficiency <= 0 || $this->efficiency > 1) {
|
||||
$this->efficiency = 1;
|
||||
}
|
||||
|
||||
return $this->createCommon($user, $notrigger);
|
||||
}
|
||||
@ -289,7 +290,9 @@ class BOM extends CommonObject
|
||||
|
||||
// Load source object
|
||||
$result = $object->fetchCommon($fromid);
|
||||
if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
|
||||
if ($result > 0 && !empty($object->table_element_line)) {
|
||||
$object->fetchLines();
|
||||
}
|
||||
|
||||
// Get lines so they will be clone
|
||||
//foreach ($object->lines as $line)
|
||||
@ -306,14 +309,11 @@ class BOM extends CommonObject
|
||||
$object->status = self::STATUS_DRAFT;
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0)
|
||||
{
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0) {
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
foreach ($object->array_options as $key => $option)
|
||||
{
|
||||
foreach ($object->array_options as $key => $option) {
|
||||
$shortkey = preg_replace('/options_/', '', $key);
|
||||
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey]))
|
||||
{
|
||||
if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) {
|
||||
//var_dump($key); var_dump($clonedObj->array_options[$key]); exit;
|
||||
unset($object->array_options[$key]);
|
||||
}
|
||||
@ -329,22 +329,19 @@ class BOM extends CommonObject
|
||||
$this->errors = $object->errors;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
// copy internal contacts
|
||||
if ($this->copy_linked_contact($object, 'internal') < 0)
|
||||
{
|
||||
if ($this->copy_linked_contact($object, 'internal') < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
// copy external contacts if same company
|
||||
if (property_exists($this, 'socid') && $this->socid == $object->socid)
|
||||
{
|
||||
if ($this->copy_linked_contact($object, 'external') < 0)
|
||||
if (property_exists($this, 'socid') && $this->socid == $object->socid) {
|
||||
if ($this->copy_linked_contact($object, 'external') < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +372,9 @@ class BOM extends CommonObject
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
|
||||
if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
|
||||
if ($result > 0 && !empty($this->table_element_line)) {
|
||||
$this->fetchLines();
|
||||
}
|
||||
$this->calculateCosts();
|
||||
|
||||
return $result;
|
||||
@ -416,8 +415,11 @@ class BOM extends CommonObject
|
||||
$sql = 'SELECT ';
|
||||
$sql .= $this->getFieldList();
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
if ($this->ismultientitymanaged) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
|
||||
else $sql .= ' WHERE 1 = 1';
|
||||
if ($this->ismultientitymanaged) {
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
|
||||
} else {
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
}
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
@ -448,8 +450,7 @@ class BOM extends CommonObject
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$record = new self($this->db);
|
||||
$record->setVarsFromFetchObj($obj);
|
||||
|
||||
@ -475,7 +476,9 @@ class BOM extends CommonObject
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
if ($this->efficiency <= 0 || $this->efficiency > 1) $this->efficiency = 1;
|
||||
if ($this->efficiency <= 0 || $this->efficiency > 1) {
|
||||
$this->efficiency = 1;
|
||||
}
|
||||
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
@ -503,8 +506,7 @@ class BOM extends CommonObject
|
||||
*/
|
||||
public function deleteLine(User $user, $idline, $notrigger = false)
|
||||
{
|
||||
if ($this->status < 0)
|
||||
{
|
||||
if ($this->status < 0) {
|
||||
$this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
|
||||
return -2;
|
||||
}
|
||||
@ -524,8 +526,7 @@ class BOM extends CommonObject
|
||||
global $langs, $conf;
|
||||
$langs->load("mrp");
|
||||
|
||||
if (!empty($conf->global->BOM_ADDON))
|
||||
{
|
||||
if (!empty($conf->global->BOM_ADDON)) {
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->BOM_ADDON.".php";
|
||||
@ -533,16 +534,14 @@ class BOM extends CommonObject
|
||||
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/bom/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
$mybool |= @include_once $dir.$file;
|
||||
}
|
||||
|
||||
if ($mybool === false)
|
||||
{
|
||||
if ($mybool === false) {
|
||||
dol_print_error('', "Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
@ -550,8 +549,7 @@ class BOM extends CommonObject
|
||||
$obj = new $classname();
|
||||
$numref = $obj->getNextValue($prod, $this);
|
||||
|
||||
if ($numref != "")
|
||||
{
|
||||
if ($numref != "") {
|
||||
return $numref;
|
||||
} else {
|
||||
$this->error = $obj->error;
|
||||
@ -580,27 +578,25 @@ class BOM extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
// Protection
|
||||
if ($this->status == self::STATUS_VALIDATED)
|
||||
{
|
||||
if ($this->status == self::STATUS_VALIDATED) {
|
||||
dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->create))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
|
||||
{
|
||||
$this->error='NotEnoughPermissions';
|
||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}*/
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
|
||||
{
|
||||
$this->error='NotEnoughPermissions';
|
||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Define new ref
|
||||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
|
||||
{
|
||||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
$this->fetch_product();
|
||||
$num = $this->getNextNumRef($this->product);
|
||||
} else {
|
||||
@ -618,50 +614,47 @@ class BOM extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($this->db);
|
||||
$this->error = $this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BOM_VALIDATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->oldref = $this->ref;
|
||||
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'bom/".$this->db->escape($this->newref)."'";
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'bom/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->bom->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->bom->dir_output.'/'.$newref;
|
||||
if (!$error && file_exists($dirsource))
|
||||
{
|
||||
if (!$error && file_exists($dirsource)) {
|
||||
dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
if (@rename($dirsource, $dirdest))
|
||||
{
|
||||
if (@rename($dirsource, $dirdest)) {
|
||||
dol_syslog("Rename ok");
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles = dol_dir_list($conf->bom->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
foreach ($listoffiles as $fileentry)
|
||||
{
|
||||
foreach ($listoffiles as $fileentry) {
|
||||
$dirsource = $fileentry['name'];
|
||||
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
|
||||
$dirsource = $fileentry['path'].'/'.$dirsource;
|
||||
@ -674,14 +667,12 @@ class BOM extends CommonObject
|
||||
}
|
||||
|
||||
// Set new ref and current status
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->ref = $num;
|
||||
$this->status = self::STATUS_VALIDATED;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
@ -700,8 +691,7 @@ class BOM extends CommonObject
|
||||
public function setDraft($user, $notrigger = 0)
|
||||
{
|
||||
// Protection
|
||||
if ($this->status <= self::STATUS_DRAFT)
|
||||
{
|
||||
if ($this->status <= self::STATUS_DRAFT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -725,8 +715,7 @@ class BOM extends CommonObject
|
||||
public function cancel($user, $notrigger = 0)
|
||||
{
|
||||
// Protection
|
||||
if ($this->status != self::STATUS_VALIDATED)
|
||||
{
|
||||
if ($this->status != self::STATUS_VALIDATED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -750,8 +739,7 @@ class BOM extends CommonObject
|
||||
public function reopen($user, $notrigger = 0)
|
||||
{
|
||||
// Protection
|
||||
if ($this->status != self::STATUS_CANCELED)
|
||||
{
|
||||
if ($this->status != self::STATUS_CANCELED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -780,7 +768,9 @@ class BOM extends CommonObject
|
||||
{
|
||||
global $db, $conf, $langs, $hookmanager;
|
||||
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
if (!empty($conf->dol_no_mouse_hover)) {
|
||||
$notooltip = 1; // Force disable tooltips
|
||||
}
|
||||
|
||||
$result = '';
|
||||
|
||||
@ -793,19 +783,20 @@ class BOM extends CommonObject
|
||||
|
||||
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||
$add_save_lastsearch_values = 1;
|
||||
}
|
||||
if ($add_save_lastsearch_values) {
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
}
|
||||
|
||||
$linkclose = '';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
if (empty($notooltip)) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$label = $langs->trans("ShowBillOfMaterials");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
@ -813,20 +804,26 @@ class BOM extends CommonObject
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
|
||||
/*
|
||||
$hookmanager->initHooks(array('bomdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||
*/
|
||||
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
$hookmanager->initHooks(array('bomdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||
*/
|
||||
} else {
|
||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
}
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= $this->ref;
|
||||
}
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
@ -834,8 +831,11 @@ class BOM extends CommonObject
|
||||
$hookmanager->initHooks(array('bomdao'));
|
||||
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
|
||||
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $result = $hookmanager->resPrint;
|
||||
else $result .= $hookmanager->resPrint;
|
||||
if ($reshook > 0) {
|
||||
$result = $hookmanager->resPrint;
|
||||
} else {
|
||||
$result .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -862,8 +862,7 @@ class BOM extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelStatus))
|
||||
{
|
||||
if (empty($this->labelStatus)) {
|
||||
global $langs;
|
||||
//$langs->load("mrp");
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
|
||||
@ -872,8 +871,12 @@ class BOM extends CommonObject
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||
if ($status == self::STATUS_CANCELED) $statusType = 'status6';
|
||||
if ($status == self::STATUS_VALIDATED) {
|
||||
$statusType = 'status4';
|
||||
}
|
||||
if ($status == self::STATUS_CANCELED) {
|
||||
$statusType = 'status6';
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatus[$status], '', $statusType, $mode);
|
||||
}
|
||||
@ -891,28 +894,23 @@ class BOM extends CommonObject
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE t.rowid = '.$id;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid)
|
||||
{
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture)
|
||||
{
|
||||
if ($obj->fk_user_cloture) {
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
@ -941,8 +939,7 @@ class BOM extends CommonObject
|
||||
$objectline = new BOMLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
|
||||
|
||||
if (is_numeric($result))
|
||||
{
|
||||
if (is_numeric($result)) {
|
||||
$this->error = $this->error;
|
||||
$this->errors = $this->errors;
|
||||
return $result;
|
||||
@ -1051,8 +1048,7 @@ class BOM extends CommonObject
|
||||
}
|
||||
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
||||
if (empty($line->unit_cost)) {
|
||||
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)
|
||||
{
|
||||
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
|
||||
$line->unit_cost = $productFournisseur->fourn_unitprice;
|
||||
}
|
||||
}
|
||||
@ -1197,25 +1193,24 @@ class BOMLine extends CommonObjectLine
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
|
||||
$this->fields['rowid']['visible'] = 0;
|
||||
}
|
||||
if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
|
||||
$this->fields['entity']['enabled'] = 0;
|
||||
}
|
||||
|
||||
// Unset fields that are disabled
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled']))
|
||||
{
|
||||
foreach ($this->fields as $key => $val) {
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) {
|
||||
unset($this->fields[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Translate some data of arrayofkeyval
|
||||
foreach ($this->fields as $key => $val)
|
||||
{
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval']))
|
||||
{
|
||||
foreach ($val['arrayofkeyval'] as $key2 => $val2)
|
||||
{
|
||||
foreach ($this->fields as $key => $val) {
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
foreach ($val['arrayofkeyval'] as $key2 => $val2) {
|
||||
$this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
|
||||
}
|
||||
}
|
||||
@ -1231,7 +1226,9 @@ class BOMLine extends CommonObjectLine
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
if ($this->efficiency < 0 || $this->efficiency > 1) $this->efficiency = 1;
|
||||
if ($this->efficiency < 0 || $this->efficiency > 1) {
|
||||
$this->efficiency = 1;
|
||||
}
|
||||
|
||||
return $this->createCommon($user, $notrigger);
|
||||
}
|
||||
@ -1272,8 +1269,11 @@ class BOMLine extends CommonObjectLine
|
||||
$sql = 'SELECT ';
|
||||
$sql .= $this->getFieldList();
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
if ($this->ismultientitymanaged) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
|
||||
else $sql .= ' WHERE 1 = 1';
|
||||
if ($this->ismultientitymanaged) {
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
|
||||
} else {
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
}
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
@ -1304,8 +1304,7 @@ class BOMLine extends CommonObjectLine
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$record = new self($this->db);
|
||||
$record->setVarsFromFetchObj($obj);
|
||||
|
||||
@ -1331,7 +1330,9 @@ class BOMLine extends CommonObjectLine
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
if ($this->efficiency < 0 || $this->efficiency > 1) $this->efficiency = 1;
|
||||
if ($this->efficiency < 0 || $this->efficiency > 1) {
|
||||
$this->efficiency = 1;
|
||||
}
|
||||
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
@ -1363,7 +1364,9 @@ class BOMLine extends CommonObjectLine
|
||||
{
|
||||
global $db, $conf, $langs, $hookmanager;
|
||||
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
if (!empty($conf->dol_no_mouse_hover)) {
|
||||
$notooltip = 1; // Force disable tooltips
|
||||
}
|
||||
|
||||
$result = '';
|
||||
|
||||
@ -1373,19 +1376,20 @@ class BOMLine extends CommonObjectLine
|
||||
|
||||
$url = dol_buildpath('/bom/bomline_card.php', 1).'?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||
$add_save_lastsearch_values = 1;
|
||||
}
|
||||
if ($add_save_lastsearch_values) {
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
}
|
||||
|
||||
$linkclose = '';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
if (empty($notooltip)) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$label = $langs->trans("ShowBillOfMaterialsLine");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
@ -1393,20 +1397,26 @@ class BOMLine extends CommonObjectLine
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
|
||||
/*
|
||||
$hookmanager->initHooks(array('bomlinedao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||
*/
|
||||
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
$hookmanager->initHooks(array('bomlinedao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||
*/
|
||||
} else {
|
||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
}
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= $this->ref;
|
||||
}
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
@ -1414,8 +1424,11 @@ class BOMLine extends CommonObjectLine
|
||||
$hookmanager->initHooks(array('bomlinedao'));
|
||||
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
|
||||
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) $result = $hookmanager->resPrint;
|
||||
else $result .= $hookmanager->resPrint;
|
||||
if ($reshook > 0) {
|
||||
$result = $hookmanager->resPrint;
|
||||
} else {
|
||||
$result .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -1458,28 +1471,23 @@ class BOMLine extends CommonObjectLine
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE t.rowid = '.$id;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid)
|
||||
{
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture)
|
||||
{
|
||||
if ($obj->fk_user_cloture) {
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
|
||||
@ -50,7 +50,7 @@ function bomAdminPrepareHead()
|
||||
$head[$h][1] = $langs->trans("About");
|
||||
$head[$h][2] = 'about';
|
||||
$h++;
|
||||
*/
|
||||
*/
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
@ -88,14 +88,19 @@ function bomPrepareHead($object)
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
|
||||
{
|
||||
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
|
||||
$nbNote = 0;
|
||||
if (!empty($object->note_private)) $nbNote++;
|
||||
if (!empty($object->note_public)) $nbNote++;
|
||||
if (!empty($object->note_private)) {
|
||||
$nbNote++;
|
||||
}
|
||||
if (!empty($object->note_public)) {
|
||||
$nbNote++;
|
||||
}
|
||||
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
|
||||
if ($nbNote > 0) {
|
||||
$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
|
||||
}
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
@ -107,7 +112,9 @@ function bomPrepareHead($object)
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
|
||||
if (($nbFiles + $nbLinks) > 0) {
|
||||
$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>' : '');
|
||||
}
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -39,12 +39,13 @@ $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1)
|
||||
|
||||
$total = 0;
|
||||
$ilink = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
$ilink++;
|
||||
$product_static = new Product($db);
|
||||
$trclass = 'oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
||||
$trclass .= ' liste_sub_total';
|
||||
}
|
||||
echo '<tr class="'.$trclass.'" >';
|
||||
echo '<td class="linkedcol-element" >'.$langs->trans("Bom");
|
||||
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
|
||||
|
||||
@ -38,7 +38,9 @@ if (empty($object) || !is_object($object)) {
|
||||
|
||||
global $forceall, $forcetoshowtitlelines;
|
||||
|
||||
if (empty($forceall)) $forceall = 0;
|
||||
if (empty($forceall)) {
|
||||
$forceall = 0;
|
||||
}
|
||||
|
||||
|
||||
// Define colspan for the button 'Add'
|
||||
@ -60,8 +62,7 @@ if ($nolinesbefore) {
|
||||
print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
|
||||
print '</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit left">';
|
||||
print '<span id="title_units">';
|
||||
print $langs->trans('Unit');
|
||||
@ -86,16 +87,18 @@ $coldisplay++;
|
||||
print '<td class="bordertop nobottom linecoldescription minwidth500imp">';
|
||||
|
||||
// Predefined product/service
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
|
||||
{
|
||||
if ($forceall >= 0 && $freelines) echo '<br>';
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
if ($forceall >= 0 && $freelines) {
|
||||
echo '<br>';
|
||||
}
|
||||
echo '<span class="prod_entry_mode_predef">';
|
||||
$filtertype = '';
|
||||
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype = '1';
|
||||
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) {
|
||||
$filtertype = '1';
|
||||
}
|
||||
|
||||
$statustoshow = -1;
|
||||
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS))
|
||||
{
|
||||
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
|
||||
// hide products in closed warehouse, but show products for internal transfer
|
||||
$form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
|
||||
} else {
|
||||
@ -109,8 +112,7 @@ $coldisplay++;
|
||||
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
print '</td>';
|
||||
@ -154,18 +156,18 @@ jQuery(document).ready(function() {
|
||||
{
|
||||
console.log("#idprod change triggered");
|
||||
|
||||
/* To set focus */
|
||||
if (jQuery('#idprod').val() > 0)
|
||||
{
|
||||
/* To set focus */
|
||||
if (jQuery('#idprod').val() > 0)
|
||||
{
|
||||
/* focus work on a standard textarea but not if field was replaced with CKEDITOR */
|
||||
jQuery('#dp_desc').focus();
|
||||
/* focus if CKEDITOR */
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
|
||||
{
|
||||
var editor = CKEDITOR.instances['dp_desc'];
|
||||
if (editor) { editor.focus(); }
|
||||
if (editor) { editor.focus(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -32,8 +32,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || !is_object($object))
|
||||
{
|
||||
if (empty($object) || !is_object($object)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -41,7 +40,9 @@ if (empty($object) || !is_object($object))
|
||||
|
||||
global $forceall;
|
||||
|
||||
if (empty($forceall)) $forceall = 0;
|
||||
if (empty($forceall)) {
|
||||
$forceall = 0;
|
||||
}
|
||||
|
||||
|
||||
// Define colspan for the button 'Add'
|
||||
@ -79,8 +80,7 @@ if ($line->fk_product > 0) {
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
}
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
if (is_object($hookmanager)) {
|
||||
$fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
|
||||
$parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer);
|
||||
$reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
|
||||
@ -90,7 +90,7 @@ print '</td>';
|
||||
|
||||
/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
|
||||
{
|
||||
$coldisplay++;
|
||||
$coldisplay++;
|
||||
?>
|
||||
<td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
|
||||
<?php
|
||||
@ -108,8 +108,7 @@ if (($line->info_bits & 2) != 2) {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
print '</td>';
|
||||
|
||||
@ -34,8 +34,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || !is_object($object))
|
||||
{
|
||||
if (empty($object) || !is_object($object)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -46,7 +45,9 @@ print "<thead>\n";
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
|
||||
// Adds a line numbering column
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum center"> </td>';
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
print '<td class="linecolnum center"> </td>';
|
||||
}
|
||||
|
||||
// Description
|
||||
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
|
||||
@ -54,8 +55,7 @@ print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
|
||||
// Qty
|
||||
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).'</td>';
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';
|
||||
}
|
||||
|
||||
@ -77,8 +77,7 @@ print '<td class="linecoldelete" style="width: 10px"></td>';
|
||||
|
||||
print '<td class="linecolmove" style="width: 10px"></td>';
|
||||
|
||||
if ($action == 'selectlines')
|
||||
{
|
||||
if ($action == 'selectlines') {
|
||||
print '<td class="linecolcheckall center">';
|
||||
print '<input type="checkbox" class="linecheckboxtoggle" />';
|
||||
print '<script>$(document).ready(function() {$(".linecheckboxtoggle").click(function() {var checkBoxes = $(".linecheckbox");checkBoxes.prop("checked", this.checked);})});</script>';
|
||||
|
||||
@ -35,8 +35,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($object) || !is_object($object))
|
||||
{
|
||||
if (empty($object) || !is_object($object)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -44,11 +43,21 @@ if (empty($object) || !is_object($object))
|
||||
|
||||
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
|
||||
|
||||
if (empty($dateSelector)) $dateSelector = 0;
|
||||
if (empty($forceall)) $forceall = 0;
|
||||
if (empty($senderissupplier)) $senderissupplier = 0;
|
||||
if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0;
|
||||
if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax = 0;
|
||||
if (empty($dateSelector)) {
|
||||
$dateSelector = 0;
|
||||
}
|
||||
if (empty($forceall)) {
|
||||
$forceall = 0;
|
||||
}
|
||||
if (empty($senderissupplier)) {
|
||||
$senderissupplier = 0;
|
||||
}
|
||||
if (empty($inputalsopricewithtax)) {
|
||||
$inputalsopricewithtax = 0;
|
||||
}
|
||||
if (empty($outputalsopricetotalwithtax)) {
|
||||
$outputalsopricetotalwithtax = 0;
|
||||
}
|
||||
|
||||
// add html5 elements
|
||||
$domData = ' data-element="'.$line->element.'"';
|
||||
@ -79,8 +88,7 @@ $coldisplay++;
|
||||
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<td class="linecoluseunit nowrap left">';
|
||||
$label = $tmpproduct->getLabelOfUnit('long');
|
||||
if ($label !== '') {
|
||||
@ -159,8 +167,7 @@ if ($action == 'selectlines') {
|
||||
print '</tr>';
|
||||
|
||||
//Line extrafield
|
||||
if (!empty($extrafields))
|
||||
{
|
||||
if (!empty($extrafields)) {
|
||||
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1, 'line');
|
||||
}
|
||||
|
||||
|
||||
@ -27,16 +27,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id']))
|
||||
{
|
||||
if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) {
|
||||
$_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
|
||||
$_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
|
||||
$_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
|
||||
}
|
||||
|
||||
// Security check
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "cashdesk"));
|
||||
@ -45,11 +45,12 @@ $langs->loadLangs(array("admin", "cashdesk"));
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if (GETPOST('action', 'alpha') == 'set')
|
||||
{
|
||||
if (GETPOST('action', 'alpha') == 'set') {
|
||||
$db->begin();
|
||||
|
||||
if (GETPOST('socid', 'int') < 0) $_POST["socid"] = '';
|
||||
if (GETPOST('socid', 'int') < 0) {
|
||||
$_POST["socid"] = '';
|
||||
}
|
||||
|
||||
$res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY", (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH", (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
||||
@ -62,10 +63,11 @@ if (GETPOST('action', 'alpha') == 'set')
|
||||
|
||||
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
|
||||
|
||||
if (!($res > 0)) $error++;
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
@ -93,8 +95,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
if (!empty($conf->service->enabled))
|
||||
{
|
||||
if (!empty($conf->service->enabled)) {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
@ -121,8 +122,7 @@ print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdParty
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client in (1,3) AND s.status = 1)', 1, 0, 0, array(), 0);
|
||||
print '</td></tr>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1);
|
||||
@ -141,8 +141,7 @@ if (!empty($conf->banque->enabled))
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (!empty($conf->stock->enabled))
|
||||
{
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
|
||||
print '<td colspan="2">';
|
||||
if (empty($conf->productbatch->enabled)) {
|
||||
@ -161,8 +160,7 @@ if (!empty($conf->stock->enabled))
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value)
|
||||
print '<td colspan="2">';
|
||||
if (!$disabled)
|
||||
{
|
||||
if (!$disabled) {
|
||||
print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>';
|
||||
} else {
|
||||
@ -172,8 +170,7 @@ if (!empty($conf->stock->enabled))
|
||||
}
|
||||
|
||||
// Use Dolibarr Receipt Printer
|
||||
if (!empty($conf->receiptprinter->enabled))
|
||||
{
|
||||
if (!empty($conf->receiptprinter->enabled)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')';
|
||||
print '<td colspan="2">';
|
||||
|
||||
@ -25,15 +25,13 @@
|
||||
require_once 'class/Facturation.class.php';
|
||||
|
||||
// Si nouvelle vente, reinitialisation des donnees (destruction de l'objet et vidage de la table contenant la liste des articles)
|
||||
if ($_GET['id'] == 'NOUV')
|
||||
{
|
||||
if ($_GET['id'] == 'NOUV') {
|
||||
unset($_SESSION['serObjFacturation']);
|
||||
unset($_SESSION['poscart']);
|
||||
}
|
||||
|
||||
// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
|
||||
if (isset($_SESSION['serObjFacturation']))
|
||||
{
|
||||
if (isset($_SESSION['serObjFacturation'])) {
|
||||
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
|
||||
unset($_SESSION['serObjFacturation']);
|
||||
} else {
|
||||
@ -58,17 +56,18 @@ print '<div class="inline-block" style="vertical-align: top">';
|
||||
print '<div class="principal">';
|
||||
|
||||
$page = GETPOST('menutpl', 'alpha');
|
||||
if (empty($page)) $page = 'facturation';
|
||||
if (empty($page)) {
|
||||
$page = 'facturation';
|
||||
}
|
||||
|
||||
if (in_array(
|
||||
$page,
|
||||
array(
|
||||
$page,
|
||||
array(
|
||||
'deconnexion',
|
||||
'index', 'index_verif', 'facturation', 'facturation_verif', 'facturation_dhtml',
|
||||
'validation', 'validation_ok', 'validation_ticket', 'validation_verif',
|
||||
)
|
||||
))
|
||||
{
|
||||
)) {
|
||||
include $page.'.php';
|
||||
} else {
|
||||
dol_print_error('', 'menu param '.$page.' is not inside allowed list');
|
||||
|
||||
@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php';
|
||||
$error = GETPOST('error');
|
||||
|
||||
// Test if already logged
|
||||
if ($_SESSION['uid'] <= 0)
|
||||
{
|
||||
if ($_SESSION['uid'] <= 0) {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
@ -53,8 +52,7 @@ top_htmlhead($head, $langs->trans("CashDesk"), 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
print '<body>'."\n";
|
||||
|
||||
if (!empty($error))
|
||||
{
|
||||
if (!empty($error)) {
|
||||
dol_htmloutput_events();
|
||||
}
|
||||
|
||||
|
||||
@ -27,8 +27,7 @@
|
||||
<?php
|
||||
|
||||
// Wrapper to show tooltips
|
||||
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover))
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover)) {
|
||||
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
@ -95,15 +95,18 @@ class Auth
|
||||
$test = true;
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'http,dolibarr';
|
||||
if (empty($dolibarr_main_authentication)) {
|
||||
$dolibarr_main_authentication = 'http,dolibarr';
|
||||
}
|
||||
// Authentication mode: forceuser
|
||||
if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user = 'auto';
|
||||
if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
|
||||
$dolibarr_auto_user = 'auto';
|
||||
}
|
||||
// Set authmode
|
||||
$authmode = explode(',', $dolibarr_main_authentication);
|
||||
|
||||
// No authentication mode
|
||||
if (!count($authmode))
|
||||
{
|
||||
if (!count($authmode)) {
|
||||
$langs->load('main');
|
||||
dol_print_error('', $langs->trans("ErrorConfigParameterNotDefined", 'dolibarr_main_authentication'));
|
||||
exit;
|
||||
@ -117,15 +120,17 @@ class Auth
|
||||
// If ok, the variable will be initialized login
|
||||
// If error, we will put error message in session under the name dol_loginmesg
|
||||
$goontestloop = false;
|
||||
if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) $goontestloop = true;
|
||||
if (isset($aLogin) || GETPOST('openid_mode', 'alpha', 1)) $goontestloop = true;
|
||||
if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) {
|
||||
$goontestloop = true;
|
||||
}
|
||||
if (isset($aLogin) || GETPOST('openid_mode', 'alpha', 1)) {
|
||||
$goontestloop = true;
|
||||
}
|
||||
|
||||
if ($test && $goontestloop)
|
||||
{
|
||||
if ($test && $goontestloop) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode);
|
||||
if ($login)
|
||||
{
|
||||
if ($login) {
|
||||
$this->login($aLogin);
|
||||
$this->passwd($aPasswd);
|
||||
$ret = 0;
|
||||
|
||||
@ -116,8 +116,7 @@ class Facturation
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg)) {
|
||||
$vat_src_code = $reg[1];
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
@ -133,8 +132,7 @@ class Facturation
|
||||
$total_localtax2 = $resultarray[10];
|
||||
|
||||
// Calculation of the discount amount
|
||||
if ($this->remisePercent())
|
||||
{
|
||||
if ($this->remisePercent()) {
|
||||
$remise_percent = $this->remisePercent();
|
||||
} else {
|
||||
$remise_percent = 0;
|
||||
@ -155,10 +153,8 @@ class Facturation
|
||||
$newcartarray[$i]['price'] = $product->price;
|
||||
$newcartarray[$i]['price_ttc'] = $product->price_ttc;
|
||||
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if (isset($product->multiprices[$societe->price_level]))
|
||||
{
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
if (isset($product->multiprices[$societe->price_level])) {
|
||||
$newcartarray[$i]['price'] = $product->multiprices[$societe->price_level];
|
||||
$newcartarray[$i]['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
|
||||
}
|
||||
@ -191,10 +187,8 @@ class Facturation
|
||||
|
||||
$j = 0;
|
||||
$newposcart = array();
|
||||
foreach ($poscart as $key => $val)
|
||||
{
|
||||
if ($poscart[$key]['id'] != $aArticle)
|
||||
{
|
||||
foreach ($poscart as $key => $val) {
|
||||
if ($poscart[$key]['id'] != $aArticle) {
|
||||
$newposcart[$j] = $poscart[$key];
|
||||
$newposcart[$j]['id'] = $j;
|
||||
$j++;
|
||||
@ -223,8 +217,7 @@ class Facturation
|
||||
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
|
||||
|
||||
$tab_size = count($tab);
|
||||
for ($i = 0; $i < $tab_size; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $tab_size; $i++) {
|
||||
// Total HT
|
||||
$remise = $tab[$i]['remise'];
|
||||
$total_ht += ($tab[$i]['total_ht']);
|
||||
@ -291,11 +284,9 @@ class Facturation
|
||||
public function id($aId = null)
|
||||
{
|
||||
|
||||
if (!$aId)
|
||||
{
|
||||
if (!$aId) {
|
||||
return $this->id;
|
||||
} elseif ($aId == 'RESET')
|
||||
{
|
||||
} elseif ($aId == 'RESET') {
|
||||
$this->id = null;
|
||||
} else {
|
||||
$this->id = $aId;
|
||||
@ -311,11 +302,9 @@ class Facturation
|
||||
public function ref($aRef = null)
|
||||
{
|
||||
|
||||
if (is_null($aRef))
|
||||
{
|
||||
if (is_null($aRef)) {
|
||||
return $this->ref;
|
||||
} elseif ($aRef == 'RESET')
|
||||
{
|
||||
} elseif ($aRef == 'RESET') {
|
||||
$this->ref = null;
|
||||
} else {
|
||||
$this->ref = $aRef;
|
||||
@ -330,11 +319,9 @@ class Facturation
|
||||
*/
|
||||
public function qte($aQte = null)
|
||||
{
|
||||
if (is_null($aQte))
|
||||
{
|
||||
if (is_null($aQte)) {
|
||||
return $this->qte;
|
||||
} elseif ($aQte == 'RESET')
|
||||
{
|
||||
} elseif ($aQte == 'RESET') {
|
||||
$this->qte = null;
|
||||
} else {
|
||||
$this->qte = $aQte;
|
||||
@ -350,11 +337,9 @@ class Facturation
|
||||
public function stock($aStock = null)
|
||||
{
|
||||
|
||||
if (is_null($aStock))
|
||||
{
|
||||
if (is_null($aStock)) {
|
||||
return $this->stock;
|
||||
} elseif ($aStock == 'RESET')
|
||||
{
|
||||
} elseif ($aStock == 'RESET') {
|
||||
$this->stock = null;
|
||||
} else {
|
||||
$this->stock = $aStock;
|
||||
@ -370,11 +355,9 @@ class Facturation
|
||||
public function remisePercent($aRemisePercent = null)
|
||||
{
|
||||
|
||||
if (is_null($aRemisePercent))
|
||||
{
|
||||
if (is_null($aRemisePercent)) {
|
||||
return $this->remise_percent;
|
||||
} elseif ($aRemisePercent == 'RESET')
|
||||
{
|
||||
} elseif ($aRemisePercent == 'RESET') {
|
||||
$this->remise_percent = null;
|
||||
} else {
|
||||
$this->remise_percent = $aRemisePercent;
|
||||
@ -564,11 +547,9 @@ class Facturation
|
||||
*/
|
||||
public function amountWithTax($aTotalTtc = null)
|
||||
{
|
||||
if (is_null($aTotalTtc))
|
||||
{
|
||||
if (is_null($aTotalTtc)) {
|
||||
return $this->prix_total_ttc;
|
||||
} elseif ($aTotalTtc == 'RESET')
|
||||
{
|
||||
} elseif ($aTotalTtc == 'RESET') {
|
||||
$this->prix_total_ttc = null;
|
||||
} else {
|
||||
$this->prix_total_ttc = $aTotalTtc;
|
||||
|
||||
@ -22,10 +22,18 @@
|
||||
*/
|
||||
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Uncomment creates pb to relogon after a disconnect
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
|
||||
require_once '../main.inc.php';
|
||||
|
||||
|
||||
@ -40,16 +40,21 @@ if (GETPOST('filtre', 'alpha')) {
|
||||
$ret = array(); $i = 0;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= ", ps.reel";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND p.tosell = 1";
|
||||
if (!$conf->global->CASHDESK_SERVICES) $sql .= " AND p.fk_product_type = 0";
|
||||
if (!$conf->global->CASHDESK_SERVICES) {
|
||||
$sql .= " AND p.fk_product_type = 0";
|
||||
}
|
||||
$sql .= " AND (";
|
||||
$sql .= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
|
||||
if (!empty($conf->barcode->enabled))
|
||||
{
|
||||
if (!empty($conf->barcode->enabled)) {
|
||||
$filtre = GETPOST('filtre', 'alpha');
|
||||
|
||||
//If the barcode looks like an EAN13 format and the last digit is included in it,
|
||||
@ -67,14 +72,11 @@ if (GETPOST('filtre', 'alpha')) {
|
||||
|
||||
dol_syslog("facturation.php", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$nbr_enreg = $db->num_rows($resql);
|
||||
|
||||
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql))
|
||||
{
|
||||
foreach ($tab as $cle => $valeur)
|
||||
{
|
||||
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) {
|
||||
foreach ($tab as $cle => $valeur) {
|
||||
$ret[$i][$cle] = $valeur;
|
||||
}
|
||||
$i++;
|
||||
@ -90,24 +92,27 @@ if (GETPOST('filtre', 'alpha')) {
|
||||
$i = 0;
|
||||
|
||||
$sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= ", ps.reel";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND p.tosell = 1";
|
||||
if (!$conf->global->CASHDESK_SERVICES) $sql .= " AND p.fk_product_type = 0";
|
||||
if (!$conf->global->CASHDESK_SERVICES) {
|
||||
$sql .= " AND p.fk_product_type = 0";
|
||||
}
|
||||
$sql .= " ORDER BY p.label";
|
||||
|
||||
dol_syslog($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$nbr_enreg = $db->num_rows($resql);
|
||||
|
||||
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql))
|
||||
{
|
||||
foreach ($tab as $cle => $valeur)
|
||||
{
|
||||
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) {
|
||||
foreach ($tab as $cle => $valeur) {
|
||||
$ret[$i][$cle] = $valeur;
|
||||
}
|
||||
$i++;
|
||||
@ -121,16 +126,13 @@ if (GETPOST('filtre', 'alpha')) {
|
||||
|
||||
//$nbr_enreg = count($tab_designations);
|
||||
|
||||
if ($nbr_enreg > 1)
|
||||
{
|
||||
if ($nbr_enreg > $conf_taille_listes)
|
||||
{
|
||||
if ($nbr_enreg > 1) {
|
||||
if ($nbr_enreg > $conf_taille_listes) {
|
||||
$top_liste_produits = '----- '.$conf_taille_listes.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----';
|
||||
} else {
|
||||
$top_liste_produits = '----- '.$nbr_enreg.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----';
|
||||
}
|
||||
} elseif ($nbr_enreg == 1)
|
||||
{
|
||||
} elseif ($nbr_enreg == 1) {
|
||||
$top_liste_produits = '----- 1 '.$langs->transnoentitiesnoconv("ProductFound").' -----';
|
||||
} else {
|
||||
$top_liste_produits = '----- '.$langs->transnoentitiesnoconv("NoProductFound").' -----';
|
||||
|
||||
@ -24,12 +24,24 @@
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
|
||||
// Change this following line to use the correct relative path (../, ../../, etc)
|
||||
require '../main.inc.php';
|
||||
@ -40,24 +52,30 @@ top_httphead('text/html');
|
||||
$search = GETPOST("code", "alpha");
|
||||
|
||||
// Search from criteria
|
||||
if (dol_strlen($search) >= 0) // If search criteria is on char length at least
|
||||
{
|
||||
if (dol_strlen($search) >= 0) { // If search criteria is on char length at least
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= ", ps.reel";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND p.tosell = 1";
|
||||
$sql .= " AND p.fk_product_type = 0";
|
||||
// Add criteria on ref/label
|
||||
if (!empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) {
|
||||
$sql .= " AND (p.ref LIKE '".$db->escape($search)."%' OR p.label LIKE '".$db->escape($search)."%'";
|
||||
if (!empty($conf->barcode->enabled)) $sql .= " OR p.barcode LIKE '".$db->escape($search)."%'";
|
||||
if (!empty($conf->barcode->enabled)) {
|
||||
$sql .= " OR p.barcode LIKE '".$db->escape($search)."%'";
|
||||
}
|
||||
$sql .= ")";
|
||||
} else {
|
||||
$sql .= " AND (p.ref LIKE '%".$db->escape($search)."%' OR p.label LIKE '%".$db->escape($search)."%'";
|
||||
if (!empty($conf->barcode->enabled)) $sql .= " OR p.barcode LIKE '%".$db->escape($search)."%'";
|
||||
if (!empty($conf->barcode->enabled)) {
|
||||
$sql .= " OR p.barcode LIKE '%".$db->escape($search)."%'";
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
$sql .= " ORDER BY label";
|
||||
@ -65,17 +83,13 @@ if (dol_strlen($search) >= 0) // If search criteria is on char length at least
|
||||
dol_syslog("facturation_dhtml.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($nbr = $db->num_rows($result))
|
||||
{
|
||||
if ($result) {
|
||||
if ($nbr = $db->num_rows($result)) {
|
||||
$resultat = '<ul class="dhtml_bloc">';
|
||||
|
||||
$ret = array(); $i = 0;
|
||||
while ($tab = $db->fetch_array($result))
|
||||
{
|
||||
foreach ($tab as $cle => $valeur)
|
||||
{
|
||||
while ($tab = $db->fetch_array($result)) {
|
||||
foreach ($tab as $cle => $valeur) {
|
||||
$ret[$i][$cle] = $valeur;
|
||||
}
|
||||
$i++;
|
||||
@ -83,8 +97,7 @@ if (dol_strlen($search) >= 0) // If search criteria is on char length at least
|
||||
$tab = $ret;
|
||||
|
||||
$tab_size = count($tab);
|
||||
for ($i = 0; $i < $tab_size; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $tab_size; $i++) {
|
||||
$resultat .= '
|
||||
<li class="dhtml_defaut" title="'.$tab[$i]['ref'].'"
|
||||
onMouseOver="javascript: this.className = \'dhtml_selection\';"
|
||||
|
||||
@ -35,36 +35,33 @@ $obj_facturation = unserialize($_SESSION['serObjFacturation']);
|
||||
unset($_SESSION['serObjFacturation']);
|
||||
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
switch ($action) {
|
||||
default:
|
||||
if ($_POST['hdnSource'] != 'NULL')
|
||||
{
|
||||
if ($_POST['hdnSource'] != 'NULL') {
|
||||
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.default_vat_code, p.recuperableonly";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= ", ps.reel";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= ", ps.reel";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
|
||||
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
|
||||
// Recuperation des donnees en fonction de la source (liste deroulante ou champ texte) ...
|
||||
if ($_POST['hdnSource'] == 'LISTE')
|
||||
{
|
||||
if ($_POST['hdnSource'] == 'LISTE') {
|
||||
$sql .= " AND p.rowid = ".((int) GETPOST('selProduit', 'int'));
|
||||
} elseif ($_POST['hdnSource'] == 'REF')
|
||||
{
|
||||
} elseif ($_POST['hdnSource'] == 'REF') {
|
||||
$sql .= " AND p.ref = '".$db->escape(GETPOST('txtRef', 'alpha'))."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
// ... et enregistrement dans l'objet
|
||||
if ($db->num_rows($result))
|
||||
{
|
||||
if ($db->num_rows($result)) {
|
||||
$ret = array();
|
||||
$tab = $db->fetch_array($result);
|
||||
foreach ($tab as $key => $value)
|
||||
{
|
||||
foreach ($tab as $key => $value) {
|
||||
$ret[$key] = $value;
|
||||
}
|
||||
// Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function
|
||||
@ -81,7 +78,9 @@ switch ($action)
|
||||
// Update if prices fields are defined
|
||||
$tva_tx = get_default_tva($mysoc, $societe, $product->id);
|
||||
$tva_npr = get_default_npr($mysoc, $societe, $product->id);
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
if (empty($tva_tx)) {
|
||||
$tva_npr = 0;
|
||||
}
|
||||
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
@ -89,19 +88,20 @@ switch ($action)
|
||||
$price_base_type = $prod->price_base_type;
|
||||
|
||||
// multiprix
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($societe->price_level))
|
||||
{
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($societe->price_level)) {
|
||||
$pu_ht = $prod->multiprices[$societe->price_level];
|
||||
$pu_ttc = $prod->multiprices_ttc[$societe->price_level];
|
||||
$price_min = $prod->multiprices_min[$societe->price_level];
|
||||
$price_base_type = $prod->multiprices_base_type[$societe->price_level];
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx = $prod->multiprices_tva_tx[$societe->price_level];
|
||||
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr = $prod->multiprices_recuperableonly[$societe->price_level];
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility
|
||||
if (isset($prod->multiprices_tva_tx[$societe->price_level])) {
|
||||
$tva_tx = $prod->multiprices_tva_tx[$societe->price_level];
|
||||
}
|
||||
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) {
|
||||
$tva_npr = $prod->multiprices_recuperableonly[$societe->price_level];
|
||||
}
|
||||
}
|
||||
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
|
||||
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
@ -109,17 +109,19 @@ switch ($action)
|
||||
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $societe->id);
|
||||
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (count($prodcustprice->lines) > 0)
|
||||
{
|
||||
if ($result >= 0) {
|
||||
if (count($prodcustprice->lines) > 0) {
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
|
||||
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||
}
|
||||
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
|
||||
if (empty($tva_tx)) $tva_npr = 0;
|
||||
if (empty($tva_tx)) {
|
||||
$tva_npr = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
|
||||
@ -133,10 +135,9 @@ switch ($action)
|
||||
if (!empty($price_ht)) {
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
elseif ($tmpvat != $tmpprodvat) {
|
||||
} elseif ($tmpvat != $tmpprodvat) {
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($price_base_type != 'HT') {
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
|
||||
} else {
|
||||
@ -155,11 +156,9 @@ switch ($action)
|
||||
$obj_facturation->vatrate = $vatrate; // Save vat rate (full text vat with code)
|
||||
|
||||
// Definition du filtre pour n'afficher que le produit concerne
|
||||
if ($_POST['hdnSource'] == 'LISTE')
|
||||
{
|
||||
if ($_POST['hdnSource'] == 'LISTE') {
|
||||
$filtre = $ret['ref'];
|
||||
} elseif ($_POST['hdnSource'] == 'REF')
|
||||
{
|
||||
} elseif ($_POST['hdnSource'] == 'REF') {
|
||||
$filtre = $_POST['txtRef'];
|
||||
}
|
||||
|
||||
@ -167,8 +166,7 @@ switch ($action)
|
||||
} else {
|
||||
$obj_facturation->raz();
|
||||
|
||||
if ($_POST['hdnSource'] == 'REF')
|
||||
{
|
||||
if ($_POST['hdnSource'] == 'REF') {
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.$_POST['txtRef'];
|
||||
} else {
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
@ -185,18 +183,15 @@ switch ($action)
|
||||
|
||||
case 'change_thirdparty': // We have clicked on button "Modify" a thirdparty
|
||||
$newthirdpartyid = GETPOST('CASHDESK_ID_THIRDPARTY', 'int');
|
||||
if ($newthirdpartyid > 0)
|
||||
{
|
||||
if ($newthirdpartyid > 0) {
|
||||
$_SESSION["CASHDESK_ID_THIRDPARTY"] = $newthirdpartyid;
|
||||
}
|
||||
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
|
||||
break;
|
||||
|
||||
case 'ajout_article': // We have clicked on button "Add product"
|
||||
|
||||
if (!empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it
|
||||
{
|
||||
case 'ajout_article':
|
||||
if (!empty($obj_facturation->id)) { // A product was previously selected and stored in session, so we can add it
|
||||
dol_syslog("facturation_verif save vat ".$_POST['selTva']);
|
||||
$obj_facturation->qte($_POST['txtQte']);
|
||||
$obj_facturation->tva($_POST['selTva']); // id of vat. Saved so we can use it for next product
|
||||
|
||||
@ -32,7 +32,9 @@ $conf_db_base = $dolibarr_main_db_name;
|
||||
$conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0);
|
||||
// Identifiant unique correspondant a l'entrepot a utiliser
|
||||
$conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0);
|
||||
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0.
|
||||
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
|
||||
$conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0.
|
||||
}
|
||||
|
||||
// Identifiant unique correspondant au compte caisse / liquide
|
||||
$conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0);
|
||||
|
||||
@ -26,7 +26,9 @@ function genkeypad($keypadname, $formname)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($conf->global->CASHDESK_SHOW_KEYPAD)) return '';
|
||||
if (empty($conf->global->CASHDESK_SHOW_KEYPAD)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// défine the font size of button
|
||||
$btnsize = 32;
|
||||
|
||||
@ -32,8 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$langs->loadLangs(array("admin", "cashdesk"));
|
||||
|
||||
// Test if user logged
|
||||
if ($_SESSION['uid'] > 0)
|
||||
{
|
||||
if ($_SESSION['uid'] > 0) {
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php');
|
||||
exit;
|
||||
}
|
||||
@ -72,8 +71,7 @@ if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
|
||||
<div class="menu_principal hideonsmartphone">
|
||||
<div class="logo">
|
||||
<?php
|
||||
if (!empty($mysoc->logo_small))
|
||||
{
|
||||
if (!empty($mysoc->logo_small)) {
|
||||
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
|
||||
} else {
|
||||
print '<div class="logopos">'.$mysoc->name.'</div>';
|
||||
@ -85,7 +83,9 @@ if (!empty($mysoc->logo_small))
|
||||
<div class="contenu">
|
||||
<div class="inline-block" style="vertical-align: top">
|
||||
<div class="principal_login">
|
||||
<?php if ($err) print dol_escape_htmltag($err)."<br><br>\n"; ?>
|
||||
<?php if ($err) {
|
||||
print dol_escape_htmltag($err)."<br><br>\n";
|
||||
} ?>
|
||||
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend>
|
||||
<form id="frmLogin" method="POST" action="index_verif.php">
|
||||
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
|
||||
@ -104,8 +104,7 @@ if (!empty($mysoc->logo_small))
|
||||
<?php
|
||||
if (!empty($morelogincontent)) {
|
||||
if (is_array($morelogincontent)) {
|
||||
foreach ($morelogincontent as $format => $option)
|
||||
{
|
||||
foreach ($morelogincontent as $format => $option) {
|
||||
if ($format == 'table') {
|
||||
echo '<!-- Option by hook -->';
|
||||
echo $option;
|
||||
@ -130,20 +129,23 @@ print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
|
||||
print '<td>';
|
||||
$disabled = 0;
|
||||
$langs->load("companies");
|
||||
if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled = 1; // If a particular third party is defined, we disable choice
|
||||
if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) {
|
||||
$disabled = 1; // If a particular third party is defined, we disable choice
|
||||
}
|
||||
print $form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client IN (1,3) AND s.status = 1)', !$disabled, $disabled, 0, array(), 0, 'maxwidth300');
|
||||
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK))
|
||||
{
|
||||
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
|
||||
$langs->load("stocks");
|
||||
print "<tr>";
|
||||
print '<td class="label1">'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td>';
|
||||
$disabled = 0;
|
||||
if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) $disabled = 1; // If a particular stock is defined, we disable choice
|
||||
if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) {
|
||||
$disabled = 1; // If a particular stock is defined, we disable choice
|
||||
}
|
||||
print $formproduct->selectWarehouses((GETPOST('warehouseid') ?GETPOST('warehouseid', 'int') : (empty($conf->global->CASHDESK_ID_WAREHOUSE) ? 'ifone' : $conf->global->CASHDESK_ID_WAREHOUSE)), 'warehouseid', '', !$disabled, $disabled);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
@ -153,7 +155,9 @@ print "<tr>";
|
||||
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>';
|
||||
print '<td>';
|
||||
$defaultknown = 0;
|
||||
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) $defaultknown = 1; // If a particular stock is defined, we disable choice
|
||||
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) {
|
||||
$defaultknown = 1; // If a particular stock is defined, we disable choice
|
||||
}
|
||||
$form->select_comptes(((GETPOST('bankid_cash') > 0) ?GETPOST('bankid_cash') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH), 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", ($defaultknown ? 0 : 2));
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
@ -162,7 +166,9 @@ print "<tr>";
|
||||
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
|
||||
print '<td>';
|
||||
$defaultknown = 0;
|
||||
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) && $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0) $defaultknown = 1; // If a particular stock is defined, we disable choice
|
||||
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) && $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0) {
|
||||
$defaultknown = 1; // If a particular stock is defined, we disable choice
|
||||
}
|
||||
$form->select_comptes(((GETPOST('bankid_cheque') > 0) ?GETPOST('bankid_cheque') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE), 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", ($defaultknown ? 0 : 2));
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
@ -171,7 +177,9 @@ print "<tr>";
|
||||
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>';
|
||||
print '<td>';
|
||||
$defaultknown = 0;
|
||||
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) && $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0) $defaultknown = 1; // If a particular stock is defined, we disable choice
|
||||
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) && $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0) {
|
||||
$defaultknown = 1; // If a particular stock is defined, we disable choice
|
||||
}
|
||||
$form->select_comptes(((GETPOST('bankid_cb') > 0) ?GETPOST('bankid_cb') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB), 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", ($defaultknown ? 0 : 2));
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
@ -195,8 +203,7 @@ print "</tr>\n";
|
||||
|
||||
|
||||
<?php
|
||||
if ($_GET['err'] < 0)
|
||||
{
|
||||
if ($_GET['err'] < 0) {
|
||||
echo ('<script type="text/javascript">');
|
||||
echo (' document.getElementById(\'frmLogin\').pwdPassword.focus();');
|
||||
echo ('</script>');
|
||||
|
||||
@ -42,36 +42,31 @@ $bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE") > 0) ?GETPOST("CASHD
|
||||
$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CB", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB;
|
||||
|
||||
// Check username
|
||||
if (empty($username))
|
||||
{
|
||||
if (empty($username)) {
|
||||
$retour = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Login"));
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
|
||||
exit;
|
||||
}
|
||||
// Check third party id
|
||||
if (!($thirdpartyid > 0))
|
||||
{
|
||||
if (!($thirdpartyid > 0)) {
|
||||
$retour = $langs->trans("ErrorFieldRequired", $langs->transnoentities("CashDeskThirdPartyForSell"));
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
|
||||
exit;
|
||||
}
|
||||
|
||||
// If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished.
|
||||
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !($warehouseid > 0))
|
||||
{
|
||||
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !($warehouseid > 0)) {
|
||||
$retour = $langs->trans("CashDeskYouDidNotDisableStockDecease");
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
|
||||
exit;
|
||||
}
|
||||
|
||||
// If stock decrease on bill validation, check user has stock edit permissions
|
||||
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !empty($username))
|
||||
{
|
||||
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !empty($username)) {
|
||||
$testuser = new User($db);
|
||||
$testuser->fetch(0, $username);
|
||||
$testuser->getrights('stock');
|
||||
if (empty($testuser->rights->stock->creer))
|
||||
{
|
||||
if (empty($testuser->rights->stock->creer)) {
|
||||
$retour = $langs->trans("UserNeedPermissionToEditStockToUsePos");
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
|
||||
exit;
|
||||
@ -83,8 +78,7 @@ if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_S
|
||||
$auth = new Auth($db);
|
||||
$retour = $auth->verif($username, $password);
|
||||
|
||||
if ($retour >= 0)
|
||||
{
|
||||
if ($retour >= 0) {
|
||||
$return = array();
|
||||
|
||||
$sql = "SELECT rowid, lastname, firstname";
|
||||
@ -93,12 +87,10 @@ if ($retour >= 0)
|
||||
$sql .= " AND entity IN (0,".$conf->entity.")";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$tab = $db->fetch_array($res);
|
||||
|
||||
foreach ($tab as $key => $value)
|
||||
{
|
||||
foreach ($tab as $key => $value) {
|
||||
$return[$key] = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -21,8 +21,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
if (empty($langs) || !is_object($langs)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -64,10 +63,11 @@ $id = $obj_facturation->id();
|
||||
// Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
|
||||
|
||||
$nbtoshow = $nbr_enreg;
|
||||
if (!empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) $nbtoshow = $conf_taille_listes;
|
||||
if (!empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) {
|
||||
$nbtoshow = $conf_taille_listes;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $nbtoshow; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nbtoshow; $i++) {
|
||||
if ($id == $tab_designations[$i]['rowid']) {
|
||||
$selected = 'selected';
|
||||
} else {
|
||||
@ -96,9 +96,9 @@ for ($i = 0; $i < $nbtoshow; $i++)
|
||||
<th><?php echo $langs->trans("Qty"); ?></th>
|
||||
<th><?php echo $langs->trans("PriceUHT"); ?></th>
|
||||
<th><?php echo $langs->trans("Discount"); ?> (%)</th>
|
||||
<th><?php echo $langs->trans("VATRate"); ?></th>
|
||||
<th><?php echo $langs->trans("VATRate"); ?></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" />
|
||||
<?php print genkeypad("txtQte", "frmQte"); ?>
|
||||
@ -106,20 +106,22 @@ for ($i = 0; $i < $nbtoshow; $i++)
|
||||
<!-- Show unit price -->
|
||||
<?php // TODO Remove the disabled and use this value when adding product into cart ?>
|
||||
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td>
|
||||
<!-- Choix de la remise -->
|
||||
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
|
||||
<!-- Choix de la remise -->
|
||||
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
|
||||
<?php print genkeypad("txtRemise", "frmQte"); ?>
|
||||
</td>
|
||||
<!-- Choix du taux de TVA -->
|
||||
<td class="select_tva center">
|
||||
<?php
|
||||
</td>
|
||||
<!-- Choix du taux de TVA -->
|
||||
<td class="select_tva center">
|
||||
<?php
|
||||
$vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
|
||||
|
||||
$buyer = new Societe($db);
|
||||
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
|
||||
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) {
|
||||
$buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
|
||||
}
|
||||
echo $form->load_tva('selTva', (GETPOSTISSET("selTva") ? GETPOST("selTva", 'alpha', 2) : $vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
|
||||
?>
|
||||
</td>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -130,8 +132,8 @@ for ($i = 0; $i < $nbtoshow; $i++)
|
||||
<input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
|
||||
</td>
|
||||
<td><?php echo $langs->trans("TotalHT"); ?></td>
|
||||
<!-- Affichage du total HT -->
|
||||
<td colspan="2"><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
|
||||
<!-- Affichage du total HT -->
|
||||
<td colspan="2"><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -165,25 +167,28 @@ for ($i = 0; $i < $nbtoshow; $i++)
|
||||
<div class="inline-block">
|
||||
<?php
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
|
||||
{
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0) {
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
|
||||
} else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
|
||||
} else {
|
||||
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
|
||||
{
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) {
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
|
||||
} else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
|
||||
} else {
|
||||
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
|
||||
{
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0) {
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete"), $langs->transnoentitiesnoconv("CashDesk")).'" />';
|
||||
} else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
|
||||
} else {
|
||||
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="clearboth">';
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
if (empty($langs) || !is_object($langs)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -48,10 +47,10 @@ $societe->fetch($thirdpartyid);
|
||||
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
|
||||
|
||||
$tab_size = count($tab);
|
||||
if ($tab_size <= 0) print '<div class="center">'.$langs->trans("NoArticle").'</div><br>';
|
||||
else {
|
||||
for ($i = 0; $i < $tab_size; $i++)
|
||||
{
|
||||
if ($tab_size <= 0) {
|
||||
print '<div class="center">'.$langs->trans("NoArticle").'</div><br>';
|
||||
} else {
|
||||
for ($i = 0; $i < $tab_size; $i++) {
|
||||
echo ('<div class="cadre_article">'."\n");
|
||||
echo ('<p><a href="facturation_verif.php?action=suppr_article&suppr_id='.$tab[$i]['id'].'" title="'.$langs->trans("DeleteArticle").'">'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</a></p>'."\n");
|
||||
|
||||
|
||||
@ -20,8 +20,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
if (empty($langs) || !is_object($langs)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -37,27 +36,23 @@ include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
|
||||
$companyLink = $company->getNomUrl(1);
|
||||
}*/
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
|
||||
{
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
|
||||
$bankcash = new Account($db);
|
||||
$bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]);
|
||||
$bankcash->label = $bankcash->ref;
|
||||
$bankcashLink = $bankcash->getNomUrl(1);
|
||||
}
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))
|
||||
{
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
|
||||
$bankcb = new Account($db);
|
||||
$bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]);
|
||||
$bankcbLink = $bankcb->getNomUrl(1);
|
||||
}
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))
|
||||
{
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
|
||||
$bankcheque = new Account($db);
|
||||
$bankcheque->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]);
|
||||
$bankchequeLink = $bankcheque->getNomUrl(1);
|
||||
}
|
||||
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled))
|
||||
{
|
||||
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled)) {
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]);
|
||||
$warehouseLink = $warehouse->getNomUrl(1);
|
||||
@ -87,8 +82,7 @@ print '</form>';
|
||||
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
|
||||
print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/
|
||||
print '<div class="clearboth">';
|
||||
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK))
|
||||
{
|
||||
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
|
||||
print $langs->trans("CashDeskWarehouse").': '.$warehouseLink;
|
||||
}
|
||||
print '</div></li></ul>';
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
if (empty($langs) || !is_object($langs)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -38,82 +37,81 @@ $object->fetch($facid);
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $langs->trans('PrintTicket') ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT; ?>/cashdesk/css/ticket.css">
|
||||
<head>
|
||||
<title><?php echo $langs->trans('PrintTicket') ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT; ?>/cashdesk/css/ticket.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="entete">
|
||||
<div class="logo">
|
||||
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">'; ?>
|
||||
</div>
|
||||
<div class="infos">
|
||||
<p class="address"><?php echo $mysoc->name; ?><br>
|
||||
<?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
|
||||
</p>
|
||||
<div class="logo">
|
||||
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">'; ?>
|
||||
</div>
|
||||
<div class="infos">
|
||||
<p class="address"><?php echo $mysoc->name; ?><br>
|
||||
<?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
|
||||
</p>
|
||||
|
||||
<p class="date_heure"><?php
|
||||
<p class="date_heure"><?php
|
||||
// Recuperation et affichage de la date et de l'heure
|
||||
$now = dol_now();
|
||||
print dol_print_date($now, 'dayhourtext').'<br>';
|
||||
print $object->ref;
|
||||
?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class="liste_articles">
|
||||
<thead>
|
||||
<thead>
|
||||
<tr class="titres">
|
||||
<th><?php print $langs->trans("Code"); ?></th>
|
||||
<th><?php print $langs->trans("Label"); ?></th>
|
||||
<th><?php print $langs->trans("Qty"); ?></th>
|
||||
<th><?php print $langs->trans("Discount").' (%)'; ?></th>
|
||||
<th><?php print $langs->trans("TotalHT"); ?></th>
|
||||
<th><?php print $langs->trans("Code"); ?></th>
|
||||
<th><?php print $langs->trans("Label"); ?></th>
|
||||
<th><?php print $langs->trans("Qty"); ?></th>
|
||||
<th><?php print $langs->trans("Discount").' (%)'; ?></th>
|
||||
<th><?php print $langs->trans("TotalHT"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$tab = array();
|
||||
$tab = $_SESSION['poscart'];
|
||||
|
||||
$tab_size = count($tab);
|
||||
for ($i = 0; $i < $tab_size; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $tab_size; $i++) {
|
||||
$remise = $tab[$i]['remise'];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $tab[$i]['ref']; ?></td>
|
||||
<td><?php echo $tab[$i]['label']; ?></td>
|
||||
<td><?php echo $tab[$i]['qte']; ?></td>
|
||||
<td><?php echo $tab[$i]['remise_percent']; ?></td>
|
||||
<td class="total"><?php echo price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
<tr>
|
||||
<td><?php echo $tab[$i]['ref']; ?></td>
|
||||
<td><?php echo $tab[$i]['label']; ?></td>
|
||||
<td><?php echo $tab[$i]['qte']; ?></td>
|
||||
<td><?php echo $tab[$i]['remise_percent']; ?></td>
|
||||
<td class="total"><?php echo price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table class="totaux">
|
||||
<tr>
|
||||
<th class="nowrap"><?php echo $langs->trans("TotalHT"); ?></th>
|
||||
<td class="nowrap"><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
|
||||
<th class="nowrap"><?php echo $langs->trans("TotalHT"); ?></th>
|
||||
<td class="nowrap"><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
|
||||
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
|
||||
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.print();
|
||||
window.print();
|
||||
</script>
|
||||
|
||||
<a class="lien" href="#" onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
|
||||
|
||||
@ -17,8 +17,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
if (empty($langs) || !is_object($langs)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -47,25 +46,27 @@ if ($obj_facturation->amountVat()) {
|
||||
<tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price(price2num($obj_facturation->amountWithTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
|
||||
<tr><td class="resume_label"><?php echo $langs->trans("PaymentMode"); ?> </td><td>
|
||||
<?php
|
||||
switch ($obj_facturation->getSetPaymentMode())
|
||||
{
|
||||
switch ($obj_facturation->getSetPaymentMode()) {
|
||||
case 'ESP':
|
||||
echo $langs->trans("Cash");
|
||||
$filtre = 'courant=2';
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
|
||||
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
|
||||
}
|
||||
break;
|
||||
case 'CB':
|
||||
echo $langs->trans("CreditCard");
|
||||
$filtre = 'courant=1';
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
|
||||
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
|
||||
}
|
||||
break;
|
||||
case 'CHQ':
|
||||
echo $langs->trans("Cheque");
|
||||
$filtre = 'courant=1';
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))
|
||||
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
|
||||
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
|
||||
}
|
||||
break;
|
||||
case 'DIF':
|
||||
echo $langs->trans("Reported");
|
||||
|
||||
@ -18,8 +18,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
if (empty($langs) || !is_object($langs)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -33,8 +33,7 @@ $hookmanager->initHooks(array('cashdeskTplTicket'));
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $obj_facturation);
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
require 'tpl/ticket.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
@ -36,8 +36,7 @@ $obj_facturation = unserialize($_SESSION['serObjFacturation']);
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$bankaccountid = GETPOST('cashdeskbank');
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
switch ($action) {
|
||||
default:
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
|
||||
break;
|
||||
@ -55,15 +54,18 @@ switch ($action)
|
||||
// To use a specific numbering module for POS, reset $conf->global->FACTURE_ADDON and other vars here
|
||||
// and restore values just after
|
||||
$sav_FACTURE_ADDON = '';
|
||||
if (!empty($conf->global->POS_ADDON))
|
||||
{
|
||||
if (!empty($conf->global->POS_ADDON)) {
|
||||
$sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
|
||||
$conf->global->FACTURE_ADDON = $conf->global->POS_ADDON;
|
||||
|
||||
// To force prefix only for POS with terre module
|
||||
if (!empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX;
|
||||
if (!empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) {
|
||||
$conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX;
|
||||
}
|
||||
// To force prefix only for POS with mars module
|
||||
if (!empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX;
|
||||
if (!empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) {
|
||||
$conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX;
|
||||
}
|
||||
// To force rule only for POS with mercure
|
||||
//...
|
||||
}
|
||||
@ -71,8 +73,7 @@ switch ($action)
|
||||
$num = $invoice->getNextNumRef($company);
|
||||
|
||||
// Restore save values
|
||||
if (!empty($sav_FACTURE_ADDON))
|
||||
{
|
||||
if (!empty($sav_FACTURE_ADDON)) {
|
||||
$conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
|
||||
}
|
||||
|
||||
@ -120,14 +121,12 @@ switch ($action)
|
||||
$heure = dol_print_date($now, 'hour');
|
||||
|
||||
$note = '';
|
||||
if (!is_object($obj_facturation))
|
||||
{
|
||||
if (!is_object($obj_facturation)) {
|
||||
dol_print_error('', 'Empty context');
|
||||
exit;
|
||||
}
|
||||
|
||||
switch ($obj_facturation->getSetPaymentMode())
|
||||
{
|
||||
switch ($obj_facturation->getSetPaymentMode()) {
|
||||
case 'DIF':
|
||||
$mode_reglement_id = 0;
|
||||
//$cond_reglement_id = dol_getIdFromCode($db,'RECEP','cond_reglement','code','rowid')
|
||||
@ -151,8 +150,12 @@ switch ($action)
|
||||
$cond_reglement_id = 0;
|
||||
break;
|
||||
}
|
||||
if (empty($mode_reglement_id)) $mode_reglement_id = 0; // If mode_reglement_id not found
|
||||
if (empty($cond_reglement_id)) $cond_reglement_id = 0; // If cond_reglement_id not found
|
||||
if (empty($mode_reglement_id)) {
|
||||
$mode_reglement_id = 0; // If mode_reglement_id not found
|
||||
}
|
||||
if (empty($cond_reglement_id)) {
|
||||
$cond_reglement_id = 0; // If cond_reglement_id not found
|
||||
}
|
||||
$note .= $_POST['txtaNotes'];
|
||||
dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id);
|
||||
|
||||
@ -175,8 +178,7 @@ switch ($action)
|
||||
|
||||
// Loop on each line into cart
|
||||
$tab_liste_size = count($tab_liste);
|
||||
for ($i = 0; $i < $tab_liste_size; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $tab_liste_size; $i++) {
|
||||
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
|
||||
$vat_rate = $tmp['rate'];
|
||||
$vat_npr = $tmp['npr'];
|
||||
@ -218,32 +220,32 @@ switch ($action)
|
||||
//print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit;
|
||||
|
||||
// Si paiement differe ...
|
||||
if ($obj_facturation->getSetPaymentMode() == 'DIF')
|
||||
{
|
||||
if ($obj_facturation->getSetPaymentMode() == 'DIF') {
|
||||
$resultcreate = $invoice->create($user, 0, dol_stringtotime($obj_facturation->paiementLe()));
|
||||
if ($resultcreate > 0)
|
||||
{
|
||||
if ($resultcreate > 0) {
|
||||
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
|
||||
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
|
||||
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
|
||||
$warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
|
||||
}
|
||||
|
||||
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
|
||||
|
||||
if ($warehouseidtodecrease > 0)
|
||||
{
|
||||
if ($warehouseidtodecrease > 0) {
|
||||
// Decrease
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
// Loop on each line
|
||||
$cpt = count($invoice->lines);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
if ($invoice->lines[$i]->fk_product > 0)
|
||||
{
|
||||
for ($i = 0; $i < $cpt; $i++) {
|
||||
if ($invoice->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($db);
|
||||
$mouvP->origin = &$invoice;
|
||||
// We decrease stock for product
|
||||
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
else $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
|
||||
$result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
} else {
|
||||
$result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
}
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
@ -258,29 +260,30 @@ switch ($action)
|
||||
$id = $invoice->id;
|
||||
} else {
|
||||
$resultcreate = $invoice->create($user, 0, 0);
|
||||
if ($resultcreate > 0)
|
||||
{
|
||||
if ($resultcreate > 0) {
|
||||
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
|
||||
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
|
||||
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
|
||||
$warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
|
||||
}
|
||||
|
||||
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
|
||||
|
||||
if ($warehouseidtodecrease > 0)
|
||||
{
|
||||
if ($warehouseidtodecrease > 0) {
|
||||
// Decrease
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
$langs->load("agenda");
|
||||
// Loop on each line
|
||||
$cpt = count($invoice->lines);
|
||||
for ($i = 0; $i < $cpt; $i++)
|
||||
{
|
||||
if ($invoice->lines[$i]->fk_product > 0)
|
||||
{
|
||||
for ($i = 0; $i < $cpt; $i++) {
|
||||
if ($invoice->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($db);
|
||||
$mouvP->origin = &$invoice;
|
||||
// We decrease stock for product
|
||||
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
else $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
|
||||
$result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
} else {
|
||||
$result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
|
||||
}
|
||||
if ($result < 0) {
|
||||
setEventMessages($mouvP->error, $mouvP->errors, 'errors');
|
||||
$error++;
|
||||
@ -301,26 +304,21 @@ switch ($action)
|
||||
$payment->num_payment = '';
|
||||
|
||||
$paiement_id = $payment->create($user);
|
||||
if ($paiement_id > 0)
|
||||
{
|
||||
if (!$error)
|
||||
{
|
||||
if ($paiement_id > 0) {
|
||||
if (!$error) {
|
||||
$result = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccountid, '', '');
|
||||
if (!$result > 0)
|
||||
{
|
||||
if (!$result > 0) {
|
||||
$errmsg = $paiement->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
if ($invoice->total_ttc == $obj_facturation->amountWithTax()
|
||||
&& $obj_facturation->getSetPaymentMode() != 'DIFF')
|
||||
{
|
||||
&& $obj_facturation->getSetPaymentMode() != 'DIFF') {
|
||||
// We set status to paid
|
||||
$result = $invoice->setPaid($user);
|
||||
//print 'set paid';exit;
|
||||
//print 'set paid';exit;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -334,8 +332,7 @@ switch ($action)
|
||||
}
|
||||
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
$redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
|
||||
} else {
|
||||
|
||||
@ -559,7 +559,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Paid
|
||||
* VAT Paid
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("VATPaid"), '', '');
|
||||
@ -586,47 +586,6 @@ $sql .= " ORDER BY dm ASC, mode ASC";
|
||||
|
||||
pt($db, $sql, $langs->trans("Month"));
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Recap
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation
|
||||
|
||||
$sql1 = "SELECT SUM(amount) as mm";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."tva as f";
|
||||
$sql1 .= " WHERE f.entity = ".$conf->entity;
|
||||
$sql1 .= " AND f.datev >= '".$db->idate($date_start)."'";
|
||||
$sql1 .= " AND f.datev <= '".$db->idate($date_end)."'";
|
||||
|
||||
$result = $db->query($sql1);
|
||||
if ($result) {
|
||||
$obj = $db->fetch_object($result);
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="right">'.$langs->trans("VATDue").'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($total, 'MT')).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="right">'.$langs->trans("VATPaid").'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($obj->mm, 'MT'))."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$restopay = $total - $obj->mm;
|
||||
print "<tr>";
|
||||
print '<td class="right">'.$langs->trans("RemainToPay").'</td>';
|
||||
print '<td class="nowrap right">'.price(price2num($restopay, 'MT')).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div></div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -1810,7 +1810,7 @@ class Contact extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".$this->id." AND entity IN (".getEntity("societe_contact").")";
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".((int) $this->id)." AND entity IN (".getEntity("societe_contact").")";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
|
||||
@ -40,13 +40,17 @@ $form = new Form($db);
|
||||
// List of supported format
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
foreach ($tmptype2label as $key => $val) {
|
||||
$type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'contrat'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -78,8 +82,7 @@ print dol_get_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
@ -92,8 +95,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($action == 'create') {
|
||||
print '<br><div name="topofform" id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
@ -105,8 +107,7 @@ if ($action == 'create')
|
||||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print '<div name="topofform"></div><br>';
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
|
||||
@ -40,13 +40,17 @@ $form = new Form($db);
|
||||
// List of supported format
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
foreach ($tmptype2label as $key => $val) {
|
||||
$type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'contratdet'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -78,8 +82,7 @@ print dol_get_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
@ -92,8 +95,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
@ -105,8 +107,7 @@ if ($action == 'create')
|
||||
/* Edition d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
|
||||
@ -35,10 +35,11 @@ if (!empty($conf->projet->enabled)) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "contracts"));
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
if (!count($actioncode)) {
|
||||
$actioncode = '0';
|
||||
}
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
@ -50,19 +51,27 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id, '');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = 'a.datep,a.id';
|
||||
if (!$sortorder) $sortorder = 'DESC,DESC';
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'a.datep,a.id';
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC,DESC';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('agendacontract', 'globalcard'));
|
||||
@ -74,20 +83,19 @@ $hookmanager->initHooks(array('agendacontract', 'globalcard'));
|
||||
|
||||
$parameters = array('id'=>$id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage))
|
||||
{
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$actioncode = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
@ -102,19 +110,18 @@ if (empty($reshook))
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
}
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
if ($id > 0) {
|
||||
// Load object modContract
|
||||
$module = (!empty($conf->global->CONTRACT_ADDON) ? $conf->global->CONTRACT_ADDON : 'mod_contract_serpis');
|
||||
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php')
|
||||
{
|
||||
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') {
|
||||
$module = substr($module, 0, dol_strlen($module) - 4);
|
||||
}
|
||||
$result = dol_include_once('/core/modules/contract/'.$module.'.php');
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$modCodeContract = new $module();
|
||||
}
|
||||
|
||||
@ -126,10 +133,14 @@ if ($id > 0)
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$title = $langs->trans("Agenda");
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) $title = $object->ref." - ".$title;
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) {
|
||||
$title = $object->ref." - ".$title;
|
||||
}
|
||||
llxHeader('', $title);
|
||||
|
||||
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
$langs->load("mails");
|
||||
}
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
print dol_get_fiche_head($head, 'agenda', $langs->trans("Contract"), -1, 'contract');
|
||||
@ -156,14 +167,14 @@ if ($id > 0)
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
||||
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
}
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
@ -231,21 +242,22 @@ if ($id > 0)
|
||||
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($conf->agenda->enabled))
|
||||
{
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
|
||||
{
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
print '<br>';
|
||||
|
||||
$param = '&id='.$id;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.$contextpage;
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.$limit;
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("ActionsOnContract"), $newcardbutton, '');
|
||||
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -113,28 +113,37 @@ class Contracts extends DolibarrApi
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) {
|
||||
$search_sale = DolibarrApiAccess::$user->id;
|
||||
}
|
||||
|
||||
$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)
|
||||
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."contrat 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
|
||||
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 t.entity IN ('.getEntity('contrat').')';
|
||||
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
|
||||
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)
|
||||
{
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
@ -143,8 +152,7 @@ class Contracts extends DolibarrApi
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
@ -155,13 +163,11 @@ class Contracts extends DolibarrApi
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i = 0;
|
||||
while ($i < $min)
|
||||
{
|
||||
while ($i < $min) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$contrat_static = new Contrat($this->db);
|
||||
if ($contrat_static->fetch($obj->rowid)) {
|
||||
@ -196,12 +202,12 @@ class Contracts extends DolibarrApi
|
||||
$this->contract->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
}
|
||||
$this->contract->lines = $lines;
|
||||
}*/
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
}
|
||||
$this->contract->lines = $lines;
|
||||
}*/
|
||||
if ($this->contract->create(DolibarrApiAccess::$user) < 0) {
|
||||
throw new RestException(500, "Error creating contract", array_merge(array($this->contract->error), $this->contract->errors));
|
||||
}
|
||||
@ -491,7 +497,9 @@ class Contracts extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
$this->contract->$field = $value;
|
||||
}
|
||||
|
||||
@ -667,8 +675,9 @@ class Contracts extends DolibarrApi
|
||||
{
|
||||
$contrat = array();
|
||||
foreach (Contracts::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
if (!isset($data[$field])) {
|
||||
throw new RestException(400, "$field field missing");
|
||||
}
|
||||
$contrat[$field] = $data[$field];
|
||||
}
|
||||
return $contrat;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,9 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$object = new Contrat($db);
|
||||
@ -56,19 +58,16 @@ $hookmanager->initHooks(array('contractcard', 'globalcard'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
if ($result > 0 && $id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
} else {
|
||||
@ -84,10 +83,8 @@ if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
if ($action == 'swapstatut' && $user->rights->contrat->creer) {
|
||||
if ($object->fetch($id)) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
@ -95,13 +92,11 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
}
|
||||
|
||||
// Delete contact
|
||||
if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($action == 'deletecontact' && $user->rights->contrat->creer) {
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($_GET["lineid"]);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
@ -125,10 +120,8 @@ $userstatic = new User($db);
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
if ($object->fetch($id, $ref) > 0)
|
||||
{
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
if ($object->fetch($id, $ref) > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = contract_prepare_head($object);
|
||||
@ -146,9 +139,9 @@ if ($id > 0 || !empty($ref))
|
||||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref .= $object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
// Ref customer
|
||||
@ -213,8 +206,11 @@ if ($id > 0 || !empty($ref))
|
||||
}
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($absolute_discount) {
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
} else {
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
}
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -46,8 +46,7 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
unset($_GET["action"]);
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
@ -59,18 +58,23 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "name";
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "name";
|
||||
}
|
||||
|
||||
|
||||
$object = new Contrat($db);
|
||||
$object->fetch($id, $ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
@ -97,8 +101,7 @@ $form = new Form($db);
|
||||
llxHeader('', $langs->trans("Contract"), "");
|
||||
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
if ($object->id) {
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
print dol_get_fiche_head($head, 'documents', $langs->trans("Contract"), -1, 'contract');
|
||||
@ -107,8 +110,7 @@ if ($object->id)
|
||||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file)
|
||||
{
|
||||
foreach ($filearray as $key => $file) {
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
@ -136,17 +138,18 @@ if ($object->id)
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
||||
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
}
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref .= ' : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
|
||||
@ -46,7 +46,9 @@ $statut = GETPOST('statut') ?GETPOST('statut') : 1;
|
||||
// Security check
|
||||
$socid = 0;
|
||||
$id = GETPOST('id', 'int');
|
||||
if (!empty($user->socid)) $socid = $user->socid;
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$staticcompany = new Societe($db);
|
||||
@ -78,11 +80,9 @@ print load_fiche_titre($langs->trans("ContractsArea"), '', 'contract');
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
|
||||
{
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
|
||||
// Search contract
|
||||
if (!empty($conf->contrat->enabled))
|
||||
{
|
||||
if (!empty($conf->contrat->enabled)) {
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/list.php">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
@ -112,26 +112,28 @@ $vals = array();
|
||||
$sql = "SELECT count(cd.rowid) as nb, cd.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now)."')))";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) {
|
||||
$sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
$sql .= " GROUP BY cd.statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
if ($obj) {
|
||||
$nb[$obj->status] = $obj->nb;
|
||||
if ($obj->status != 5)
|
||||
{
|
||||
if ($obj->status != 5) {
|
||||
$vals[$obj->status] = $obj->nb;
|
||||
$totalinprocess += $obj->nb;
|
||||
}
|
||||
@ -147,28 +149,30 @@ if ($resql)
|
||||
$sql = "SELECT count(cd.rowid) as nb, cd.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now)."')";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) {
|
||||
$sql .= ' AND c.fk_soc = '.$user->socid;
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
$sql .= " GROUP BY cd.statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// 0 inactive, 4 active, 5 closed
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
if ($obj) {
|
||||
$nb[$obj->status.true] = $obj->nb;
|
||||
if ($obj->status != 5)
|
||||
{
|
||||
if ($obj->status != 5) {
|
||||
$vals[$obj->status.true] = $obj->nb;
|
||||
$totalinprocess += $obj->nb;
|
||||
}
|
||||
@ -189,26 +193,34 @@ print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Services").'</th></tr>'."\n";
|
||||
$listofstatus = array(0, 4, 4, 5); $bool = false;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
foreach ($listofstatus as $status) {
|
||||
$dataseries[] = array($staticcontratligne->LibStatut($status, 1, ($bool ? 1 : 0)), (isset($nb[$status.$bool]) ? (int) $nb[$status.$bool] : 0));
|
||||
if ($status == ContratLigne::STATUS_INITIAL) $colorseries[$status.$bool] = '-'.$badgeStatus0;
|
||||
if ($status == ContratLigne::STATUS_OPEN && !$bool) $colorseries[$status.$bool] = $badgeStatus4;
|
||||
if ($status == ContratLigne::STATUS_OPEN && $bool) $colorseries[$status.$bool] = $badgeStatus1;
|
||||
if ($status == ContratLigne::STATUS_CLOSED) $colorseries[$status.$bool] = $badgeStatus6;
|
||||
if ($status == ContratLigne::STATUS_INITIAL) {
|
||||
$colorseries[$status.$bool] = '-'.$badgeStatus0;
|
||||
}
|
||||
if ($status == ContratLigne::STATUS_OPEN && !$bool) {
|
||||
$colorseries[$status.$bool] = $badgeStatus4;
|
||||
}
|
||||
if ($status == ContratLigne::STATUS_OPEN && $bool) {
|
||||
$colorseries[$status.$bool] = $badgeStatus1;
|
||||
}
|
||||
if ($status == ContratLigne::STATUS_CLOSED) {
|
||||
$colorseries[$status.$bool] = $badgeStatus6;
|
||||
}
|
||||
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
|
||||
print '<td class="right"><a href="services_list.php?mode='.$status.($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($status == 4 && !$bool) $bool = true;
|
||||
else $bool = false;
|
||||
if ($status == 4 && !$bool) {
|
||||
$bool = true;
|
||||
} else {
|
||||
$bool = false;
|
||||
}
|
||||
}
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<tr class="impair"><td class="center" colspan="2">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
@ -225,15 +237,16 @@ if (!empty($conf->use_javascript_ajax))
|
||||
print '</td></tr>';
|
||||
}
|
||||
$listofstatus = array(0, 4, 4, 5); $bool = false;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
foreach ($listofstatus as $status) {
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status, 0, ($bool ? 1 : 0)).'</td>';
|
||||
print '<td class="right"><a href="services_list.php?mode='.$status.($bool ? '&filter=expired' : '').'">'.($nb[$status.$bool] ? $nb[$status.$bool] : 0).' '.$staticcontratligne->LibStatut($status, 3, ($bool ? 1 : 0)).'</a></td>';
|
||||
if ($status == 4 && !$bool) $bool = true;
|
||||
else $bool = false;
|
||||
if ($status == 4 && !$bool) {
|
||||
$bool = true;
|
||||
} else {
|
||||
$bool = false;
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -245,36 +258,38 @@ print "</table></div><br>";
|
||||
|
||||
// Draft contracts
|
||||
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
|
||||
$sql = "SELECT c.rowid, c.ref,";
|
||||
$sql .= " s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = c.fk_soc";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql .= " AND c.statut = 0";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".$socid;
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftContracts").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
if ($num)
|
||||
{
|
||||
if ($num) {
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
//$tot_ttc = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticcontrat->ref = $obj->ref;
|
||||
@ -319,22 +334,27 @@ $sql .= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AN
|
||||
$sql .= ' sum('.$db->ifsql("cd.statut=5", 1, 0).') as nb_closed,';
|
||||
$sql .= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom as name, s.rowid as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql .= " AND c.statut > 0";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid";
|
||||
$sql .= " ORDER BY c.tms DESC";
|
||||
$sql .= " LIMIT ".$max;
|
||||
|
||||
dol_syslog("contrat/index.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
@ -347,8 +367,7 @@ if ($result)
|
||||
print '<th class="center" width="80" colspan="4">'.$langs->trans("Services").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -356,7 +375,9 @@ if ($result)
|
||||
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
|
||||
$staticcontrat->id = $obj->cid;
|
||||
print $staticcontrat->getNomUrl(1, 16);
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
if ($obj->nb_late) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id = $obj->socid;
|
||||
@ -388,19 +409,24 @@ $sql .= " s.nom as name,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql .= ") LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql .= " AND cd.fk_contrat = c.rowid";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY cd.tms DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
@ -410,8 +436,7 @@ if ($resql)
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("LastModifiedServices", $max).'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num, $max))
|
||||
{
|
||||
while ($i < min($num, $max)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -422,8 +447,7 @@ if ($resql)
|
||||
//if (1 == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
@ -431,8 +455,11 @@ if ($resql)
|
||||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note, 20);
|
||||
if ($obj->label) {
|
||||
print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
} else {
|
||||
print '</a> '.dol_trunc($obj->note, 20);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -462,7 +489,9 @@ $sql .= " s.nom as name,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql .= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
@ -470,13 +499,16 @@ $sql .= " AND c.statut = 1";
|
||||
$sql .= " AND cd.statut = 0";
|
||||
$sql .= " AND cd.fk_contrat = c.rowid";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY cd.tms DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
@ -486,8 +518,7 @@ if ($resql)
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -498,8 +529,7 @@ if ($resql)
|
||||
print $staticcontrat->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
@ -507,8 +537,11 @@ if ($resql)
|
||||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note, 20);
|
||||
if ($obj->label) {
|
||||
print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
} else {
|
||||
print '</a> '.dol_trunc($obj->note, 20);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -537,7 +570,9 @@ $sql .= " s.nom as name,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql .= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
@ -546,13 +581,16 @@ $sql .= " AND cd.statut = 4";
|
||||
$sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
$sql .= " AND cd.fk_contrat = c.rowid";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
$sql .= " ORDER BY cd.tms DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
@ -562,8 +600,7 @@ if ($resql)
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -574,8 +611,7 @@ if ($resql)
|
||||
print $staticcontrat->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->fk_product > 0)
|
||||
{
|
||||
if ($obj->fk_product > 0) {
|
||||
$productstatic->id = $obj->fk_product;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
@ -583,8 +619,11 @@ if ($resql)
|
||||
print $productstatic->getNomUrl(1, '', 20);
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"), "service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
else print '</a> '.dol_trunc($obj->note, 20);
|
||||
if ($obj->label) {
|
||||
print ' '.dol_trunc($obj->label, 20).'</a>';
|
||||
} else {
|
||||
print '</a> '.dol_trunc($obj->note, 20);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
||||
@ -76,16 +76,24 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = 'c.ref';
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'c.ref';
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = 'DESC';
|
||||
}
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id', 'int');
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$diroutputmassaction = $conf->contrat->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
@ -93,7 +101,9 @@ $diroutputmassaction = $conf->contrat->dir_output.'/temp/massgeneration/'.$user-
|
||||
$staticcontrat = new Contrat($db);
|
||||
$staticcontratligne = new ContratLigne($db);
|
||||
|
||||
if ($search_status == '') $search_status = 1;
|
||||
if ($search_status == '') {
|
||||
$search_status = 1;
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Contrat($db);
|
||||
@ -112,7 +122,9 @@ $fieldstosearchall = array(
|
||||
's.nom'=>"ThirdParty",
|
||||
'c.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"] = "NotePrivate";
|
||||
if (empty($user->socid)) {
|
||||
$fieldstosearchall["c.note_private"] = "NotePrivate";
|
||||
}
|
||||
|
||||
$arrayfields = array(
|
||||
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>10),
|
||||
@ -142,18 +154,23 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||
$day = '';
|
||||
$month = '';
|
||||
$year = '';
|
||||
@ -180,8 +197,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
$objectclass = 'Contrat';
|
||||
$objectlabel = 'Contracts';
|
||||
$permissiontoread = $user->rights->contrat->lire;
|
||||
@ -216,7 +232,9 @@ $sql .= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AN
|
||||
$sql .= ' SUM('.$db->ifsql("cd.statut=5", 1, 0).') as nb_closed';
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
@ -226,34 +244,60 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
if ($search_user > 0)
|
||||
{
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= ' AND c.entity IN ('.getEntity('contract').')';
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
||||
if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$db->escape($socid);
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
|
||||
}
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".$db->escape($socid);
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
$sql .= dolSqlDateFilter('c.date_contrat', $day, $month, $year);
|
||||
if ($search_name) $sql .= natural_search('s.nom', $search_name);
|
||||
if ($search_email) $sql .= natural_search('s.email', $search_email);
|
||||
if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
|
||||
if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
if ($search_name) {
|
||||
$sql .= natural_search('s.nom', $search_name);
|
||||
}
|
||||
if ($search_email) {
|
||||
$sql .= natural_search('s.email', $search_email);
|
||||
}
|
||||
if ($search_contract) {
|
||||
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
}
|
||||
if (!empty($search_ref_customer)) {
|
||||
$sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
|
||||
}
|
||||
if (!empty($search_ref_supplier)) {
|
||||
$sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
}
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@ -266,34 +310,36 @@ $sql .= " typent.code,";
|
||||
$sql .= " state.code_departement, state.nom";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
if ($search_dfyear > 0 && $search_op2df)
|
||||
{
|
||||
if ($search_op2df == '<=') $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
elseif ($search_op2df == '>=') $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
else $sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
if ($search_dfyear > 0 && $search_op2df) {
|
||||
if ($search_op2df == '<=') {
|
||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
} elseif ($search_op2df == '>=') {
|
||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
} else {
|
||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||
}
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
@ -302,8 +348,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
@ -311,8 +356,7 @@ if (!$resql)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall && !$page)
|
||||
{
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id);
|
||||
@ -329,31 +373,66 @@ $i = 0;
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
if ($socid > 0)
|
||||
{
|
||||
if ($socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
if (empty($search_name)) $search_name = $soc->name;
|
||||
if (empty($search_name)) {
|
||||
$search_name = $soc->name;
|
||||
}
|
||||
}
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($sall != '') $param .= '&sall='.urlencode($sall);
|
||||
if ($search_contract != '') $param .= '&search_contract='.urlencode($search_contract);
|
||||
if ($search_name != '') $param .= '&search_name='.urlencode($search_name);
|
||||
if ($search_email != '') $param .= '&search_email='.urlencode($search_email);
|
||||
if ($search_ref_customer != '') $param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||
if ($search_ref_supplier != '') $param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
if ($search_op2df != '') $param .= '&search_op2df='.urlencode($search_op2df);
|
||||
if ($search_dfyear != '') $param .= '&search_dfyear='.urlencode($search_dfyear);
|
||||
if ($search_dfmonth != '') $param .= '&search_dfmonth='.urlencode($search_dfmonth);
|
||||
if ($search_sale != '') $param .= '&search_sale='.urlencode($search_sale);
|
||||
if ($search_user != '') $param .= '&search_user='.urlencode($search_user);
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
|
||||
if ($show_files) $param .= '&show_files='.urlencode($show_files);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
if ($sall != '') {
|
||||
$param .= '&sall='.urlencode($sall);
|
||||
}
|
||||
if ($search_contract != '') {
|
||||
$param .= '&search_contract='.urlencode($search_contract);
|
||||
}
|
||||
if ($search_name != '') {
|
||||
$param .= '&search_name='.urlencode($search_name);
|
||||
}
|
||||
if ($search_email != '') {
|
||||
$param .= '&search_email='.urlencode($search_email);
|
||||
}
|
||||
if ($search_ref_customer != '') {
|
||||
$param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||
}
|
||||
if ($search_ref_supplier != '') {
|
||||
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
}
|
||||
if ($search_op2df != '') {
|
||||
$param .= '&search_op2df='.urlencode($search_op2df);
|
||||
}
|
||||
if ($search_dfyear != '') {
|
||||
$param .= '&search_dfyear='.urlencode($search_dfyear);
|
||||
}
|
||||
if ($search_dfmonth != '') {
|
||||
$param .= '&search_dfmonth='.urlencode($search_dfmonth);
|
||||
}
|
||||
if ($search_sale != '') {
|
||||
$param .= '&search_sale='.urlencode($search_sale);
|
||||
}
|
||||
if ($search_user != '') {
|
||||
$param .= '&search_user='.urlencode($search_user);
|
||||
}
|
||||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
|
||||
}
|
||||
if ($search_product_category != '') {
|
||||
$param .= '&search_product_category='.urlencode($search_product_category);
|
||||
}
|
||||
if ($show_files) {
|
||||
$param .= '&show_files='.urlencode($show_files);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -363,16 +442,24 @@ $arrayofmassactions = array(
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
if ($user->rights->contrat->supprimer) {
|
||||
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$url = DOL_URL_ROOT.'/contrat/card.php?action=create';
|
||||
if (!empty($socid)) $url .= '&socid='.$socid;
|
||||
if (!empty($socid)) {
|
||||
$url .= '&socid='.$socid;
|
||||
}
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
@ -388,17 +475,17 @@ $objecttmp = new Contrat($db);
|
||||
$trackid = 'con'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
if ($sall) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
if ($user->rights->societe->client->voir || $socid) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
|
||||
@ -406,16 +493,14 @@ if ($user->rights->societe->client->voir || $socid)
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view other users
|
||||
if ($user->rights->user->user->lire)
|
||||
{
|
||||
if ($user->rights->user->user->lire) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
|
||||
$moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$moreforfilter .= '</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view categories of products
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
{
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
@ -426,11 +511,13 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($use
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
@ -438,77 +525,75 @@ if (!empty($moreforfilter))
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
if ($massactionbutton) {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.email']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.email']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||
}
|
||||
// Zip
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
}
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Company type
|
||||
if (!empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['typent.code']['checked'])) {
|
||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) {
|
||||
// Date contract
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
//print $langs->trans('Month').': ';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.$day.'">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.$day.'">';
|
||||
}
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.$month.'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$syear = $year;
|
||||
@ -523,20 +608,17 @@ $parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// First end date
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
|
||||
print '<td class="liste_titre nowraponall center">';
|
||||
$arrayofoperators = array('0'=>'', '='=>'=', '<='=>'<=', '>='=>'>=');
|
||||
print $form->selectarray('search_op2df', $arrayofoperators, $search_op2df, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth50imp');
|
||||
@ -547,8 +629,7 @@ if (!empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td class="liste_titre right" colspan="4"></td>';
|
||||
}
|
||||
print '<td class="liste_titre center">';
|
||||
@ -558,18 +639,42 @@ print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.email']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['typent.code']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -598,8 +703,7 @@ $totalarray = array();
|
||||
$typenArray = array();
|
||||
$cacheCountryIDCode = array();
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$contracttmp->ref = $obj->ref;
|
||||
@ -632,11 +736,12 @@ while ($i < min($num, $limit))
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
print $contracttmp->getNomUrl(1);
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
if ($obj->nb_late) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
if (!empty($obj->note_private) || !empty($obj->note_public)) {
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'&save_lastsearch_values=1">'.img_picto($langs->trans("ViewPrivateNote"), 'note').'</a>';
|
||||
@ -652,16 +757,13 @@ while ($i < min($num, $limit))
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_customer']['checked'])) {
|
||||
print '<td>'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).'</td>';
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
|
||||
print '<td>'.$obj->ref_supplier.'</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">';
|
||||
if ($obj->socid > 0) {
|
||||
// TODO Use a cache for this string
|
||||
@ -669,57 +771,63 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['s.email']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.email']['checked'])) {
|
||||
print '<td>'.$obj->email.'</td>';
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Zip
|
||||
if (!empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.zip']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print $socstatic->country;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Type ent
|
||||
if (!empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['typent.code']['checked'])) {
|
||||
print '<td class="center">';
|
||||
if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
|
||||
if (count($typenArray) == 0) {
|
||||
$typenArray = $formcompany->typent_array(1);
|
||||
}
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['sale_representative']['checked'])) {
|
||||
// Sales representatives
|
||||
print '<td>';
|
||||
if ($obj->socid > 0)
|
||||
{
|
||||
if ($obj->socid > 0) {
|
||||
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
|
||||
if ($listsalesrepresentatives < 0) dol_print_error($db);
|
||||
if ($listsalesrepresentatives < 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 6) {
|
||||
// We print only number
|
||||
@ -756,8 +864,7 @@ while ($i < min($num, $limit))
|
||||
print '</td>';
|
||||
}
|
||||
// Date
|
||||
if (!empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.date_contrat']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').'</td>';
|
||||
}
|
||||
// Extra fields
|
||||
@ -767,32 +874,34 @@ while ($i < min($num, $limit))
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.datec']['checked'])) {
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.tms']['checked'])) {
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date lower end date
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
|
||||
print '<td class="center nowrapforall">';
|
||||
print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td class="center">'.($obj->nb_initial > 0 ? $obj->nb_initial : '').'</td>';
|
||||
print '<td class="center">'.($obj->nb_running > 0 ? $obj->nb_running : '').'</td>';
|
||||
print '<td class="center">'.($obj->nb_expired > 0 ? $obj->nb_expired : '').'</td>';
|
||||
@ -800,14 +909,17 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@ -824,7 +936,9 @@ print '</div>';
|
||||
print '</form>';
|
||||
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
|
||||
$hidegeneratedfilelistifempty = 0;
|
||||
}
|
||||
|
||||
// Show list of available documents
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
|
||||
@ -41,7 +41,9 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$object = new Contrat($db);
|
||||
@ -70,8 +72,7 @@ llxHeader('', $langs->trans("Contract"), "");
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = contract_prepare_head($object);
|
||||
@ -89,9 +90,9 @@ if ($id > 0 || !empty($ref))
|
||||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref .= $object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
// Ref customer
|
||||
@ -104,15 +105,14 @@ if ($id > 0 || !empty($ref))
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref .= ' : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
@ -150,12 +150,18 @@ if ($id > 0 || !empty($ref))
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $object->thirdparty->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
if ($object->thirdparty->remise_percent) {
|
||||
print $langs->trans("CompanyHasRelativeDiscount", $object->thirdparty->remise_percent);
|
||||
} else {
|
||||
print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
}
|
||||
$absolute_discount = $object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
if ($absolute_discount) {
|
||||
print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency".$conf->currency));
|
||||
} else {
|
||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
}
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -39,12 +39,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = "c.rowid";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "c.rowid";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
$mode = GETPOST("mode");
|
||||
$filter = GETPOST("filter");
|
||||
@ -90,22 +96,32 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
|
||||
// Security check
|
||||
$contratid = GETPOST('id', 'int');
|
||||
if (!empty($user->socid)) $socid = $user->socid;
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $contratid);
|
||||
|
||||
if ($search_status != '')
|
||||
{
|
||||
if ($search_status != '') {
|
||||
$tmp = explode('&', $search_status);
|
||||
$mode = $tmp[0];
|
||||
if (empty($tmp[1])) $filter = '';
|
||||
else {
|
||||
if ($tmp[1] == 'filter=notexpired') $filter = 'notexpired';
|
||||
if ($tmp[1] == 'filter=expired') $filter = 'expired';
|
||||
if (empty($tmp[1])) {
|
||||
$filter = '';
|
||||
} else {
|
||||
if ($tmp[1] == 'filter=notexpired') {
|
||||
$filter = 'notexpired';
|
||||
}
|
||||
if ($tmp[1] == 'filter=expired') {
|
||||
$filter = 'expired';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$search_status = $mode;
|
||||
if ($filter == 'expired') $search_status .= '&filter=expired';
|
||||
if ($filter == 'notexpired') $search_status .= '&filter=notexpired';
|
||||
if ($filter == 'expired') {
|
||||
$search_status .= '&filter=expired';
|
||||
}
|
||||
if ($filter == 'notexpired') {
|
||||
$search_status .= '&filter=notexpired';
|
||||
}
|
||||
}
|
||||
|
||||
$staticcontrat = new Contrat($db);
|
||||
@ -142,21 +158,25 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; }
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_product_category = 0;
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
|
||||
$search_product_category = 0;
|
||||
$search_name = "";
|
||||
$search_contract = "";
|
||||
$search_service = "";
|
||||
@ -197,7 +217,9 @@ $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
|
||||
$sql .= " cd.rowid, cd.description, cd.statut,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " sc.fk_soc, sc.fk_user,";
|
||||
}
|
||||
$sql .= " cd.date_ouverture_prevue,";
|
||||
$sql .= " cd.date_ouverture,";
|
||||
$sql .= " cd.date_fin_validite,";
|
||||
@ -211,7 +233,9 @@ $sql .= " cd.subprice,";
|
||||
$sql .= " cd.tms as date_update";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
@ -219,50 +243,102 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
}
|
||||
$sql .= " WHERE c.entity = ".$conf->entity;
|
||||
$sql .= " AND c.rowid = cd.fk_contrat";
|
||||
if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($search_product_category > 0) {
|
||||
$sql .= " AND cp.fk_categorie = ".$search_product_category;
|
||||
}
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($mode == "0") $sql .= " AND cd.statut = 0";
|
||||
if ($mode == "4") $sql .= " AND cd.statut = 4";
|
||||
if ($mode == "5") $sql .= " AND cd.statut = 5";
|
||||
if ($filter == "expired") $sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
if ($filter == "notexpired") $sql .= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
|
||||
if ($search_name) $sql .= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
|
||||
if ($search_contract) $sql .= " AND c.ref LIKE '%".$db->escape($search_contract)."%' ";
|
||||
if ($search_service) $sql .= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
|
||||
if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($mode == "0") {
|
||||
$sql .= " AND cd.statut = 0";
|
||||
}
|
||||
if ($mode == "4") {
|
||||
$sql .= " AND cd.statut = 4";
|
||||
}
|
||||
if ($mode == "5") {
|
||||
$sql .= " AND cd.statut = 5";
|
||||
}
|
||||
if ($filter == "expired") {
|
||||
$sql .= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
}
|
||||
if ($filter == "notexpired") {
|
||||
$sql .= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
|
||||
}
|
||||
if ($search_name) {
|
||||
$sql .= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
|
||||
}
|
||||
if ($search_contract) {
|
||||
$sql .= " AND c.ref LIKE '%".$db->escape($search_contract)."%' ";
|
||||
}
|
||||
if ($search_service) {
|
||||
$sql .= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND s.rowid = ".$socid;
|
||||
}
|
||||
|
||||
$filter_dateouvertureprevue_start = dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
|
||||
$filter_dateouvertureprevue_end = dol_mktime(23, 59, 59, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
|
||||
if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) $filter_opouvertureprevue = ' BETWEEN ';
|
||||
if ($filter_dateouvertureprevue_start != '' && $filter_opouvertureprevue == -1) {
|
||||
$filter_opouvertureprevue = ' BETWEEN ';
|
||||
}
|
||||
|
||||
$filter_date1_start = dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
|
||||
$filter_date1_end = dol_mktime(23, 59, 59, $op1month, $op1day, $op1year);
|
||||
if ($filter_date1_start != '' && $filter_op1 == -1) $filter_op1 = ' BETWEEN ';
|
||||
if ($filter_date1_start != '' && $filter_op1 == -1) {
|
||||
$filter_op1 = ' BETWEEN ';
|
||||
}
|
||||
|
||||
$filter_date2_start = dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
|
||||
$filter_date2_end = dol_mktime(23, 59, 59, $op2month, $op2day, $op2year);
|
||||
if ($filter_date2_start != '' && $filter_op2 == -1) $filter_op2 = ' BETWEEN ';
|
||||
if ($filter_date2_start != '' && $filter_op2 == -1) {
|
||||
$filter_op2 = ' BETWEEN ';
|
||||
}
|
||||
|
||||
$filter_datecloture_start = dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
|
||||
$filter_datecloture_end = dol_mktime(23, 59, 59, $opcloturemonth, $opclotureday, $opclotureyear);
|
||||
if ($filter_datecloture_start != '' && $filter_opcloture == -1) $filter_opcloture = ' BETWEEN ';
|
||||
if ($filter_datecloture_start != '' && $filter_opcloture == -1) {
|
||||
$filter_opcloture = ' BETWEEN ';
|
||||
}
|
||||
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_opouvertureprevue != ' BETWEEN ' && $filter_dateouvertureprevue_start != '') $sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_dateouvertureprevue_end)."'";
|
||||
if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') $sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
|
||||
if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_date1_end)."'";
|
||||
if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') $sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
|
||||
if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_date2_end)."'";
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') $sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
|
||||
if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') $sql .= " AND '".$db->idate($filter_datecloture_end)."'";
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_opouvertureprevue != ' BETWEEN ' && $filter_dateouvertureprevue_start != '') {
|
||||
$sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
|
||||
}
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_dateouvertureprevue_end)."'";
|
||||
}
|
||||
if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') {
|
||||
$sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
|
||||
}
|
||||
if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_date1_end)."'";
|
||||
}
|
||||
if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') {
|
||||
$sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
|
||||
}
|
||||
if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_date2_end)."'";
|
||||
}
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') {
|
||||
$sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
|
||||
}
|
||||
if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
|
||||
$sql .= " AND '".$db->idate($filter_datecloture_end)."'";
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -270,12 +346,10 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
//print $sql;
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
@ -286,8 +360,7 @@ $sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
dol_syslog("contrat/services_list.php", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
@ -297,31 +370,63 @@ $num = $db->num_rows($resql);
|
||||
/*
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->id;
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
|
||||
exit;
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->id;
|
||||
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
|
||||
exit;
|
||||
}*/
|
||||
|
||||
llxHeader(null, $langs->trans("Services"));
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($search_contract) $param .= '&search_contract='.urlencode($search_contract);
|
||||
if ($search_name) $param .= '&search_name='.urlencode($search_name);
|
||||
if ($search_service) $param .= '&search_service='.urlencode($search_service);
|
||||
if ($mode) $param .= '&mode='.urlencode($mode);
|
||||
if ($filter) $param .= '&filter='.urlencode($filter);
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param .= '&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
|
||||
if (!empty($filter_op1) && $filter_op1 != -1) $param .= '&filter_op1='.urlencode($filter_op1);
|
||||
if (!empty($filter_op2) && $filter_op2 != -1) $param .= '&filter_op2='.urlencode($filter_op2);
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != -1) $param .= '&filter_opcloture='.urlencode($filter_opcloture);
|
||||
if ($filter_dateouvertureprevue != '') $param .= '&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear;
|
||||
if ($filter_date1 != '') $param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||
if ($filter_date2 != '') $param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||
if ($filter_datecloture != '') $param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.$limit;
|
||||
}
|
||||
if ($search_contract) {
|
||||
$param .= '&search_contract='.urlencode($search_contract);
|
||||
}
|
||||
if ($search_name) {
|
||||
$param .= '&search_name='.urlencode($search_name);
|
||||
}
|
||||
if ($search_service) {
|
||||
$param .= '&search_service='.urlencode($search_service);
|
||||
}
|
||||
if ($mode) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if ($filter) {
|
||||
$param .= '&filter='.urlencode($filter);
|
||||
}
|
||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) {
|
||||
$param .= '&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
|
||||
}
|
||||
if (!empty($filter_op1) && $filter_op1 != -1) {
|
||||
$param .= '&filter_op1='.urlencode($filter_op1);
|
||||
}
|
||||
if (!empty($filter_op2) && $filter_op2 != -1) {
|
||||
$param .= '&filter_op2='.urlencode($filter_op2);
|
||||
}
|
||||
if (!empty($filter_opcloture) && $filter_opcloture != -1) {
|
||||
$param .= '&filter_opcloture='.urlencode($filter_opcloture);
|
||||
}
|
||||
if ($filter_dateouvertureprevue != '') {
|
||||
$param .= '&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear;
|
||||
}
|
||||
if ($filter_date1 != '') {
|
||||
$param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||
}
|
||||
if ($filter_date2 != '') {
|
||||
$param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||
}
|
||||
if ($filter_datecloture != '') {
|
||||
$param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.$optioncss;
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -335,7 +440,9 @@ $arrayofmassactions = array(
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
@ -345,24 +452,32 @@ print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$title = $langs->trans("ListOfServices");
|
||||
if ($mode == "0") $title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
|
||||
if ($mode == "4" && $filter != "expired") $title = $langs->trans("ListOfRunningServices");
|
||||
if ($mode == "4" && $filter == "expired") $title = $langs->trans("ListOfExpiredServices");
|
||||
if ($mode == "5") $title = $langs->trans("ListOfClosedServices");
|
||||
if ($mode == "0") {
|
||||
$title = $langs->trans("ListOfInactiveServices"); // Must use == "0"
|
||||
}
|
||||
if ($mode == "4" && $filter != "expired") {
|
||||
$title = $langs->trans("ListOfRunningServices");
|
||||
}
|
||||
if ($mode == "4" && $filter == "expired") {
|
||||
$title = $langs->trans("ListOfExpiredServices");
|
||||
}
|
||||
if ($mode == "5") {
|
||||
$title = $langs->trans("ListOfClosedServices");
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
if ($sall) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$morefilter = '';
|
||||
|
||||
// If the user can view categories of products
|
||||
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
{
|
||||
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
|
||||
@ -373,12 +488,14 @@ if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights-
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
@ -392,33 +509,62 @@ print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.description']['checked'])) print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['p.description']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.description']['label'], $_SERVER["PHP_SELF"], "p.description", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.qty']['label'], $_SERVER["PHP_SELF"], "cd.qty", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.total_ht']['label'], $_SERVER["PHP_SELF"], "cd.total_ht", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.total_tva']['label'], $_SERVER["PHP_SELF"], "cd.total_tva", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.tva_tx']['label'], $_SERVER["PHP_SELF"], "cd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.subprice']['label'], $_SERVER["PHP_SELF"], "cd.subprice", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture_prevue", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_ouverture']['label'], $_SERVER["PHP_SELF"], "cd.date_ouverture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'], $_SERVER["PHP_SELF"], "cd.date_fin_validite", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.date_cloture']['label'], $_SERVER["PHP_SELF"], "cd.date_cloture", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (!empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
@ -426,49 +572,41 @@ if (!empty($arrayfields['c.ref']['checked']))
|
||||
print '</td>';
|
||||
}
|
||||
// Service label
|
||||
if (!empty($arrayfields['p.description']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['p.description']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// detail lines
|
||||
if (!empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Third party
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_opouvertureprevue', $arrayofoperators, $filter_opouvertureprevue, 1);
|
||||
@ -477,8 +615,7 @@ if (!empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
print $form->selectDate($filter_dateouvertureprevue, 'opouvertureprevue', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_op1', $arrayofoperators, $filter_op1, 1);
|
||||
@ -487,8 +624,7 @@ if (!empty($arrayfields['cd.date_ouverture']['checked']))
|
||||
print $form->selectDate($filter_date1, 'op1', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_op2', $arrayofoperators, $filter_op2, 1);
|
||||
@ -497,8 +633,7 @@ if (!empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||
print $form->selectDate($filter_date2, 'op2', 0, 0, 1, '', 1, 0);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$arrayofoperators = array('<'=>'<', '>'=>'>');
|
||||
print $form->selectarray('filter_opcloture', $arrayofoperators, $filter_opcloture, 1);
|
||||
@ -514,20 +649,17 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (!empty($arrayfields['cd.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) {
|
||||
// Date creation
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['cd.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) {
|
||||
// Date modification
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
// Status
|
||||
print '<td class="liste_titre right">';
|
||||
$arrayofstatus = array(
|
||||
@ -552,8 +684,7 @@ $productstatic = new Product($db);
|
||||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$contractstatic->id = $obj->cid;
|
||||
@ -570,118 +701,142 @@ while ($i < min($num, $limit))
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
print $contractstatic->getNomUrl(1, 16);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Service
|
||||
if (!empty($arrayfields['p.description']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['p.description']['checked'])) {
|
||||
print '<td>';
|
||||
if ($obj->pid > 0)
|
||||
{
|
||||
if ($obj->pid > 0) {
|
||||
$productstatic->id = $obj->pid;
|
||||
$productstatic->type = $obj->ptype;
|
||||
$productstatic->ref = $obj->pref;
|
||||
$productstatic->entity = $obj->pentity;
|
||||
print $productstatic->getNomUrl(1, '', 24);
|
||||
print $obj->label ? ' - '.dol_trunc($obj->label, 16) : '';
|
||||
if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);
|
||||
if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) {
|
||||
print '<br>'.dol_nl2br($obj->description);
|
||||
}
|
||||
} else {
|
||||
if ($obj->type == 0) print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
|
||||
if ($obj->type == 1) print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
|
||||
if ($obj->type == 0) {
|
||||
print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24);
|
||||
}
|
||||
if ($obj->type == 1) {
|
||||
print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['cd.qty']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.qty']['checked'])) {
|
||||
print '<td>';
|
||||
print $obj->qty;
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_ht']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_ht']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price($obj->total_ht);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'cd.total_ht';
|
||||
}
|
||||
$totalarray['val']['cd.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
if (!empty($arrayfields['cd.total_tva']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.total_tva']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price($obj->total_tva);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'cd.total_tva';
|
||||
}
|
||||
$totalarray['val']['cd.total_tva'] += $obj->total_tva;
|
||||
}
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tva_tx']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price2num($obj->tva_tx).'%';
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.subprice']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.subprice']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print price($obj->subprice);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td>';
|
||||
print $companystatic->getNomUrl(1, 'customer', 28);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Start date
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture_prevue']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print ($obj->date_ouverture_prevue ?dol_print_date($db->jdate($obj->date_ouverture_prevue), 'dayhour') : ' ');
|
||||
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0)
|
||||
print ' '.img_picto($langs->trans("Late"), "warning");
|
||||
else print ' ';
|
||||
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
|
||||
print ' '.img_picto($langs->trans("Late"), "warning");
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_ouverture']['checked'])) {
|
||||
print '<td class="center">'.($obj->date_ouverture ?dol_print_date($db->jdate($obj->date_ouverture), 'dayhour') : ' ').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// End date
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_fin_validite']['checked'])) {
|
||||
print '<td class="center">'.($obj->date_fin_validite ?dol_print_date($db->jdate($obj->date_fin_validite), 'dayhour') : ' ');
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
|
||||
{
|
||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24;
|
||||
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
|
||||
print img_warning($textlate);
|
||||
} else print ' ';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Close date (real end date)
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.date_cloture']['checked'])) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_cloture), 'dayhour').'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
@ -691,45 +846,50 @@ while ($i < min($num, $limit))
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (!empty($arrayfields['cd.datec']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.datec']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Date modification
|
||||
if (!empty($arrayfields['cd.tms']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['cd.tms']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td class="right">';
|
||||
if ($obj->cstatut == 0)
|
||||
{
|
||||
if ($obj->cstatut == 0) {
|
||||
// If contract is draft, we say line is also draft
|
||||
print $contractstatic->LibStatut(0, 5);
|
||||
} else {
|
||||
print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -17,8 +17,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
@ -37,24 +36,24 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
$langs->load("contracts");
|
||||
|
||||
$total = 0; $ilink = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
$ilink++;
|
||||
|
||||
$trclass = 'oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
||||
$trclass .= ' liste_sub_total';
|
||||
}
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Contract"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td><?php echo $langs->trans("Contract"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
||||
<td class="right"><?php
|
||||
<td class="right"><?php
|
||||
// Price of contract is not shown by default because a contract is a list of service with
|
||||
// start and end date that change with time andd that may be different that the period of reference for price.
|
||||
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
||||
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE))
|
||||
{
|
||||
if ($user->rights->contrat->lire && empty($conf->global->CONTRACT_SHOW_TOTAL_OF_PRODUCT_AS_PRICE)) {
|
||||
$totalcontrat = 0;
|
||||
foreach ($objectlink->lines as $linecontrat) {
|
||||
$totalcontrat = $totalcontrat + $linecontrat->total_ht;
|
||||
|
||||
@ -459,8 +459,8 @@ class Conf
|
||||
$this->service->dir_temp = $rootfortemp."/produit/temp";
|
||||
|
||||
// Module productbatch
|
||||
$this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot");
|
||||
$this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/produitlot/temp");
|
||||
$this->productbatch->multidir_output = array($this->entity => $rootfordata."/productlot");
|
||||
$this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/productlot/temp");
|
||||
|
||||
// Module contrat
|
||||
$this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
|
||||
|
||||
@ -488,7 +488,7 @@ class FormMail extends Form
|
||||
|
||||
// Zone to select email template
|
||||
if (count($modelmail_array) > 0) {
|
||||
$model_mail_selected_id = GETPOSTISSET('modelmailselected') ? GETPOST('modelmailselected', 'int') : ($arraydefaultmessage->id > 0 ? $arraydefaultmessage->id : 0);
|
||||
$model_mail_selected_id = GETPOSTISSET('modelmailselected') ? GETPOST('modelmailselected', 'int') : ($arraydefaultmessage->id > 0 ? $arraydefaultmessage->id : 0);
|
||||
|
||||
// If list of template is filled
|
||||
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
||||
|
||||
@ -537,9 +537,9 @@ function hideMessage(fieldId,message) {
|
||||
* Used by button to set on/off.
|
||||
* Call url then make complementary action (like show/hide, enable/disable or set another option).
|
||||
*
|
||||
* @param string url Url
|
||||
* @param string url Url (warning: as any url called in ajax mode, the url called here must not renew the token)
|
||||
* @param string code Code
|
||||
* @param string intput Input
|
||||
* @param string intput Array of complementary actions to do if success
|
||||
* @param int entity Entity
|
||||
* @param int strict Strict
|
||||
* @param int forcereload Force reload
|
||||
@ -553,7 +553,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
entity: entity,
|
||||
token: token
|
||||
},
|
||||
function() {
|
||||
function() { /* handler for success of post */
|
||||
console.log("url request success forcereload="+forcereload);
|
||||
$("#set_" + code).hide();
|
||||
$("#del_" + code).show();
|
||||
@ -611,9 +611,9 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
* Used by button to set on/off
|
||||
* Call url then make complementary action (like show/hide, enable/disable or set another option).
|
||||
*
|
||||
* @param string url Url
|
||||
* @param string url Url (warning: as any url called in ajax mode, the url called here must not renew the token)
|
||||
* @param string code Code
|
||||
* @param string intput Input
|
||||
* @param string intput Array of complementary actions to do if success
|
||||
* @param int entity Entity
|
||||
* @param int strict Strict
|
||||
* @param int forcereload Force reload
|
||||
@ -678,12 +678,13 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
}
|
||||
|
||||
/*
|
||||
* Used by button to set on/off
|
||||
* Call the setConstant or delConstant but with a confirmation before.
|
||||
* Used by button to set on/off.
|
||||
*
|
||||
* @param string action Action
|
||||
* @param string url Url
|
||||
* @param string code Code
|
||||
* @param string intput Input
|
||||
* @param string intput Array of complementary actions to do if success
|
||||
* @param string box Box
|
||||
* @param int entity Entity
|
||||
* @param int yesButton yesButton
|
||||
|
||||
@ -535,13 +535,13 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
||||
* On/off button for constant
|
||||
*
|
||||
* @param string $code Name of constant
|
||||
* @param array $input Array of options. ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
|
||||
* @param int $entity Entity to set. Use current entity if null.
|
||||
* @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
|
||||
* @param int $entity Entity. Current entity is used if null.
|
||||
* @param int $revertonoff Revert on/off
|
||||
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
||||
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
|
||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. Works for fontawesome picto only.
|
||||
* @param int $forcenoajax 1=Force to use a ahref link instead of ajax code.
|
||||
* @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code.
|
||||
* @return string
|
||||
*/
|
||||
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0)
|
||||
|
||||
@ -6164,6 +6164,8 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
|
||||
$allowed_tags_string = join("><", $allowed_tags);
|
||||
$allowed_tags_string = '<'.$allowed_tags_string.'>';
|
||||
|
||||
$stringtoclean = str_replace('<!DOCTYPE html>', '__!DOCTYPE_HTML__', $stringtoclean); // Replace DOCTYPE to avoid to have it removed by the strip_tags
|
||||
|
||||
$stringtoclean = dol_string_nounprintableascii($stringtoclean, 0);
|
||||
$stringtoclean = preg_replace('/:/i', ':', $stringtoclean);
|
||||
|
||||
@ -6186,6 +6188,8 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
|
||||
$temp = preg_replace('/javascript\s*:/i', '', $temp);
|
||||
}
|
||||
|
||||
$temp = str_replace('__!DOCTYPE_HTML__', '<!DOCTYPE html>', $temp); // Restore the DOCTYPE
|
||||
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
@ -2122,6 +2122,11 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
|
||||
$module = 'mrp';
|
||||
$myobject = 'mo';
|
||||
}
|
||||
elseif ($objecttype == 'productlot') {
|
||||
$classpath = 'product/stock/class';
|
||||
$module = 'stock';
|
||||
$myobject = 'productlot';
|
||||
}
|
||||
|
||||
// Generic case for $classfile and $classname
|
||||
$classfile = strtolower($myobject); $classname = ucfirst($myobject);
|
||||
|
||||
@ -376,7 +376,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("propal");
|
||||
print '<tr><td>';
|
||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('', 'propal').' '.$langs->trans("Proposals").'</a>';
|
||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('', 'propal', 'class="paddingright"').$langs->trans("Proposals").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_propale['customers'];
|
||||
print '</td><td class="right">';
|
||||
@ -393,9 +393,9 @@ function show_stats_for_company($product, $socid)
|
||||
if ($ret < 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$langs->load("propal");
|
||||
$langs->load("supplier_proposal");
|
||||
print '<tr><td>';
|
||||
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'supplier_proposal').' '.$langs->trans("SupplierProposals").'</a>';
|
||||
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'supplier_proposal', 'class="paddingright"').$langs->trans("SupplierProposals").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_proposal_supplier['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
@ -414,7 +414,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("orders");
|
||||
print '<tr><td>';
|
||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('', 'order').' '.$langs->trans("CustomersOrders").'</a>';
|
||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('', 'order', 'class="paddingright"').$langs->trans("CustomersOrders").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande['customers'];
|
||||
print '</td><td class="right">';
|
||||
@ -433,7 +433,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("orders");
|
||||
print '<tr><td>';
|
||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_order').' '.$langs->trans("SuppliersOrders").'</a>';
|
||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_order', 'class="paddingright"').$langs->trans("SuppliersOrders").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande_fournisseur['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
@ -471,7 +471,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("bills");
|
||||
print '<tr><td>';
|
||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_invoice').' '.$langs->trans("SuppliersInvoices").'</a>';
|
||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_invoice', 'class="paddingright"').$langs->trans("SuppliersInvoices").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture_fournisseur['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
@ -491,7 +491,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("contracts");
|
||||
print '<tr><td>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('', 'contract').' '.$langs->trans("Contracts").'</a>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('', 'contract', 'class="paddingright"').$langs->trans("Contracts").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_contrat['customers'];
|
||||
print '</td><td class="right">';
|
||||
@ -512,15 +512,15 @@ function show_stats_for_company($product, $socid)
|
||||
$langs->load("mrp");
|
||||
|
||||
print '<tr><td>';
|
||||
print '<a href="bom.php?id='.$product->id.'">'.img_object('', 'mrp').' '.$langs->trans("BOM").'</a>';
|
||||
print '<a href="bom.php?id='.$product->id.'">'.img_object('', 'bom', 'class="paddingright"').$langs->trans("BOM").'</a>';
|
||||
print '</td><td class="right">';
|
||||
|
||||
print '</td><td class="right">';
|
||||
print $form->textwithpicto($product->stats_bom['nb_toproduce'], $langs->trans("QtyToProduce"));
|
||||
print $form->textwithpicto($product->stats_bom['nb_toconsume'], $langs->trans("ToConsume"));
|
||||
print $form->textwithpicto($product->stats_bom['nb_toconsume'], $langs->trans("RowMaterial"));
|
||||
print $form->textwithpicto($product->stats_bom['nb_toproduce'], $langs->trans("Finished"));
|
||||
print '</td><td class="right">';
|
||||
print $form->textwithpicto($product->stats_bom['qty_toproduce'], $langs->trans("QtyToProduce"));
|
||||
print $form->textwithpicto($product->stats_bom['qty_toconsume'], $langs->trans("ToConsume"));
|
||||
print $form->textwithpicto($product->stats_bom['qty_toconsume'], $langs->trans("RowMaterial"));
|
||||
print $form->textwithpicto($product->stats_bom['qty_toproduce'], $langs->trans("Finished"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -534,7 +534,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("mrp");
|
||||
print '<tr><td>';
|
||||
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp').' '.$langs->trans("MO").'</a>';
|
||||
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp', 'class="paddingright"').$langs->trans("MO").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $form->textwithpicto($product->stats_mo['customers_toconsume'], $langs->trans("ToConsume"));
|
||||
print $form->textwithpicto($product->stats_mo['customers_consumed'], $langs->trans("QtyAlreadyConsumed"));
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -44,24 +44,44 @@ function project_prepare_head(Project $project)
|
||||
$head[$h][1] = $langs->trans("Project");
|
||||
$head[$h][2] = 'project';
|
||||
$h++;
|
||||
$nbContacts = 0;
|
||||
// Enable caching of project count Contacts
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_contacts_project_'.$object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
|
||||
$nbContact = count($project->liste_contact(-1, 'internal')) + count($project->liste_contact(-1, 'external'));
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbContacts = $dataretrieved;
|
||||
} else {
|
||||
$nbContacts = count($project->liste_contact(-1, 'internal')) + count($project->liste_contact(-1, 'external'));
|
||||
dol_setcache($cachekey, $nbContact, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("ProjectContact");
|
||||
if ($nbContact > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
if ($nbContacts > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContacts.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
|
||||
// Then tab for sub level of projet, i mean tasks
|
||||
$nbTasks = 0;
|
||||
// Enable caching of project count Tasks
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_tasks_project_'.$object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbTasks = $dataretrieved;
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
$taskstatic = new Task($db);
|
||||
$nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
|
||||
dol_setcache($cachekey, $nbTasks, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("Tasks");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
$taskstatic = new Task($db);
|
||||
$nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
|
||||
if ($nbTasks > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbTasks).'</span>';
|
||||
}
|
||||
@ -69,20 +89,28 @@ function project_prepare_head(Project $project)
|
||||
$h++;
|
||||
|
||||
$nbTimeSpent = 0;
|
||||
$sql = "SELECT t.rowid";
|
||||
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql .= " WHERE t.fk_task = pt.rowid";
|
||||
$sql .= " AND pt.fk_projet =".$project->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$nbTimeSpent = 1;
|
||||
}
|
||||
// Enable caching of project count Timespent
|
||||
$cachekey = 'count_timespent_project_'.$object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbTimeSpent = $dataretrieved;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$sql = "SELECT t.rowid";
|
||||
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql .= " WHERE t.fk_task = pt.rowid";
|
||||
$sql .= " AND pt.fk_projet =".$project->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$nbTimeSpent = 1;
|
||||
dol_setcache($cachekey, $nbTimeSpent, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$project->id;
|
||||
@ -98,73 +126,78 @@ function project_prepare_head(Project $project)
|
||||
|| !empty($conf->propal->enabled) || !empty($conf->commande->enabled)
|
||||
|| !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
|
||||
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) {
|
||||
$count = 0;
|
||||
|
||||
if (!empty($conf->propal->enabled)) {
|
||||
$count += $project->getElementCount('propal', 'propal');
|
||||
$nbElements = 0;
|
||||
// Enable caching of thirdrparty count Contacts
|
||||
$cachekey = 'count_elements_project_'.$object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbElements = $dataretrieved;
|
||||
} else {
|
||||
if (!empty($conf->propal->enabled)) {
|
||||
$count += $project->getElementCount('propal', 'propal');
|
||||
}
|
||||
if (!empty($conf->commande->enabled)) {
|
||||
$count += $project->getElementCount('order', 'commande');
|
||||
}
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$count += $project->getElementCount('invoice', 'facture');
|
||||
}
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$count += $project->getElementCount('invoice_predefined', 'facture_rec');
|
||||
}
|
||||
if (!empty($conf->supplier_proposal->enabled)) {
|
||||
$count += $project->getElementCount('proposal_supplier', 'supplier_proposal');
|
||||
}
|
||||
if (!empty($conf->supplier_order->enabled)) {
|
||||
$count += $project->getElementCount('order_supplier', 'commande_fournisseur');
|
||||
}
|
||||
if (!empty($conf->supplier_invoice->enabled)) {
|
||||
$count += $project->getElementCount('invoice_supplier', 'facture_fourn');
|
||||
}
|
||||
if (!empty($conf->contrat->enabled)) {
|
||||
$count += $project->getElementCount('contract', 'contrat');
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$count += $project->getElementCount('intervention', 'fichinter');
|
||||
}
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
$count += $project->getElementCount('shipping', 'expedition');
|
||||
}
|
||||
if (!empty($conf->mrp->enabled)) {
|
||||
$count += $project->getElementCount('mrp', 'mrp_mo', 'fk_project');
|
||||
}
|
||||
if (!empty($conf->deplacement->enabled)) {
|
||||
$count += $project->getElementCount('trip', 'deplacement');
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled)) {
|
||||
$count += $project->getElementCount('expensereport', 'expensereport');
|
||||
}
|
||||
if (!empty($conf->don->enabled)) {
|
||||
$count += $project->getElementCount('donation', 'don');
|
||||
}
|
||||
if (!empty($conf->loan->enabled)) {
|
||||
$count += $project->getElementCount('loan', 'loan');
|
||||
}
|
||||
if (!empty($conf->tax->enabled)) {
|
||||
$count += $project->getElementCount('chargesociales', 'chargesociales');
|
||||
}
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$count += $project->getElementCount('project_task', 'projet_task');
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
$count += $project->getElementCount('stock_mouvement', 'stock');
|
||||
}
|
||||
if (!empty($conf->salaries->enabled)) {
|
||||
$count += $project->getElementCount('salaries', 'payment_salary');
|
||||
}
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$count += $project->getElementCount('variouspayment', 'payment_various');
|
||||
}
|
||||
}
|
||||
if (!empty($conf->commande->enabled)) {
|
||||
$count += $project->getElementCount('order', 'commande');
|
||||
}
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$count += $project->getElementCount('invoice', 'facture');
|
||||
}
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$count += $project->getElementCount('invoice_predefined', 'facture_rec');
|
||||
}
|
||||
if (!empty($conf->supplier_proposal->enabled)) {
|
||||
$count += $project->getElementCount('proposal_supplier', 'supplier_proposal');
|
||||
}
|
||||
if (!empty($conf->supplier_order->enabled)) {
|
||||
$count += $project->getElementCount('order_supplier', 'commande_fournisseur');
|
||||
}
|
||||
if (!empty($conf->supplier_invoice->enabled)) {
|
||||
$count += $project->getElementCount('invoice_supplier', 'facture_fourn');
|
||||
}
|
||||
if (!empty($conf->contrat->enabled)) {
|
||||
$count += $project->getElementCount('contract', 'contrat');
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$count += $project->getElementCount('intervention', 'fichinter');
|
||||
}
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
$count += $project->getElementCount('shipping', 'expedition');
|
||||
}
|
||||
if (!empty($conf->mrp->enabled)) {
|
||||
$count += $project->getElementCount('mrp', 'mrp_mo', 'fk_project');
|
||||
}
|
||||
if (!empty($conf->deplacement->enabled)) {
|
||||
$count += $project->getElementCount('trip', 'deplacement');
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled)) {
|
||||
$count += $project->getElementCount('expensereport', 'expensereport');
|
||||
}
|
||||
if (!empty($conf->don->enabled)) {
|
||||
$count += $project->getElementCount('donation', 'don');
|
||||
}
|
||||
if (!empty($conf->loan->enabled)) {
|
||||
$count += $project->getElementCount('loan', 'loan');
|
||||
}
|
||||
if (!empty($conf->tax->enabled)) {
|
||||
$count += $project->getElementCount('chargesociales', 'chargesociales');
|
||||
}
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$count += $project->getElementCount('project_task', 'projet_task');
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
$count += $project->getElementCount('stock_mouvement', 'stock');
|
||||
}
|
||||
if (!empty($conf->salaries->enabled)) {
|
||||
$count += $project->getElementCount('salaries', 'payment_salary');
|
||||
}
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$count += $project->getElementCount('variouspayment', 'payment_various');
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("ProjectOverview");
|
||||
if ($count > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$count.'</span>';
|
||||
if ($nbElements > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbElements.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'element';
|
||||
$h++;
|
||||
@ -207,22 +240,44 @@ function project_prepare_head(Project $project)
|
||||
$h++;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($project->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $project->element, $project->id);
|
||||
// Attached files and Links
|
||||
$totalAttached = 0;
|
||||
// Enable caching of thirdrparty count attached files and links
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_attached_project_'.$object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
if (!is_null($dataretrieved)) {
|
||||
$totalAttached = $dataretrieved;
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($project->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $project->element, $project->id);
|
||||
$totalAttached = $nbFiles + $nbLinks;
|
||||
dol_setcache($cachekey, $totalAttached, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
if (($totalAttached) > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($totalAttached).'</span>';
|
||||
}
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
// Manage discussion
|
||||
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) {
|
||||
$nbComments = $project->getNbComments();
|
||||
$nbComments = 0;
|
||||
// Enable caching of thirdrparty count attached files and links
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_attached_project_'.$object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbComments = $dataretrieved;
|
||||
} else {
|
||||
$nbComments = $project->getNbComments();
|
||||
dol_setcache($cachekey, $nbComments, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("CommentLink");
|
||||
if ($nbComments > 0) {
|
||||
|
||||
@ -1433,7 +1433,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
$mode = 'target';
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -1618,7 +1618,8 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
|
||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
$mode = 'target';
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -1850,7 +1850,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
$mode = 'target';
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -2116,7 +2116,8 @@ class pdf_sponge extends ModelePDFFactures
|
||||
|
||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
$mode = 'target';
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -1602,7 +1602,8 @@ class pdf_azur extends ModelePDFPropales
|
||||
|
||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
$mode = 'target';
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = 100;
|
||||
|
||||
@ -1718,7 +1718,8 @@ class pdf_cyan extends ModelePDFPropales
|
||||
|
||||
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
|
||||
$mode = 'target';
|
||||
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact,$mode, $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
|
||||
|
||||
@ -124,4 +124,6 @@ GiftReceipt=Gift receipt
|
||||
ModuleReceiptPrinterMustBeEnabled=Module Receipt printer must have been enabled first
|
||||
AllowDelayedPayment=Allow delayed payment
|
||||
PrintPaymentMethodOnReceipts=Print payment method on tickets|receipts
|
||||
WeighingScale=Weighing scale
|
||||
WeighingScale=Weighing scale
|
||||
ShowPriceHT = Display the price excluding tax column
|
||||
ShowPriceHTOnReceipt = Display the price excluding tax column on receipt
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
# ProductBATCH language file - en_US - ProductBATCH
|
||||
ManageLotSerial=Use lot/serial number
|
||||
ProductStatusOnBatch=Yes (lot/serial required)
|
||||
ProductStatusOnBatch=Lot (required)
|
||||
ProductStatusOnSerial=Unique Serial Number (required)
|
||||
ProductStatusNotOnBatch=No (lot/serial not used)
|
||||
ProductStatusOnBatchShort=Yes
|
||||
ProductStatusOnBatchShort=Lot
|
||||
ProductStatusOnSerialShort=Serial
|
||||
ProductStatusNotOnBatchShort=No
|
||||
Batch=Lot/Serial
|
||||
atleast1batchfield=Eat-by date or Sell-by date or Lot/Serial number
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
# ProductBATCH language file - en_US - ProductBATCH
|
||||
ManageLotSerial=Utiliser les numéros de lots/série
|
||||
ProductStatusOnBatch=Oui (Lot/Série requis)
|
||||
ProductStatusOnBatch=Lot (requis)
|
||||
ProductStatusOnSerial=Numéro de série (doit être unique pour chaque équipement)
|
||||
ProductStatusNotOnBatch=Non (Lot/Série non utilisé)
|
||||
ProductStatusOnBatchShort=Oui
|
||||
ProductStatusOnBatchShort=Lot
|
||||
ProductStatusOnSerialShort=N°série
|
||||
ProductStatusNotOnBatchShort=Non
|
||||
Batch=Lot/Série
|
||||
atleast1batchfield=Date limite utilisation optimale, de consommation ou numéro de lot/série
|
||||
|
||||
@ -1029,7 +1029,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
if (!empty($conf->productbatch->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="3">';
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
||||
if ( empty($conf->global ->MAIN_ADVANCE_NUMLOT) )
|
||||
{
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
||||
}
|
||||
else {
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
|
||||
}
|
||||
print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch'));
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1488,7 +1494,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="3">';
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
||||
if ( empty($conf->global ->MAIN_ADVANCE_NUMLOT) )
|
||||
{
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
||||
}
|
||||
else {
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
|
||||
}
|
||||
print $form->selectarray('status_batch', $statutarray, $object->status_batch);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1995,7 +2007,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="2">';
|
||||
if (!empty($conf->use_javascript_ajax) && $usercancreate && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
if (!empty($conf->use_javascript_ajax) && $usercancreate && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE) && empty($conf->global->MAIN_ADVANCE_NUMLOT)) {
|
||||
print ajax_object_onoff($object, 'status_batch', 'tobatch', 'ProductStatusOnBatch', 'ProductStatusNotOnBatch');
|
||||
} else {
|
||||
print $object->getLibStatut(0, 2);
|
||||
|
||||
@ -2464,7 +2464,7 @@ class Product extends CommonObject
|
||||
$this->stats_bom['qty_toconsume'] = 0;
|
||||
|
||||
$sql = "SELECT COUNT(DISTINCT b.rowid) as nb_toproduce,";
|
||||
$sql .= " b.qty as qty_toproduce";
|
||||
$sql .= " SUM(b.qty) as qty_toproduce";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bom_bomline as bl ON bl.fk_bom=b.rowid";
|
||||
$sql .= " WHERE ";
|
||||
@ -4590,7 +4590,7 @@ class Product extends CommonObject
|
||||
$result .= (img_object(($notooltip ? '' : $label), 'product', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1));
|
||||
}
|
||||
if ($this->type == Product::TYPE_SERVICE) {
|
||||
$result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddinright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1));
|
||||
$result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1));
|
||||
}
|
||||
}
|
||||
$result .= $newref;
|
||||
@ -4688,10 +4688,10 @@ class Product extends CommonObject
|
||||
switch ($mode)
|
||||
{
|
||||
case 0:
|
||||
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch'));
|
||||
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial')));
|
||||
return dolGetStatus($label);
|
||||
case 1:
|
||||
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort'));
|
||||
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort')));
|
||||
return dolGetStatus($label);
|
||||
case 2:
|
||||
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2);
|
||||
@ -4729,11 +4729,15 @@ class Product extends CommonObject
|
||||
$labelStatus = $langs->trans('ProductStatusOnBuyShort');
|
||||
$labelStatusShort = $langs->trans('ProductStatusOnBuy');
|
||||
} elseif ($type == 2) {
|
||||
$labelStatus = $langs->trans('ProductStatusOnBatch');
|
||||
$labelStatusShort = $langs->trans('ProductStatusOnBatchShort');
|
||||
$labelStatus = ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial'));
|
||||
$labelStatusShort = ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort'));
|
||||
}
|
||||
}
|
||||
|
||||
elseif ( ! empty($conf->global->MAIN_ADVANCE_NUMLOT) && $type == 2 && $status == 2)
|
||||
{
|
||||
$labelStatus = $langs->trans('ProductStatusOnSerial');
|
||||
$labelStatusShort = $langs->trans('ProductStatusOnSerialShort');
|
||||
}
|
||||
|
||||
if ($mode > 6) {
|
||||
return dolGetStatus($langs->trans('Unknown'), '', '', 'status0', 0);
|
||||
@ -5456,7 +5460,7 @@ class Product extends CommonObject
|
||||
*/
|
||||
public function hasbatch()
|
||||
{
|
||||
return ($this->status_batch == 1 ? true : false);
|
||||
return ($this->status_batch > 0 ? true : false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -833,7 +833,21 @@ if ($resql)
|
||||
// Stock
|
||||
if (!empty($arrayfields['stock_virtual']['checked'])) print '<td class="liste_titre"> </td>';
|
||||
// To batch
|
||||
if (!empty($arrayfields['p.tobatch']['checked'])) print '<td class="liste_titre center">'.$form->selectyesno('search_tobatch', $search_tobatch, 1, false, 1).'</td>';
|
||||
if (!empty($arrayfields['p.tobatch']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
|
||||
if ( empty($conf->global ->MAIN_ADVANCE_NUMLOT) )
|
||||
{
|
||||
print $form->selectyesno('search_tobatch', $search_tobatch, 1, false, 1);
|
||||
} else
|
||||
{
|
||||
$statutarray = array('-1' => '', '0' => $langs->trans("ProductStatusNotOnBatchShort"), '1' => $langs->trans("ProductStatusOnBatchShort"), '2' => $langs->trans("ProductStatusOnSerialShort"));
|
||||
print $form->selectarray('search_tobatch', $statutarray, $search_tobatch);
|
||||
}
|
||||
|
||||
'</td>';
|
||||
}
|
||||
// Country
|
||||
if (!empty($arrayfields['p.fk_country']['checked'])) print '<td class="liste_titre center">'.$form->select_country($search_country, 'search_country', '', 0).'</td>';
|
||||
// State
|
||||
@ -1456,7 +1470,13 @@ if ($resql)
|
||||
if (!empty($arrayfields['p.tobatch']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print yn($obj->tobatch);
|
||||
if ( empty($conf->global->MAIN_ADVANCE_NUMLOT) )
|
||||
{
|
||||
print yn($obj->tobatch);
|
||||
}
|
||||
else {
|
||||
print $product_static->getLibStatut(1, 2);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -244,8 +244,8 @@ if ($id > 0 || !empty($ref))
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", "&id=".$product->id, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.date_valid", "", "&id=".$product->id, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ToConsume", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("QtyToProduce", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("RowMaterial", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Finished", $_SERVER["PHP_SELF"], "", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "b.status", "", "&id=".$product->id, '', $sortfield, $sortorder, 'center ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -95,7 +95,8 @@ class Productlot extends CommonObject
|
||||
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
|
||||
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
|
||||
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511)
|
||||
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@ -36,8 +36,35 @@ $langs->loadLangs(array('stocks', 'other', 'productbatch'));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new ProductLot($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$hookmanager->initHooks(array('productlotcard', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = GETPOST("search_all", 'alpha');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) {
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
$batch = GETPOST('batch', 'alpha');
|
||||
$productid = GETPOST('productid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha'); // ref is productid_batch
|
||||
@ -51,22 +78,6 @@ $search_import_key = GETPOST('search_import_key', 'int');
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) $action = 'list';
|
||||
|
||||
|
||||
// Protection if external user
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
//accessforbidden();
|
||||
}
|
||||
//$result = restrictedArea($user, 'mymodule', $id);
|
||||
|
||||
|
||||
$object = new ProductLot($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id || $ref)
|
||||
@ -81,6 +92,15 @@ if ($id || $ref)
|
||||
$object->ref = $object->batch; // For document management ( it use $object->ref)
|
||||
}
|
||||
|
||||
// Protection if external user
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
//accessforbidden();
|
||||
}
|
||||
//$result = restrictedArea($user, 'mymodule', $id);
|
||||
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('productlotcard', 'globalcard'));
|
||||
|
||||
@ -93,16 +113,26 @@ $usercanread = $user->rights->produit->lire;
|
||||
$usercancreate = $user->rights->produit->creer;
|
||||
$usercandelete = $user->rights->produit->supprimer;
|
||||
|
||||
$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
|
||||
|
||||
$permissiontoadd = $usercancreate;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook)) {
|
||||
$error = 0;
|
||||
|
||||
$backurlforlist = dol_buildpath('/product/stock/productlot_list.php', 1);
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action == 'seteatby' && $user->rights->stock->creer)
|
||||
{
|
||||
$newvalue = dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
|
||||
@ -117,6 +147,11 @@ if (empty($reshook))
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
$triggermodname = 'PRODUCT_LOT_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
|
||||
/*
|
||||
if ($action == 'update_extras')
|
||||
{
|
||||
$object->oldcopy = dol_clone($object);
|
||||
@ -152,8 +187,6 @@ if (empty($reshook))
|
||||
|
||||
$error = 0;
|
||||
|
||||
/* object_prop_getpost_prop */
|
||||
|
||||
$object->entity = GETPOST('entity', 'int');
|
||||
$object->fk_product = GETPOST('fk_product', 'int');
|
||||
$object->batch = GETPOST('batch', 'alpha');
|
||||
@ -241,11 +274,15 @@ if (empty($reshook))
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
|
||||
$permissiontoadd = $usercancreate;
|
||||
*/
|
||||
// Action to build doc
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'PRODUCT_LOT_SENTBYMAIL';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_PRODUCT_LOT_TO';
|
||||
$trackid = 'productlot'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -255,69 +292,98 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', 'ProductLot', '');
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$title = $langs->trans("ProductLot");
|
||||
$help_url = '';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
|
||||
// Part to create
|
||||
if ($action == 'create')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("Batch"));
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans("Batch"), '', 'object_'.$object->picto);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
if ($backtopage) {
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
}
|
||||
if ($backtopageforcancel) {
|
||||
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
|
||||
}
|
||||
|
||||
print dol_get_fiche_head();
|
||||
print dol_get_fiche_head(array(), '');
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
|
||||
//
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldfk_product").'</td><td><input class="flat" type="text" name="fk_product" value="'.GETPOST('fk_product').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldbatch").'</td><td><input class="flat" type="text" name="batch" value="'.GETPOST('batch').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldfk_user_creat").'</td><td><input class="flat" type="text" name="fk_user_creat" value="'.GETPOST('fk_user_creat').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldfk_user_modif").'</td><td><input class="flat" type="text" name="fk_user_modif" value="'.GETPOST('fk_user_modif').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldimport_key").'</td><td><input class="flat" type="text" name="import_key" value="'.GETPOST('import_key').'"></td></tr>';
|
||||
// Set some default values
|
||||
//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
|
||||
|
||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
||||
|
||||
// Common attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"> <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||
print ' ';
|
||||
print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
//dol_set_focus('input[name="ref"]');
|
||||
}
|
||||
|
||||
|
||||
// Part to show record
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||
{
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
//print load_fiche_titre($langs->trans("Batch"));
|
||||
|
||||
$head = productlot_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("Batch"), -1, 'barcode');
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("Batch"), -1, $object->picto);
|
||||
|
||||
$formconfirm = '';
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
// Call Hook formConfirm
|
||||
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$formconfirm .= $hookmanager->resPrint;
|
||||
} elseif ($reshook > 0) {
|
||||
$formconfirm = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/productlot_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->socid && !in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch');
|
||||
$morehtmlref = '';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// Product
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Product").'</td><td>';
|
||||
@ -345,44 +411,49 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
|
||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
/*TODO if ($user->rights->stock->lire)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->stock->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
*/
|
||||
}
|
||||
print '</div>'."\n";
|
||||
|
||||
|
||||
// Link to other lists
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/reassortlot.php?sref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.$langs->trans("ShowCurrentStockOfLot").'</a><br>';
|
||||
print '<br>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?search_product_ref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.$langs->trans("ShowLogOfMovementIfLot").'</a><br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Buttons for actions
|
||||
if ($action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">'."\n";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook)) {
|
||||
/*TODO if ($user->rights->stock->lire)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
|
||||
if ($user->rights->stock->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -391,21 +462,32 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
* Documents generes
|
||||
*/
|
||||
|
||||
if (empty($action))
|
||||
{
|
||||
if ($action != 'presend') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
$includedocgeneration = 1;
|
||||
|
||||
// Documents
|
||||
$filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product_batch').dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $usercanread;
|
||||
$delallowed = $usercancreate;
|
||||
if ($includedocgeneration) {
|
||||
$objref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $objref.'/'.$objref.'.pdf';
|
||||
$filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product_batch');
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = $usercanread; // If you can read, you can build the PDF to read content
|
||||
$delallowed = $usercancreate; // If you can create/edit, you can remove a file on card
|
||||
print $formfile->showdocuments('product_batch', $objref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $langs->default_lang, '', $object);
|
||||
}
|
||||
|
||||
print $formfile->showdocuments('product_batch', dol_sanitizeFileName($object->ref), $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
print '</div>';
|
||||
$MAXEVENT = 10;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'productlot', 0, 1, '', $MAXEVENT);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
/**
|
||||
* \file htdocs/product/stock/productlot_document.php
|
||||
* \ingroup product
|
||||
* \brief Page des documents joints sur les lots produits
|
||||
* \brief Page of attached documents for porudct lots
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -79,7 +79,7 @@ if ($id || $ref)
|
||||
$object->fetch($id, $productid, $batch);
|
||||
$object->ref = $object->batch; // For document management ( it use $object->ref)
|
||||
|
||||
if (!empty($conf->productbatch->enabled)) $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, $modulepart).dol_sanitizeFileName($object->ref);
|
||||
if (!empty($conf->productbatch->enabled)) $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart);
|
||||
}
|
||||
|
||||
|
||||
@ -142,6 +142,13 @@ if ($object->id)
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Product
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Product").'</td><td>';
|
||||
$producttmp = new Product($db);
|
||||
$producttmp->fetch($object->fk_product);
|
||||
print $producttmp->getNomUrl(1, 'stock')." - ".$producttmp->label;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -124,9 +124,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->stock->read;
|
||||
$permissiontoadd = $user->rights->stock->write;
|
||||
$permissiontodelete = $user->rights->stock->delete;
|
||||
$permissiontoread = $user->rights->stock->lire;
|
||||
$permissiontoadd = $user->rights->stock->mouvement->creer;
|
||||
//$permissiontodelete = $user->rights->stock->supprimer;
|
||||
|
||||
|
||||
|
||||
@ -321,8 +321,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
//print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||
$newcardbutton = '';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/product/stock/productlot_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 ATM Consulting <support@atm-consulting.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -353,12 +353,12 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<div class="inline-block valignmiddle" style="padding-right: 20px;">';
|
||||
print '<span class="fieldrequired">'.$langs->trans('Date').'</span> '.$form->selectDate(($date ? $date : -1), 'date');
|
||||
|
||||
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddinrightonly"> </span> ';
|
||||
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
|
||||
print img_picto('', 'product').' ';
|
||||
print $langs->trans('Product').'</span> ';
|
||||
$form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300');
|
||||
|
||||
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddinrightonly"> </span> ';
|
||||
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
|
||||
print img_picto('', 'stock').' ';
|
||||
print $langs->trans('Warehouse').'</span> ';
|
||||
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1);
|
||||
|
||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load('projects', 'enevntorganization');
|
||||
$langs->load('projects', 'eventorganization');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -45,7 +45,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
|
||||
|
||||
// Security check
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
}
|
||||
$result = restrictedArea($user, 'eventorganization', $id);
|
||||
|
||||
$permissiontoread = $user->rights->eventorganization->read;
|
||||
|
||||
@ -1602,6 +1602,7 @@ class Societe extends CommonObject
|
||||
$sql .= ', e.libelle as effectif';
|
||||
$sql .= ', c.code as country_code, c.label as country';
|
||||
$sql .= ', d.code_departement as state_code, d.nom as state';
|
||||
$sql .= ', r.rowid as region_id, r.code_region as region_code';
|
||||
$sql .= ', st.libelle as stcomm, st.picto as stcomm_picto';
|
||||
$sql .= ', te.code as typent_code';
|
||||
$sql .= ', i.libelle as label_incoterms';
|
||||
@ -1612,6 +1613,7 @@ class Societe extends CommonObject
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as fj ON s.fk_forme_juridique = fj.code';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_regions as r ON d.fk_region = r.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))';
|
||||
@ -1689,6 +1691,8 @@ class Societe extends CommonObject
|
||||
|
||||
$this->state_id = $obj->state_id;
|
||||
$this->state_code = $obj->state_code;
|
||||
$this->region_id = $obj->region_id;
|
||||
$this->region_code = $obj->region_code;
|
||||
$this->state = ($obj->state != '-' ? $obj->state : '');
|
||||
|
||||
$transcode = $langs->trans('StatusProspect'.$obj->fk_stcomm);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
* Copyright (C) 2021 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -233,6 +234,14 @@ print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
// Show price without vat
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('ShowPriceHTOnReceipt');
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_SHOW_HT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('WeighingScale');
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2021 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -371,6 +372,13 @@ print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_DELAYED_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Show price without vat
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('ShowPriceHT');
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Numbering module
|
||||
//print '<tr class="oddeven"><td>';
|
||||
//print $langs->trans("BillsNumberingModule");
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
||||
* Copyright (C) 2021 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1120,7 +1121,10 @@ print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' mobilep
|
||||
print '<div class="div-table-responsive-no-min invoice">';
|
||||
print '<table id="tablelines" class="noborder noshadow postablelines" width="100%">';
|
||||
if ($sectionwithinvoicelink && ($mobilepage == "invoice" || $mobilepage == "")) {
|
||||
print '<tr><td colspan="4">'.$sectionwithinvoicelink.'</td></tr>';
|
||||
if (!empty($conf->global->TAKEPOS_SHOW_HT)) { print '<tr><td colspan="5">'.$sectionwithinvoicelink.'</td></tr>'; }
|
||||
else {
|
||||
print '<tr><td colspan="4">'.$sectionwithinvoicelink.'</td></tr>';
|
||||
}
|
||||
}
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<td class="linecoldescription">';
|
||||
@ -1154,6 +1158,23 @@ if ($_SESSION["basiclayout"] != 1)
|
||||
{
|
||||
print '<td class="linecolqty right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
if ($conf->global->TAKEPOS_SHOW_HT) {
|
||||
print '<td class="linecolht right nowraponall">';
|
||||
print '<span class="opacitymedium small">' . $langs->trans('TotalHTShort') . '</span><br>';
|
||||
// In phone version only show when it is invoice page
|
||||
if ($mobilepage == "invoice" || $mobilepage == "") {
|
||||
print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</span>';
|
||||
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
|
||||
include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php';
|
||||
$multicurrency = new MultiCurrency($db);
|
||||
$multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]);
|
||||
print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">(' . price($invoice->total_ht * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="linecolht right nowraponall">';
|
||||
print '<span class="opacitymedium small">'.$langs->trans('TotalTTCShort').'</span><br>';
|
||||
// In phone version only show when it is invoice page
|
||||
@ -1373,6 +1394,18 @@ if ($placeid > 0)
|
||||
}
|
||||
|
||||
$htmlforlines .= '</td>';
|
||||
if ($conf->global->TAKEPOS_SHOW_HT) {
|
||||
$htmlforlines .= '<td class="right classfortooltip" title="'.$moreinfo.'">';
|
||||
$htmlforlines .= price($line->total_ht, 1, '', 1, -1, -1, $conf->currency);
|
||||
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
|
||||
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
$multicurrency = new MultiCurrency($db);
|
||||
$multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]);
|
||||
$htmlforlines .= '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($line->total_ht * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>';
|
||||
}
|
||||
$htmlforlines .= '</td>';
|
||||
}
|
||||
$htmlforlines .= '<td class="right classfortooltip" title="'.$moreinfo.'">';
|
||||
$htmlforlines .= price($line->total_ttc, 1, '', 1, -1, -1, $conf->currency);
|
||||
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
|
||||
@ -1390,10 +1423,15 @@ if ($placeid > 0)
|
||||
print $htmlforlines;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="drag drop oddeven"><td class="left"><span class="opacitymedium">'.$langs->trans("Empty").'</span></td><td></td><td></td><td></td></tr>';
|
||||
print '<tr class="drag drop oddeven"><td class="left"><span class="opacitymedium">'.$langs->trans("Empty").'</span></td><td></td><td></td><td></td>';
|
||||
if (!empty($conf->global->TAKEPOS_SHOW_HT)){ print '<td></td>'; }
|
||||
print '</tr>';
|
||||
}
|
||||
} else { // No invoice generated yet
|
||||
print '<tr class="drag drop oddeven"><td class="left"><span class="opacitymedium">'.$langs->trans("Empty").'</span></td><td></td><td></td><td></td></tr>';
|
||||
print '<tr class="drag drop oddeven"><td class="left"><span class="opacitymedium">'.$langs->trans("Empty").'</span></td><td></td><td></td><td></td>';
|
||||
|
||||
if (!empty($conf->global->TAKEPOS_SHOW_HT)){ print '<td></td>'; }
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2021 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -139,6 +140,9 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER)
|
||||
<th class="center"><?php print $langs->trans("Label"); ?></th>
|
||||
<th class="right"><?php print $langs->trans("Qty"); ?></th>
|
||||
<th class="right"><?php if ($gift != 1) print $langs->trans("Price"); ?></th>
|
||||
<?php if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) { ?>
|
||||
<th class="right"><?php if ($gift != 1) print $langs->trans("TotalHT"); ?></th>
|
||||
<?php } ?>
|
||||
<th class="right"><?php if ($gift != 1) print $langs->trans("TotalTTC"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -154,6 +158,12 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER)
|
||||
</td>
|
||||
<td class="right"><?php echo $line->qty; ?></td>
|
||||
<td class="right"><?php if ($gift != 1) echo price(price2num($line->total_ttc / $line->qty, 'MT'), 1); ?></td>
|
||||
<?php
|
||||
if (!empty($conf->global->TAKEPOS_SHOW_HT_RECEIPT)) { ?>
|
||||
<td class="right"><?php if ($gift != 1) echo price($line->total_ht, 1); ?></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td class="right"><?php if ($gift != 1) echo price($line->total_ttc, 1); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@ -1,140 +1,142 @@
|
||||
<?php
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet');
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) {
|
||||
die('Must be call by steelsheet');
|
||||
}
|
||||
?>
|
||||
/* Badge style is based on boostrap framework */
|
||||
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: .1em .35em;
|
||||
font-size: 80%;
|
||||
font-weight: 700 !important;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: .25rem;
|
||||
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
border-color: rgba(255,255,255,0);
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
padding: .1em .35em;
|
||||
font-size: 80%;
|
||||
font-weight: 700 !important;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: .25rem;
|
||||
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
border-color: rgba(255,255,255,0);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.badge-status {
|
||||
font-size: 0.95em;
|
||||
padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */
|
||||
font-size: 0.95em;
|
||||
padding: .19em .35em; /* more than 0.19 generate a change into heigth of lines */
|
||||
}
|
||||
.tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
|
||||
font-size: 1.1em;
|
||||
padding: .4em .4em;
|
||||
font-size: 1.1em;
|
||||
padding: .4em .4em;
|
||||
}
|
||||
/* Force values for small screen 767 */
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
.tabBar .arearef .statusref .badge-status, .tabBar .arearefnobottom .statusref .badge-status {
|
||||
font-size: 0.95em;
|
||||
padding: .3em .2em;
|
||||
font-size: 0.95em;
|
||||
padding: .3em .2em;
|
||||
}
|
||||
}
|
||||
|
||||
.badge-pill, .tabs .badge {
|
||||
padding-right: .5em;
|
||||
padding-left: .5em;
|
||||
border-radius: 0.25rem;
|
||||
padding-right: .5em;
|
||||
padding-left: .5em;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.badge-dot {
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
padding: 0.45em;
|
||||
vertical-align: text-top;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
padding: 0.45em;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
a.badge:focus, a.badge:hover {
|
||||
text-decoration: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.liste_titre .badge:not(.nochangebackground) {
|
||||
background-color: <?php print $badgeSecondary; ?>;
|
||||
color: #fff;
|
||||
background-color: <?php print $badgeSecondary; ?>;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
span.badgeneutral {
|
||||
padding: 2px 7px 2px 7px;
|
||||
background-color: #e4e4e4;
|
||||
color: #666;
|
||||
border-radius: 10px;
|
||||
padding: 2px 7px 2px 7px;
|
||||
background-color: #e4e4e4;
|
||||
color: #666;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
|
||||
/* PRIMARY */
|
||||
.badge-primary{
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgePrimary; ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgePrimary; ?>;
|
||||
}
|
||||
a.badge-primary.focus, a.badge-primary:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgePrimary, 0.5); ?>;
|
||||
}
|
||||
a.badge-primary:focus, a.badge-primary:hover {
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgePrimary, 10); ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgePrimary, 10); ?>;
|
||||
}
|
||||
|
||||
/* SECONDARY */
|
||||
.badge-secondary, .tabs .badge {
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeSecondary; ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeSecondary; ?>;
|
||||
}
|
||||
a.badge-secondary.focus, a.badge-secondary:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSecondary, 0.5); ?>;
|
||||
}
|
||||
a.badge-secondary:focus, a.badge-secondary:hover {
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeSecondary, 10); ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeSecondary, 10); ?>;
|
||||
}
|
||||
|
||||
/* SUCCESS */
|
||||
.badge-success {
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeSuccess; ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeSuccess; ?>;
|
||||
}
|
||||
a.badge-success.focus, a.badge-success:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeSuccess, 0.5); ?>;
|
||||
}
|
||||
a.badge-success:focus, a.badge-success:hover {
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeSuccess, 10); ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeSuccess, 10); ?>;
|
||||
}
|
||||
|
||||
/* DANGER */
|
||||
.badge-danger {
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeDanger; ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeDanger; ?>;
|
||||
}
|
||||
a.badge-danger.focus, a.badge-danger:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDanger, 0.5); ?>;
|
||||
}
|
||||
a.badge-danger:focus, a.badge-danger:hover {
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeDanger, 10); ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeDanger, 10); ?>;
|
||||
}
|
||||
|
||||
/* WARNING */
|
||||
.badge-warning {
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeWarning; ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeWarning; ?>;
|
||||
}
|
||||
a.badge-warning.focus, a.badge-warning:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeWarning, 0.5); ?>;
|
||||
}
|
||||
a.badge-warning:focus, a.badge-warning:hover {
|
||||
color: #212529 !important;
|
||||
background-color: <?php print colorDarker($badgeWarning, 10); ?>;
|
||||
color: #212529 !important;
|
||||
background-color: <?php print colorDarker($badgeWarning, 10); ?>;
|
||||
}
|
||||
|
||||
/* WARNING colorblind */
|
||||
@ -150,53 +152,53 @@ body[class*="colorblind-"] a.badge-warning:focus, a.badge-warning:hover {
|
||||
|
||||
/* INFO */
|
||||
.badge-info {
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeInfo; ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeInfo; ?>;
|
||||
}
|
||||
a.badge-info.focus, a.badge-info:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeInfo, 0.5); ?>;
|
||||
}
|
||||
a.badge-info:focus, a.badge-info:hover {
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeInfo, 10); ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeInfo, 10); ?>;
|
||||
}
|
||||
|
||||
/* LIGHT */
|
||||
.badge-light {
|
||||
color: #212529 !important;
|
||||
background-color: <?php print $badgeLight; ?>;
|
||||
color: #212529 !important;
|
||||
background-color: <?php print $badgeLight; ?>;
|
||||
}
|
||||
a.badge-light.focus, a.badge-light:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeLight, 0.5); ?>;
|
||||
}
|
||||
a.badge-light:focus, a.badge-light:hover {
|
||||
color: #212529 !important;
|
||||
background-color: <?php print colorDarker($badgeLight, 10); ?>;
|
||||
color: #212529 !important;
|
||||
background-color: <?php print colorDarker($badgeLight, 10); ?>;
|
||||
}
|
||||
|
||||
/* DARK */
|
||||
.badge-dark {
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeDark; ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print $badgeDark; ?>;
|
||||
}
|
||||
a.badge-dark.focus, a.badge-dark:focus {
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 0.2rem <?php print colorHexToRgb($badgeDark, 0.5); ?>;
|
||||
}
|
||||
a.badge-dark:focus, a.badge-dark:hover {
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeDark, 10); ?>;
|
||||
color: #fff !important;
|
||||
background-color: <?php print colorDarker($badgeDark, 10); ?>;
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 570px)
|
||||
{
|
||||
span.badge.badge-status {
|
||||
overflow: hidden;
|
||||
max-width: 130px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
max-width: 130px;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,8 +248,12 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL
|
||||
$thisBadgeBackgroundColor = "#fff";
|
||||
}
|
||||
|
||||
if (in_array((string) $statusName, array('0', '5', '9'))) $thisBadgeTextColor = '#999999';
|
||||
if (in_array((string) $statusName, array('6'))) $thisBadgeTextColor = '#777777';
|
||||
if (in_array((string) $statusName, array('0', '5', '9'))) {
|
||||
$thisBadgeTextColor = '#999999';
|
||||
}
|
||||
if (in_array((string) $statusName, array('6'))) {
|
||||
$thisBadgeTextColor = '#777777';
|
||||
}
|
||||
|
||||
print $cssPrefix.".badge-status".$statusName." {\n";
|
||||
print " color: ".$thisBadgeTextColor." !important;\n";
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
<?php
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) {
|
||||
die('Must be call by steelsheet');
|
||||
} ?>
|
||||
/* <style type="text/css" > */
|
||||
|
||||
:root {
|
||||
--btncolortext:rgb(<?php print $colortextlink; ?>);
|
||||
--btncolorbg: #fbfbfb;
|
||||
--btncolorborderhover: none;
|
||||
--btncolorborder: #FFF;
|
||||
/* --butactionbg:rgba(150, 110, 162, 0.95); */
|
||||
--butactionbg:rgb(118, 145, 225);
|
||||
--butactionbg:rgba(150, 110, 162, 0.95);
|
||||
--butactiondeletebg: rgb(234,228,225);
|
||||
/* tertiary color */
|
||||
/* --butactionbg:rgb(218, 235, 225); */
|
||||
/* --butactionbg:rgb(228, 218, 235); */
|
||||
--btncolortext:rgb(<?php print $colortextlink; ?>);
|
||||
--btncolorbg: #fbfbfb;
|
||||
--btncolorborderhover: none;
|
||||
--btncolorborder: #FFF;
|
||||
/* --butactionbg:rgba(150, 110, 162, 0.95); */
|
||||
--butactionbg:rgb(118, 145, 225);
|
||||
--butactionbg:rgba(150, 110, 162, 0.95);
|
||||
--butactiondeletebg: rgb(234,228,225);
|
||||
/* tertiary color */
|
||||
/* --butactionbg:rgb(218, 235, 225); */
|
||||
/* --butactionbg:rgb(228, 218, 235); */
|
||||
}
|
||||
|
||||
<?php
|
||||
@ -45,60 +47,60 @@ if (!empty($conf->global->THEME_DARKMODEENABLED)) {
|
||||
/* ============================================================================== */
|
||||
|
||||
div.divButAction {
|
||||
margin-bottom: 1.4em;
|
||||
margin-bottom: 1.4em;
|
||||
}
|
||||
div.tabsAction > a.butAction, div.tabsAction > a.butActionRefused, div.tabsAction > a.butActionDelete,
|
||||
div.tabsAction > span.butAction, div.tabsAction > span.butActionRefused, div.tabsAction > span.butActionDelete {
|
||||
margin-bottom: 1.4em !important;
|
||||
margin-bottom: 1.4em !important;
|
||||
}
|
||||
div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused {
|
||||
margin-bottom: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
span.butAction, span.butActionDelete {
|
||||
cursor: pointer;
|
||||
cursor: pointer;
|
||||
}
|
||||
.paginationafterarrows .butAction {
|
||||
font-size: 0.9em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.butAction {
|
||||
background: var(--butactionbg);
|
||||
color: #FFF !important;
|
||||
border-radius: 3px;
|
||||
/* background: rgb(230, 232, 239); */
|
||||
background: var(--butactionbg);
|
||||
color: #FFF !important;
|
||||
border-radius: 3px;
|
||||
/* background: rgb(230, 232, 239); */
|
||||
}
|
||||
.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
|
||||
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
|
||||
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
/* color: #fff; */
|
||||
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */
|
||||
color: #444;
|
||||
/* border: 1px solid #aaa; */
|
||||
/* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */
|
||||
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
|
||||
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
/* color: #fff; */
|
||||
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */
|
||||
color: #444;
|
||||
/* border: 1px solid #aaa; */
|
||||
/* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */
|
||||
|
||||
/*border-top-right-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
border-top-left-radius: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;*/
|
||||
/*border-top-right-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
border-top-left-radius: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;*/
|
||||
}
|
||||
.butActionNew, .butActionNewRefused, .butActionNew:link, .butActionNew:visited, .butActionNew:hover, .butActionNew:active {
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
font-weight: normal;
|
||||
|
||||
margin: 0em 0.3em 0 0.3em !important;
|
||||
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em;
|
||||
font-family: <?php print $fontlist ?>;
|
||||
display: inline-block;
|
||||
/* text-align: center; New button are on right of screen */
|
||||
cursor: pointer;
|
||||
margin: 0em 0.3em 0 0.3em !important;
|
||||
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em 0.3em;
|
||||
font-family: <?php print $fontlist ?>;
|
||||
display: inline-block;
|
||||
/* text-align: center; New button are on right of screen */
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover,
|
||||
@ -127,66 +129,66 @@ span.butActionNewRefused>span.fa, span.butActionNewRefused>span.fa:hover
|
||||
}
|
||||
|
||||
.butAction:hover {
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
}
|
||||
.butActionNew:hover {
|
||||
text-decoration: underline;
|
||||
box-shadow: unset !important;
|
||||
text-decoration: underline;
|
||||
box-shadow: unset !important;
|
||||
}
|
||||
|
||||
.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
|
||||
background: var(--butactiondeletebg);
|
||||
/* border: 1px solid #633; */
|
||||
color: #633;
|
||||
background: var(--butactiondeletebg);
|
||||
/* border: 1px solid #633; */
|
||||
color: #633;
|
||||
}
|
||||
|
||||
.butActionDelete:hover {
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
}
|
||||
|
||||
.butActionRefused {
|
||||
text-decoration: none !important;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold !important;
|
||||
text-decoration: none !important;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold !important;
|
||||
|
||||
white-space: nowrap !important;
|
||||
cursor: not-allowed !important;
|
||||
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
|
||||
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
|
||||
font-family: <?php print $fontlist ?> !important;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999 !important;
|
||||
border: 1px solid #ccc;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
white-space: nowrap !important;
|
||||
cursor: not-allowed !important;
|
||||
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.9'); ?>em;
|
||||
padding: 0.6em <?php echo ($dol_optimize_smallscreen ? '0.6' : '0.7'); ?>em;
|
||||
font-family: <?php print $fontlist ?> !important;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999 !important;
|
||||
border: 1px solid #ccc;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
}
|
||||
.butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active {
|
||||
text-decoration: none !important;
|
||||
text-transform: uppercase;
|
||||
font-weight: normal !important;
|
||||
text-decoration: none !important;
|
||||
text-transform: uppercase;
|
||||
font-weight: normal !important;
|
||||
|
||||
white-space: nowrap !important;
|
||||
cursor: not-allowed !important;
|
||||
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
|
||||
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
|
||||
font-family: <?php print $fontlist ?> !important;
|
||||
display: inline-block;
|
||||
/* text-align: center; New button are on right of screen */
|
||||
cursor: pointer;
|
||||
color: #999 !important;
|
||||
padding-top: 0.2em;
|
||||
box-shadow: none !important;
|
||||
-webkit-box-shadow: none !important;
|
||||
white-space: nowrap !important;
|
||||
cursor: not-allowed !important;
|
||||
margin: 0em <?php echo ($dol_optimize_smallscreen ? '0.7' : '0.9'); ?>em;
|
||||
padding: 0.2em <?php echo ($dol_optimize_smallscreen ? '0.4' : '0.7'); ?>em;
|
||||
font-family: <?php print $fontlist ?> !important;
|
||||
display: inline-block;
|
||||
/* text-align: center; New button are on right of screen */
|
||||
cursor: pointer;
|
||||
color: #999 !important;
|
||||
padding-top: 0.2em;
|
||||
box-shadow: none !important;
|
||||
-webkit-box-shadow: none !important;
|
||||
}
|
||||
|
||||
.butActionTransparent {
|
||||
color: #222 ! important;
|
||||
background-color: transparent ! important;
|
||||
color: #222 ! important;
|
||||
background-color: transparent ! important;
|
||||
}
|
||||
|
||||
|
||||
@ -195,37 +197,37 @@ TITLE BUTTON
|
||||
*/
|
||||
|
||||
.btnTitle, a.btnTitle {
|
||||
display: inline-block;
|
||||
padding: 4px 4px 4px 4px;
|
||||
font-weight: 400;
|
||||
/* line-height: 1; */
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
box-shadow: var(--btncolorbg);
|
||||
text-decoration: none;
|
||||
position: relative;
|
||||
/* margin: 0 0 0 8px; */
|
||||
min-width: 72px;
|
||||
text-align: center;
|
||||
color: var(--btncolortext);
|
||||
border: none;
|
||||
font-size: 12px;
|
||||
font-weight: 300;
|
||||
background-color: var(--btncolorbg);
|
||||
display: inline-block;
|
||||
padding: 4px 4px 4px 4px;
|
||||
font-weight: 400;
|
||||
/* line-height: 1; */
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
box-shadow: var(--btncolorbg);
|
||||
text-decoration: none;
|
||||
position: relative;
|
||||
/* margin: 0 0 0 8px; */
|
||||
min-width: 72px;
|
||||
text-align: center;
|
||||
color: var(--btncolortext);
|
||||
border: none;
|
||||
font-size: 12px;
|
||||
font-weight: 300;
|
||||
background-color: var(--btncolorbg);
|
||||
border: 1px solid var(--btncolorborder);
|
||||
}
|
||||
|
||||
a.btnTitle.btnTitleSelected {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.btnTitle > .btnTitle-icon{
|
||||
@ -233,43 +235,43 @@ a.btnTitle.btnTitleSelected {
|
||||
}
|
||||
|
||||
.btnTitle > .btnTitle-label{
|
||||
color: #666666;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.btnTitle:hover, a.btnTitle:hover {
|
||||
border: 1px solid #bbb;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
/* color: #ffffff;
|
||||
background-color: rgb(<?php print $colortextlink; ?>); */
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
box-shadow: none;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
/* color: #ffffff;
|
||||
background-color: rgb(<?php print $colortextlink; ?>); */
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover {
|
||||
color: #8a8a8a;
|
||||
cursor: not-allowed;
|
||||
background-color: #fbfbfb;
|
||||
background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
|
||||
color: #8a8a8a;
|
||||
cursor: not-allowed;
|
||||
background-color: #fbfbfb;
|
||||
background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
|
||||
}
|
||||
|
||||
.btnTitle:hover .btnTitle-label{
|
||||
color: var(--btncolorborderhover);
|
||||
color: var(--btncolorborderhover);
|
||||
}
|
||||
|
||||
.btnTitle.refused .btnTitle-label, .btnTitle.refused:hover .btnTitle-label{
|
||||
color: #8a8a8a;
|
||||
color: #8a8a8a;
|
||||
}
|
||||
|
||||
.btnTitle>.fa {
|
||||
font-size: 20px;
|
||||
display: block;
|
||||
font-size: 20px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.pagination li:first-child a.btnTitle{
|
||||
margin-left: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
|
||||
@ -284,15 +286,15 @@ div.pagination li:first-child a.btnTitle{
|
||||
font-size: 0.95em;
|
||||
}
|
||||
.btnTitle, a.btnTitle {
|
||||
display: inline-block;
|
||||
padding: 4px 4px 4px 4px;
|
||||
display: inline-block;
|
||||
padding: 4px 4px 4px 4px;
|
||||
min-width: unset;
|
||||
}
|
||||
}
|
||||
|
||||
<?php if (!empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (!$user->admin)) { ?>
|
||||
.butActionRefused, .butActionNewRefused, .btnTitle.refused {
|
||||
display: none !important;
|
||||
display: none !important;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -1,63 +1,65 @@
|
||||
<?php
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) {
|
||||
die('Must be call by steelsheet');
|
||||
} ?>
|
||||
/* <style type="text/css" > dont remove this line it's an ide hack */
|
||||
/*
|
||||
* Dropdown of user popup
|
||||
*/
|
||||
|
||||
button.dropdown-item.global-search-item {
|
||||
outline: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-quickadd, .open>.dropdown-menu, .dropdown dd ul.open {
|
||||
display: block;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dropdown-search {
|
||||
border-color: #eee;
|
||||
border-color: #eee;
|
||||
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
float: left;
|
||||
min-width: 160px;
|
||||
margin: 2px 0 0;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
float: left;
|
||||
min-width: 160px;
|
||||
margin: 2px 0 0;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
}
|
||||
.dropdown-bookmark {
|
||||
border-color: #eee;
|
||||
border-color: #eee;
|
||||
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
float: left;
|
||||
min-width: 160px;
|
||||
margin: 2px 0 0;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
float: left;
|
||||
min-width: 160px;
|
||||
margin: 2px 0 0;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
}
|
||||
.dropdown-quickadd {
|
||||
border-color: #eee;
|
||||
@ -83,107 +85,107 @@ button.dropdown-item.global-search-item {
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
}
|
||||
.dropdown-menu {
|
||||
border-color: #eee;
|
||||
border-color: #eee;
|
||||
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
float: left;
|
||||
min-width: 160px;
|
||||
margin: 2px 0 0;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
float: left;
|
||||
min-width: 160px;
|
||||
margin: 2px 0 0;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
-webkit-background-clip: padding-box;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,.175);
|
||||
}
|
||||
|
||||
|
||||
.dropdown-toggle{
|
||||
text-decoration: none !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.dropdown-toggle::after {
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-size: 0.7em;
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
margin: auto 3px;
|
||||
display: inline-block;
|
||||
content: "\f078";
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-size: 0.7em;
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
margin: auto 3px;
|
||||
display: inline-block;
|
||||
content: "\f078";
|
||||
|
||||
-webkit-transition: -webkit-transform .2s ease-in-out;
|
||||
-ms-transition: -ms-transform .2s ease-in-out;
|
||||
transition: transform .2s ease-in-out;
|
||||
-webkit-transition: -webkit-transform .2s ease-in-out;
|
||||
-ms-transition: -ms-transform .2s ease-in-out;
|
||||
transition: transform .2s ease-in-out;
|
||||
}
|
||||
|
||||
.open>.dropdown-toggle::after {
|
||||
transform: rotate(180deg);
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/*
|
||||
* MENU Dropdown
|
||||
*/
|
||||
.login_block.usedropdown .logout-btn{
|
||||
display: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tmenu .open.dropdown, .tmenu .open.dropdown {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.tmenu .dropdown-menu, .login_block .dropdown-menu, .topnav .dropdown-menu {
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
<?php echo $left; ?>: auto;
|
||||
line-height:1.3em;
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
<?php echo $left; ?>: auto;
|
||||
line-height:1.3em;
|
||||
}
|
||||
.tmenu .dropdown-menu, .login_block .dropdown-menu .user-body {
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
.user-body {
|
||||
color: #333;
|
||||
color: #333;
|
||||
}
|
||||
.side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu {
|
||||
border-top-right-radius: 0;
|
||||
border-top-left-radius: 0;
|
||||
padding: 1px 0 0 0;
|
||||
border-top-width: 0;
|
||||
width: 300px;
|
||||
border-top-right-radius: 0;
|
||||
border-top-left-radius: 0;
|
||||
padding: 1px 0 0 0;
|
||||
border-top-width: 0;
|
||||
width: 300px;
|
||||
}
|
||||
.topnav .user-menu .dropdown-menu {
|
||||
top: 50px;
|
||||
}
|
||||
.side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu {
|
||||
margin-top: 0;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
margin-top: 0;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
.side-nav-vert .user-menu .dropdown-menu > .user-header, .topnav .user-menu .dropdown-menu > .user-header {
|
||||
min-height: 100px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
min-height: 100px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
#topmenu-global-search-dropdown .dropdown-menu{
|
||||
width: 300px;
|
||||
max-width: 100%;
|
||||
width: 300px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-quickadd-dropdown {
|
||||
@ -192,184 +194,184 @@ div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-q
|
||||
<?php } ?>
|
||||
}
|
||||
a.top-menu-dropdown-link {
|
||||
padding: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.dropdown-user-image {
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
z-index: 5;
|
||||
height: 90px;
|
||||
width: 90px;
|
||||
border: 3px solid;
|
||||
border-color: transparent;
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
max-width: 100%;
|
||||
max-height :100%;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
z-index: 5;
|
||||
height: 90px;
|
||||
width: 90px;
|
||||
border: 3px solid;
|
||||
border-color: transparent;
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
max-width: 100%;
|
||||
max-height :100%;
|
||||
}
|
||||
|
||||
.dropdown-menu > .user-header{
|
||||
background: var(--colorbackhmenu1);
|
||||
background: var(--colorbackhmenu1);
|
||||
}
|
||||
|
||||
.dropdown-menu .dropdown-header{
|
||||
padding: 8px 8px 8px 8px;
|
||||
padding: 8px 8px 8px 8px;
|
||||
}
|
||||
|
||||
.dropdown-menu > .user-footer {
|
||||
border-top: 1px solid #f0f0f0;
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.user-footer:after {
|
||||
clear: both;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.dropdown-menu > .bookmark-footer{
|
||||
border-top: 1px solid #f0f0f0;
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
background-color: #f9f9f9;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
|
||||
.dropdown-menu > .user-body, .dropdown-body{
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #f4f4f4;
|
||||
border-top: 1px solid #dddddd;
|
||||
white-space: normal;
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #f4f4f4;
|
||||
border-top: 1px solid #dddddd;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.dropdown-menu > .bookmark-body, .dropdown-body{
|
||||
overflow-y: auto;
|
||||
max-height: 60vh ; /* fallback for browsers without support for calc() */
|
||||
max-height: calc(90vh - 110px) ;
|
||||
overflow-y: auto;
|
||||
max-height: 60vh ; /* fallback for browsers without support for calc() */
|
||||
max-height: calc(90vh - 110px) ;
|
||||
white-space: normal;
|
||||
}
|
||||
#topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{
|
||||
max-height: 60vh ; /* fallback for browsers without support for calc() */
|
||||
max-height: calc(90vh - 200px) ;
|
||||
max-height: 60vh ; /* fallback for browsers without support for calc() */
|
||||
max-height: calc(90vh - 200px) ;
|
||||
}
|
||||
|
||||
|
||||
.dropdown-body::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
width: 8px;
|
||||
}
|
||||
.dropdown-body::-webkit-scrollbar-thumb {
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */
|
||||
background: #aaa;
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
/* background: rgb(<?php echo $colorbackhmenu1 ?>); */
|
||||
background: #aaa;
|
||||
}
|
||||
.dropdown-body::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
|
||||
#topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown {
|
||||
padding: 0 5px 0 5px;
|
||||
padding: 0 5px 0 5px;
|
||||
}
|
||||
#topmenu-login-dropdown a:hover{
|
||||
text-decoration: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#topmenuloginmoreinfo-btn{
|
||||
display: block;
|
||||
text-aling: right;
|
||||
color:#666;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
text-aling: right;
|
||||
color:#666;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#topmenuloginmoreinfo{
|
||||
display: none;
|
||||
clear: both;
|
||||
font-size: 0.95em;
|
||||
display: none;
|
||||
clear: both;
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
.button-top-menu-dropdown {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background-image: none;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-bottom: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.42857143;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background-image: none;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.user-footer .button-top-menu-dropdown {
|
||||
color: #666666;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
border-width: 1px;
|
||||
background-color: #f4f4f4;
|
||||
border-color: #ddd;
|
||||
color: #666666;
|
||||
border-radius: 0;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
border-width: 1px;
|
||||
background-color: #f4f4f4;
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
.dropdown-menu a.top-menu-dropdown-link {
|
||||
color: rgb(<?php print $colortextlink; ?>) !important;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
display: block;
|
||||
margin: 5px 0px;
|
||||
color: rgb(<?php print $colortextlink; ?>) !important;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
display: block;
|
||||
margin: 5px 0px;
|
||||
}
|
||||
|
||||
.dropdown-item {
|
||||
display: block !important;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: .3em 1.5em .4em 1em;
|
||||
clear: both;
|
||||
font-weight: 400;
|
||||
color: #212529 !important;
|
||||
text-align: inherit;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
display: block !important;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: .3em 1.5em .4em 1em;
|
||||
clear: both;
|
||||
font-weight: 400;
|
||||
color: #212529 !important;
|
||||
text-align: inherit;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.dropdown-item::before {
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
margin-right: 5px;
|
||||
display: inline-block;
|
||||
content: "\f0da";
|
||||
/* color: rgba(0,0,0,0.3); */
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
margin-right: 5px;
|
||||
display: inline-block;
|
||||
content: "\f0da";
|
||||
/* color: rgba(0,0,0,0.3); */
|
||||
}
|
||||
.dropdown-item.bookmark-item-external::before {
|
||||
content: "\f35d";
|
||||
}
|
||||
|
||||
.dropdown-item.active, .dropdown-item:hover, .dropdown-item:focus {
|
||||
color: #<?php echo $colortextbackhmenu; ?> !important;
|
||||
text-decoration: none;
|
||||
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||
color: #<?php echo $colortextbackhmenu; ?> !important;
|
||||
text-decoration: none;
|
||||
background: rgb(<?php echo $colorbackhmenu1 ?>);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -377,34 +379,34 @@ a.top-menu-dropdown-link {
|
||||
*/
|
||||
|
||||
.dropdown-search-input {
|
||||
width: 100%;
|
||||
padding: 10px 35px 10px 20px;
|
||||
width: 100%;
|
||||
padding: 10px 35px 10px 20px;
|
||||
|
||||
background-color: transparent;
|
||||
/*font-size: 14px;
|
||||
line-height: 16px;*/
|
||||
box-sizing: border-box;
|
||||
background-color: transparent;
|
||||
/*font-size: 14px;
|
||||
line-height: 16px;*/
|
||||
box-sizing: border-box;
|
||||
|
||||
color: #575756;
|
||||
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 16px 16px;
|
||||
background-position: 95% center;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #c4c4c2 !important;
|
||||
transition: all 250ms ease-in-out;
|
||||
backface-visibility: hidden;
|
||||
transform-style: preserve-3d;
|
||||
color: #575756;
|
||||
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 16px 16px;
|
||||
background-position: 95% center;
|
||||
border-radius: 10px;
|
||||
border: 1px solid #c4c4c2 !important;
|
||||
transition: all 250ms ease-in-out;
|
||||
backface-visibility: hidden;
|
||||
transform-style: preserve-3d;
|
||||
|
||||
}
|
||||
|
||||
.dropdown-search-input::placeholder {
|
||||
color: color(#575756 a(0.8));
|
||||
letter-spacing: 1.5px;
|
||||
color: color(#575756 a(0.8));
|
||||
letter-spacing: 1.5px;
|
||||
}
|
||||
|
||||
.hidden-search-result{
|
||||
display: none !important;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -468,11 +470,11 @@ div.quickaddblock:focus {
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
.dropdown-search-input {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tmenu .dropdown-menu, .login_block .dropdown-menu, .topnav .dropdown-menu {
|
||||
margin-left: 5px;
|
||||
right: 0;
|
||||
}
|
||||
margin-left: 5px;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) {
|
||||
die('Must be call by steelsheet');
|
||||
} ?>
|
||||
/* <style type="text/css" > */
|
||||
|
||||
/*
|
||||
@ -8,33 +10,33 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
*/
|
||||
|
||||
.info-box-module-external span.info-box-icon-version {
|
||||
background: #bbb;
|
||||
background: #bbb;
|
||||
}
|
||||
|
||||
.info-box {
|
||||
display: block;
|
||||
position: relative;
|
||||
position: relative;
|
||||
min-height: 90px;
|
||||
/* background: #fff; */
|
||||
width: 100%;
|
||||
box-shadow: 1px 1px 15px rgba(192, 192, 192, 0.2);
|
||||
border-radius: 2px;
|
||||
border: 1px solid #e9e9e9;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #e9e9e9;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.info-box.info-box-sm {
|
||||
min-height: 80px;
|
||||
margin-bottom: 10px;
|
||||
/* background: #fff; */
|
||||
min-height: 80px;
|
||||
margin-bottom: 10px;
|
||||
/* background: #fff; */
|
||||
}
|
||||
.opened-dash-board-wrap .info-box.info-box-sm {
|
||||
border-radius: 0 0 0 20px;
|
||||
border-radius: 0 0 0 20px;
|
||||
}
|
||||
.info-box-more {
|
||||
float: right;
|
||||
top: 5px;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
float: right;
|
||||
top: 5px;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
}
|
||||
|
||||
.info-box small {
|
||||
@ -71,7 +73,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 2px;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
height: 90px;
|
||||
width: 90px;
|
||||
@ -82,20 +84,20 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
}
|
||||
|
||||
.info-box-module .info-box-icon {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.info-box-sm .info-box-icon {
|
||||
height: 80px;
|
||||
width: 78px;
|
||||
font-size: 25px;
|
||||
line-height: 92px;
|
||||
height: 80px;
|
||||
width: 78px;
|
||||
font-size: 25px;
|
||||
line-height: 92px;
|
||||
}
|
||||
.opened-dash-board-wrap .info-box-sm .info-box-icon {
|
||||
border-radius: 0 0 0 20px;
|
||||
border-radius: 0 0 0 20px;
|
||||
}
|
||||
.opened-dash-board-wrap .info-box-sm .info-box-icon {
|
||||
line-height: 80px;
|
||||
line-height: 80px;
|
||||
}
|
||||
.info-box-module .info-box-icon {
|
||||
height: 98px;
|
||||
@ -104,75 +106,75 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
max-width: 100%;
|
||||
}
|
||||
.info-box-module .info-box-icon > img {
|
||||
max-width: 60%;
|
||||
max-width: 60%;
|
||||
}
|
||||
|
||||
a.info-box-text.info-box-text-a {
|
||||
display: table-cell;
|
||||
display: table-cell;
|
||||
}
|
||||
a.info-box-text-a i.fa.fa-exclamation-triangle {
|
||||
font-size: 0.9em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.info-box-icon-text{
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 90px;
|
||||
bottom: 0px;
|
||||
color: #ffffff;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
cursor: default;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 90px;
|
||||
bottom: 0px;
|
||||
color: #ffffff;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
cursor: default;
|
||||
|
||||
font-size: 10px;
|
||||
line-height: 15px;
|
||||
padding: 0px 3px;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
font-size: 10px;
|
||||
line-height: 15px;
|
||||
padding: 0px 3px;
|
||||
text-align: center;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
}
|
||||
|
||||
.info-box-icon-version {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 90px;
|
||||
bottom: 0px;
|
||||
color: #ffffff;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
cursor: default;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 90px;
|
||||
bottom: 0px;
|
||||
color: #ffffff;
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
cursor: default;
|
||||
|
||||
font-size: 10px;
|
||||
line-height: 22px;
|
||||
padding: 0px 3px;
|
||||
text-align: center;
|
||||
opacity: 1;
|
||||
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
font-size: 10px;
|
||||
line-height: 22px;
|
||||
padding: 0px 3px;
|
||||
text-align: center;
|
||||
opacity: 1;
|
||||
-webkit-transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
transition: opacity 0.5s, visibility 0s 0.5s;
|
||||
}
|
||||
.box-flex-item.info-box-module.info-box-module-disabled {
|
||||
/* opacity: 0.6; */
|
||||
/* opacity: 0.6; */
|
||||
}
|
||||
|
||||
.info-box-actions {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
<?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?>
|
||||
.info-box-icon-text{
|
||||
opacity: 1;
|
||||
opacity: 1;
|
||||
}
|
||||
<?php } ?>
|
||||
|
||||
.info-box-sm .info-box-icon-text, .info-box-sm .info-box-icon-version{
|
||||
overflow: hidden;
|
||||
width: 80px;
|
||||
overflow: hidden;
|
||||
width: 80px;
|
||||
}
|
||||
.info-box:hover .info-box-icon-text{
|
||||
opacity: 1;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.info-box-content {
|
||||
@ -180,11 +182,11 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
|
||||
margin-left: 84px;
|
||||
}
|
||||
.info-box-sm .info-box-content{
|
||||
margin-left: 80px;
|
||||
margin-left: 80px;
|
||||
}
|
||||
.info-box-sm .info-box-module-enabled {
|
||||
/* background: linear-gradient(0.35turn, #fff, #fff, #f6faf8, #e4efe8) */
|
||||
background: linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8);
|
||||
/* background: linear-gradient(0.35turn, #fff, #fff, #f6faf8, #e4efe8) */
|
||||
background: linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8);
|
||||
}
|
||||
.info-box-content-warning span.font-status4 {
|
||||
color: #bc9526 !important;
|
||||
@ -193,7 +195,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
|
||||
background: #ffd7a3;
|
||||
}*/
|
||||
/*.info-box-icon.info-box-icon-module-enabled {
|
||||
background: #e4f0e4 !important;
|
||||
background: #e4f0e4 !important;
|
||||
}*/
|
||||
|
||||
.info-box-number {
|
||||
@ -240,20 +242,26 @@ a.info-box-text{ text-decoration: none;}
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$prefix = '';
|
||||
if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'background-';
|
||||
if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) {
|
||||
$prefix = 'background-';
|
||||
}
|
||||
|
||||
if (!isset($conf->global->THEME_SATURATE_RATIO)) $conf->global->THEME_SATURATE_RATIO = 0.7;
|
||||
if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
|
||||
if (!isset($conf->global->THEME_SATURATE_RATIO)) {
|
||||
$conf->global->THEME_SATURATE_RATIO = 0.7;
|
||||
}
|
||||
if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
|
||||
$conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int');
|
||||
}
|
||||
|
||||
?>
|
||||
.info-box-icon {
|
||||
<?php if ($prefix) { ?>
|
||||
color: #fff !important;
|
||||
<?php } ?>
|
||||
opacity: 0.95;
|
||||
<?php if (isset($conf->global->THEME_SATURATE_RATIO)) { ?>
|
||||
filter: saturate(<?php echo $conf->global->THEME_SATURATE_RATIO; ?>);
|
||||
<?php } ?>
|
||||
opacity: 0.95;
|
||||
<?php if (isset($conf->global->THEME_SATURATE_RATIO)) { ?>
|
||||
filter: saturate(<?php echo $conf->global->THEME_SATURATE_RATIO; ?>);
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
.customer-back {
|
||||
@ -435,13 +443,13 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
|
||||
}
|
||||
.info-box-module {
|
||||
min-width: 350px;
|
||||
max-width: 350px;
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1740px) {
|
||||
.info-box-module {
|
||||
min-width: 315px;
|
||||
max-width: 315px;
|
||||
min-width: 315px;
|
||||
max-width: 315px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,8 +471,8 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
|
||||
@media only screen and (max-width: 767px)
|
||||
{
|
||||
.box-flex-container {
|
||||
margin: 0 0 0 0px !important;
|
||||
width: 100% !important;
|
||||
margin: 0 0 0 0px !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
.info-box-module {
|
||||
width: 100%;
|
||||
|
||||
@ -1,23 +1,25 @@
|
||||
<?php if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
<?php if (!defined('ISLOADEDBYSTEELSHEET')) {
|
||||
die('Must be call by steelsheet');
|
||||
} ?>
|
||||
/* <style type="text/css" > */
|
||||
|
||||
.mainmenu::before{
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
line-height: 23px;
|
||||
/* font part */
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
text-rendering: auto;
|
||||
line-height: 23px;
|
||||
font-size: <?php echo $topMenuFontSize; ?>;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
color: #<?php echo $colortextbackhmenu; ?>;
|
||||
}
|
||||
|
||||
.fa-15x {
|
||||
font-size: 1.5em;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
div.mainmenu.menu {
|
||||
@ -34,116 +36,116 @@ div.mainmenu.home::before{
|
||||
}
|
||||
|
||||
div.mainmenu.billing::before {
|
||||
content: "\f51e";
|
||||
content: "\f51e";
|
||||
}
|
||||
|
||||
div.mainmenu.accountancy::before {
|
||||
content: "\f53d";
|
||||
content: "\f53d";
|
||||
}
|
||||
|
||||
div.mainmenu.agenda::before {
|
||||
content: "\f073";
|
||||
content: "\f073";
|
||||
}
|
||||
|
||||
div.mainmenu.bank::before {
|
||||
content: "\f19c";
|
||||
content: "\f19c";
|
||||
}
|
||||
|
||||
<?php if ($conf->global->MAIN_FEATURES_LEVEL == 2) { ?>
|
||||
/* TESTING USAGE OF SVG WITHOUT FONT */
|
||||
div.mainmenu.cashdesk {
|
||||
line-height: 26px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
div.mainmenu.cashdesk .tmenuimage {
|
||||
line-height: 26px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: <?php echo $topMenuFontSize; ?>;
|
||||
line-height: 26px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: <?php echo $topMenuFontSize; ?>;
|
||||
background-color: #<?php echo $colortextbackhmenu; ?>;
|
||||
width: 100%;
|
||||
-webkit-mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%; /* for old webkit browser */
|
||||
mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%;
|
||||
width: 100%;
|
||||
-webkit-mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%; /* for old webkit browser */
|
||||
mask: url(<?php echo DOL_URL_ROOT.'/theme/common/fontawesome-5/svgs/solid/cash-register.svg' ?>) no-repeat 50% 50%;
|
||||
}
|
||||
|
||||
<?php } else { ?>
|
||||
div.mainmenu.cashdesk::before {
|
||||
content: "\f788";
|
||||
content: "\f788";
|
||||
}
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
div.mainmenu.takepos::before {
|
||||
content: "\f788";
|
||||
content: "\f788";
|
||||
}
|
||||
|
||||
div.mainmenu.companies::before {
|
||||
content: "\f1ad";
|
||||
content: "\f1ad";
|
||||
}
|
||||
|
||||
div.mainmenu.commercial::before {
|
||||
content: "\f0f2";
|
||||
content: "\f0f2";
|
||||
}
|
||||
|
||||
div.mainmenu.ecm::before {
|
||||
content: "\f07c";
|
||||
content: "\f07c";
|
||||
}
|
||||
|
||||
div.mainmenu.externalsite::before {
|
||||
content: "\f360";
|
||||
content: "\f360";
|
||||
}
|
||||
|
||||
div.mainmenu.ftp::before {
|
||||
content: "\f362";
|
||||
content: "\f362";
|
||||
}
|
||||
|
||||
div.mainmenu.hrm::before {
|
||||
content: "\f508";
|
||||
content: "\f508";
|
||||
}
|
||||
|
||||
div.mainmenu.members::before {
|
||||
content: "\f007";
|
||||
content: "\f007";
|
||||
}
|
||||
|
||||
div.mainmenu.products::before {
|
||||
content: "\f1b2";
|
||||
content: "\f1b2";
|
||||
}
|
||||
|
||||
div.mainmenu.mrp::before {
|
||||
content: "\f1b3";
|
||||
content: "\f1b3";
|
||||
}
|
||||
|
||||
div.mainmenu.project::before {
|
||||
content: "\f0e8";
|
||||
content: "\f0e8";
|
||||
}
|
||||
|
||||
div.mainmenu.ticket::before {
|
||||
content: "\f3ff";
|
||||
content: "\f3ff";
|
||||
}
|
||||
|
||||
div.mainmenu.tools::before {
|
||||
content: "\f0ad";
|
||||
content: "\f0ad";
|
||||
}
|
||||
|
||||
div.mainmenu.website::before {
|
||||
content: "\f57d";
|
||||
content: "\f57d";
|
||||
}
|
||||
|
||||
div.mainmenu.generic1::before {
|
||||
content: "\f249";
|
||||
content: "\f249";
|
||||
}
|
||||
|
||||
div.mainmenu.generic2::before {
|
||||
content: "\f249";
|
||||
content: "\f249";
|
||||
}
|
||||
|
||||
div.mainmenu.generic3::before {
|
||||
content: "\f249";
|
||||
content: "\f249";
|
||||
}
|
||||
|
||||
div.mainmenu.generic4::before {
|
||||
content: "\f249";
|
||||
content: "\f249";
|
||||
}
|
||||
|
||||
/* Define color of some picto */
|
||||
|
||||
@ -25,16 +25,36 @@
|
||||
* \brief File for The Web App
|
||||
*/
|
||||
|
||||
if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', '1');
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOSESSION')) define('NOSESSION', '1');
|
||||
if (!defined('NOREQUIREUSER')) {
|
||||
define('NOREQUIREUSER', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRETRAN')) {
|
||||
define('NOREQUIRETRAN', '1');
|
||||
}
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', '1');
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREMENU')) {
|
||||
define('NOREQUIREMENU', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', '1');
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOSESSION')) {
|
||||
define('NOSESSION', '1');
|
||||
}
|
||||
|
||||
require_once __DIR__.'/../../main.inc.php';
|
||||
|
||||
@ -45,8 +65,7 @@ if (empty($dolibarr_nocache)) {
|
||||
header('Cache-Control: max-age=10800, public, must-revalidate');
|
||||
// For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server
|
||||
header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
header('Cache-Control: no-cache');
|
||||
}
|
||||
|
||||
@ -55,7 +74,9 @@ $manifest = new stdClass();
|
||||
|
||||
|
||||
$manifest->name = constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $manifest->name = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||
$manifest->name = $conf->global->MAIN_APPLICATION_TITLE;
|
||||
}
|
||||
|
||||
|
||||
$manifest->theme_color = !empty($conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR)?$conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR:'#F05F40';
|
||||
@ -64,21 +85,23 @@ $manifest->display = "standalone";
|
||||
$manifest->splash_pages = null;
|
||||
$manifest->icons = array();
|
||||
|
||||
if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)){
|
||||
if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
|
||||
$icon = new stdClass();
|
||||
$icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL;
|
||||
if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) { $icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE."x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE; }
|
||||
else { $icon->sizes = "512x512"; }
|
||||
if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) {
|
||||
$icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE."x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE;
|
||||
} else {
|
||||
$icon->sizes = "512x512";
|
||||
}
|
||||
$icon->type = "image/png";
|
||||
$manifest->icons[] = $icon;
|
||||
}
|
||||
elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)){
|
||||
} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)) {
|
||||
$iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI;
|
||||
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
|
||||
if (is_readable($iconPath)) {
|
||||
$imgSize = getimagesize($iconPath);
|
||||
if ($imgSize){
|
||||
if ($imgSize) {
|
||||
$icon = new stdClass();
|
||||
$icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
|
||||
$icon->sizes = $imgSize[0]."x".$imgSize[1];
|
||||
@ -88,12 +111,12 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)){
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)) {
|
||||
$iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL;
|
||||
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
|
||||
if (is_readable($iconPath)) {
|
||||
$imgSize = getimagesize($iconPath);
|
||||
if ($imgSize){
|
||||
if ($imgSize) {
|
||||
$icon = new stdClass();
|
||||
$icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
|
||||
$icon->sizes = $imgSize[0]."x".$imgSize[1];
|
||||
@ -103,12 +126,12 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
|
||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
|
||||
$iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED;
|
||||
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
|
||||
if (is_readable($iconPath)) {
|
||||
$imgSize = getimagesize($iconPath);
|
||||
if ($imgSize){
|
||||
if ($imgSize) {
|
||||
$icon = new stdClass();
|
||||
$icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath);
|
||||
$icon->sizes = $imgSize[0]."x".$imgSize[1];
|
||||
@ -120,7 +143,7 @@ elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)){
|
||||
}
|
||||
|
||||
// Add Dolibarr std icon
|
||||
if (empty($manifest->icons)){
|
||||
if (empty($manifest->icons)) {
|
||||
$icon = new stdClass();
|
||||
$icon->src = DOL_URL_ROOT.'/theme/dolibarr_256x256_color.png';
|
||||
$icon->sizes = "256x256";
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) {
|
||||
die('Must be call by steelsheet');
|
||||
} ?>
|
||||
/* <style type="text/css" > */
|
||||
/*
|
||||
progress style is based on boostrap and admin lte framework
|
||||
@ -12,183 +14,183 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
*/
|
||||
|
||||
.progress * {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.progress {
|
||||
height: 20px;
|
||||
overflow: hidden;
|
||||
background-color: #f5f5f5;
|
||||
background-color: rgba(128, 128, 128, 0.1);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
height: 20px;
|
||||
overflow: hidden;
|
||||
background-color: #f5f5f5;
|
||||
background-color: rgba(128, 128, 128, 0.1);
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.progress.spaced{
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
float: left;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #337ab7;
|
||||
-webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
|
||||
box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
|
||||
-webkit-transition: width .6s ease;
|
||||
-o-transition: width .6s ease;
|
||||
transition: width .6s ease;
|
||||
float: left;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #337ab7;
|
||||
-webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
|
||||
box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
|
||||
-webkit-transition: width .6s ease;
|
||||
-o-transition: width .6s ease;
|
||||
transition: width .6s ease;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.progress-group > .progress{
|
||||
clear: both;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.progress,
|
||||
.progress > .progress-bar {
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
.progress,
|
||||
.progress > .progress-bar,
|
||||
.progress .progress-bar,
|
||||
.progress > .progress-bar .progress-bar {
|
||||
border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
}
|
||||
/* size variation */
|
||||
.progress.sm,
|
||||
.progress-sm {
|
||||
height: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
.progress.sm,
|
||||
.progress-sm,
|
||||
.progress.sm .progress-bar,
|
||||
.progress-sm .progress-bar {
|
||||
border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
}
|
||||
.progress.xs,
|
||||
.progress-xs {
|
||||
height: 7px;
|
||||
height: 7px;
|
||||
}
|
||||
.progress.xs,
|
||||
.progress-xs,
|
||||
.progress.xs .progress-bar,
|
||||
.progress-xs .progress-bar {
|
||||
border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
}
|
||||
.progress.xxs,
|
||||
.progress-xxs {
|
||||
height: 3px;
|
||||
height: 3px;
|
||||
}
|
||||
.progress.xxs,
|
||||
.progress-xxs,
|
||||
.progress.xxs .progress-bar,
|
||||
.progress-xxs .progress-bar {
|
||||
border-radius: 1px;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
|
||||
/* Vertical bars */
|
||||
.progress.vertical {
|
||||
position: relative;
|
||||
width: 30px;
|
||||
height: 200px;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
width: 30px;
|
||||
height: 200px;
|
||||
display: inline-block;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.progress.vertical > .progress-bar {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
.progress.vertical.sm,
|
||||
.progress.vertical.progress-sm {
|
||||
width: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
.progress.vertical.xs,
|
||||
.progress.vertical.progress-xs {
|
||||
width: 10px;
|
||||
width: 10px;
|
||||
}
|
||||
.progress.vertical.xxs,
|
||||
.progress.vertical.progress-xxs {
|
||||
width: 3px;
|
||||
width: 3px;
|
||||
}
|
||||
.progress-group .progress-text {
|
||||
/* font-weight: 600; */
|
||||
/* font-weight: 600; */
|
||||
}
|
||||
.progress-group .progress-number {
|
||||
float: right;
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Remove margins from progress bars when put in a table */
|
||||
.table tr > td .progress {
|
||||
margin: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.progress-bar-light-blue,
|
||||
.progress-bar-primary {
|
||||
background-color: #3c8dbc;
|
||||
background-color: #3c8dbc;
|
||||
}
|
||||
.progress-striped .progress-bar-light-blue,
|
||||
.progress-striped .progress-bar-primary {
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
.progress-bar-green, .progress-bar-success {
|
||||
background-color: <?php echo $badgeSuccess ?>;
|
||||
background-color: <?php echo $badgeSuccess ?>;
|
||||
}
|
||||
.progress-striped .progress-bar-green, .progress-striped .progress-bar-success {
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
body[class*="colorblind-"] .progress-bar-green, body[class*="colorblind-"] .progress-bar-success {
|
||||
background-color: <?php echo $colorblind_deuteranopes_badgeSuccess ?>;
|
||||
background-color: <?php echo $colorblind_deuteranopes_badgeSuccess ?>;
|
||||
}
|
||||
body[class*="colorblind-"] .progress-bar-red, body[class*="colorblind-"] .progress-bar-danger {
|
||||
background-color: <?php echo $colorblind_deuteranopes_badgeDanger ?>;
|
||||
background-color: <?php echo $colorblind_deuteranopes_badgeDanger ?>;
|
||||
}
|
||||
|
||||
.progress-bar-aqua,
|
||||
.progress-bar-info {
|
||||
background-color: #00c0ef;
|
||||
background-color: #00c0ef;
|
||||
}
|
||||
.progress-striped .progress-bar-aqua,
|
||||
.progress-striped .progress-bar-info {
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
.progress-bar-yellow,
|
||||
.progress-bar-warning {
|
||||
background-color: <?php echo $badgeWarning ?>;
|
||||
background-color: <?php echo $badgeWarning ?>;
|
||||
}
|
||||
.progress-striped .progress-bar-yellow,
|
||||
.progress-striped .progress-bar-warning {
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
.progress-bar-red,
|
||||
.progress-bar-danger {
|
||||
background-color: <?php echo $badgeDanger ?>;
|
||||
background-color: <?php echo $badgeDanger ?>;
|
||||
}
|
||||
.progress-striped .progress-bar-red,
|
||||
.progress-striped .progress-bar-danger {
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
|
||||
}
|
||||
.progress-bar-consumed {
|
||||
background-color: rgb(0, 0, 0, 0.15);
|
||||
|
||||
@ -27,21 +27,35 @@
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login.
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', 1);
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1);
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', 1); // File must be accessed by logon page so without login.
|
||||
}
|
||||
//if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We load menu manager class (note that object loaded may have wrong content because NOLOGIN is set and some values depends on login)
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', 1);
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
|
||||
|
||||
define('ISLOADEDBYSTEELSHEET', '1');
|
||||
|
||||
|
||||
require __DIR__.'/theme_vars.inc.php';
|
||||
if (defined('THEME_ONLY_CONSTANT')) return;
|
||||
if (defined('THEME_ONLY_CONSTANT')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
session_cache_limiter('public');
|
||||
@ -51,8 +65,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
|
||||
// and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile.
|
||||
if (empty($user->id) && !empty($_SESSION['dol_login']))
|
||||
{
|
||||
if (empty($user->id) && !empty($_SESSION['dol_login'])) {
|
||||
$user->fetch('', $_SESSION['dol_login'], '', 1);
|
||||
$user->getrights();
|
||||
|
||||
@ -65,12 +78,21 @@ if (empty($user->id) && !empty($_SESSION['dol_login']))
|
||||
// Define css type
|
||||
top_httphead('text/css');
|
||||
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
|
||||
else header('Cache-Control: no-cache');
|
||||
if (empty($dolibarr_nocache)) {
|
||||
header('Cache-Control: max-age=10800, public, must-revalidate');
|
||||
} else {
|
||||
header('Cache-Control: no-cache');
|
||||
}
|
||||
|
||||
if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
|
||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
||||
if (GETPOST('THEME_DARKMODEENABLED', 'int')) $conf->global->THEME_DARKMODEENABLED = GETPOST('THEME_DARKMODEENABLED', 'int'); // If darkmode was forced on URL
|
||||
if (GETPOST('theme', 'alpha')) {
|
||||
$conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
|
||||
}
|
||||
if (GETPOST('lang', 'aZ09')) {
|
||||
$langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
||||
}
|
||||
if (GETPOST('THEME_DARKMODEENABLED', 'int')) {
|
||||
$conf->global->THEME_DARKMODEENABLED = GETPOST('THEME_DARKMODEENABLED', 'int'); // If darkmode was forced on URL
|
||||
}
|
||||
|
||||
$langs->load("main", 0, 1);
|
||||
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
||||
@ -78,7 +100,9 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
|
||||
|
||||
$path = ''; // This value may be used in future for external module to overwrite theme
|
||||
$theme = 'eldy'; // Value of theme
|
||||
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES; }
|
||||
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
|
||||
$path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES;
|
||||
}
|
||||
|
||||
// Define image path files and other constants
|
||||
$fontlist = 'arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif';
|
||||
@ -98,19 +122,36 @@ $useboldtitle = (isset($conf->global->THEME_ELDY_USEBOLDTITLE) ? $conf->global->
|
||||
$borderwidth = 1;
|
||||
|
||||
// Case of option always editable
|
||||
if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody;
|
||||
if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
|
||||
if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1;
|
||||
if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1;
|
||||
if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover;
|
||||
if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked;
|
||||
if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak;
|
||||
if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab;
|
||||
if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
|
||||
if (!isset($conf->global->THEME_ELDY_BACKBODY)) {
|
||||
$conf->global->THEME_ELDY_BACKBODY = $colorbackbody;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
|
||||
$conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) {
|
||||
$conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) {
|
||||
$conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_USE_HOVER)) {
|
||||
$conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) {
|
||||
$conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_LINEBREAK)) {
|
||||
$conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) {
|
||||
$conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab;
|
||||
}
|
||||
if (!isset($conf->global->THEME_ELDY_TEXTLINK)) {
|
||||
$conf->global->THEME_ELDY_TEXTLINK = $colortextlink;
|
||||
}
|
||||
|
||||
// Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on
|
||||
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||
{
|
||||
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) {
|
||||
$conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card
|
||||
$conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234';
|
||||
$conf->global->THEME_ELDY_TEXT = '0,0,0';
|
||||
@ -142,8 +183,7 @@ $fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (emp
|
||||
// Hover color
|
||||
$colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_HOVER));
|
||||
$colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($conf->global->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $conf->global->THEME_ELDY_USE_CHECKED));
|
||||
if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||
{
|
||||
if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) {
|
||||
$colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0') ? '' : ($user->conf->THEME_ELDY_USE_HOVER === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_HOVER));
|
||||
$colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0') ? '' : ($user->conf->THEME_ELDY_USE_CHECKED === '1' ? 'e6edf0' : $user->conf->THEME_ELDY_USE_CHECKED));
|
||||
}
|
||||
@ -153,26 +193,42 @@ if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
|
||||
$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbackhmenu1);
|
||||
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF';
|
||||
else $colortextbackhmenu = '000000';
|
||||
if ($tmpval <= 460) {
|
||||
$colortextbackhmenu = 'FFFFFF';
|
||||
} else {
|
||||
$colortextbackhmenu = '000000';
|
||||
}
|
||||
|
||||
$colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbackvmenu1);
|
||||
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; } else { $colortextbackvmenu = '000000'; }
|
||||
if ($tmpval <= 460) {
|
||||
$colortextbackvmenu = 'FFFFFF';
|
||||
} else {
|
||||
$colortextbackvmenu = '000000';
|
||||
}
|
||||
|
||||
$colorbacktitle1 = join(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbacktitle1);
|
||||
if ($colortexttitle == '')
|
||||
{
|
||||
if ($colortexttitle == '') {
|
||||
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; } else { $colortexttitle = '000000'; $colorshadowtitle = 'FFFFFF'; }
|
||||
} else $colorshadowtitle = '888888';
|
||||
if ($tmpval <= 460) {
|
||||
$colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888';
|
||||
} else {
|
||||
$colortexttitle = '000000'; $colorshadowtitle = 'FFFFFF';
|
||||
}
|
||||
} else {
|
||||
$colorshadowtitle = '888888';
|
||||
}
|
||||
|
||||
$colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z'
|
||||
$tmppart = explode(',', $colorbacktabcard1);
|
||||
$tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0);
|
||||
if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; } else { $colortextbacktab = '000000'; }
|
||||
if ($tmpval <= 460) {
|
||||
$colortextbacktab = 'FFFFFF';
|
||||
} else {
|
||||
$colortextbacktab = '000000';
|
||||
}
|
||||
|
||||
|
||||
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
|
||||
@ -185,8 +241,12 @@ $colorbacklineimpair1 = join(',', colorStringToArray($colorbacklineimpair1));
|
||||
$colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2));
|
||||
$colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1));
|
||||
$colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2));
|
||||
if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
|
||||
if ($colorbacklinepairchecked != '') $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
|
||||
if ($colorbacklinepairhover != '') {
|
||||
$colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover));
|
||||
}
|
||||
if ($colorbacklinepairchecked != '') {
|
||||
$colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked));
|
||||
}
|
||||
$colorbackbody = join(',', colorStringToArray($colorbackbody));
|
||||
$colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab));
|
||||
$colortexttitle = join(',', colorStringToArray($colortexttitle));
|
||||
@ -195,7 +255,9 @@ $colortextlink = join(',', colorStringToArray($colortextlink));
|
||||
|
||||
$nbtopmenuentries = $menumanager->showmenu('topnb');
|
||||
|
||||
if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10);
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
$nbtopmenuentries = max($nbtopmenuentries, 10);
|
||||
}
|
||||
|
||||
|
||||
$minwidthtmenu = 66; /* minimum width for one top menu entry */
|
||||
@ -203,11 +265,19 @@ $heightmenu = 50; /* height of top menu, part with image */
|
||||
$heightmenu2 = 49; /* height of top menu, part with login */
|
||||
$disableimages = 0;
|
||||
$maxwidthloginblock = 180;
|
||||
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0; }
|
||||
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) {
|
||||
$disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
|
||||
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
|
||||
if (!empty($conf->bookmark->enabled)) { $maxwidthloginblock = $maxwidthloginblock + 55; }
|
||||
if (!empty($conf->global->MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN)) {
|
||||
$maxwidthloginblock = $maxwidthloginblock + 55;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
|
||||
$maxwidthloginblock = $maxwidthloginblock + 55;
|
||||
}
|
||||
if (!empty($conf->bookmark->enabled)) {
|
||||
$maxwidthloginblock = $maxwidthloginblock + 55;
|
||||
}
|
||||
|
||||
|
||||
print '/*'."\n";
|
||||
@ -247,4 +317,6 @@ print '*/'."\n";
|
||||
require __DIR__.'/global.inc.php';
|
||||
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
if (is_object($db)) {
|
||||
$db->close();
|
||||
}
|
||||
|
||||
@ -33,12 +33,9 @@
|
||||
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
|
||||
$theme_bordercolor = array(235, 235, 224);
|
||||
$theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(80, 166, 90), array(190, 190, 100), array(91, 115, 247), array(140, 140, 220), array(190, 120, 120), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
|
||||
{
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php
|
||||
{
|
||||
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy')
|
||||
{
|
||||
if (!defined('ISLOADEDBYSTEELSHEET')) { // File is run after an include of a php page, not by the style sheet, if the constant is not defined.
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) { // user is loaded by dolgraph.class.php
|
||||
if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy') {
|
||||
$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150));
|
||||
} else {
|
||||
// for now we use the same configuration for all types of color blind
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user