Merge branch 'theme_top_menu' of github.com:atm-john/dolibarr into theme_badge_status

This commit is contained in:
John BOTELLA 2019-03-07 09:41:03 +01:00
commit 5ea5d51247
58 changed files with 705 additions and 493 deletions

View File

@ -22,21 +22,51 @@ Following changes may create regressions for some external modules, but were nec
FIX: #10381 FIX: #10381
FIX: #10460 compatibility with MariaDB 10.4 FIX: #10460 compatibility with MariaDB 10.4
FIX: #10485 FIX: #10485
FIX: #10638
FIX: Accountancy - Adding transaction with multicompany uses all the time 1st entity
FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work
FIX: add fk_unit on addline action FIX: add fk_unit on addline action
FIX: adding css by page if url is externam
FIX: Bad link in menu manager
FIX: better test on fetch FIX: better test on fetch
FIX: can't add lines on invoices
FIX: Check for old picture name if the new one was not found
FIX: could not create several superadmin in transversal mode
FIX: creation of menu entry with parent id not int
FIX: creation of new left menu entry
FIX: Default language of company is not set FIX: Default language of company is not set
FIX: error on setup of password if pass generators have a .old file.
FIX: error report not returned FIX: error report not returned
FIX: expedition: reset status on rollback + replace hardcoded status with const FIX: expedition: reset status on rollback + replace hardcoded status with const
FIX: fetch module / pos source
FIX: fk_default_warehouse missing in group by
FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it
FIX: if empty error message, we just see "error" displayed
FIX: label of bank account
FIX: line edit template: keep fk_parent_line FIX: line edit template: keep fk_parent_line
FIX: Mark credit note as available for credit note in other currency
FIX: missing access security checking with multicompany
FIX: missing entity filter in function "build_filterField()" (export module)
FIX: missing $ismultientitymanaged for previous/next ref
FIX: Missing province in export of invoice FIX: Missing province in export of invoice
FIX: must fetch member in current entity FIX: must fetch member in current entity
FIX: positive values creating diff on addline rounding
FIX: positive values IN supplier credit notes creating diff on addline rounding
FIX: Price in combo list of service does not use the correct price level FIX: Price in combo list of service does not use the correct price level
FIX: supplier invoice payment total doesnt care about deposit or credit FIX: project_title for display of getNomUrl()
FIX: same thing here
FIX: Show button POS Ticket only if invoice was generated by POS
FIX: supplier invoice payment total doesn't care about deposit or credit
FIX: supplier invoice product stats total ht is line total not invoice total FIX: supplier invoice product stats total ht is line total not invoice total
FIX: The notes was also copied on invoice
FIX: Transaction on leave approval and decrease ko if setup not complete
FIX: Translation not loaded by scheduled jobs FIX: Translation not loaded by scheduled jobs
FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9
FIX: we want to be able to reopen fourn credit note
FIX: wrong feature2 when user rights "group_advance" is used
FIX: wrong merged conflict FIX: wrong merged conflict
FIX: wrong tests on fetch FIX: wrong tests on fetch
NEW: Add protection to avoid packaging if files non indexed exists into NEW: Add protection to avoid packaging if files non indexed exists
***** ChangeLog for 9.0.0 compared to 8.0.0 ***** ***** ChangeLog for 9.0.0 compared to 8.0.0 *****
For Users: For Users:

View File

@ -1,6 +1,6 @@
# DOLIBARR ERP & CRM # DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) ![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|6|7|8|9|develop| |6|7|8|9|develop|

View File

@ -288,15 +288,16 @@ class Members extends DolibarrApi
return $member; return $member;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource. // Remove the subscriptions because they are handled as a subresource.

View File

@ -266,15 +266,16 @@ class MembersTypes extends DolibarrApi
return $membertype; return $membertype;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->array_options); unset($object->array_options);

View File

@ -600,7 +600,8 @@ class Documents extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
private function _validate_file($data) { private function _validate_file($data)
{
// phpcs:enable // phpcs:enable
$result = array(); $result = array();
foreach (Documents::$DOCUMENT_FIELDS as $field) { foreach (Documents::$DOCUMENT_FIELDS as $field) {

View File

@ -273,14 +273,16 @@ class Setup extends DolibarrApi
return $list; return $list;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->error); unset($object->error);

View File

@ -18,12 +18,11 @@
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
dol_include_once('/bom/class/bom.class.php'); require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
/** /**
* \file bom/class/api_bom.class.php * \file bom/class/api_boms.class.php
* \ingroup bom * \ingroup bom
* \brief File for API management of bom. * \brief File for API management of bom.
*/ */
@ -31,36 +30,32 @@ dol_include_once('/bom/class/bom.class.php');
/** /**
* API class for bom bom * API class for bom bom
* *
* @smart-auto-routing false
* @access protected * @access protected
* @class DolibarrApiAccess {@requires user,external} * @class DolibarrApiAccess {@requires user,external}
*/ */
class BillOfMaterialsApi extends DolibarrApi class BOMs extends DolibarrApi
{ {
/** /**
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'name', 'label'
); );
/** /**
* @var BillOfMaterials $bom {@type BillOfMaterials} * @var BOM $bom {@type BOM}
*/ */
public $bom; public $bom;
/** /**
* Constructor * Constructor
*
* @url GET /
*
*/ */
public function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
$this->bom = new BillOfMaterials($this->db); $this->bom = new BOM($this->db);
} }
/** /**
@ -71,7 +66,7 @@ class BillOfMaterialsApi extends DolibarrApi
* @param int $id ID of bom * @param int $id ID of bom
* @return array|mixed data without useless information * @return array|mixed data without useless information
* *
* @url GET boms/{id} * @url GET {id}
* @throws RestException * @throws RestException
*/ */
public function get($id) public function get($id)
@ -82,7 +77,7 @@ class BillOfMaterialsApi extends DolibarrApi
$result = $this->bom->fetch($id); $result = $this->bom->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found'); throw new RestException(404, 'BOM not found');
} }
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
@ -106,8 +101,6 @@ class BillOfMaterialsApi extends DolibarrApi
* @return array Array of order objects * @return array Array of order objects
* *
* @throws RestException * @throws RestException
*
* @url GET /boms/
*/ */
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
@ -134,7 +127,7 @@ class BillOfMaterialsApi extends DolibarrApi
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
$tmpobject = new BillOfMaterials($db); $tmpobject = new BOM($db);
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')'; if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')';
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid; if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
@ -172,7 +165,7 @@ class BillOfMaterialsApi extends DolibarrApi
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$bom_static = new BillOfMaterials($db); $bom_static = new BOM($db);
if($bom_static->fetch($obj->rowid)) { if($bom_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($bom_static); $obj_ret[] = $this->_cleanObjectDatas($bom_static);
} }
@ -193,8 +186,6 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @param array $request_data Request datas * @param array $request_data Request datas
* @return int ID of bom * @return int ID of bom
*
* @url POST boms/
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
@ -208,7 +199,7 @@ class BillOfMaterialsApi extends DolibarrApi
$this->bom->$field = $value; $this->bom->$field = $value;
} }
if( ! $this->bom->create(DolibarrApiAccess::$user)) { if( ! $this->bom->create(DolibarrApiAccess::$user)) {
throw new RestException(500); throw new RestException(500, "Error creating BOM", array_merge(array($this->bom->error), $this->bom->errors));
} }
return $this->bom->id; return $this->bom->id;
} }
@ -218,9 +209,8 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @param int $id Id of bom to update * @param int $id Id of bom to update
* @param array $request_data Datas * @param array $request_data Datas
* @return int
* *
* @url PUT boms/{id} * @return int
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
@ -230,7 +220,7 @@ class BillOfMaterialsApi extends DolibarrApi
$result = $this->bom->fetch($id); $result = $this->bom->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found'); throw new RestException(404, 'BOM not found');
} }
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
@ -238,22 +228,25 @@ class BillOfMaterialsApi extends DolibarrApi
} }
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->bom->$field = $value; $this->bom->$field = $value;
} }
if($this->bom->update($id, DolibarrApiAccess::$user)) if($this->bom->update($id, DolibarrApiAccess::$user) > 0)
{
return $this->get($id); return $this->get($id);
}
return false; else
{
throw new RestException(500, $this->commande->error);
}
} }
/** /**
* Delete bom * Delete bom
* *
* @param int $id BillOfMaterials ID * @param int $id BOM ID
* @return array * @return array
*
* @url DELETE bom/{id}
*/ */
public function delete($id) public function delete($id)
{ {
@ -262,35 +255,37 @@ class BillOfMaterialsApi extends DolibarrApi
} }
$result = $this->bom->fetch($id); $result = $this->bom->fetch($id);
if (! $result) { if (! $result) {
throw new RestException(404, 'BillOfMaterials not found'); throw new RestException(404, 'BOM not found');
} }
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if( !$this->bom->delete(DolibarrApiAccess::$user, 0)) if (! $this->bom->delete(DolibarrApiAccess::$user))
{ {
throw new RestException(500); throw new RestException(500, 'Error when deleting BOM : '.$this->bom->error);
} }
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'message' => 'BillOfMaterials deleted' 'message' => 'BOM deleted'
) )
); );
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
/*unset($object->note); /*unset($object->note);
@ -306,7 +301,7 @@ class BillOfMaterialsApi extends DolibarrApi
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
* @param array $data Data to validate * @param array $data Array of data to validate
* @return array * @return array
* *
* @throws RestException * @throws RestException
@ -314,7 +309,7 @@ class BillOfMaterialsApi extends DolibarrApi
private function _validate($data) private function _validate($data)
{ {
$bom = array(); $bom = array();
foreach (BillOfMaterialsApi::$FIELDS as $field) { foreach (BOMs::$FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field]))
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
$bom[$field] = $data[$field]; $bom[$field] = $data[$field];

View File

@ -261,15 +261,16 @@ class Categories extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Categorie $object Object to clean * @param Categorie $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove fields not relevent to categories // Remove fields not relevent to categories

View File

@ -313,15 +313,16 @@ class AgendaEvents extends DolibarrApi
return $event; return $event;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->usermod); unset($object->usermod);

View File

@ -782,15 +782,16 @@ class Proposals extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -544,7 +544,7 @@ class Orders extends DolibarrApi
} }
if( ! $this->commande->delete(DolibarrApiAccess::$user)) { if( ! $this->commande->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete order : '.$this->commande->error); throw new RestException(500, 'Error when deleting order : '.$this->commande->error);
} }
return array( return array(
@ -838,15 +838,16 @@ class Orders extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -248,14 +248,16 @@ class BankAccounts extends DolibarrApi
return $account; return $account;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->rowid); unset($object->rowid);

View File

@ -1417,15 +1417,16 @@ class Invoices extends DolibarrApi
return $paiement_id; return $paiement_id;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -633,15 +633,16 @@ class Contracts extends DolibarrApi
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->address); unset($object->address);

View File

@ -22,7 +22,6 @@
*/ */
/** /**
* Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content. * Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content.
* Used to ouput the page on the Preview from backoffice. * Used to ouput the page on the Preview from backoffice.
@ -661,7 +660,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
$tplcontent =''; $tplcontent ='';
$tplcontent.= "<?php // BEGIN PHP\n"; $tplcontent.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(dirname(__FILE__)); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n"; $tplcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n"; $tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
@ -731,7 +730,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
dol_delete_file($fileindex); dol_delete_file($fileindex);
$indexcontent = '<?php'."\n"; $indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n"; $indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(dirname(__FILE__)); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n"; $indexcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n"; $indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n"; $indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";

View File

@ -66,264 +66,401 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
} }
// Home // Home
$showmode=1; $menu_arr[] = array(
$classname=""; 'name' => 'Home',
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } 'link' => '/index.php?mainmenu=home&amp;leftmenu=home',
else $classname = 'class="tmenu"'; 'title' => (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)? '&nbsp; <span class="fa fa-home"></span> &nbsp;' : "Home") ,
$idsel='home'; 'level' => 0,
'enabled' => $showmode = 1,
$titlehome = $langs->trans("Home"); 'target' => $atarget,
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '&nbsp; <span class="fa fa-home"></span> &nbsp;'; 'mainmenu' => "home",
$menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname); 'leftmenu' => '',
'position' => 10,
'id' => $id,
'idsel' => 'home',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home" ) ? 0 : 1 ),
'loadLangs' => array(),
'submenus' => array(),
);
// Members // Members
$menu_arr[] = array(
'name' => 'Members',
'link' => '/adherents/index.php?mainmenu=members&amp;leftmenu=',
'title' => "MenuMembers",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled' => (! empty($conf->adherent->enabled) ) , 'enabled' => (! empty($conf->adherent->enabled) ) ,
'perms' => (! empty($user->rights->adherent->lire) ), 'perms' => (! empty($user->rights->adherent->lire) ),
'module' => 'adherent', 'module' => 'adherent',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "members",
'leftmenu' => '',
'position' => 18,
'id' => $id,
'idsel' => 'members',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 0 : 1 ),
'loadLangs' => array(),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='members';
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 18, $id, $idsel, $classname);
}
// Third parties // Third parties
$menu_arr[] = array(
'name' => 'Companies',
'link' => '/societe/index.php?mainmenu=companies&amp;leftmenu=',
'title' => "ThirdParties",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'enabled'=> ( ( ! empty($conf->societe->enabled) &&
( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) )
)
|| ! empty($conf->fournisseur->enabled)
),
'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)),
'module'=>'societe|fournisseur', 'module'=>'societe|fournisseur',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "companies",
'leftmenu' => '',
'position' => 20,
'id' => $id,
'idsel' => 'companies',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies" ) ? 0 : 1 ),
'loadLangs' => array("companies","suppliers"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
// Load translation files required by the page
$langs->loadLangs(array("companies","suppliers"));
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='companies';
$menu->add('/societe/index.php?mainmenu=companies&amp;leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '', 20, $id, $idsel, $classname);
}
// Products-Services // Products-Services
$menu_arr[] = array(
'name' => 'Products',
'link' => '/product/index.php?mainmenu=products&amp;leftmenu=',
'title' => (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
? ( array("TMenuProducts" , " | " ,"TMenuServices") )
: (! empty($conf->product->enabled)? "TMenuProducts" : "TMenuServices" ),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'enabled'=> (( ! empty($conf->societe->enabled) &&
'perms'=>(! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)), ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) )
)
|| ! empty($conf->fournisseur->enabled)
),
'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)),
'module'=>'product|service', 'module'=>'product|service',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "products",
'leftmenu' => '',
'position' => 30,
'id' => $id,
'idsel' => 'products',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products" ) ? 0 : 1 ),
'loadLangs' => array("products"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("products");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='products';
$chaine="";
if (! empty($conf->product->enabled)) {
$chaine.=$langs->trans("TMenuProducts");
}
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) {
$chaine.=" | ";
}
if (! empty($conf->service->enabled)) {
$chaine.=$langs->trans("TMenuServices");
}
$menu->add('/product/index.php?mainmenu=products&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "products", '', 30, $id, $idsel, $classname);
}
// MRP // MRP
$menu_arr[] = array(
'name' => 'TMenuMRP',
'link' => '/bom/bom_list.php?mainmenu=mrp&amp;leftmenu=',
'title' => $langs->trans("TMenuMRP"),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)),
'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)), 'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)),
'module'=>'bom|mrp', 'module'=>'bom|mrp',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "mrp",
'leftmenu' => '',
'position' => 30,
'id' => $id,
'idsel' => 'mrp',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 0 : 1 ),
'loadLangs' => array("projects"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='products';
$chaine=$langs->trans("TMenuMRP");
$menu->add('/bom/bom_list.php?mainmenu=mrp&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "bom", '', 30, $id, $idsel, $classname);
}
// Projects // Projects
$tmpentry=array('enabled'=>(! empty($conf->projet->enabled)), $menu_arr[] = array(
'perms'=>(! empty($user->rights->projet->lire)), 'name' => 'Projet',
'module'=>'projet'); 'link' => '/projet/index.php?mainmenu=project&amp;leftmenu=',
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); 'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2 )
if ($showmode) ? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2)?"Leads":"Projects")
{ : "LeadsOrProjects",
$langs->load("projects"); 'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$classname=""; $type_user,
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } $tmpentry = array(
else $classname = 'class="tmenu"'; 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0),
$idsel='project'; 'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0),
'module'=>'projet',
$title = $langs->trans("LeadsOrProjects"); // Leads and opportunities by default ),
$showmodel = $showmodep = $showmode; $listofmodulesforexternal
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) ),
{ 'target' => $atarget,
$title = $langs->trans("Projects"); 'mainmenu' => "project",
$showmodel = 0; 'leftmenu' => '',
} 'position' => 35,
if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { 'id' => $id,
$title = $langs->trans("Leads"); 'idsel' => 'project',
$showmodep = 0; 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 'class="tmenusel"' : 'class="tmenu"',
} 'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 0 : 1 ),
$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=', $title, 0, $showmode, $atarget, "project", '', 35, $id, $idsel, $classname); 'loadLangs' => array("projects"),
//$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=&search_opp_status=openedopp', $langs->trans("ListLeads"), 0, $showmodel & $conf->global->PROJECT_USE_OPPORTUNITIES, $atarget, "project", '', 70, $id, $idsel, $classname); 'submenus' => array(),
//$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=&search_opp_status=notopenedopp', $langs->trans("ListProjects"), 0, $showmodep, $atarget, "project", '', 70, $id, $idsel, $classname); );
}
// Commercial // Commercial
$menuqualified=0; $menu_arr[] = array(
if (! empty($conf->propal->enabled)) $menuqualified++; 'name' => 'Commercial',
if (! empty($conf->commande->enabled)) $menuqualified++; 'link' => '/comm/index.php?mainmenu=commercial&amp;leftmenu=',
if (! empty($conf->supplier_order->enabled)) $menuqualified++; 'title' => "Commercial",
if (! empty($conf->supplier_proposal->enabled)) $menuqualified++; 'level' => 0,
if (! empty($conf->contrat->enabled)) $menuqualified++; 'enabled' => $showmode = isVisibleToUserType(
if (! empty($conf->ficheinter->enabled)) $menuqualified++; $type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>$menuqualified, 'enabled'=>(! empty($conf->propal->enabled) ||
! empty($conf->commande->enabled) ||
! empty($conf->supplier_order->enabled) ||
! empty($conf->supplier_proposal->enabled) ||
! empty($conf->contrat->enabled) ||
! empty($conf->ficheinter->enabled)
)?1:0,
'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)),
'module'=>'propal|commande|supplier_order|contrat|ficheinter', 'module'=>'propal|commande|supplier_order|contrat|ficheinter',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "commercial",
'leftmenu' => '',
'position' => 40,
'id' => $id,
'idsel' => 'commercial',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial" ) ? 0 : 1 ),
'loadLangs' => array("commercial"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("commercial");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='commercial';
$menu->add('/comm/index.php?mainmenu=commercial&amp;leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "", 40, $id, $idsel, $classname);
}
// Billing - Financial // Billing - Financial
$menuqualified=0; $menu_arr[] = array(
if (! empty($conf->facture->enabled)) $menuqualified++; 'name' => 'Compta',
if (! empty($conf->don->enabled)) $menuqualified++; 'link' => '/compta/index.php?mainmenu=billing&amp;leftmenu=',
if (! empty($conf->tax->enabled)) $menuqualified++; 'title' => "MenuFinancial",
if (! empty($conf->salaries->enabled)) $menuqualified++; 'level' => 0,
if (! empty($conf->supplier_invoice->enabled)) $menuqualified++; 'enabled' => $showmode = isVisibleToUserType(
if (! empty($conf->loan->enabled)) $menuqualified++; $type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>$menuqualified, 'enabled'=>(! empty($conf->facture->enabled) ||
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), ! empty($conf->don->enabled) ||
! empty($conf->tax->enabled) ||
! empty($conf->salaries->enabled) ||
! empty($conf->supplier_invoice->enabled) ||
! empty($conf->loan->enabled)
)?1:0,
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->contact->lire)
|| ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read)
|| ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
'module'=>'facture|supplier_invoice|don|tax|salaries|loan', 'module'=>'facture|supplier_invoice|don|tax|salaries|loan',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "billing",
'leftmenu' => '',
'position' => 50,
'id' => $id,
'idsel' => 'billing',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing" ) ? 0 : 1 ),
'loadLangs' => array("compta"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("compta");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='billing';
$menu->add('/compta/index.php?mainmenu=billing&amp;leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "billing", '', 50, $id, $idsel, $classname);
}
// Bank // Bank
$menu_arr[] = array(
'name' => 'Bank',
'link' => '/compta/bank/list.php?mainmenu=bank&amp;leftmenu=',
'title' => "MenuBankCash",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)), 'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)),
'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)), 'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)),
'module'=>'banque|prelevement', 'module'=>'banque|prelevement',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "bank",
'leftmenu' => '',
'position' => 52,
'id' => $id,
'idsel' => 'bank',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 0 : 1 ),
'loadLangs' => array("compta","banks"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
// Load translation files required by the page
$langs->loadLangs(array("compta","banks"));
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='bank';
$menu->add('/compta/bank/list.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 52, $id, $idsel, $classname);
}
// Accounting // Accounting
$menuqualified=0; $menu_arr[] = array(
if (! empty($conf->comptabilite->enabled)) $menuqualified++; 'name' => 'Accounting',
if (! empty($conf->accounting->enabled)) $menuqualified++; 'link' => '/accountancy/index.php?mainmenu=accountancy&amp;leftmenu=',
if (! empty($conf->asset->enabled)) $menuqualified++; 'title' => "MenuAccountancy",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>$menuqualified, 'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)),
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)), 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)),
'module'=>'comptabilite|accounting', 'comptabilite|accounting',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "accountancy",
'leftmenu' => '',
'position' => 54,
'id' => $id,
'idsel' => 'accountancy',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 0 : 1 ),
'loadLangs' => array("compta"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("compta");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='accountancy';
$menu->add('/accountancy/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("MenuAccountancy"), 0, $showmode, $atarget, "accountancy", '', 54, $id, $idsel, $classname);
}
// HRM // HRM
$menu_arr[] = array(
'name' => 'HRM',
'link' => '/hrm/index.php?mainmenu=hrm&amp;leftmenu=',
'title' => "HRM",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), 'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)),
'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), 'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)),
'module'=>'hrm|holiday|deplacement|expensereport', 'module'=>'hrm|holiday|deplacement|expensereport',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "hrm",
'leftmenu' => '',
'position' => 80,
'id' => $id,
'idsel' => 'hrm',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 0 : 1 ),
'loadLangs' => array("holiday"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("holiday");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='hrm';
$menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname);
}
// Tools // Tools
$menu_arr[] = array(
'name' => 'Tools',
'link' => '/core/tools.php?mainmenu=tools&amp;leftmenu=',
'title' => "Tools",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array( $tmpentry = array(
'enabled'=>1, 'enabled'=>1,
'perms'=>1, 'perms'=>1,
'module'=>'', 'module'=>'',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "tools",
'leftmenu' => '',
'position' => 90,
'id' => $id,
'idsel' => 'tools',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 0 : 1 ),
'loadLangs' => array("other"),
'submenus' => array(),
); );
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode) // Add menus
foreach($menu_arr as $key => $smenu)
{ {
$langs->load("other"); $smenu = (object) $smenu;
$classname=""; if( $smenu->enabled )
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } {
else $classname = 'class="tmenu"'; if($langs->session)
$idsel='tools'; {
$_SESSION['idmenu']='';
}
$menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname); // Load Langue
if(! empty($smenu->loadLangs))
{
$langs->loadLangs($smenu->loadLangs);
}
// Trans title
$mtitle = '';
if(is_array($smenu->title))
{
foreach($smenu->title as $item)
{
$mtitle .= $langs->trans($item);
}
}
else
{
$mtitle = $langs->trans($smenu->title);
}
// Add item
$menu->add($smenu->link, $mtitle, $smenu->level, $smenu->enabled, $smenu->target, $smenu->mainmenu, $smenu->leftmenu, $smenu->position, $smenu->id, $smenu->idsel, $smenu->classname, $smenu->prefix);
}
} }
// Show personalized menus // Show personalized menus

View File

@ -915,21 +915,26 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
/** /**
* Gives the last date of activation * Gives the last date of activation
* *
* @return timestamp Date of last activation * @return timestamp|string Date of last activation
*/ */
public function getLastActivationDate() public function getLastActivationDate()
{ {
global $conf; global $conf;
$err = 0;
$sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const"; $sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
$sql.= " AND entity IN (0, ".$conf->entity.")"; $sql.= " AND entity IN (0, ".$conf->entity.")";
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG); dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) { if (! $resql)
{
$err++; $err++;
} else { }
else
{
$obj=$this->db->fetch_object($resql); $obj=$this->db->fetch_object($resql);
if ($obj) { if ($obj) {
return $this->db->jdate($obj->tms); return $this->db->jdate($obj->tms);
@ -949,15 +954,20 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
{ {
global $conf; global $conf;
$err = 0;
$sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const"; $sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
$sql.= " AND entity IN (0, ".$conf->entity.")"; $sql.= " AND entity IN (0, ".$conf->entity.")";
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG); dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) { if (! $resql)
{
$err++; $err++;
} else { }
else
{
$obj=$this->db->fetch_object($resql); $obj=$this->db->fetch_object($resql);
$tmp=array(); $tmp=array();
if ($obj->note) { if ($obj->note) {

View File

@ -54,6 +54,12 @@ if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/com
class pdf_beluga extends ModelePDFProjects class pdf_beluga extends ModelePDFProjects
{ {
/**
* Page orientation
* @var string 'P' or 'Portait' (default), 'L' or 'Landscape'
*/
private $orientation = '';
/** /**
* Issuer * Issuer
* @var Societe * @var Societe
@ -79,8 +85,14 @@ class pdf_beluga extends ModelePDFProjects
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf'; $this->type = 'pdf';
$formatarray=pdf_getFormat(); $formatarray=pdf_getFormat();
$this->orientation = 'L';
if ($this->orientation == 'L' || $this->orientation == 'Landscape') {
$this->page_largeur = $formatarray['height'];
$this->page_hauteur = $formatarray['width'];
} else {
$this->page_largeur = $formatarray['width']; $this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height']; $this->page_hauteur = $formatarray['height'];
}
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
@ -96,12 +108,21 @@ class pdf_beluga extends ModelePDFProjects
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
// Defini position des colonnes // Defini position des colonnes
if ($this->orientation == 'L' || $this->orientation == 'Landscape') {
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+105;
$this->posxsociety=$this->marge_gauche+125;
$this->posxamountht=$this->marge_gauche+190;
$this->posxamountttc=$this->marge_gauche+215;
$this->posxstatut=$this->marge_gauche+245;
} else {
$this->posxref=$this->marge_gauche+1; $this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+25; $this->posxdate=$this->marge_gauche+25;
$this->posxsociety=$this->marge_gauche+45; $this->posxsociety=$this->marge_gauche+45;
$this->posxamountht=$this->marge_gauche+110; $this->posxamountht=$this->marge_gauche+110;
$this->posxamountttc=$this->marge_gauche+135; $this->posxamountttc=$this->marge_gauche+135;
$this->posxstatut=$this->marge_gauche+165; $this->posxstatut=$this->marge_gauche+165;
}
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
$this->posxref-=20; $this->posxref-=20;
@ -217,7 +238,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// New page // New page
$pdf->AddPage(); $pdf->AddPage($this->orientation);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++; $pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs); $this->_pagehead($pdf, $object, 1, $outputlangs);
@ -433,7 +454,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->setTopMargin($tab_top_newpage); $pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage(); $pageposbefore=$pdf->getPage();
// Description of line // Description of line
@ -469,7 +490,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label // Label
$pdf->SetXY($this->posxref, $curY); $pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY(); $posybefore=$pdf->GetY();
@ -480,7 +501,7 @@ class pdf_beluga extends ModelePDFProjects
{ {
if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page
{ {
$pdf->AddPage('', '', true); $pdf->AddPage($this->orientation, '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1); $pdf->setPage($pageposafter+1);
@ -495,9 +516,9 @@ class pdf_beluga extends ModelePDFProjects
{ {
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->AddPage('', '', true); $pdf->AddPage($this->orientation, '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1); $pdf->setPage($pageposafter+1);
@ -505,7 +526,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1; $curY = $tab_top_newpage + $heightoftitleline + 1;
// Label // Label
@ -528,7 +549,7 @@ class pdf_beluga extends ModelePDFProjects
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore); $pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute); $pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page // We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
@ -628,7 +649,7 @@ class pdf_beluga extends ModelePDFProjects
$this->_pagefoot($pdf, $object, $outputlangs, 1); $this->_pagefoot($pdf, $object, $outputlangs, 1);
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }

View File

@ -596,6 +596,28 @@ if (! empty($usemargins) && $user->rights->margins->creer)
/* JQuery for product free or predefined select */ /* JQuery for product free or predefined select */
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#price_ttc").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
});
$("#prod_entry_mode_free").on( "click", function() { $("#prod_entry_mode_free").on( "click", function() {
setforfree(); setforfree();
}); });
@ -662,10 +684,7 @@ jQuery(document).ready(function() {
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) { $.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) {
if (data && data.length > 0) if (data && data.length > 0)
{ {
var options = ''; var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0;
var defaultkey = '';
var defaultprice = '';
var bestpricefound = 0;
var bestpriceid = 0; var bestpricevalue = 0; var bestpriceid = 0; var bestpricevalue = 0;
var pmppriceid = 0; var pmppricevalue = 0; var pmppriceid = 0; var pmppricevalue = 0;
@ -796,61 +815,29 @@ jQuery(document).ready(function() {
<?php if (GETPOST('prod_entry_mode') == 'predef') { // When we submit with a predef product and it fails we must start with predef ?> <?php if (GETPOST('prod_entry_mode') == 'predef') { // When we submit with a predef product and it fails we must start with predef ?>
setforpredef(); setforpredef();
<?php } ?> <?php } ?>
}); });
/* Function to set fields from choice */ /* Function to set fields from choice */
function setforfree() { function setforfree() {
console.log("Call setforfree. We show most fields"); console.log("Call setforfree. We show most fields");
jQuery("#search_idprod").val('');
jQuery("#idprod").val('');
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
jQuery("#search_idprodfournprice").val('');
jQuery("#prod_entry_mode_free").prop('checked',true).change(); jQuery("#prod_entry_mode_free").prop('checked',true).change();
jQuery("#prod_entry_mode_predef").prop('checked',false).change(); jQuery("#prod_entry_mode_predef").prop('checked',false).change();
jQuery("#price_ht").show(); jQuery("#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val('');
jQuery("#multicurrency_price_ht").show(); jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show();
jQuery("#price_ttc").show(); // May not exist jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
jQuery("#fourn_ref").show();
jQuery("#tva_tx").show();
jQuery("#buying_price").val('').show();
jQuery("#fournprice_predef").hide(); jQuery("#fournprice_predef").hide();
jQuery("#title_vat").show();
jQuery("#title_up_ht").show();
jQuery("#title_up_ht_currency").show();
jQuery("#title_up_ttc").show();
jQuery("#title_up_ttc_currency").show();
jQuery("#np_marginRate").show(); // May not exist
jQuery("#np_markRate").show(); // May not exist
jQuery(".np_marginRate").show(); // May not exist
jQuery(".np_markRate").show(); // May not exist
jQuery("#units, #title_units").show();
} }
function setforpredef() { function setforpredef() {
console.log("Call setforpredef. We hide some fields and show dates"); console.log("Call setforpredef. We hide some fields and show dates");
jQuery("#select_type").val(-1); jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").prop('checked',false).change(); jQuery("#prod_entry_mode_free").prop('checked',false).change();
jQuery("#prod_entry_mode_predef").prop('checked',true).change(); jQuery("#prod_entry_mode_predef").prop('checked',true).change();
jQuery("#price_ht").val('').hide(); jQuery("#price_ht").val('')
jQuery("#multicurrency_price_ht").hide(); jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide();
jQuery("#price_ttc").hide(); // May not exist jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
jQuery("#fourn_ref").hide();
jQuery("#tva_tx").hide();
jQuery("#buying_price").show(); jQuery("#buying_price").show();
jQuery("#title_vat").hide(); jQuery('#trlinefordates, .divlinefordates').show();
jQuery("#title_up_ht").hide();
jQuery("#title_up_ht_currency").hide();
jQuery("#title_up_ttc").hide();
jQuery("#title_up_ttc_currency").hide();
jQuery("#np_marginRate").hide(); // May not exist
jQuery("#np_markRate").hide(); // May not exist
jQuery(".np_marginRate").hide(); // May not exist
jQuery(".np_markRate").hide(); // May not exist
jQuery("#units, #title_units").hide();
jQuery('#trlinefordates').show();
jQuery('.divlinefordates').show();
} }
</script> </script>

View File

@ -326,15 +326,16 @@ class Donations extends DolibarrApi
return $this->_cleanObjectDatas($this->don); return $this->_cleanObjectDatas($this->don);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -610,15 +610,16 @@ class Shipments extends DolibarrApi
} }
*/ */
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->thirdparty); // id already returned unset($object->thirdparty); // id already returned

View File

@ -489,15 +489,16 @@ class ExpenseReports extends DolibarrApi
); );
}*/ }*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->barcode_type); unset($object->barcode_type);

View File

@ -417,15 +417,16 @@ class Interventions extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->statuts_short); unset($object->statuts_short);

View File

@ -333,15 +333,16 @@ class SupplierInvoices extends DolibarrApi
); );
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->rowid); unset($object->rowid);

View File

@ -330,15 +330,16 @@ class SupplierOrders extends DolibarrApi
); );
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->rowid); unset($object->rowid);

View File

@ -23,7 +23,7 @@
* \brief Common load of data * \brief Common load of data
*/ */
require_once realpath(dirname(__FILE__)).'/../main.inc.php'; require_once realpath(__DIR__).'/../main.inc.php';
if (! class_exists('Holiday')) { if (! class_exists('Holiday')) {
require_once DOL_DOCUMENT_ROOT. '/holiday/class/holiday.class.php'; require_once DOL_DOCUMENT_ROOT. '/holiday/class/holiday.class.php';
} }

View File

@ -230,3 +230,10 @@ ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom);
ALTER TABLE llx_facturedet_rec ADD COLUMN buy_price_ht double(24,8) DEFAULT 0;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_product_fournisseur_price integer DEFAULT NULL;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_author integer;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_modif integer;

View File

@ -55,16 +55,16 @@ create table llx_facturedet
buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it). buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it).
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...) special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0, -- position of line rang integer DEFAULT 0, -- position of line
fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines
fk_unit integer DEFAULT NULL, -- id of the unit code
import_key varchar(14), import_key varchar(14),
fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line
situation_percent real, -- % progression of lines invoicing situation_percent real, -- % progression of lines invoicing
fk_prev_id integer, -- id of the line in the previous situation, fk_prev_id integer, -- id of the line in the previous situation
fk_unit integer DEFAULT NULL, -- id of the unit code¡
fk_user_author integer, -- user making creation fk_user_author integer, -- user making creation
fk_user_modif integer, -- user making last change fk_user_modif integer, -- user making last change

View File

@ -48,12 +48,19 @@ create table llx_facturedet_rec
date_start_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__ date_start_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__
date_end_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__ date_end_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__
info_bits integer DEFAULT 0, -- TVA NPR ou non info_bits integer DEFAULT 0, -- TVA NPR ou non
buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it).
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
rang integer DEFAULT 0, -- ordre d'affichage rang integer DEFAULT 0, -- ordre d'affichage
fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines
fk_unit integer DEFAULT NULL, fk_unit integer DEFAULT NULL,
import_key varchar(14), import_key varchar(14),
fk_user_author integer, -- user making creation
fk_user_modif integer, -- user making last change
fk_multicurrency integer, fk_multicurrency integer,
multicurrency_code varchar(255), multicurrency_code varchar(255),
multicurrency_subprice double(24,8) DEFAULT 0, multicurrency_subprice double(24,8) DEFAULT 0,

View File

@ -88,7 +88,7 @@ if (! $versionfrom && ! $versionto)
// Test if batch mode // Test if batch mode
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
$script_file = basename(__FILE__); $script_file = basename(__FILE__);
$path=dirname(__FILE__).'/'; $path=__DIR__.'/';
if (substr($sapi_type, 0, 3) == 'cli') if (substr($sapi_type, 0, 3) == 'cli')
{ {
print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n"; print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n";

View File

@ -96,7 +96,7 @@ if ((! $versionfrom || preg_match('/version/', $versionfrom)) && (! $versionto |
// Test if batch mode // Test if batch mode
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
$script_file = basename(__FILE__); $script_file = basename(__FILE__);
$path=dirname(__FILE__).'/'; $path=__DIR__.'/';
if (substr($sapi_type, 0, 3) == 'cli') if (substr($sapi_type, 0, 3) == 'cli')
{ {
print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n";

View File

@ -95,3 +95,4 @@ InternalURLOfPage=Internal URL of page
ThisPageIsTranslationOf=This page/container is a translation of ThisPageIsTranslationOf=This page/container is a translation of
ThisPageHasTranslationPages=This page/container has translation ThisPageHasTranslationPages=This page/container has translation
NoWebSiteCreateOneFirst=No website has been created yet. Create one first. NoWebSiteCreateOneFirst=No website has been created yet. Create one first.
GoTo=Go to

View File

@ -31,7 +31,6 @@ dol_include_once('/mymodule/class/myobject.class.php');
/** /**
* API class for mymodule myobject * API class for mymodule myobject
* *
* @smart-auto-routing false
* @access protected * @access protected
* @class DolibarrApiAccess {@requires user,external} * @class DolibarrApiAccess {@requires user,external}
*/ */
@ -205,7 +204,7 @@ class MyModuleApi extends DolibarrApi
$this->myobject->$field = $value; $this->myobject->$field = $value;
} }
if( ! $this->myobject->create(DolibarrApiAccess::$user)) { if( ! $this->myobject->create(DolibarrApiAccess::$user)) {
throw new RestException(500); throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors));
} }
return $this->myobject->id; return $this->myobject->id;
} }
@ -235,13 +234,18 @@ class MyModuleApi extends DolibarrApi
} }
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->myobject->$field = $value; $this->myobject->$field = $value;
} }
if($this->myobject->update($id, DolibarrApiAccess::$user)) if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0)
{
return $this->get($id); return $this->get($id);
}
return false; else
{
throw new RestException(500, $this->myobject->error);
}
} }
/** /**
@ -266,9 +270,9 @@ class MyModuleApi extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if( !$this->myobject->delete(DolibarrApiAccess::$user, 0)) if (! $this->myobject->delete(DolibarrApiAccess::$user))
{ {
throw new RestException(500); throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error);
} }
return array( return array(
@ -280,14 +284,16 @@ class MyModuleApi extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
/*unset($object->note); /*unset($object->note);
@ -303,7 +309,7 @@ class MyModuleApi extends DolibarrApi
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
* @param array $data Data to validate * @param array $data Array of data to validate
* @return array * @return array
* *
* @throws RestException * @throws RestException

View File

@ -186,7 +186,7 @@ class mymodulewidget1 extends ModeleBoxes
'tr' => 'class="left"', 'tr' => 'class="left"',
'text' => '' 'text' => ''
), ),
0 => array( // TR 1 => array( // TR
'tr' => 'class="left"', 'tr' => 'class="left"',
'text' => '' 'text' => ''
) )

View File

@ -25,7 +25,7 @@
$sapi_type = php_sapi_name(); $sapi_type = php_sapi_name();
$script_file = basename(__FILE__); $script_file = basename(__FILE__);
$path=dirname(__FILE__).'/'; $path=__DIR__.'/';
// Test if batch mode // Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') { if (substr($sapi_type, 0, 3) == 'cgi') {

View File

@ -468,15 +468,16 @@ class Products extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->regeximgext); unset($object->regeximgext);

View File

@ -274,15 +274,16 @@ class StockMovements extends DolibarrApi
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param MouvementStock $object Object to clean * @param MouvementStock $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove useless data // Remove useless data

View File

@ -243,15 +243,16 @@ class Warehouses extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Entrepot $object Object to clean * @param Entrepot $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource. // Remove the subscriptions because they are handled as a subresource.

View File

@ -711,15 +711,16 @@ class MouvementStock extends CommonObject
* @param date $sellby sell-by date * @param date $sellby sell-by date
* @param string $batch batch number * @param string $batch batch number
* @param int $id_product_batch Id product_batch * @param int $id_product_batch Id product_batch
* @param string $inventorycode Inventory code
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0) public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0, $inventorycode='')
{ {
global $conf; global $conf;
$skip_batch = empty($conf->productbatch->enabled); $skip_batch = empty($conf->productbatch->enabled);
return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, '', $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch);
} }
/** /**
@ -736,15 +737,16 @@ class MouvementStock extends CommonObject
* @param string $batch batch number * @param string $batch batch number
* @param string $datem Force date of movement * @param string $datem Force date of movement
* @param int $id_product_batch Id product_batch * @param int $id_product_batch Id product_batch
* @param string $inventorycode Inventory code
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0) public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0, $inventorycode='')
{ {
global $conf; global $conf;
$skip_batch = empty($conf->productbatch->enabled); $skip_batch = empty($conf->productbatch->enabled);
return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, '', $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch);
} }

View File

@ -534,15 +534,16 @@ class Projects extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->titre); unset($object->titre);

View File

@ -547,15 +547,16 @@ class Tasks extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->barcode_type); unset($object->barcode_type);

View File

@ -379,15 +379,16 @@ class Contacts extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->total_ht); unset($object->total_ht);

View File

@ -1626,14 +1626,16 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array(
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->nom); // ->name already defined and nom deprecated unset($object->nom); // ->name already defined and nom deprecated

View File

@ -190,15 +190,16 @@ class Supplierproposals extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->name); unset($object->name);

View File

@ -22,7 +22,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
box-sizing: border-box; box-sizing: border-box;
} }
.badge-pill { .badge-pill, .tabs .badge {
padding-right: .6em; padding-right: .6em;
padding-left: .6em; padding-left: .6em;
border-radius: 10rem; border-radius: 10rem;
@ -58,7 +58,7 @@ a.badge-primary:focus, a.badge-primary:hover {
} }
/* SECONDARY */ /* SECONDARY */
.badge-secondary { .badge-secondary, .tabs .badge {
color: #fff !important; color: #fff !important;
background-color: <?php print $badgeSecondary; ?>; background-color: <?php print $badgeSecondary; ?>;
} }

View File

@ -47,7 +47,7 @@ if (defined('THEME_ONLY_CONSTANT')) return;
session_cache_limiter('public'); session_cache_limiter('public');
require_once '../../main.inc.php'; require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; 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) // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)

View File

@ -1764,6 +1764,10 @@ div.mainmenu.products {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png', 1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png', 1) ?>);
} }
div.mainmenu.mrp {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png', 1) ?>);
}
div.mainmenu.project { div.mainmenu.project {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project.png', 1) ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project.png', 1) ?>);
} }

View File

@ -116,9 +116,9 @@ class ActionsTicket
/* /*
* Add file in email form * Add file in email form
*/ */
if (GETPOST('addfile')) { if (GETPOST('addfile', 'alpha')) {
// altairis : allow files from public interface // altairis : allow files from public interface
if (GETPOST('track_id')) { if (GETPOST('track_id', 'alpha')) {
$res = $object->fetch('', '', GETPOST('track_id', 'alpha')); $res = $object->fetch('', '', GETPOST('track_id', 'alpha'));
} }
@ -140,7 +140,7 @@ class ActionsTicket
/* /*
* Remove file in email form * Remove file in email form
*/ */
if (GETPOST('removedfile')) { if (GETPOST('removedfile', 'alpha')) {
// altairis : allow files from public interface // altairis : allow files from public interface
if (GETPOST('track_id')) { if (GETPOST('track_id')) {
$res = $object->fetch('', '', GETPOST('track_id', 'alpha')); $res = $object->fetch('', '', GETPOST('track_id', 'alpha'));

View File

@ -513,7 +513,7 @@ class Tickets extends DolibarrApi
return $ticket; return $ticket;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
@ -523,9 +523,9 @@ class Tickets extends DolibarrApi
* @todo use an array for properties to clean * @todo use an array for properties to clean
* *
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Other attributes to clean // Other attributes to clean

View File

@ -528,9 +528,12 @@ class Ticket extends CommonObject
$this->severity_label = $label_severity; $this->severity_label = $label_severity;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_read = $this->db->jdate($obj->date_read); $this->date_read = $this->db->jdate($obj->date_read);
$this->date_validation = $this->db->jdate($obj->date_read);
$this->date_close = $this->db->jdate($obj->date_close); $this->date_close = $this->db->jdate($obj->date_close);
$this->tms = $this->db->jdate($obj->tms); $this->tms = $this->db->jdate($obj->tms);
$this->date_modification = $this->db->jdate($obj->tms);
$this->fetch_optionals(); $this->fetch_optionals();

View File

@ -580,7 +580,7 @@ foreach($object->fields as $key => $val)
if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) 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"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
} }
} }
// Extra fields // Extra fields

View File

@ -354,14 +354,16 @@ class Users extends DolibarrApi
return $this->useraccount->delete(DolibarrApiAccess::$user); return $this->useraccount->delete(DolibarrApiAccess::$user);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
global $conf; global $conf;
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -920,7 +920,7 @@ if ($action == 'updatecss')
/* We disable php code since htmlheader is never executed as an include but only read by fgets_content. /* We disable php code since htmlheader is never executed as an include but only read by fgets_content.
$htmlheadercontent.= "<?php // BEGIN PHP\n"; $htmlheadercontent.= "<?php // BEGIN PHP\n";
$htmlheadercontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $htmlheadercontent.= '$websitekey=basename(__DIR__);'."\n";
$htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n"; $htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
@ -943,8 +943,8 @@ if ($action == 'updatecss')
$csscontent =''; $csscontent ='';
$csscontent.= "<?php // BEGIN PHP\n"; $csscontent.= "<?php // BEGIN PHP\n";
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $csscontent.= '$websitekey=basename(__DIR__);'."\n";
$csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file. $csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once __DIR__.'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$csscontent.= "ob_start();\n"; $csscontent.= "ob_start();\n";
@ -976,8 +976,8 @@ if ($action == 'updatecss')
$jscontent =''; $jscontent ='';
$jscontent.= "<?php // BEGIN PHP\n"; $jscontent.= "<?php // BEGIN PHP\n";
$jscontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $jscontent.= '$websitekey=basename(__DIR__);'."\n";
$jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file. $jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once __DIR__.'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$jscontent.= "ob_start();\n"; $jscontent.= "ob_start();\n";
@ -1009,7 +1009,7 @@ if ($action == 'updatecss')
$robotcontent =''; $robotcontent ='';
/*$robotcontent.= "<?php // BEGIN PHP\n"; /*$robotcontent.= "<?php // BEGIN PHP\n";
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $robotcontent.= '$websitekey=basename(__DIR__);'."\n";
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n"; $robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
@ -1042,7 +1042,7 @@ if ($action == 'updatecss')
$htaccesscontent =''; $htaccesscontent ='';
/*$htaccesscontent.= "<?php // BEGIN PHP\n"; /*$htaccesscontent.= "<?php // BEGIN PHP\n";
$htaccesscontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $htaccesscontent.= '$websitekey=basename(__DIR__);'."\n";
$htaccesscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n"; $htaccesscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";

View File

@ -1,6 +1,6 @@
<?php <?php
// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of wrapper.html sample. // BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of wrapper.html sample.
$websitekey=basename(dirname(__FILE__)); $websitekey=basename(__DIR__);
if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';

View File

@ -163,17 +163,17 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
// Do a list of movement into warehouse 1 // Do a list of movement into warehouse 1
// Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9 // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9
$result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', 'Inventory Code Test'); $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', '', '', '', '', 0, 'Inventory Code Test');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', 'Inventory Code Test'); $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', '', '', '', '', 0, 'Inventory Code Test');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', 'Inventory Code Test'); $result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', '', '', '', '', 0, 'Inventory Code Test');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
@ -191,17 +191,17 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
// Do same but into warehouse 2 // Do same but into warehouse 2
// Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9 // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9
$result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', 'Inventory Code Test 2'); $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', '', '', '', '', 0, 'Inventory Code Test 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', 'Inventory Code Test 2'); $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', '', '', '', '', 0, 'Inventory Code Test 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', 'Inventory Code Test 2'); $result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', '', '', '', '', 0, 'Inventory Code Test 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);

View File

@ -332,33 +332,6 @@ class TicketTest extends PHPUnit_Framework_TestCase
return $localobject; return $localobject;
} }
/**
* testTicketcreateTicketLog
*
* @param Ticket $localobject Ticket
* @return int
*
* @depends testTicketFetch
* The depends says test is run only if previous is ok
*/
public function testTicketcreateTicketLog($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$message = 'Test ticket log';
$noemail = 1;
$result=$localobject->createTicketLog($user, $message, $noemail);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertGreaterThan(0, $result);
return $localobject;
}
/** /**
* testTicketclose * testTicketclose
* *