This commit is contained in:
Christophe Battarel
2019-04-05 11:44:29 +02:00
276 changed files with 28615 additions and 2851 deletions

View File

@@ -16,6 +16,7 @@ NEW: Module DebugBar is available as a stable module.
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The PHP extension php-intl is not mandatory but should be installed to have new features working correctly.
* Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules.
* API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules.
* Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.;
@@ -24,7 +25,10 @@ Following changes may create regressions for some external modules, but were nec
* All methods set_draft() were renamed into setDraft().
* Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject.
* Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated.
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION
* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION.
* Method dolEscapeXML was moved from functions.lib.php into function2.lib.php (not used enough to be loaded by default).
* Removed deprecated use of string in dol_print_date(). Only date allowed.
***** ChangeLog for 9.0.1 compared to 9.0.0 *****

View File

@@ -8,6 +8,15 @@ ALL:
Check "@CHANGE"
PrestaShopWebservice:
---------------------
Replace
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop');
With
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date');
CKEDITOR (4.6.2):
-----------------
* In ckeditor/ckeditor/contents.css

View File

@@ -8,9 +8,11 @@
<exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
<exclude-pattern type="relative">htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">htdocs/install/doctemplates/websites</exclude-pattern>
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<!-- List of all tests -->

View File

@@ -142,12 +142,12 @@ class AccountancySystem
$result = $this->rowid;
} else {
$result = - 2;
$this->error = "AccountancySystem::Create Erreur $result";
$this->error = "AccountancySystem::Create Error $result";
dol_syslog($this->error, LOG_ERR);
}
} else {
$result = - 1;
$this->error = "AccountancySystem::Create Erreur $result";
$this->error = "AccountancySystem::Create Error $result";
dol_syslog($this->error, LOG_ERR);
}

View File

@@ -56,7 +56,7 @@ class AdherentType extends CommonObject
/**
* @var string
* @deprecated Use label
* @see label
* @see $label
*/
public $libelle;

View File

@@ -86,7 +86,8 @@ class Members extends DolibarrApi
* @param int $limit Limit for list
* @param int $page Page number
* @param string $typeid ID of the type of member
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @param string $sqlfilters Other criteria to filter answers separated by a comma.
* Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))"
* @return array Array of member objects
*
* @throws RestException

View File

@@ -113,7 +113,7 @@ if ($id > 0)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2018 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,7 +36,8 @@ $action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters=array(
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
);
@@ -84,7 +85,11 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td>';
if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{
print $langs->trans("AlwaysActive");
}
elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{
print $form->selectyesno($key, $conf->global->$key, 1);
}
@@ -114,7 +119,11 @@ else
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
print '</td><td>';
if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{
print $langs->trans("AlwaysActive");
}
elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{
print yn($conf->global->$key);
}

View File

@@ -46,7 +46,7 @@ class PrestaShopWebservice
/** @var array compatible versions of PrestaShop Webservice */
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
const PSCOMPATIBLEVERSIONMAX = '1.7.99.99';
/**
@@ -128,6 +128,7 @@ class PrestaShopWebservice
CURLOPT_HTTPHEADER => array( 'Expect:' )
);
dol_syslog("curl_init url=".$url);
$session = curl_init($url);
$curl_options = array();
@@ -142,6 +143,7 @@ class PrestaShopWebservice
if (!isset($curl_options[$defkey]))
$curl_options[$defkey] = $curl_params[$defkey];
dol_syslog("curl curl_options = ".var_export($curl_options, true));
curl_setopt_array($session, $curl_options);
$response = curl_exec($session);
@@ -309,7 +311,9 @@ class PrestaShopWebservice
if (isset($options['id']))
$url .= '/'.$options['id'];
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop');
// @CHANGE LDR
//$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop');
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date');
foreach ($params as $p)
foreach ($options as $k => $o)
if (strpos($k, $p) !== false)
@@ -388,6 +392,49 @@ class PrestaShopWebservice
self::checkStatusCode($request['status_code']);// check the response validity
return self::parseXML($request['response']);
}
/**
* Delete (DELETE) a resource.
* Unique parameter must take : <br><br>
* 'resource' => Resource name<br>
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
* <code>
* <?php
* require_once('./PrestaShopWebservice.php');
* try
* {
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
* // Following code will not be executed if an exception is thrown.
* echo 'Successfully deleted.';
* }
* catch (PrestaShopWebserviceException $ex)
* {
* echo 'Error : '.$ex->getMessage();
* }
* ?>
* </code>
*
* @param array $options Array representing resource to delete.
* @return boolean True
*/
public function delete($options)
{
if (isset($options['url']))
$url = $options['url'];
elseif (isset($options['resource']) && isset($options['id']))
if (is_array($options['id']))
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
else
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
if (isset($options['id_shop']))
$url .= '&id_shop='.$options['id_shop'];
if (isset($options['id_group_shop']))
$url .= '&id_group_shop='.$options['id_group_shop'];
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
self::checkStatusCode($request['status_code']);// check the response validity
return true;
}
}
/**

View File

@@ -44,7 +44,6 @@ class Dolistore
// setups
public $url; // the url of this page
public $shop_url; // the url of the shop
public $vat_rate; // the vat rate used in the shop (prices are provided without vat)
public $lang; // the integer representing the lang in the store
public $debug_api; // usefull if no dialog
@@ -60,12 +59,11 @@ class Dolistore
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
$this->vat_rate = 1.2; // 20% de TVA
$this->debug_api = $debug;
$langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0];
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
$lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
$this->lang = $lang_array[$lang];
}
@@ -74,12 +72,50 @@ class Dolistore
* Load data from remote Dolistore market place.
* This fills ->categories
*
* @param array $options Options
* @return void
*/
public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
public function getRemoteCategories()
{
global $conf, $langs;
global $conf;
try {
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
// $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data.
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
dol_syslog("Call API with opt = ".var_export($opt, true));
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
elseif ($trace[0]['args'][0] == 401) die('Bad auth key');
else
{
print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'<br>';
print $e->getMessage();
}
}
}
/**
* Load data from remote Dolistore market place.
* This fills ->products
*
* @param array $options Options. If 'categorie' is defined, we filter products on this category id
* @return void
*/
public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0, 'search' => ''))
{
global $conf;
$this->start = $options['start'];
$this->end = $options['end'];
@@ -103,25 +139,26 @@ class Dolistore
// make a search to limit the id returned.
if ($this->search != '') {
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; // It seems for search, key start with
// Call
//var_dump($this->api);
dol_syslog("Call API with opt = ".var_export($opt, true));
dol_syslog("Call API with opt2 = ".var_export($opt2, true));
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->products->children() as $product) {
$products[] = (int) $product['id'];
}
$opt['filter[id]'] = '['.implode('|', $products).']';
} elseif ($this->categorie != 0) {
} elseif ($this->categorie != 0) { // We filter on category, so we first get list of product id in this category
// $opt2['url'] is set by default to $this->url.'/api/'.$options['resource'];
$opt2['resource'] = 'categories';
$opt2['id'] = $this->categorie;
// Call
dol_syslog("Call API with opt2 = ".var_export($opt2, true));
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->category->associations->products->children() as $product) {
$products[] = (int) $product->id;
@@ -134,22 +171,10 @@ class Dolistore
$opt['limit'] = "$this->start,$this->end";
// $opt['filter[id]'] contais list of product id that are result of search
// Call API to get the detail
dol_syslog("Call API with opt = ".var_export($opt, true));
dol_syslog("Call API with opt2 = ".var_export($opt2, true));
$xml = $this->api->get($opt);
$this->products = $xml->products->children();
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
@@ -186,15 +211,15 @@ class Dolistore
$cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'"'
.'>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" '
.'>'.$cat->name->language[$this->lang - 1].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} else {
@@ -242,7 +267,7 @@ class Dolistore
// add image or default ?
if ($product->id_default_image != '') {
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang - 1].', '.$langs->trans('Version').' '.$product->module_version.'">'.
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
@@ -250,7 +275,7 @@ class Dolistore
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).'&nbsp;&euro;</h3>';
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else {
$price = '<h3>'.$langs->trans('Free').'</h3>';
@@ -283,10 +308,10 @@ class Dolistore
//output template
$html .= '<tr class="app '.$parity.' '.$compatible.'">
<td class="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang]
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang - 1]
.'<br/><small>'.$version.'</small></h2>
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang - 1].'</td>
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>
<td class="margeCote center">'.$price.'
</td>
<td class="margeCote">'.$download_link.'</td>

View File

@@ -100,8 +100,8 @@ print '<br>'.$moreinfo;
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
{
$langs->load("errors");
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
$warnpicto=img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
}
print '<br>';
print '<br>';

View File

@@ -888,7 +888,8 @@ if ($mode == 'marketplace')
{
// $options is array with filter criterias
//var_dump($options);
$dolistore->getRemoteData($options);
$dolistore->getRemoteCategories();
$dolistore->getRemoteProducts($options);
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';

View File

@@ -279,7 +279,7 @@ class DolibarrApi
/**
* Function to forge a SQL criteria
*
* @param array $matches Array of found string by regex search
* @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
* @return string Forged criteria. Example: "t.field like 'abc%'"
*/
protected static function _forge_criteria_callback($matches)

View File

@@ -117,7 +117,7 @@ if ($object->id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
// Number of files
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';

View File

@@ -66,7 +66,7 @@ function bomAdminPrepareHead()
/**
* Prepare array of tabs for BillOfMaterials
*
* @param BillOfMaterials $object BillOfMaterials
* @param BOM $object BillOfMaterials
* @return array Array of tabs
*/
function bomPrepareHead($object)

View File

@@ -281,7 +281,7 @@ class Facturation
* Getter for id
*
* @param int $aId Id
* @return id
* @return int Id
*/
public function id($aId = null)
{
@@ -542,8 +542,8 @@ class Facturation
/**
* Get payment date
*
* @param date $aPaiementLe Date
* @return date Date
* @param integer $aPaiementLe Date
* @return integer Date
*/
public function paiementLe($aPaiementLe = null)
{

View File

@@ -33,10 +33,7 @@ $langs->loadLangs(array("admin","other","website"));
if (! $user->admin) accessforbidden();
if (! ((GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)))
{
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
}
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
$error=0;
$website=GETPOST('website', 'alpha');

View File

@@ -155,7 +155,7 @@ if ($object->id > 0)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Files infos
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td>'.count($filearray).'</td></tr>';

View File

@@ -1075,7 +1075,7 @@ class Commande extends CommonOrder
*/
public function createFromClone($socid = 0)
{
global $user,$hookmanager;
global $conf, $user,$hookmanager;
$error=0;
@@ -1085,69 +1085,88 @@ class Commande extends CommonOrder
foreach($this->lines as $line)
$line->fetch_optionals();
// Load source object
$objFrom = clone $this;
// Load source object
$objFrom = clone $this;
// Change socid if needed
if (! empty($socid) && $socid != $this->socid)
// Change socid if needed
if (! empty($socid) && $socid != $this->socid)
{
$objsoc = new Societe($this->db);
if ($objsoc->fetch($socid)>0)
{
$objsoc = new Societe($this->db);
if ($objsoc->fetch($socid)>0)
{
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = 0;
$this->fk_delivery_address = 0;
}
// TODO Change product price if multi-prices
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = 0;
$this->fk_delivery_address = 0;
}
$this->id=0;
$this->ref = '';
$this->statut=self::STATUS_DRAFT;
// TODO Change product price if multi-prices
}
// Clear fields
$this->user_author_id = $user->id;
$this->user_valid = '';
$this->date = dol_now();
$this->date_commande = dol_now();
$this->date_creation = '';
$this->date_validation = '';
$this->ref_client = '';
$this->id=0;
$this->ref = '';
$this->statut=self::STATUS_DRAFT;
// Create clone
$this->context['createfromclone'] = 'createfromclone';
$result=$this->create($user);
if ($result < 0) $error++;
// Clear fields
$this->user_author_id = $user->id;
$this->user_valid = '';
$this->date = dol_now();
$this->date_commande = dol_now();
$this->date_creation = '';
$this->date_validation = '';
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = '';
if (! $error)
// Create clone
$this->context['createfromclone'] = 'createfromclone';
$result=$this->create($user);
if ($result < 0) $error++;
if (! $error)
{
// copy internal contacts
if ($this->copy_linked_contact($objFrom, 'internal') < 0)
{
// Hook of thirdparty module
if (is_object($hookmanager))
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
$error++;
}
}
unset($this->context['createfromclone']);
if (! $error)
{
// copy external contacts if same company
if ($this->socid == $objFrom->socid)
{
if ($this->copy_linked_contact($objFrom, 'external') < 0)
$error++;
}
}
// End
if (! $error)
if (! $error)
{
// Hook of thirdparty module
if (is_object($hookmanager))
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -1;
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
}
unset($this->context['createfromclone']);
// End
if (! $error)
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -1;
}
}
@@ -1367,7 +1386,7 @@ class Commande extends CommonOrder
// Check parameters
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
@@ -2947,7 +2966,7 @@ class Commande extends CommonOrder
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($remise_percent)) $remise_percent=0;
if (empty($special_code) || $special_code == 3) $special_code=0;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
@@ -2962,7 +2981,7 @@ class Commande extends CommonOrder
$txtva=price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$this->db->begin();
// Calcul du total TTC et de la TVA pour la ligne a partir de

View File

@@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@@ -497,12 +497,12 @@ if ($resql)
print '<td>';
if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{
print $form->selectyesno('valdate_invoices', 0, 1, 1);
print $form->selectyesno('validate_invoices', 0, 1, 1);
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
}
else
{
print $form->selectyesno('valdate_invoices', 0, 1);
print $form->selectyesno('validate_invoices', 0, 1);
}
if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>';
else print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("OptionToSetOrderBilledNotEnabled").'</span>';

View File

@@ -639,11 +639,12 @@ else
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>';
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($object->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
if ($object->fk_accountancy_journal > 0) {
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($object->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
print '</td></tr>';
}

View File

@@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) {
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' .dol_print_size($totalsize, 1, 1).'</td></tr>';
print "</table>\n";

View File

@@ -407,18 +407,17 @@ foreach ($accounts as $key=>$type)
$found++;
$obj = new Account($db);
$obj->fetch($key);
$result = $objecttmp->fetch($key);
$solde = $obj->solde(1);
$solde = $objecttmp->solde(1);
if (! empty($lastcurrencycode) && $lastcurrencycode != $obj->currency_code)
if (! empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code)
{
$lastcurrencycode='various'; // We found several different currencies
}
if ($lastcurrencycode != 'various')
{
$lastcurrencycode=$obj->currency_code;
$lastcurrencycode=$objecttmp->currency_code;
}
print '<tr class="oddeven">';
@@ -426,14 +425,14 @@ foreach ($accounts as $key=>$type)
// Ref
if (! empty($arrayfields['b.ref']['checked']))
{
print '<td class="nowrap">'.$obj->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Label
if (! empty($arrayfields['b.label']['checked']))
{
print '<td>'.$obj->label.'</td>';
print '<td>'.$objecttmp->label.'</td>';
if (! $i) $totalarray['nbfield']++;
}
@@ -441,7 +440,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['accountype']['checked']))
{
print '<td>';
print $obj->type_lib[$obj->type];
print $objecttmp->type_lib[$objecttmp->type];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@@ -449,7 +448,7 @@ foreach ($accounts as $key=>$type)
// Number
if (! empty($arrayfields['b.number']['checked']))
{
print '<td>'.$obj->number.'</td>';
print '<td>'.$objecttmp->number.'</td>';
if (! $i) $totalarray['nbfield']++;
}
@@ -460,12 +459,12 @@ foreach ($accounts as $key=>$type)
if (! empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $obj->account_number, 1);
$accountingaccount->fetch('', $objecttmp->account_number, 1);
print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
}
else
{
print $obj->account_number;
print $objecttmp->account_number;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
@@ -478,7 +477,7 @@ foreach ($accounts as $key=>$type)
if (! empty($conf->accounting->enabled))
{
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($obj->fk_accountancy_journal);
$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
}
else
@@ -493,7 +492,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['b.currency_code']['checked']))
{
print '<td class="center">';
print $obj->currency_code;
print $objecttmp->currency_code;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@@ -502,11 +501,11 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['toreconcile']['checked']))
{
print '<td class="center">';
if ($obj->rappro)
if ($objecttmp->rappro)
{
$result=$obj->load_board($user, $obj->id);
$result=$objecttmp->load_board($user, $objecttmp->id);
if ($result<0) {
setEventMessages($obj->error, $obj->errors, 'errors');
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print $result->nbtodo;
if ($result->nbtodolate) print ' &nbsp; ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
@@ -520,14 +519,14 @@ foreach ($accounts as $key=>$type)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['b.datec']['checked']))
{
print '<td class="center">';
print dol_print_date($obj->date_creation, 'dayhour');
print dol_print_date($objecttmp->date_creation, 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@@ -535,7 +534,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['b.tms']['checked']))
{
print '<td class="center">';
print dol_print_date($obj->date_update, 'dayhour');
print dol_print_date($objecttmp->date_update, 'dayhour');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@@ -543,7 +542,7 @@ foreach ($accounts as $key=>$type)
// Status
if (! empty($arrayfields['b.clos']['checked']))
{
print '<td class="center">'.$obj->getLibStatut(5).'</td>';
print '<td class="center">'.$objecttmp->getLibStatut(5).'</td>';
if (! $i) $totalarray['nbfield']++;
}
@@ -551,7 +550,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['balance']['checked']))
{
print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
@@ -563,15 +562,15 @@ foreach ($accounts as $key=>$type)
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
if (in_array($objecttmp->id, $arrayofselected)) $selected=1;
print '<input id="cb'.$objecttmp->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$objecttmp->id.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print '</tr>';
$total[$obj->currency_code] += $solde;
$total[$objecttmp->currency_code] += $solde;
$i++;
}

View File

@@ -131,7 +131,7 @@ if ($object->id)
$totalsize+=$file['size'];
}
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';

View File

@@ -100,7 +100,7 @@ if ($object->id)
}
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';

View File

@@ -4280,7 +4280,7 @@ elseif ($id > 0 || ! empty($ref))
print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits');
else
print $langs->trans('AlreadyPaid');
print ' :</td><td class="right"'.(($totalpaye > 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . '</td><td>&nbsp;</td></tr>';
print ' :</td><td class="right'.(($totalpaye > 0)?' amountalreadypaid':'').'">' . price($totalpaye) . '</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
@@ -4359,14 +4359,13 @@ elseif ($id > 0 || ! empty($ref))
// Billed
print '<tr><td colspan="' . $nbcols . '" class="right">' . $langs->trans("Billed") . ' :</td><td class="right">' . price($object->total_ttc) . '</td><td>&nbsp;</td></tr>';
// Remainder to pay
print '<tr><td colspan="' . $nbcols . '" class="right">';
print $langs->trans('RemainderToPay');
if ($resteapayeraffiche < 0)
print ' ('.$langs->trans('ExcessReceived').')';
print ' :</td>';
print '<td class="right"'.($resteapayeraffiche?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($resteapayeraffiche) . '</td>';
print '<td class="right'.($resteapayeraffiche?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">' . price($resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>';
}
else // Credit note
@@ -4387,7 +4386,7 @@ elseif ($id > 0 || ! empty($ref))
if ($resteapayeraffiche > 0)
print ' ('.$langs->trans('ExcessPaid').')';
print ' :</td>';
print '<td class="right"'.($resteapayeraffiche?' class="amountremaintopayback"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($sign * $resteapayeraffiche) . '</td>';
print '<td class="right'.($resteapayeraffiche?' amountremaintopayback':(' '.$cssforamountpaymentcomplete)).'">' . price($sign * $resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>';
// Sold credit note

View File

@@ -1199,9 +1199,10 @@ class Facture extends CommonInvoice
* @param int $notooltip 1=Disable tooltip
* @param int $addlinktonotes 1=Add link to notes
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param string $target Target of link ('', '_self', '_blank', '_parent', '_backoffice', ...)
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1)
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '')
{
global $langs, $conf, $user, $form;
@@ -1254,7 +1255,7 @@ class Facture extends CommonInvoice
if ($moretitle) $label.=' - '.$moretitle;
}
$linkclose='';
$linkclose=($target?' target="'.$target.'"':'');
if (empty($notooltip) && $user->rights->facture->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
@@ -2720,7 +2721,7 @@ class Facture extends CommonInvoice
// Check parameters
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
@@ -2929,7 +2930,7 @@ class Facture extends CommonInvoice
return -3;
}
}
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');

View File

@@ -165,7 +165,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@@ -1305,7 +1305,7 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer)
if ($action != 'editconditions' && $user->rights->facture->creer)
print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>';
@@ -1329,7 +1329,7 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer)
if ($action != 'editmode' && $user->rights->facture->creer)
print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&amp;facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>';
@@ -1463,7 +1463,7 @@ else
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Frequency');
print '</td>';
if ($action != 'editfrequency' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer)
if ($action != 'editfrequency' && $user->rights->facture->creer)
print '<td class="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&amp;facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>';

View File

@@ -26,7 +26,7 @@
/**
* \file htdocs/compta/paiement/list.php
* \ingroup compta
* \brief Page liste des paiements des factures clients
* \brief Payment page for customer invoices
*/
require '../../main.inc.php';
@@ -37,9 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'compta', 'companies'));
$langs->loadLangs(array('bills', 'banks', 'compta', 'companies'));
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
// Security check
$facid = GETPOST('facid', 'int');
$socid = GETPOST('socid', 'int');
$userid = GETPOST('userid', 'int');
@@ -47,6 +50,7 @@ $day = GETPOST('day', 'int');
$month = GETPOST('month', 'int');
$year = GETPOST('year', 'int');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $facid, '');
@@ -83,7 +87,7 @@ $arrayfields=array();
* Actions
*/
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_ref="";
$search_account="";
@@ -94,22 +98,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$day='';
$year='';
$month='';
$search_array_options=array();
}
/*
* View
*/
llxHeader('', $langs->trans('ListPayment'));
$form=new Form($db);
$formother=new FormOther($db);
if (GETPOST("orphelins"))
llxHeader('', $langs->trans('ListPayment'));
if (GETPOST("orphelins", "alpha"))
{
// Paiements lies a aucune facture (pour aide au diagnostic)
// Payments not linked to an invoice. Should not happend. For debug only.
$sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,";
$sql.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code";
@@ -197,7 +201,6 @@ $resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
@@ -213,6 +216,7 @@ if ($resql)
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
@@ -228,18 +232,18 @@ if ($resql)
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
$formother->select_year($year?$year:-1, 'year', 1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left">';
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>';
print '<td class="liste_titre">';
$form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1);
print '</td>';
print '<td class="liste_titre" align="left">';
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
print '</td>';
if (! empty($conf->banque->enabled))
@@ -264,7 +268,7 @@ if ($resql)
print '<tr class="liste_titre">';
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder);
@@ -283,6 +287,8 @@ if ($resql)
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
$i = 0;
$totalarray=array();
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($resql);
@@ -290,35 +296,39 @@ if ($resql)
$paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->ref;
$companystatic->id=$objp->socid;
$companystatic->name=$objp->name;
$companystatic->email=$objp->email;
print '<tr class="oddeven">';
print '<td>';
print $paymentstatic->getNomUrl(1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
// Date
$dateformatforpayment = 'day';
if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour';
print '<td align="center">'.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).'</td>';
if (! $i) $totalarray['nbfield']++;
// Thirdparty
print '<td>';
if ($objp->socid > 0)
{
$companystatic->id=$objp->socid;
$companystatic->name=$objp->name;
$companystatic->email=$objp->email;
print $companystatic->getNomUrl(1, '', 24);
}
else print '&nbsp;';
print '</td>';
if (! $i) $totalarray['nbfield']++;
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td>';
if (! $i) $totalarray['nbfield']++;
// Payment number
print '<td>'.$objp->num_paiement.'</td>';
if (! $i) $totalarray['nbfield']++;
// Account
if (! empty($conf->banque->enabled))
@@ -338,11 +348,15 @@ if ($resql)
print $accountstatic->getNomUrl(1);
}
else print '&nbsp;';
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Amount
print '<td class="right">'.price($objp->amount).'</td>';
if (! $i) $totalarray['nbfield']++;
$totalarray['pos'][7]='amount';
$totalarray['val']['amount'] += $objp->amount;
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
@@ -351,13 +365,39 @@ if ($resql)
print $paymentstatic->LibStatut($objp->statut, 5);
if ($objp->statut == 0) print '</a>';
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
print '<td>&nbsp;</td>';
print '</tr>';
print '<td></td>';
if (! $i) $totalarray['nbfield']++;
print '</tr>';
$i++;
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
print "</table>\n";
print "</div>";
print "</form>\n";

View File

@@ -1592,6 +1592,9 @@ class BonPrelevement extends CommonObject
{
// phpcs:enable
global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$CrLf = "\n";
$Rowing = sprintf("%06d", $row_idfac);

View File

@@ -114,7 +114,7 @@ if ($object->id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print '</table>';

View File

@@ -665,7 +665,7 @@ if ($id > 0)
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
print '<td class="right"'.($resteapayer?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>'.price($resteapayer)."</td></tr>\n";
print '<td class="right'.($resteapayer?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">'.price($resteapayer)."</td></tr>\n";
print "</table>";
$db->free($resql);

View File

@@ -145,7 +145,7 @@ if ($object->id)
}
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@@ -131,7 +131,7 @@ if ($object->id)
}
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@@ -124,7 +124,7 @@ if ($object->id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border tableforfield centpercent">';
// Company
/*

View File

@@ -1393,7 +1393,7 @@ class Contrat extends CommonObject
if (empty($txtva) || ! is_numeric($txtva)) $txtva=0;
if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0;
if ($price_base_type=='HT')
{
$pu=$pu_ht;
@@ -1405,13 +1405,13 @@ class Contrat extends CommonObject
// Check parameters
if (empty($remise_percent)) $remise_percent=0;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
@@ -1603,7 +1603,7 @@ class Contrat extends CommonObject
{
$remise_percent=0;
}
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');

View File

@@ -178,7 +178,7 @@ if ($object->id)
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print '</table>';

View File

@@ -7,6 +7,7 @@
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -802,6 +803,10 @@ while ($i < min($num, $limit))
}
$db->free($resql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>';
print '</div>';

View File

@@ -28,7 +28,7 @@
// $object must be defined (object is loaded in this file with fetch)
// Save selection
if (GETPOST('formfilteraction') == 'listafterchangingselectedfields')
if (GETPOST('formfilteraction', 'none') == 'listafterchangingselectedfields')
{
$tabparam=array();

View File

@@ -539,7 +539,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
{
$orders = GETPOST('toselect', 'array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int');
$validate_invoices = GETPOST('validate_invoices', 'int');
$TFact = array();
$TFactThird = array();

View File

@@ -1303,9 +1303,9 @@ class CMailFile
* This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions.
*
* @param Socket $socket Socket
* @param string $response Response string
* @return boolean true if success
* @param resource $socket Socket
* @param string $response Response string
* @return boolean true if success
*/
public function server_parse($socket, $response)
{

View File

@@ -3286,7 +3286,7 @@ abstract class CommonObject
* @param string $targettype Object target type
* @param int $rowid Row id of line to delete. If defined, other parameters are not used.
* @return int >0 if OK, <0 if KO
* @see add_object_linked, updateObjectLinked, fetchObjectLinked
* @see add_object_linked(), updateObjectLinked(), fetchObjectLinked()
*/
public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '')
{

View File

@@ -39,7 +39,7 @@ abstract class CommonObjectLine extends CommonObject
* Id of the line
* @var int
* @deprecated Try to use id property as possible (even if field into database is still rowid)
* @see id
* @see $id
*/
public $rowid;

View File

@@ -41,7 +41,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* Product ref
* @var string
* @deprecated Use product_ref
* @see product_ref
* @see $product_ref
*/
public $ref;
@@ -55,7 +55,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* Product label
* @var string
* @deprecated Use product_label
* @see product_label
* @see $product_label
*/
public $libelle;
@@ -80,7 +80,7 @@ abstract class CommonOrderLine extends CommonObjectLine
/**
* Unit price
* @deprecated
* @see subprice
* @see $subprice
*/
public $price;

View File

@@ -659,8 +659,8 @@ class Conf
if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1;
$this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
$this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
// For backward compatibility
if (isset($this->product)) $this->produit=$this->product;

View File

@@ -82,7 +82,7 @@ class CoreObject extends CommonObject
*
* @param string $field name of field
* @param string $type type of field to test
* @return value of field or false
* @return boolean value of field or false
*/
private function checkFieldType($field, $type)
{

View File

@@ -54,7 +54,7 @@ class Cstate // extends CommonObject
/**
* @var string
* @deprecated
* @see name
* @see $name
*/
public $nom='';

View File

@@ -257,7 +257,7 @@ class DolGraph
*
* @param array $data Data
* @return void
* @see draw_jflot for syntax of data array
* @see draw_jflot() for syntax of data array
*/
public function SetData($data)
{

View File

@@ -586,7 +586,7 @@ class Form
$disabled=0;
$ret='<div class="centpercent center">';
$ret.='<select class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect" name="massaction"'.($disabled?' disabled="disabled"':'').'>';
$ret.='<select class="flat'.(empty($conf->use_javascript_ajax)?'':' hideobject').' massaction massactionselect valignmiddle" name="massaction"'.($disabled?' disabled="disabled"':'').'>';
// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
$parameters=array();
@@ -2321,7 +2321,7 @@ class Form
* constructProductListOption.
* This define value for &$opt and &$optJson.
*
* @param resultset $objp Resultset of fetch
* @param resource $objp Resultset of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format)
* @param int $price_level Price level
@@ -5153,7 +5153,7 @@ class Form
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return string|void Nothing or string if nooutput is 1
* @deprecated
* @see form_date, select_month, select_year, select_dayofweek
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '')
{
@@ -6056,7 +6056,7 @@ class Form
* @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string
* @see selectArrayAjax, ajax_combobox in ajax.lib.php
* @see selectArrayAjax(), ajax_combobox() in ajax.lib.php
*/
public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
{
@@ -6304,7 +6304,6 @@ class Form
else $array[$key]['checked']=0;
}
}
//var_dump($array);
$lis='';
$listcheckedstring='';
@@ -6774,8 +6773,6 @@ class Form
return $resultyesno;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of export templates

View File

@@ -224,9 +224,9 @@ class FormAccounting extends Form
/**
* Return select filter with date of transaction
*
* @param string $htmlname Name of select field
* @param string $selectedkey Value
* @return string HTML edit field
* @param string $htmlname Name of select field
* @param string $selectedkey Value
* @return string HTML edit field
*/
public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
{
@@ -247,7 +247,7 @@ class FormAccounting extends Form
}
while ($obj = $this->db->fetch_object($resql)) {
$options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext');
$options[$obj->import_key] = $obj->import_key;
}
return Form::selectarray($htmlname, $options, $selectedkey);

View File

@@ -215,7 +215,7 @@ class FormCompany
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department. If '', we want only the string with <option>
* @return string String with HTML select
* @see select_country
* @see select_country()
*/
public function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id')
{

View File

@@ -1432,7 +1432,7 @@ class FormFile
* @param string $url Full url to use for click links ('' = autodetect)
* @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
* @see list_of_documents
* @see list_of_documents()
*/
public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
{

View File

@@ -9,6 +9,7 @@
* Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -326,7 +327,7 @@ class FormOther
* @param int $showempty Add also an empty line
* @param string $morecss More CSS
* @return string Html combo list code
* @see select_all_categories
* @see select_all_categories()
*/
public function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '')
{
@@ -617,7 +618,7 @@ class FormOther
* @param string $color String with hex (FFFFFF) or comma RGB ('255,255,255')
* @param string $textifnotdefined Text to show if color not defined
* @return string HTML code for color thumb
* @see selectColor
* @see selectColor()
*/
public static function showColor($color, $textifnotdefined = '')
{
@@ -660,7 +661,7 @@ class FormOther
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @param string $morecss Add css style into input field
* @return string
* @see showColor
* @see showColor()
*/
public static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '')
{
@@ -1232,4 +1233,44 @@ class FormOther
dol_print_error($this->db);
}
}
/**
* Return an html string with a select combo box to choose yes or no
*
* @param string $htmlname Name of html select field
* @param string $value Pre-selected value
* @param int $option 0 return automatic/manual, 1 return 1/0
* @param bool $disabled true or false
* @param int $useempty 1=Add empty line
* @return string See option
*/
public function selectAutoManual($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0)
{
global $langs;
$automatic="automatic"; $manual="manual";
if ($option)
{
$automatic="1";
$manual="0";
}
$disabled = ($disabled ? ' disabled' : '');
$resultautomanual = '<select class="flat width100" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
if ($useempty) $resultautomanual .= '<option value="-1"'.(($value < 0)?' selected':'').'>&nbsp;</option>'."\n";
if (("$value" == 'automatic') || ($value == 1))
{
$resultautomanual .= '<option value="'.$automatic.'" selected>'.$langs->trans("Automatic").'</option>'."\n";
$resultautomanual .= '<option value="'.$manual.'">'.$langs->trans("Manual").'</option>'."\n";
}
else
{
$selected=(($useempty && $value != '0' && $value != 'manual')?'':' selected');
$resultautomanual .= '<option value="'.$automatic.'">'.$langs->trans("Automatic").'</option>'."\n";
$resultautomanual .= '<option value="'.$manual.'"'.$selected.'>'.$langs->trans("Manual").'</option>'."\n";
}
$resultautomanual .= '</select>'."\n";
return $resultautomanual;
}
}

View File

@@ -1759,7 +1759,7 @@ class SMTPs
* This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions
*
* @param Handler $socket Socket handler
* @param resource $socket Socket handler
* @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3"
* @return boolean True or false
*/

View File

@@ -152,7 +152,7 @@ class vCard
/**
* mise en forme de l'anniversaire
*
* @param timestamp $date Date
* @param integer $date Date
* @return void
*/
public function setBirthday($date)

View File

@@ -53,6 +53,7 @@ if (empty($conf->dol_no_mouse_hover))
hide: { delay: 50 },
tooltipClass: "mytooltip",
content: function () {
console.log("Return title for popup");
return $(this).prop(\'title\'); /* To force to get title as is */
}
});'."\n";

View File

@@ -1009,6 +1009,23 @@ function getParameterByName(name, valueifnotfound)
function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); }
/**
* Function similar to PHP price()
*
* @param {number|string} amount The amount to show
* @param {string} mode 'MT' or 'MU'
* @return {string} The amount with digits
*/
function pricejs(amount, mode) {
var main_max_dec_shown = <?php echo (int) str_replace('.', '', $conf->global->MAIN_MAX_DECIMALS_SHOWN); ?>;
var main_rounding_unit = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
var main_rounding_tot = <?php echo (int) $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
if (mode == 'MU') return amount.toFixed(main_rounding_unit);
if (mode == 'MT') return amount.toFixed(main_rounding_tot);
return 'Bad value for parameter mode';
}
/**
* Function similar to PHP price2num()
*

View File

@@ -14,6 +14,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -885,17 +886,6 @@ function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '')
}
/**
* Encode string for xml usage
*
* @param string $string String to encode
* @return string String encoded
*/
function dolEscapeXML($string)
{
return strtr($string, array('\''=>'&apos;','"'=>'&quot;','&'=>'&amp;','<'=>'&lt;','>'=>'&gt;'));
}
/**
* Returns text escaped for inclusion into javascript code
*
@@ -1781,22 +1771,27 @@ function dol_print_date($time, $format = '', $tzoutput = 'tzserver', $outputlang
}
// Analyze date
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)
|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
$reg=array();
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
{
// TODO Remove this. This part of code should not be used.
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR);
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
$syear = (! empty($reg[1]) ? $reg[1] : '');
$smonth = (! empty($reg[2]) ? $reg[2] : '');
$sday = (! empty($reg[3]) ? $reg[3] : '');
$shour = (! empty($reg[4]) ? $reg[4] : '');
$smin = (! empty($reg[5]) ? $reg[5] : '');
$ssec = (! empty($reg[6]) ? $reg[6] : '');
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
return '';
}
elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) // Still available to solve problems in extrafields of type date
{
// This part of code should not be used.
dol_syslog("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"], LOG_WARNING);
//if (function_exists('debug_print_backtrace')) debug_print_backtrace();
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
$syear = (! empty($reg[1]) ? $reg[1] : '');
$smonth = (! empty($reg[2]) ? $reg[2] : '');
$sday = (! empty($reg[3]) ? $reg[3] : '');
$shour = (! empty($reg[4]) ? $reg[4] : '');
$smin = (! empty($reg[5]) ? $reg[5] : '');
$ssec = (! empty($reg[6]) ? $reg[6] : '');
$time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);
$time=dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear, true);
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);
}
else
{
@@ -3675,7 +3670,7 @@ function img_searchclear($titlealt = 'default', $other = '')
* @param string $text Text info
* @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
* @param int $nodiv No div
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'xxx'=Other
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error','xxx'=Other
* @param string $morecss More CSS
* @return string String with info text
*/
@@ -5211,7 +5206,6 @@ function yn($yesno, $case = 1, $color = 0)
return $result;
}
/**
* Return a path to have a the directory according to object where files are stored.
* New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart)
@@ -7018,15 +7012,22 @@ function getLanguageCodeFromCountryCode($countrycode)
$buildprimarykeytotest = strtolower($countrycode).'-'.strtoupper($countrycode);
if (in_array($buildprimarykeytotest, $locales)) return strtolower($countrycode).'_'.strtoupper($countrycode);
foreach ($locales as $locale)
if (function_exists('locale_get_primary_language')) // Need extension php-intl
{
$locale_language = locale_get_primary_language($locale);
$locale_region = locale_get_region($locale);
if (strtoupper($countrycode) == $locale_region)
{
//var_dump($locale.'-'.$locale_language.'-'.$locale_region);
return strtolower($locale_language).'_'.strtoupper($locale_region);
}
foreach ($locales as $locale)
{
$locale_language = locale_get_primary_language($locale);
$locale_region = locale_get_region($locale);
if (strtoupper($countrycode) == $locale_region)
{
//var_dump($locale.'-'.$locale_language.'-'.$locale_region);
return strtolower($locale_language).'_'.strtoupper($locale_region);
}
}
}
else
{
dol_syslog("Warning Exention php-intl is not available", LOG_WARNING);
}
return null;
@@ -7186,7 +7187,7 @@ function printCommonFooter($zone = 'private')
print "\n";
print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */'."\n";
print 'jQuery(".menuhider").click(function(event) {';
print ' if(!$( "body" ).hasClass( "sidebar-collapse" )){ event.preventDefault(); }'."\n";
print ' if (!$( "body" ).hasClass( "sidebar-collapse" )){ event.preventDefault(); }'."\n";
print ' console.log("We click on .menuhider");'."\n";
print ' $("body").toggleClass("sidebar-collapse")'."\n";
print '});'."\n";

View File

@@ -2414,26 +2414,77 @@ function getModuleDirForApiClass($module)
return $moduledirforclass;
}
/*
/**
* Return 2 hexa code randomly
*
* @param $min int Between 0 and 255
* @param $max int Between 0 and 255
* @return String
* @param int $min Between 0 and 255
* @param int $max Between 0 and 255
* @return string A color string '12'
*/
function random_color_part($min = 0, $max = 255)
function randomColorPart($min = 0, $max = 255)
{
return str_pad(dechex(mt_rand($min, $max)), 2, '0', STR_PAD_LEFT);
}
/*
/**
* Return hexadecimal color randomly
*
* @param $min int Between 0 and 255
* @param $max int Between 0 and 255
* @return String
* @param int $min Between 0 and 255
* @param int $max Between 0 and 255
* @return string A color string '123456'
*/
function random_color($min = 0, $max = 255)
function randomColor($min = 0, $max = 255)
{
return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max);
return randomColorPart($min, $max) . randomColorPart($min, $max) . randomColorPart($min, $max);
}
if (! function_exists('dolEscapeXML'))
{
/**
* Encode string for xml usage
*
* @param string $string String to encode
* @return string String encoded
*/
function dolEscapeXML($string)
{
return strtr($string, array('\''=>'&apos;','"'=>'&quot;','&'=>'&amp;','<'=>'&lt;','>'=>'&gt;'));
}
}
/**
* Return automatic or manual in current language
*
* @param string $automaticmanual Value to test (1, 'automatic', 'true' or 0, 'manual', 'false')
* @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Automatic/Manual
* @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color.
* @return string HTML string
*/
function autoOrManual($automaticmanual, $case = 1, $color = 0)
{
global $langs;
$result='unknown'; $classname='';
if ($automaticmanual == 1 || strtolower($automaticmanual) == 'automatic' || strtolower($automaticmanual) == 'true') // A mettre avant test sur no a cause du == 0
{
$result=$langs->trans('automatic');
if ($case == 1 || $case == 3) $result=$langs->trans("Automatic");
if ($case == 2) $result='<input type="checkbox" value="1" checked disabled>';
if ($case == 3) $result='<input type="checkbox" value="1" checked disabled> '.$result;
$classname='ok';
}
elseif ($yesno == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false')
{
$result=$langs->trans("manual");
if ($case == 1 || $case == 3) $result=$langs->trans("Manual");
if ($case == 2) $result='<input type="checkbox" value="0" disabled>';
if ($case == 3) $result='<input type="checkbox" value="0" disabled> '.$result;
if ($color == 2) $classname='ok';
else $classname='error';
}
if ($color) return '<font class="'.$classname.'">'.$result.'</font>';
return $result;
}

View File

@@ -334,20 +334,21 @@ function project_admin_prepare_head()
/**
* Show task lines with a particular parent
*
* @param string $inc Line number (start to 0, then increased by recursive call)
* @param string $parent Id of parent project to show (0 to show all)
* @param Task[] $lines Array of lines
* @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature.
* @param string $var Color
* @param int $showproject Show project columns
* @param int $taskrole Array of roles of user for each tasks
* @param int $projectsListId List of id of project allowed to user (string separated with comma)
* @param int $addordertick Add a tick to move task
* @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project)
* @param string $inc Line number (start to 0, then increased by recursive call)
* @param string $parent Id of parent project to show (0 to show all)
* @param Task[] $lines Array of lines
* @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature.
* @param string $var Color
* @param int $showproject Show project columns
* @param int $taskrole Array of roles of user for each tasks
* @param int $projectsListId List of id of project allowed to user (string separated with comma)
* @param int $addordertick Add a tick to move task
* @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project)
* @param string $filterprogresscalc filter text
* @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled'
* @return void
*/
function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '')
function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0)
{
global $user, $bc, $langs, $conf, $db;
global $projectstatic, $taskstatic;
@@ -370,12 +371,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$numlines=count($lines);
// We declare counter as global because we want to edit them into recursive call
global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned;
global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned,$total_projectlinesa_tobill,$total_projectlinesa_billed;
if ($level == 0)
{
$total_projectlinesa_spent=0;
$total_projectlinesa_planned=0;
$total_projectlinesa_spent_if_planned=0;
$total_projectlinesa_tobill=0;
$total_projectlinesa_billed=0;
}
for ($i = 0 ; $i < $numlines ; $i++)
@@ -439,15 +442,25 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '<tr '.$bc[$var].' id="row-'.$lines[$i]->id.'">'."\n";
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
$projectstatic->title=$lines[$i]->projectlabel;
$projectstatic->bill_time=$lines[$i]->bill_time;
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->ref;
$taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:'');
$taskstatic->projectstatus = $lines[$i]->projectstatus;
$taskstatic->progress = $lines[$i]->progress;
$taskstatic->fk_statut = $lines[$i]->status;
$taskstatic->datee = $lines[$i]->date_end;
if ($showproject)
{
// Project ref
print "<td>";
//if ($showlineingray) print '<i>';
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
$projectstatic->title=$lines[$i]->projectlabel;
if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
else print $projectstatic->getNomUrl(1, 'nolink');
//if ($showlineingray) print '</i>';
@@ -468,9 +481,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
else
{
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->ref;
$taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:'');
print $taskstatic->getNomUrl(1, 'withproject');
}
print '</td>';
@@ -495,10 +505,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Date end
print '<td class="center">';
$taskstatic->projectstatus = $lines[$i]->projectstatus;
$taskstatic->progress = $lines[$i]->progress;
$taskstatic->fk_statut = $lines[$i]->status;
$taskstatic->datee = $lines[$i]->date_end;
print dol_print_date($lines[$i]->date_end, 'dayhour');
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
print '</td>';
@@ -548,6 +554,35 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
print '</td>';
if ($showbilltime)
{
// Time not billed
print '<td class="right">';
if ($lines[$i]->bill_time)
{
print convertSecondToTime($lines[$i]->tobill, 'allhourmin');
$total_projectlinesa_tobill += $lines[$i]->tobill;
}
else
{
print '<span class="opacitymedium">'.$langs->trans("NA").'</span>';
}
print '</td>';
// Time billed
print '<td class="right">';
if ($lines[$i]->bill_time)
{
print convertSecondToTime($lines[$i]->billed, 'allhourmin');
$total_projectlinesa_billed += $lines[$i]->billed;
}
else
{
print '<span class="opacitymedium">'.$langs->trans("NA").'</span>';
}
print '</td>';
}
// Contacts of task
if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
{
@@ -582,7 +617,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($level >= 0) // Call sublevels
{
$level++;
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime);
$level--;
}
@@ -597,7 +632,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level <= 0)
if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0)
&& $level <= 0)
{
print '<tr class="liste_total nodrag nodrop">';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
@@ -617,6 +653,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %';
print '</td>';
print '<td></td>';
if ($showbilltime)
{
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin');
print '</td>';
print '<td class="nowrap liste_total right">';
print convertSecondToTime($total_projectlinesa_billed, 'allhourmin');
print '</td>';
}
// Contacts of task
if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
{
@@ -871,9 +916,12 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
* @param int $preselectedday Preselected day
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
* @param int $oldprojectforbreak Old project id of last project break
* @param array $arrayfields Array of additional column
* @param array $extrafields Array of additional column
* @param array $extralabels Array of additional column
* @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks
*/
function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields = '', $extralabels = array())
{
global $conf, $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
@@ -906,6 +954,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if ($lines[$i]->fk_task_parent == $parent)
{
$obj = &$lines[$i]; // To display extrafields
// If we want all or we have a role on task, we show it
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
{
@@ -952,8 +1002,16 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
{
$addcolspan=0;
if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++;
if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++;
foreach ($arrayfields as $key => $val)
{
if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++;
}
print '<tr class="oddeven trforbreak">'."\n";
print '<td colspan="9">';
print '<td colspan="'.(7+$addcolspan).'">';
print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);
if ($projectstatic->title)
@@ -961,6 +1019,67 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print ' - ';
print $projectstatic->title;
}
/*
$colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2);
print '<table class="">';
print '<tr class="liste_titre">';
// PROJECT fields
if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
$extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
print '</tr>';
print '<tr>';
// PROJECT fields
if (! empty($arrayfields['p.fk_opp_status']['checked']))
{
print '<td class="nowrap">';
$code = dol_getIdFromCode($db, $lines[$i]->fk_opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print "</td>\n";
}
if (! empty($arrayfields['p.opp_amount']['checked']))
{
print '<td class="nowrap">';
print price($lines[$i]->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
print "</td>\n";
}
if (! empty($arrayfields['p.opp_percent']['checked']))
{
print '<td class="nowrap">';
print price($lines[$i]->opp_percent, 0, $langs, 1, 0).' %';
print "</td>\n";
}
if (! empty($arrayfields['p.budget_amount']['checked']))
{
print '<td class="nowrap">';
print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print "</td>\n";
}
if (! empty($arrayfields['p.bill_time']['checked']))
{
print '<td class="nowrap">';
print yn($lines[$i]->bill_time);
print "</td>\n";
}
$extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
print '</tr>';
print '</table>';
*/
print '</td>';
print '</tr>';
}
@@ -977,14 +1096,20 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
*/
// Project
/*print "<td>";
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>";*/
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
print "<td>";
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>";
}
// Thirdparty
/*print '<td class="tdoverflowmax100">';
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10);
print '</td>';*/
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
print '<td class="tdoverflowmax100">';
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10);
print '</td>';
}
// Ref
print '<td>';
@@ -1000,16 +1125,27 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n";
// Planned Workload
print '<td class="leftborder plannedworkload right">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
else print '--:--';
print '</td>';
// TASK extrafields
$extrafieldsobjectkey='projet_task';
$extrafieldsobjectprefix='efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Planned Workload
if (! empty($arrayfields['t.planned_workload']['checked']))
{
print '<td class="leftborder plannedworkload right">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
else print '--:--';
print '</td>';
}
// Progress declared %
print '<td class="right">';
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
print '</td>';
if (! empty($arrayfields['t.progress']['checked']))
{
print '<td class="right">';
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
print '</td>';
}
// Time spent by everybody
print '<td class="right">';
@@ -1123,7 +1259,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
{
//var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
//var_dump($totalforeachday);
$ret = projectLinesPerDay($inc, $lines[$i]->id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak);
$ret = projectLinesPerDay($inc, $lines[$i]->id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields, $extralabels);
//var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
//var_dump($ret);
foreach($ret as $key => $val)
@@ -1160,9 +1296,12 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is assigned to me, 2=Enable add time only if tasks is assigned to me and hide others
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
* @param int $oldprojectforbreak Old project id of last project break
* @param array $arrayfields Array of additional column
* @param array $extrafields Array of additional column
* @param array $extralabels Array of additional column
* @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks
*/
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0)
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields = '', $extralabels = array())
{
global $conf, $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
@@ -1196,6 +1335,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if ($lines[$i]->fk_task_parent == $parent)
{
$obj = &$lines[$i]; // To display extrafields
// If we want all or we have a role on task, we show it
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
{
@@ -1241,8 +1382,16 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
{
$addcolspan=0;
if (! empty($arrayfields['t.planned_workload']['checked'])) $addcolspan++;
if (! empty($arrayfields['t.progress']['checked'])) $addcolspan++;
foreach ($arrayfields as $key => $val)
{
if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++;
}
print '<tr class="oddeven trforbreak">'."\n";
print '<td colspan="13">';
print '<td colspan="'.(11+$addcolspan).'">';
print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);
if ($projectstatic->title)
@@ -1250,6 +1399,67 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print ' - ';
print $projectstatic->title;
}
/*$colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2);
print '<table class="">';
print '<tr class="liste_titre">';
// PROJECT fields
if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
$extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
print '</tr>';
print '<tr>';
// PROJECT fields
if (! empty($arrayfields['p.fk_opp_status']['checked']))
{
print '<td class="nowrap">';
$code = dol_getIdFromCode($db, $lines[$i]->fk_opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print "</td>\n";
}
if (! empty($arrayfields['p.opp_amount']['checked']))
{
print '<td class="nowrap">';
print price($lines[$i]->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
print "</td>\n";
}
if (! empty($arrayfields['p.opp_percent']['checked']))
{
print '<td class="nowrap">';
print price($lines[$i]->opp_percent, 0, $langs, 1, 0).' %';
print "</td>\n";
}
if (! empty($arrayfields['p.budget_amount']['checked']))
{
print '<td class="nowrap">';
print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print "</td>\n";
}
if (! empty($arrayfields['p.bill_time']['checked']))
{
print '<td class="nowrap">';
print yn($lines[$i]->bill_time);
print "</td>\n";
}
$extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
print '</tr>';
print '</table>';
*/
print '</td>';
print '</tr>';
}
@@ -1266,14 +1476,20 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
*/
// Project
/*print '<td class="nowrap">';
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>";*/
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
print '<td class="nowrap">';
if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>";
}
// Thirdparty
/*print '<td class="tdoverflowmax100">';
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
print '</td>';*/
if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
{
print '<td class="tdoverflowmax100">';
if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
print '</td>';
}
// Ref
print '<td class="nowrap">';
@@ -1290,16 +1506,27 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n";
// Planned Workload
print '<td class="leftborder plannedworkload right">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
else print '--:--';
print '</td>';
// TASK extrafields
$extrafieldsobjectkey='projet_task';
$extrafieldsobjectprefix='efpt.';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Progress declared %
print '<td class="right">';
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
print '</td>';
// Planned Workload
if (! empty($arrayfields['t.planned_workload']['checked']))
{
print '<td class="leftborder plannedworkload right">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
else print '--:--';
print '</td>';
}
if (! empty($arrayfields['t.progress']['checked']))
{
// Progress declared %
print '<td class="right">';
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
print '</td>';
}
// Time spent by everybody
print '<td class="right">';
@@ -1402,7 +1629,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
{
//var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
//var_dump($totalforeachday);
$ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak);
$ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields, $extralabels);
//var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
//var_dump($ret);
foreach($ret as $key => $val)

View File

@@ -681,6 +681,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
$tplcontent.= '<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0, 'UTF-8').'" />'."\n";
$tplcontent.= '<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0, 'UTF-8').'" />'."\n";
$tplcontent.= '<meta name="generator" content="'.DOL_APPLICATION_TITLE.' '.DOL_VERSION.' (https://www.dolibarr.org)" />'."\n";
$tplcontent.= '<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).'" />'."\n";
$tplcontent.= '<link href="/'.(($objectpage->id == $object->fk_default_home) ? '' : ($objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
$tplcontent.= '<!-- Include link to CSS file -->'."\n";
$tplcontent.= '<link rel="stylesheet" href="styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'."\n";

View File

@@ -53,7 +53,8 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout
if (empty($noout)) print_start_menu_array_auguria();
$usemenuhider = (GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
$usemenuhider = 1;
global $usemenuhider;
// Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
@@ -264,7 +265,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]);
$leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"]));
$usemenuhider = (GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
$usemenuhider = 0;
global $usemenuhider;
// Show logo company
@@ -393,7 +394,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
{
$langs->load('accountancy');
$journallabel=$langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ...
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/', $leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire);
if (empty($leftmenu) || preg_match('/accountancy/', $leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire);
}
$i++;
}

View File

@@ -53,7 +53,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
if (empty($noout)) print_start_menu_array();
$usemenuhider = (GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
$usemenuhider = 1;
// Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
@@ -183,7 +183,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// MRP
$menu_arr[] = array(
'name' => 'TMenuMRP',
'link' => '/bom/bom_list.php?mainmenu=mrp&amp;leftmenu=',
'link' => '/mrp/index.php?mainmenu=mrp&amp;leftmenu=',
'title' => $langs->trans("TMenuMRP"),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
@@ -650,7 +650,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]);
$leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"]));
$usemenuhider = (GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
$usemenuhider = 0;
// Show logo company
if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
@@ -1057,7 +1057,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
{
$langs->load("orders");
if (! empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&amp;viewstatut=-3&amp;billed=0&amp;contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
// if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
//if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
}
// Supplier Orders to bill
@@ -1067,7 +1067,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
{
$langs->load("supplier");
$newmenu->add("/fourn/commande/list.php?leftmenu=orders&amp;search_status=5&amp;billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders');
// if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
//if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
}
}

View File

@@ -90,7 +90,7 @@ class MenuManager
{
if (empty($noout)) print_start_menu_array_empty();
$usemenuhider = (GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
$usemenuhider = 1;
// Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))

View File

@@ -69,25 +69,56 @@ class pdf_eratosthene extends ModelePDFCommandes
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.3 = array(5, 3)
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 2);
public $phpmin = array(5, 4);
/**
* Dolibarr version of the loaded document
* @public string
* @var string
*/
public $version = 'development';
/**
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_hauteur
*/
public $page_hauteur;
/**
* @var array format
*/
public $format;
/**
* @var int marge_gauche
*/
public $marge_gauche;
/**
* @var int marge_droite
*/
public $marge_droite;
/**
* @var int marge_haute
*/
public $marge_haute;
/**
* @var int marge_basse
*/
public $marge_basse;
public $emetteur; // Objet societe qui emet
/**
* Issuer
* @var Societe
*/
public $emetteur;
/**

View File

@@ -117,7 +117,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Issuer
* @var Company object that emits
* @var Societe object that emits
*/
public $emetteur;
@@ -856,7 +856,7 @@ class pdf_crabe extends ModelePDFFactures
$invoice->fetch($obj->fk_facture_source);
$pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef, 'day', false, $outputlangs, true), 0, 'L', 0);
$pdf->MultiCell(20, 3, dol_print_date($db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);

View File

@@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_sponge extends ModelePDFFactures
{
/**
/**
* @var DoliDb Database handler
*/
public $db;
@@ -70,9 +70,9 @@ class pdf_sponge extends ModelePDFFactures
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.3 = array(5, 3)
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 2);
public $phpmin = array(5, 4);
/**
* Dolibarr version of the loaded document
@@ -80,15 +80,46 @@ class pdf_sponge extends ModelePDFFactures
*/
public $version = 'development';
/**
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_hauteur
*/
public $page_hauteur;
/**
* @var array format
*/
public $format;
/**
* @var int marge_gauche
*/
public $marge_gauche;
/**
* @var int marge_droite
*/
public $marge_droite;
/**
* @var int marge_haute
*/
public $marge_haute;
/**
* @var int marge_basse
*/
public $marge_basse;
public $emetteur; // Objet societe qui emet
/**
* Issuer
* @var Societe
*/
public $emetteur;
/**
* @var bool Situation invoice type
@@ -928,7 +959,7 @@ class pdf_sponge extends ModelePDFFactures
$invoice->fetch($obj->fk_facture_source);
$pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef, 'day', false, $outputlangs, true), 0, 'L', 0);
$pdf->MultiCell(20, 3, dol_print_date($db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top+$y);
@@ -1829,7 +1860,7 @@ class pdf_sponge extends ModelePDFFactures
* Define Array Column Field
*
* @param object $object common object
* @param outputlangs $outputlangs langs
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref

View File

@@ -257,12 +257,12 @@ class modAdherent extends DolibarrModules
//--------
$r=0;
// $this->export_code[$r] Code unique identifiant l'export (tous modules confondus)
// $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
// $this->export_permission[$r] Liste des codes permissions requis pour faire l'export
// $this->export_fields_sql[$r] Liste des champs exportables en codif sql
// $this->export_fields_name[$r] Liste des champs exportables en codif traduction
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
// $this->export_code[$r] Unique code identifying the export (all modules combined)
// $this->export_label[$r] Libelle by default if translation of key "ExportXXX" not found (XXX = Code)
// $this->export_permission[$r] List of permission codes required to export
// $this->export_fields_sql[$r] List of exportable fields in SQL codiffication
// $this->export_fields_name[$r] List of exportable fields in translation codiffication
// $this->export_sql[$r] SQL query that offers data for export
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;

View File

@@ -218,12 +218,12 @@ class modAsset extends DolibarrModules
//--------
$r=1;
// $this->export_code[$r] Code unique identifiant l'export (tous modules confondus)
// $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
// $this->export_permission[$r] Liste des codes permissions requis pour faire l'export
// $this->export_fields_sql[$r] Liste des champs exportables en codif sql
// $this->export_fields_name[$r] Liste des champs exportables en codif traduction
// $this->export_sql[$r] Requete sql qui offre les donnees a l'export
// $this->export_code[$r] Unique code identifying the export (all modules combined)
// $this->export_label[$r] Libelle by default if translation of key "ExportXXX" not found (XXX = Code)
// $this->export_permission[$r] List of permission codes required to export
// $this->export_fields_sql[$r] List of exportable fields in SQL codiffication
// $this->export_fields_name[$r] List of exportable fields in translation codiffication
// $this->export_sql[$r] SQL query that offers data for export
/*
$r++;

View File

@@ -278,34 +278,7 @@ class modBom extends DolibarrModules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
*/
/*
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'List Bom',
'mainmenu'=>'bom',
'leftmenu'=>'bom_bom',
'url'=>'/bom/bom_list.php',
'langs'=>'mrp', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100+$r,
'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=bom,fk_leftmenu=bom_bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'New Bom',
'mainmenu'=>'bom',
'leftmenu'=>'bom_bom',
'url'=>'/bom/bom_card.php?action=create',
'langs'=>'mrp', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100+$r,
'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
*/
/* END MODULEBUILDER LEFTMENU BILLOFMATERIALS */

View File

@@ -325,6 +325,8 @@ class modProduct extends DolibarrModules
'p.duration' => "Duration",///duration of service
'p.url' => "PublicUrl",
'p.accountancy_code_sell' => "ProductAccountancySellCode",
'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode",
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
'p.weight' => "Weight",
'p.weight_units' => "WeightUnits",

View File

@@ -332,19 +332,28 @@ class modSociete extends DolibarrModules
'c.rowid'=>"IdContact",'c.civility'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction',
'c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",
'd.nom'=>'State','co.label'=>"Country",'co.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",
'c.statut'=>"Status",
's.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode",
's.client'=>'Customer','s.fournisseur'=>'Supplier'
's.client'=>'Customer','s.fournisseur'=>'Supplier',
's.address'=>'Address','s.phone'=>'Phone','s.email'=>"Email",
't.libelle'=>"ThirdPartyType"
);
$this->export_examplevalues_array[$r]=array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 (not a supplier) or 1 (supplier)');
$this->export_TypeFields_array[$r]=array(
'c.civility'=>"List:c_civility:label:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",
'c.address'=>"Text",'c.zip'=>"Text",'c.town'=>"Text",'d.nom'=>'Text','co.label'=>"List:c_country:label:rowid",'co.code'=>"Text",'c.phone'=>"Text",
'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",
's.client'=>"Text",'s.fournisseur'=>"Text"
'c.fax'=>"Text",'c.email'=>"Text",
'c.statut'=>"Status",
's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",
's.client'=>"Text",'s.fournisseur'=>"Text",
's.address'=>"Text",'s.phone'=>"Text",'s.email'=>"Text",
't.libelle'=>"Text"
);
$this->export_entities_array[$r]=array(
's.rowid'=>"company",'s.nom'=>"company", 's.status'=>'company', 's.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company",
's.fournisseur'=>"company"
's.fournisseur'=>"company",
's.address'=>"company", 's.phone'=>"company", 's.email'=>"company",
't.libelle'=>"company"
); // We define here only fields that use another picto
if (empty($conf->fournisseur->enabled))
{
@@ -363,6 +372,7 @@ class modSociete extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id';
$this->export_sql_end[$r] .=' WHERE c.entity IN ('.getEntity('socpeople').')';
if (is_object($user) && empty($user->rights->societe->client->voir)) {
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';

View File

@@ -7,7 +7,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,23 +45,79 @@ class pdf_cyan extends ModelePDFPropales
* @var DoliDb Database handler
*/
public $db;
public $name;
public $description;
public $update_main_doc_field; // Save the name of generated file as the main doc when generating a doc with this template
public $type;
public $phpmin = array(5, 4); // Minimum version of PHP required by module
/**
* @var string model name
*/
public $name;
/**
* @var string model description (short text)
*/
public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
/**
* @var string document type
*/
public $type;
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
/**
* Dolibarr version of the loaded document
* @public string
*/
public $version = 'development';
public $page_largeur;
public $page_hauteur;
public $format;
/**
* @var int page_largeur
*/
public $page_largeur;
/**
* @var int page_hauteur
*/
public $page_hauteur;
/**
* @var array format
*/
public $format;
/**
* @var int marge_gauche
*/
public $marge_gauche;
/**
* @var int marge_droite
*/
public $marge_droite;
/**
* @var int marge_haute
*/
public $marge_haute;
/**
* @var int marge_basse
*/
public $marge_basse;
public $emetteur; // Objet societe qui emet
/**
* Issuer
* @var Societe
*/
public $emetteur;
/**

View File

@@ -64,9 +64,11 @@ if (!empty($object->comments))
$fk_user = $comment->fk_user_author;
$userstatic->fetch($fk_user);
if(empty($TColors[$fk_user])) {
$bgcolor = random_color(180, 240);
if(!empty($userstatic->color)) {
if (empty($TColors[$fk_user]))
{
$bgcolor = randomColor(180, 240);
if (!empty($userstatic->color))
{
$bgcolor = $userstatic->color;
}
$color = (colorIsLight($bgcolor))?'555':'fff';

View File

@@ -14,9 +14,11 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
{
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields[$extrafieldsobjectprefix.$key]['checked']))
{
$align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey);
print '<td';
@@ -24,6 +26,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
print ' data-key="'.$key.'"';
print '>';
$tmpkey='options_'.$key;
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey))
{
$datenotinstring = $obj->$tmpkey;
@@ -51,8 +54,8 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
}
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]=$extrafieldsobjectprefix.$tmpkey;
$totalarray['val'][$extrafieldsobjectprefix.$tmpkey] += $obj->$tmpkey;
}
}
}

View File

@@ -14,27 +14,30 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
{
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';
if (empty($search_options_pattern)) $search_options_pattern='search_options_';
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked'])) {
if (! empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
$align=$extrafields->getAlignFlag($key);
$typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]))
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/', '', $key);
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
$searchclass='';
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options[$search_options_pattern.$tmpkey]).'">';
}
elseif (! in_array($typeofextrafield, array('datetime','timestamp')))
{
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
$morecss='';
if ($typeofextrafield == 'sellist') $morecss='maxwidth200';
echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_', $morecss);
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$key], '', '', 'search_', $morecss);
}
elseif (in_array($typeofextrafield, array('datetime','timestamp')))
{

View File

@@ -10,10 +10,12 @@ if (empty($conf) || ! is_object($conf))
// Loop to complete $param for extrafields
if (! empty($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
{
if (empty($search_options_pattern)) $search_options_pattern='search_options_';
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/', '', $key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
if ($val != '') $param.='&'.$search_options_pattern.$tmpkey.'='.urlencode($val);
}
}

View File

@@ -12,15 +12,18 @@ if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$o
// Loop to complete the sql search criterias from extrafields
if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
{
foreach ($search_array_options as $key => $val)
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';
if (empty($search_options_pattern)) $search_options_pattern='search_options_';
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/', '', $key);
$tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key);
$typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey];
if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp')))
{
$sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'";
$sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'";
}
elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
{
@@ -29,7 +32,7 @@ if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array
if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int
if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4; // Search on a multiselect field with sql type = text
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
$sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search);
}
}
}

View File

@@ -14,12 +14,14 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
{
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
if (empty($extrafieldsobjectprefix)) $extrafieldsobjectprefix = 'ef.';
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields[$extrafieldsobjectprefix.$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
$sortonfield = $extrafieldsobjectprefix.$key;
if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder)."\n";

View File

@@ -74,7 +74,7 @@ if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABL
else $typeofdata='textarea:12:95%';
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
print '<div class="tagtable border table-border centpercent">'."\n";
print '<div class="tagtable border table-border tableforfield centpercent">'."\n";
if ($module != 'product') {
// No public note yet on products
print '<div class="tagtr pair table-border-row">'."\n";

View File

@@ -61,7 +61,7 @@ abstract class DolibarrTriggers
* Error reported by the trigger
* @var string
* @deprecated Use $this->errors
* @see errors
* @see $errors
*/
public $error = '';

View File

@@ -772,7 +772,7 @@ if ($object->socid) {
$remaintopay = $object->amount - $totalpaid;
print "<tr><td colspan=\"3\" class=\"right\">".$langs->trans("RemainderToPay")." :</td>";
print '<td class="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n";
print '<td class="right'.($resteapayeraffiche?' amountremaintopay':'').'">'.price($remaintopay)."</td></tr>\n";
}
print "</table>";
$db->free($resql);

View File

@@ -157,7 +157,7 @@ if ($object->id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Ref
/*

View File

@@ -127,13 +127,13 @@ class Expedition extends CommonObject
/**
* @deprecated
* @see date_shipping
* @see $date_shipping
*/
public $date;
/**
* @deprecated
* @see date_shipping
* @see $date_shipping
*/
public $date_expedition;
@@ -1776,8 +1776,8 @@ class Expedition extends CommonObject
/**
* Set the planned delivery date
*
* @param User $user Objet utilisateur qui modifie
* @param timestamp $date_livraison Date de livraison
* @param User $user Objet user that modify
* @param integer $date_livraison Date of delivery
* @return int <0 if KO, >0 if OK
*/
public function set_date_livraison($user, $date_livraison)
@@ -1840,7 +1840,7 @@ class Expedition extends CommonObject
/**
* Fetch all deliveries method and return an array. Load array this->listmeths.
*
* @param id $id only this carrier, all if none
* @param int $id only this carrier, all if none
* @return void
*/
public function list_delivery_methods($id = '')
@@ -1906,8 +1906,7 @@ class Expedition extends CommonObject
/**
* Activate delivery method.
*
* @param id $id id method to activate
*
* @param int $id id method to activate
* @return void
*/
public function activ_delivery_method($id)
@@ -1923,7 +1922,7 @@ class Expedition extends CommonObject
/**
* DesActivate delivery method.
*
* @param id $id id method to desactivate
* @param int $id id method to desactivate
*
* @return void
*/
@@ -2370,7 +2369,7 @@ class ExpeditionLigne extends CommonObjectLine
/**
* @deprecated
* @see fk_origin_line
* @see $fk_origin_line
*/
public $origin_line_id;
@@ -2429,7 +2428,7 @@ class ExpeditionLigne extends CommonObjectLine
/**
* @deprecated
* @see product_label
* @see $product_label
*/
public $libelle;
@@ -2441,7 +2440,7 @@ class ExpeditionLigne extends CommonObjectLine
/**
* @var string product description
* @deprecated
* @see product_desc
* @see $product_desc
*/
public $desc;

View File

@@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref)){
$head = shipping_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("Shipment"), -1, 'sending');
// Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
@@ -159,7 +159,7 @@ if ($id > 0 || ! empty($ref)){
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -623,6 +624,10 @@ if ($resql)
$i++;
}
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print "</div>";
print '</form>';

View File

@@ -1989,7 +1989,7 @@ else
print '<tr><td colspan="' . $nbcols . '" class="right">'.$langs->trans("AmountExpected").':</td><td class="right">'.price($object->total_ttc).'</td><td></td></tr>';
print '<tr><td colspan="' . $nbcols . '" class="right">'.$langs->trans("RemainderToPay").':</td>';
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>'.price($resteapayeraffiche).'</td><td></td></tr>';
print '<td align="right'.($resteapayeraffiche?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">'.price($resteapayeraffiche).'</td><td></td></tr>';
$db->free($resql);
}

View File

@@ -1318,7 +1318,7 @@ class ExpenseReport extends CommonObject
* setDeny
*
* @param User $fuser User
* @param Details $details Details
* @param string $details Details
* @param int $notrigger Disable triggers
* @return int
*/
@@ -2088,10 +2088,10 @@ class ExpenseReport extends CommonObject
/**
* periode_existe
*
* @param User $fuser User
* @param Date $date_debut Start date
* @param Date $date_fin End date
* @return int <0 if KO, >0 if OK
* @param User $fuser User
* @param integer $date_debut Start date
* @param integer $date_fin End date
* @return int <0 if KO, >0 if OK
*/
public function periode_existe($fuser, $date_debut, $date_fin)
{

View File

@@ -143,10 +143,10 @@ class ExpenseReportRule extends CoreObject
/**
* Return all rules or filtered by something
*
* @param int $fk_c_type_fees type of expense
* @param date $date date of expense
* @param type $fk_user user of expense
* @return array \ExpenseReportRule
* @param int $fk_c_type_fees type of expense
* @param integer $date date of expense
* @param int $fk_user user of expense
* @return array Array with ExpenseReportRule
*/
public static function getAllRule($fk_c_type_fees = '', $date = '', $fk_user = '')
{

View File

@@ -114,7 +114,7 @@ if ($object->id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';

View File

@@ -1042,7 +1042,7 @@ class Fichinter extends CommonObject
* Defines a delivery date of intervention
*
* @param User $user Object user who define
* @param date $date_delivery date of delivery
* @param integer $date_delivery date of delivery
* @return int <0 if ko, >0 if ok
*/
public function set_date_delivery($user, $date_delivery)
@@ -1235,7 +1235,7 @@ class Fichinter extends CommonObject
* @param user $user User that do the action
* @param int $fichinterid Id of intervention
* @param string $desc Line description
* @param date $date_intervention Intervention date
* @param integer $date_intervention Intervention date
* @param int $duration Intervention duration
* @param array $array_options Array option
* @return int >0 if ok, <0 if ko

View File

@@ -154,7 +154,7 @@ if ($object->id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print '</table>';

View File

@@ -32,9 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
// Load translation files required by the page
$langs->loadLangs(array('companies', 'bills', 'interventions'));
if (!empty($conf->projet->enabled)) $langs->load("projects");
if (!empty($conf->contrat->enabled)) $langs->load("contracts");
$action=GETPOST('action', 'alpha');
$massaction=GETPOST('massaction', 'alpha');
@@ -46,7 +50,9 @@ $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'interven
$search_ref=GETPOST('search_ref')?GETPOST('search_ref', 'alpha'):GETPOST('search_inter', 'alpha');
$search_company=GETPOST('search_company', 'alpha');
$search_desc=GETPOST('search_desc', 'alpha');
$search_status=GETPOST('search_status');
$search_projet_ref=GETPOST('search_projet_ref', 'alpha');
$search_contrat_ref=GETPOST('search_contrat_ref', 'alpha');
$search_status=GETPOST('search_status', 'alpha');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$optioncss = GETPOST('optioncss', 'alpha');
$socid=GETPOST('socid', 'int');
@@ -74,13 +80,6 @@ if (! $sortfield)
$sortfield="f.ref";
}
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST('search_ref')?GETPOST('search_ref', 'alpha'):GETPOST('search_inter', 'alpha');
$search_company=GETPOST('search_company', 'alpha');
$search_desc=GETPOST('search_desc', 'alpha');
$search_status=GETPOST('search_status');
$optioncss = GETPOST('optioncss', 'alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Fichinter($db);
$hookmanager->initHooks(array('interventionlist'));
@@ -104,15 +103,15 @@ if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall[
$arrayfields=array(
'f.ref'=>array('label'=>'Ref', 'checked'=>1),
's.nom'=>array('label'=>'ThirdParty', 'checked'=>1),
'f.fk_project'=>array('label'=>'Project', 'checked'=>1),
'f.fk_contrat'=>array('label'=>'Contract', 'checked'=>1),
'pr.ref'=>array('label'=>'Project', 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)),
'c.ref'=>array('label'=>'Contract', 'checked'=>1, 'enabled'=>(empty($conf->contrat->enabled)?0:1)),
'f.description'=>array('label'=>'Description', 'checked'=>1),
'f.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>'DateModificationShort', 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>'Status', 'checked'=>1, 'position'=>1000),
'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@@ -145,8 +144,8 @@ if (empty($reshook))
{
$search_ref="";
$search_company="";
$search_project="";
$search_contract="";
$search_projet_ref="";
$search_contrat_ref="";
$search_desc="";
$search_status="";
$toselect='';
@@ -174,6 +173,12 @@ $form = new Form($db);
$formfile = new FormFile($db);
$objectstatic=new Fichinter($db);
$companystatic=new Societe($db);
if (!empty($conf->projet->enabled)) {
$projetstatic=new Project($db);
}
if (!empty($conf->contrat->enabled)) {
$contratstatic=new Contrat($db);
}
$title=$langs->trans("ListOfInterventions");
llxHeader('', $title);
@@ -195,6 +200,12 @@ $sql = "SELECT";
$sql.= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,";
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
$sql.= " s.nom as name, s.rowid as socid, s.client";
if (!empty($conf->projet->enabled)) {
$sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
}
if (!empty($conf->contrat->enabled)) {
$sql .= ", c.rowid as contrat_id, c.ref as contrat_ref, c.ref_customer as contrat_ref_supplier, c.ref_supplier as contrat_ref_supplier";
}
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@@ -202,6 +213,12 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if (!empty($conf->projet->enabled)) {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr on f.fk_projet = pr.rowid";
}
if (!empty($conf->contrat->enabled)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat as c on f.fk_contrat = c.rowid";
}
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)";
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -214,6 +231,12 @@ if ($search_ref) {
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_projet_ref) {
$sql .= natural_search('pr.ref', $search_projet_ref);
}
if ($search_contrat_ref) {
$sql .= natural_search('c.ref', $search_contrat_ref);
}
if ($search_desc) {
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
else $sql .= natural_search(array('f.description'), $search_desc);
@@ -355,6 +378,18 @@ if ($resql)
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
print '</td>';
}
if (! empty($arrayfields['pr.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.'" size="8">';
print '</td>';
}
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.'" size="8">';
print '</td>';
}
if (! empty($arrayfields['f.description']['checked']))
{
print '<td class="liste_titre">';
@@ -413,6 +448,8 @@ if ($resql)
print '<tr class="liste_titre">';
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], "pr.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@@ -489,6 +526,31 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['pr.ref']['checked']))
{
print '<td>';
$projetstatic->id=$obj->projet_id;
$projetstatic->ref=$obj->projet_ref;
$projetstatic->title=$obj->projet_title;
if ($projetstatic->id > 0) {
print $projetstatic->getNomUrl(1, '');
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td>';
$contratstatic->id=$obj->contrat_id;
$contratstatic->ref=$obj->contrat_ref;
$contratstatic->ref_customer=$obj->contrat_ref_customer;
$contratstatic->ref_supplier=$obj->contrat_ref_supplier;
if ($contratstatic->id > 0) {
print $contratstatic->getNomUrl(1, '');
print '</td>';
}
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['f.description']['checked']))
{
print '<td>'.dol_trunc(dolGetFirstLineOfText($obj->description), 48).'</td>';

View File

@@ -123,7 +123,7 @@ class CommandeFournisseur extends CommonOrder
/**
* @deprecated
* @see note_private, note_public
* @see $note_private, $note_public
*/
public $note;
@@ -776,7 +776,7 @@ class CommandeFournisseur extends CommonOrder
* Returns the following order reference not used depending on the numbering model activated
* defined within COMMANDE_SUPPLIER_ADDON_NUMBER
*
* @param Company $soc company object
* @param Societe $soc company object
* @return string free reference for the invoice
*/
public function getNextNumRef($soc)
@@ -1145,7 +1145,7 @@ class CommandeFournisseur extends CommonOrder
* Submit a supplier order to supplier
*
* @param User $user User making change
* @param date $date Date
* @param integer $date Date
* @param int $methode Method
* @param string $comment Comment
* @return int <0 if KO, >0 if OK
@@ -1752,8 +1752,8 @@ class CommandeFournisseur extends CommonOrder
* @param int $entrepot Id of warehouse to add product
* @param double $price Unit Price for PMP value calculation (Unit price without Tax and taking into account discount)
* @param string $comment Comment for stock movement
* @param date $eatby eat-by date
* @param date $sellby sell-by date
* @param integer $eatby eat-by date
* @param integer $sellby sell-by date
* @param string $batch Lot number
* @param int $fk_commandefourndet Id of supplier order line
* @param int $notrigger 1 = notrigger
@@ -2103,7 +2103,7 @@ class CommandeFournisseur extends CommonOrder
* Set a delivery in database for this supplier order
*
* @param User $user User that input data
* @param date $date Date of reception
* @param integer $date Date of reception
* @param string $type Type of receipt ('tot' = total/done, 'par' = partial, 'nev' = never, 'can' = cancel)
* @param string $comment Comment
* @return int <0 if KO, >0 if OK
@@ -2220,7 +2220,7 @@ class CommandeFournisseur extends CommonOrder
* Set the planned delivery date
*
* @param User $user Objet user making change
* @param timestamp $date_livraison Planned delivery date
* @param integer $date_livraison Planned delivery date
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
@@ -2465,8 +2465,8 @@ class CommandeFournisseur extends CommonOrder
* @param int $info_bits Miscellaneous informations
* @param int $type Type of line (0=product, 1=service)
* @param int $notrigger Disable triggers
* @param timestamp $date_start Date start of service
* @param timestamp $date_end Date end of service
* @param integer $date_start Date start of service
* @param integer $date_end Date end of service
* @param array $array_options Extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency
@@ -2508,7 +2508,7 @@ class CommandeFournisseur extends CommonOrder
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
return -1;
}
$this->db->begin();
// Calcul du total TTC et de la TVA pour la ligne a partir de
@@ -2926,7 +2926,7 @@ class CommandeFournisseur extends CommonOrder
* Return the max number delivery delay in day
*
* @param Translate $langs Language object
* @return Translated string
* @return string Translated string
*/
public function getMaxDeliveryTimeDay($langs)
{

View File

@@ -155,7 +155,7 @@ class FactureFournisseur extends CommonInvoice
/**
* @deprecated
* @see note_private, note_public
* @see $note_private, $note_public
*/
public $note;
@@ -1573,8 +1573,8 @@ class FactureFournisseur extends CommonInvoice
* @param double $qty Quantite
* @param int $fk_product Product/Service ID predefined
* @param double $remise_percent Percentage discount of the line
* @param date $date_start Date de debut de validite du service
* @param date $date_end Date de fin de validite du service
* @param integer $date_start Date de debut de validite du service
* @param integer $date_end Date de fin de validite du service
* @param string $ventil Code de ventilation comptable
* @param int $info_bits Bits de type de lines
* @param string $price_base_type HT ou TTC
@@ -1616,7 +1616,7 @@ class FactureFournisseur extends CommonInvoice
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
@@ -1833,8 +1833,8 @@ class FactureFournisseur extends CommonInvoice
* @param int $type Type of line (0=product, 1=service)
* @param double $remise_percent Percentage discount of the line
* @param int $notrigger Disable triggers
* @param timestamp $date_start Date start of service
* @param timestamp $date_end Date end of service
* @param integer $date_start Date start of service
* @param integer $date_end Date end of service
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Amount in currency
@@ -1855,7 +1855,7 @@ class FactureFournisseur extends CommonInvoice
// Check parameters
//if (! is_numeric($pu) || ! is_numeric($qty)) return -1;
if ($type < 0) return -1;
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
@@ -2707,7 +2707,7 @@ class SupplierInvoiceLine extends CommonObjectLine
/**
* @deprecated
* @see product_ref
* @see $product_ref
*/
public $ref;
@@ -2726,7 +2726,7 @@ class SupplierInvoiceLine extends CommonObjectLine
/**
* @deprecated
* @see label
* @see $label
*/
public $libelle;
@@ -2740,7 +2740,7 @@ class SupplierInvoiceLine extends CommonObjectLine
* Unit price before taxes
* @var float
* @deprecated Use $subprice
* @see subprice
* @see $subprice
*/
public $pu_ht;
@@ -2756,7 +2756,7 @@ class SupplierInvoiceLine extends CommonObjectLine
* Total VAT amount
* @var float
* @deprecated Use $total_tva instead
* @see total_tva
* @see $total_tva
*/
public $tva;

View File

@@ -57,7 +57,7 @@ class ProductFournisseur extends Product
/**
* @deprecated
* @see ref_supplier
* @see $ref_supplier
*/
public $fourn_ref;
public $delivery_time_days;
@@ -1078,7 +1078,7 @@ class ProductFournisseur extends Product
* Private function to log price history
*
* @param User $user Object user who adds/changes price
* @param date $datec date create
* @param integer $datec date create
* @param float $buyprice price for qty
* @param float $qty qty for price
* @param float $multicurrency_buyprice Purchase price for the quantity min in currency

View File

@@ -160,7 +160,7 @@ if ($object->id > 0)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print "</table>\n";

View File

@@ -8,6 +8,7 @@
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -228,7 +229,7 @@ if (empty($reshook))
{
$orders = GETPOST('toselect', 'array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
$validate_invoices = GETPOST('valdate_invoices', 'int');
$validate_invoices = GETPOST('validate_invoices', 'int');
$TFact = array();
$TFactThird = array();
@@ -682,7 +683,7 @@ if ($resql)
print $langs->trans('ValidateInvoices');
print '</td>';
print '<td>';
print $form->selectyesno('valdate_invoices', 1, 1);
print $form->selectyesno('validate_invoices', 1, 1);
print '</td>';
print '</tr>';
print '</table>';
@@ -1159,6 +1160,10 @@ if ($resql)
print '</tr>';
}
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print '</div>';
print "</form>\n";

Some files were not shown because too many files have changed in this diff Show More