Merge github.com:Dolibarr/dolibarr into dev_default_date_filter_module_builder

This commit is contained in:
Florian HENRY 2020-11-17 13:14:24 +01:00
commit 61b3e32c90
155 changed files with 2531 additions and 1332 deletions

View File

@ -13,5 +13,5 @@ jobs:
- name: Exakat
uses: docker://exakat/exakat-ga
with:
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test'
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'

View File

@ -108,11 +108,11 @@ install:
echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock
composer -V
composer self-update
# To have composer making parallel downloads
composer global require hirak/prestissimo
composer -n init
composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes
echo
- |
@ -146,7 +146,10 @@ install:
- |
echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$TRAVIS_BUILD_DIR/vendor/bin:$TRAVIS_BUILD_DIR/htdocs/includes:$PATH"
echo $PATH
ls $TRAVIS_BUILD_DIR/vendor
ls $TRAVIS_BUILD_DIR/htdocs/includes/bin
echo
@ -177,7 +180,7 @@ before_script:
# Check PHP
echo "PHP version"
php -i | head -
# Check Parallel-lin version
# Check Parallel-lint version
echo "Parallel-lint version"
which parallel-lint
parallel-lint -V
@ -300,7 +303,7 @@ script:
echo
- |
echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also for some jobs to avoid duplicate tests)"
echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file

View File

@ -1,33 +1,45 @@
README (deutsch / german / allemand)
--------------------------------
------------------------------------
--------------------------------
------------------------------------
Download / Herunterladen
--------------------------------
------------------------------------
* Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website
https://www.dolibarr.org/downloads
oder direkt von Sourceforge
oder direkt bei Sourceforge
https://sourceforge.net/projects/dolibarr/files/
herunterladen.
* Die meisten externen Module/Themens sind über den DoliStore verfügbar:
https://www.dolistore.com/de/
--------------------------------
Installation
--------------------------------
* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis.
------------------------------------
Installation / Hilfe
------------------------------------
* Für eine kurze Einleitung schau in die README Datei im Hauptverzeichnis.
* Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden:
https://wiki.dolibarr.org/index.php/Hauptseite
* eine Deutsche Community bietet der Dolibarr e.V. unter
https://www.dolibarr.de/
------------------------------------
Zusatzmodule
------------------------------------
* Die meisten externen Module/Themen sind über den offiziellen DoliStore verfügbar:
https://www.dolistore.com/de/

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -41,7 +41,7 @@ $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
$socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');

View File

@ -7,7 +7,8 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020 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
@ -39,7 +40,12 @@ $langs->loadLangs(array("admin", "members"));
if (!$user->admin) accessforbidden();
$type = array('yesno', 'texte', 'chaine');
$choices = array('yesno', 'texte', 'chaine');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'member';
$action = GETPOST('action', 'aZ09');
@ -48,8 +54,50 @@ $action = GETPOST('action', 'aZ09');
* Actions
*/
//
if ($action == 'updateall') {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'set_default') {
$ret = addDocumentModel($value, $type, $label, $scandir);
$res = true;
} elseif ($action == 'del_default') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") {
dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
}
}
$res = true;
} elseif ($action == 'setdoc') {
// Set default model
if (dolibarr_set_const($db, "MEMBER_ADDON_PDF_ODT", $value, 'chaine', 0, '', $conf->entity)) {
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->MEMBER_ADDON_PDF_ODT = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
$res = true;
} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
} elseif ($action == 'updateall') {
$db->begin();
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
@ -86,7 +134,7 @@ if ($action == 'update' || $action == 'add') {
$consttype = GETPOST('consttype', 'alpha');
$constnote = GETPOST('constnote');
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
$res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++;
@ -245,6 +293,137 @@ $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL_
$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
// Defini tableau def des modeles
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
}
print load_fiche_titre($langs->trans("MembersDocModules"), '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$dir = dol_buildpath($reldir."core/modules/member".$valdir);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.class\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$name = substr($file, 4, dol_strlen($file) - 14);
$classname = substr($file, 0, dol_strlen($file) - 10);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
$modulequalified = 0;
}
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
} else {
print $module->description;
}
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del_default&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&amp;token='.newToken().'&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->MEMBER_ADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
print "<br>";
print dol_get_fiche_end();

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2020 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -1564,7 +1564,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} else {
if ($object->user_id) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
$linkeduser = new User($db);
$linkeduser->fetch($object->user_id);
print $linkeduser->getNomUrl(-1);
} else {
print $langs->trans("NoDolibarrAccess");
}

View File

@ -2404,6 +2404,7 @@ class Adherent extends CommonObject
global $conf, $langs;
$info = array();
$socialnetworks = getArrayOfSocialNetworks();
$keymodified = false;
// Object classes
@ -2418,8 +2419,13 @@ class Adherent extends CommonObject
}
// Possible LDAP KEY (constname => varname)
$ldapkey = array('LDAP_MEMBER_FIELD_FULLNAME' => 'fullname', 'LDAP_MEMBER_FIELD_NAME' => 'lastname', 'LDAP_MEMBER_FIELD_LOGIN' => 'login', 'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login',
'LDAP_MEMBER_FIELD_MAIL' => 'email');
$ldapkey = array(
'LDAP_MEMBER_FIELD_FULLNAME' => 'fullname',
'LDAP_MEMBER_FIELD_NAME' => 'lastname',
'LDAP_MEMBER_FIELD_LOGIN' => 'login',
'LDAP_MEMBER_FIELD_LOGIN_SAMBA' => 'login',
'LDAP_MEMBER_FIELD_MAIL' => 'email'
);
// Member
foreach ($ldapkey as $constname => $varname) {
@ -2439,10 +2445,11 @@ class Adherent extends CommonObject
if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
if ($this->skype && !empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
if ($this->twitter && !empty($conf->global->LDAP_MEMBER_FIELD_TWITTER)) $info[$conf->global->LDAP_MEMBER_FIELD_TWITTER] = $this->twitter;
if ($this->facebook && !empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook;
if ($this->linkedin && !empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin;
foreach ($socialnetworks as $key => $value) {
if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])})) {
$info[$conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']];
}
}
if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
@ -2455,8 +2462,12 @@ class Adherent extends CommonObject
// When password is modified
if (!empty($this->pass)) {
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
}
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
}
} // Set LDAP password if possible
elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {

View File

@ -378,9 +378,8 @@ if ($result)
print '<td class="center">';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print ' &nbsp; ';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
print '<a class="editfielda marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} else {
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$id.'">';

View File

@ -221,7 +221,9 @@ class PrestaShopWebservice
* Load XML from string. Can throw exception
*
* @param string $response String from a CURL response
* @return SimpleXMLElement status_code, response
* @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/
protected function parseXML($response)
{
@ -250,7 +252,9 @@ class PrestaShopWebservice
* Examples are given in the tutorial</p>
*
* @param array $options Options
* @return SimpleXMLElement status_code, response
* @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/
public function add($options)
{
@ -268,10 +272,10 @@ class PrestaShopWebservice
} else {
throw new PrestaShopWebserviceException('Bad parameters given');
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']);
return self::parseXML($request['response']);
$this->checkStatusCode($request['status_code']);
return $this->parseXML($request['response']);
}
/**
@ -300,7 +304,9 @@ class PrestaShopWebservice
* ?>
* </code>
* @param array $options Array representing resource to get.
* @return SimpleXMLElement status_code, response
* @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/
public function get($options)
{
@ -326,9 +332,9 @@ class PrestaShopWebservice
throw new PrestaShopWebserviceException('Bad parameters given ');
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
self::checkStatusCode($request['status_code']); // check the response validity
return self::parseXML($request['response']);
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
$this->checkStatusCode($request['status_code']); // check the response validity
return $this->parseXML($request['response']);
}
/**
@ -336,6 +342,8 @@ class PrestaShopWebservice
*
* @param array $options Array representing resource for head request.
* @return SimpleXMLElement status_code, response
*
* @throw PrestaShopWebserviceException
*/
public function head($options)
{
@ -358,8 +366,8 @@ class PrestaShopWebservice
} else {
throw new PrestaShopWebserviceException('Bad parameters given');
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
self::checkStatusCode($request['status_code']); // check the response validity
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
$this->checkStatusCode($request['status_code']); // check the response validity
return $request['header'];
}
/**
@ -371,7 +379,9 @@ class PrestaShopWebservice
* Examples are given in the tutorial</p>
*
* @param array $options Array representing resource to edit.
* @return SimpleXMLElement status_code, response
* @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/
public function edit($options)
{
@ -390,9 +400,9 @@ class PrestaShopWebservice
throw new PrestaShopWebserviceException('Bad parameters given');
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']); // check the response validity
return self::parseXML($request['response']);
$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
$this->checkStatusCode($request['status_code']); // check the response validity
return $this->parseXML($request['response']);
}
}

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -118,7 +118,7 @@ foreach ($eventstolog as $key => $arr)
print '<td>'.$arr['id'].'</td>';
print '<td class="center">';
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = $conf->global->$key;
$value = empty($conf->global->$key) ? '' : $conf->global->$key;
print '<input class="oddeven checkforselect" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>';
print '</td></tr>'."\n";
}

View File

@ -51,35 +51,33 @@ if ($cancel) {
if ($action == 'update')
{
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);

View File

@ -483,13 +483,15 @@ if ($virtualdiffersfromphysical)
print '</tr>'."\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
print '<td>';
print $form->textwithpicto($langs->trans("UseRealStockByDefault"), $langs->trans("ReplenishmentCalculation"));
print '</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK');
print ajax_constantonoff('STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK);
print $form->selectarray("STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT", $arrval, $conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT);
}
print "</td>\n";
print "</tr>\n";

View File

@ -105,36 +105,21 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["main
print '</td></tr>';
print '<tr><td>Sessions support</td><td>';
if (!function_exists("session_id"))
{
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions");
}
print '</td></tr>';
print '<tr><td>UTF-8 support</td><td>';
if (!function_exists("utf8_encode"))
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "UTF8");
}
print '</td></tr>';
print '<tr><td>MBString support</td><td>';
if (!function_exists("mb_check_encoding"))
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "mbstring");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "mbstring");
}
print '</td></tr>';
print '</table>';
@ -153,6 +138,28 @@ print '<td align="center">'.$langs->trans("FunctionTest").'</td>';
print '<td>'.$langs->trans("Result").'</td>';
print '</tr>';
$functions = ["mb_check_encoding"];
$name = "MBString";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
$functions = ["json_decode"];
$name = "JSON";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
$functions = ["imagecreate"];
$name = "GD";
@ -186,7 +193,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
}
@ -225,7 +231,7 @@ foreach ($phparray as $key => $value)
print '<td>'.$keyparam.'</td>';
$valtoshow = $keyvalue;
if ($keyparam == 'X-ChromePhp-Data') $valtoshow = dol_trunc($keyvalue, 80);
print '<td colspan="2">';
print '<td colspan="2" class="wordbreak">';
if ($keyparam == 'Path') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == 'PATH') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
if ($keyparam == '_SERVER["PATH"]') $valtoshow = implode('; ', explode(';', trim($valtoshow)));
@ -425,7 +431,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function
}
$html = "<td>";
$html .= $result ? $langs->trans("PHPSupport".$name) : $langs->trans("ErrorPHPDoesNotSupport".$name);
$html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport".$name);
$html .= "</td>";
return $html;

View File

@ -25,6 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
// Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin"));
@ -52,7 +53,7 @@ print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
print '<br>';
print load_fiche_titre($langs->trans("PHPSetup"), '', '');
print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder');
// Get version of PHP
$phpversion = version_php();
@ -77,7 +78,7 @@ else {
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', '');
print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
@ -94,7 +95,7 @@ print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Permissions"), '', '');
print load_fiche_titre($langs->trans("Permissions"), '', 'folder');
print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
// TODO Check permission are read only except for custom dir
@ -109,7 +110,7 @@ print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("DolibarrModules"), '', '');
print load_fiche_titre($langs->trans("Modules"), '', 'folder');
// Module log
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
@ -133,10 +134,12 @@ print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', '');
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.$conf->global->MAIN_SECURITY_HASH_ALGO." &nbsp; (Recommanded value: 'password_hash')<br>";
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
print '<br>';
// TODO
@ -153,10 +156,20 @@ print '<br>';
print '<br>';
print '<strong>'.$langs->trans("SecurityAudit").'</strong>: ';
// TODO Disabled or enabled ?
print '<br>';
$securityevent = new Events($db);
$eventstolog = $securityevent->eventstolog;
print '<strong>'.$langs->trans("LogEvents").'</strong>: ';
// Loop on each event type
foreach ($eventstolog as $key => $arr)
{
if ($arr['id'])
{
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = empty($conf->global->$key) ? '' : $conf->global->$key;
if ($value) print $key.', ';
}
}

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 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
@ -42,6 +43,8 @@ $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'user';

View File

@ -92,8 +92,10 @@ class BOM extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassembly')),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
//'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'),
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
@ -113,6 +115,7 @@ class BOM extends CommonObject
public $rowid;
public $ref;
public $label;
public $bomtype;
public $description;
public $note_public;
public $note_private;

View File

@ -32,7 +32,7 @@ $conf_db_base = $dolibarr_main_db_name;
$conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0);
// Identifiant unique correspondant a l'entrepot a utiliser
$conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable stock decrease is on, we set warehouse id to 0.
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0.
// Identifiant unique correspondant au compte caisse / liquide
$conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0);
@ -46,6 +46,3 @@ $conf_fkaccount_cb = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) ? $_SESSI
// View parameters
$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists
$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes
// Add hidden option to force decrease of stock whatever is user setup
if (!empty($conf->global->CASHDESK_FORCE_STOCK_ON_BILL)) $conf->global->STOCK_CALCULATE_ON_BILL = 1;

View File

@ -43,16 +43,36 @@ class CActionComm
*/
public $id;
/**
* @var string code
*/
public $code;
/**
* @var string type
*/
public $type;
public $libelle; // deprecated
/**
* @var string label
* @deprecated
* @see $label
*/
public $libelle;
/**
* @var string Type of agenda event label
*/
public $label;
/**
* @var int active
*/
public $active;
/**
* @var string color hex
*/
public $color;
/**
@ -60,6 +80,9 @@ class CActionComm
*/
public $picto;
/**
* @var array array of type_actions
*/
public $type_actions = array();
@ -76,14 +99,14 @@ class CActionComm
/**
* Load action type from database
*
* @param int $id id or code of action type to read
* @return int 1=ok, 0=not found, -1=error
* @param int|string $id id or code of action type to read
* @return int 1=ok, 0=not found, -1=error
*/
public function fetch($id)
{
$sql = "SELECT id, code, type, libelle as label, color, active, picto";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
if (is_numeric($id)) $sql .= " WHERE id=".$id;
if (is_numeric($id)) $sql .= " WHERE id=".(int) $id;
else $sql .= " WHERE code='".$this->db->escape($id)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@ -138,7 +161,9 @@ class CActionComm
$sql = "SELECT id, code, libelle as label, module, type, color, picto";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm";
$sql .= " WHERE 1=1";
if ($active != '') $sql .= " AND active=".$active;
if ($active != '') {
$sql .= " AND active=".(int) $active;
}
if (!empty($excludetype)) $sql .= " AND type <> '".$this->db->escape($excludetype)."'";
if ($morefilter) $sql .= " AND ".$morefilter;
$sql .= " ORDER BY module, position, type";

View File

@ -171,19 +171,21 @@ if (empty($reshook))
GETPOST('date_deliveryday', 'int'),
GETPOST('date_deliveryyear', 'int')
);
if (!empty($object->date_livraison) && !empty($date_delivery))
$date_delivery_old = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date);
if (!empty($date_delivery_old) && !empty($date_delivery))
{
//Attempt to get the date without possible hour rounding errors
$old_date_delivery = dol_mktime(12, 0, 0,
dol_print_date($object->date_livraison, '%m'),
dol_print_date($object->date_livraison, '%d'),
dol_print_date($object->date_livraison, '%Y')
dol_print_date($date_delivery_old, '%m'),
dol_print_date($date_delivery_old, '%d'),
dol_print_date($date_delivery_old, '%Y')
);
//Calculate the difference and apply if necessary
$difference = $date_delivery - $old_date_delivery;
if ($difference != 0)
{
$object->date_livraison = $date_delivery;
$object->delivery_date = $date_delivery;
foreach ($object->lines as $line)
{
if (isset($line->date_start)) $line->date_start = $line->date_start + $difference;
@ -340,7 +342,9 @@ if (empty($reshook))
if ($object->fetch(GETPOST('copie_propal', 'int')) > 0) {
$object->ref = GETPOST('ref');
$object->datep = $datep;
$object->date_livraison = $date_delivery;
$object->date = $datep;
$object->date_livraison = $date_delivery; // deprecated
$object->delivery_date = $date_delivery;
$object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->fk_delivery_address = GETPOST('fk_address', 'int');
@ -354,8 +358,9 @@ if (empty($reshook))
$object->socid = GETPOST('socid', 'int');
$object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int');
$object->model_pdf = GETPOST('model');
$object->model_pdf = GETPOST('model', 'alphanohtml');
$object->author = $user->id; // deprecated
$object->user_author_id = $user->id;
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->statut = Propal::STATUS_DRAFT;
@ -371,7 +376,9 @@ if (empty($reshook))
$object->ref = GETPOST('ref');
$object->ref_client = GETPOST('ref_client');
$object->datep = $datep;
$object->date = $datep;
$object->date_livraison = $date_delivery;
$object->delivery_date = $date_delivery;
$object->availability_id = GETPOST('availability_id', 'int');
$object->demand_reason_id = GETPOST('demand_reason_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address', 'int');
@ -1822,8 +1829,8 @@ if ($action == 'create')
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))
);
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) {
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison);
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
}
// Incomplete payment. We ask if reason = discount or other
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
@ -2047,9 +2054,9 @@ if ($action == 'create')
// Delivery date
$langs->load('deliveries');
print '<tr><td>';
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker');
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker');
print '</td><td>';
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker');
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker');
print '</td>';
print '</tr>';

View File

@ -152,9 +152,15 @@ class Propal extends CommonObject
public $datep;
/**
* @var integer|string $delivery_date;
* @var int Date expected for delivery
* @deprecated
*/
public $delivery_date;
public $date_livraison; // deprecated; Use delivery_date instead.
/**
* @var integer|string $delivery_date;
*/
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
public $fin_validite;
@ -985,6 +991,9 @@ class Propal extends CommonObject
$this->multicurrency_tx = 1;
}
// Set tmp vars
$delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
dol_syslog(get_class($this)."::create");
// Check parameters
@ -1072,7 +1081,7 @@ class Propal extends CommonObject
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", '".$this->db->escape($this->ref_client)."'";
$sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL");
$sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'");
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
$sql .= ", ".$this->availability_id;
$sql .= ", ".$this->demand_reason_id;
@ -1435,7 +1444,7 @@ class Propal extends CommonObject
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv";
$sql .= ", p.date_livraison as date_livraison";
$sql .= ", p.date_livraison as delivery_date";
$sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams";
$sql .= ", p.note_private, p.note_public";
$sql .= ", p.fk_projet as fk_project, p.fk_statut";
@ -1517,7 +1526,8 @@ class Propal extends CommonObject
$this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null;
$this->availability_id = $obj->fk_availability;
$this->availability_code = $obj->availability_code;
@ -2104,6 +2114,7 @@ class Propal extends CommonObject
{
$this->oldcopy = clone $this;
$this->date_livraison = $delivery_date;
$this->delivery_date = $delivery_date;
}
if (!$notrigger && empty($error))
@ -3566,16 +3577,24 @@ class Propal extends CommonObject
if (isset($this->statut)) {
$label .= ' '.$this->getLibStatut(5);
}
if (!empty($this->ref))
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_client))
}
if (!empty($this->ref_client)) {
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
if (!empty($this->total_ht))
}
if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_tva))
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ttc))
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->delivery_date)) {
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
}
if ($option == '') {
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params;

View File

@ -120,6 +120,8 @@ if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WA
$error = 0;
$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
/*
* Actions
@ -274,7 +276,8 @@ if (empty($reshook))
$object->fk_account = GETPOST('fk_account', 'int');
$object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison;
$object->date_livraison = $datelivraison; // deprecated
$object->delivery_date = $datelivraison;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');
@ -538,10 +541,10 @@ if (empty($reshook))
}
} elseif ($action == 'setdate_livraison' && $usercancreate) {
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
$datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$object->fetch($id);
$result = $object->setDeliveryDate($user, $datedelivery);
$result = $object->setDeliveryDate($user, $date_delivery);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -1506,7 +1509,8 @@ if ($action == 'create' && $usercancreate)
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : '';
$datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
$date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
if (!empty($conf->multicurrency->enabled))
{
@ -1619,8 +1623,7 @@ if ($action == 'create' && $usercancreate)
// Date delivery planned
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">';
//print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed.
$date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST
$date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
print "</td>\n";
print '</tr>';
@ -2137,12 +2140,12 @@ if ($action == 'create' && $usercancreate)
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdate_livraison">';
print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : '&nbsp;';
if ($object->hasDelay() && !empty($object->date_livraison)) {
print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : '&nbsp;';
if ($object->hasDelay() && !empty($object->delivery_date)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}

View File

@ -180,6 +180,12 @@ class Commande extends CommonOrder
*/
public $date_commande;
/**
* @var int Date expected for delivery
* @deprecated
*/
public $date_livraison; // deprecated; Use delivery_date instead.
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
/**
@ -880,8 +886,9 @@ class Commande extends CommonOrder
// Clean parameters
$this->brouillon = 1; // set command as draft
// $date_commande is deprecated
// Set tmp vars
$date = ($this->date_commande ? $this->date_commande : $this->date);
$delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date);
@ -954,7 +961,7 @@ class Commande extends CommonOrder
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->availability_id > 0 ? $this->availability_id : "null");
$sql .= ", ".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null");
$sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null");
$sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null");
$sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL');
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
$sql .= ", ".($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL');
@ -1353,7 +1360,8 @@ class Commande extends CommonOrder
$this->fk_account = $object->fk_account;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->date_livraison = $object->date_livraison; // deprecated
$this->delivery_date = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->warehouse_id = $object->warehouse_id;
$this->fk_delivery_address = $object->fk_delivery_address;
@ -1777,7 +1785,7 @@ class Commande extends CommonOrder
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
$sql .= ', c.fk_account';
$sql .= ', c.date_commande, c.date_valid, c.tms';
$sql .= ', c.date_livraison';
$sql .= ', c.date_livraison as delivery_date';
$sql .= ', c.fk_shipping_method';
$sql .= ', c.fk_warehouse';
$sql .= ', c.fk_projet as fk_project, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
@ -1863,7 +1871,8 @@ class Commande extends CommonOrder
$this->availability = $obj->availability_label;
$this->demand_reason_id = $obj->fk_input_reason;
$this->demand_reason_code = $obj->demand_reason_code;
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null;
$this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null;
$this->fk_delivery_address = $obj->fk_delivery_address;
@ -2005,7 +2014,7 @@ class Commande extends CommonOrder
$sql .= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,';
$sql .= ' l.fk_unit,';
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
$sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,';
$sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch,';
$sql .= ' p.weight, p.weight_units, p.volume, p.volume_units';
$sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
@ -2068,6 +2077,8 @@ class Commande extends CommonOrder
$line->libelle = $objp->product_label;
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc;
$line->product_tosell = $objp->product_tosell;
$line->product_tobuy = $objp->product_tobuy;
$line->product_tobatch = $objp->product_tobatch;
$line->fk_product_type = $objp->fk_product_type; // Produit ou service
$line->fk_unit = $objp->fk_unit;
@ -2595,6 +2606,7 @@ class Commande extends CommonOrder
{
$this->oldcopy = clone $this;
$this->date_livraison = $delivery_date;
$this->delivery_date = $delivery_date;
}
if (!$notrigger && empty($error))
@ -3495,7 +3507,9 @@ class Commande extends CommonOrder
$generic_commande->statut = $obj->fk_statut;
$generic_commande->date_commande = $this->db->jdate($obj->date_commande);
$generic_commande->date = $this->db->jdate($obj->date_commande);
$generic_commande->date_livraison = $this->db->jdate($obj->delivery_date);
$generic_commande->delivery_date = $this->db->jdate($obj->delivery_date);
if ($generic_commande->hasDelay()) {
$response->nbtodolate++;
@ -3649,6 +3663,9 @@ class Commande extends CommonOrder
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->delivery_date)) {
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
}
}
$linkclose = '';

View File

@ -931,7 +931,8 @@ if ($resql)
$generic_commande->statut = $obj->fk_statut;
$generic_commande->billed = $obj->billed;
$generic_commande->date = $db->jdate($obj->date_commande);
$generic_commande->date_livraison = $db->jdate($obj->date_delivery);
$generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated
$generic_commande->delivery_date = $db->jdate($obj->date_delivery);
$generic_commande->ref_client = $obj->ref_client;
$generic_commande->total_ht = $obj->total_ht;
$generic_commande->total_tva = $obj->total_tva;

View File

@ -1093,7 +1093,7 @@ if ($resql)
}
print '<td class="center">';
print '<input type="checkbox" id="selectAll" />';
print '<input type="checkbox" id="selectAll" title="'.dol_escape_htmltag($langs->trans("SelectAll")).'" />';
print ' <script type="text/javascript">
$("input#selectAll").change(function() {
$("input[type=checkbox][name^=rowid]").prop("checked", $(this).is(":checked"));

View File

@ -92,14 +92,14 @@ $fieldstosearchall = array(
$checkedtypetiers = 0;
$arrayfields = array(
'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1),
'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled))),
'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled))),
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0),
'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1, 'position'=>10),
'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1, 'position'=>12),
'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>14),
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1, 'position'=>16),
'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled)), 'position'=>18),
'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled)), 'position'=>20),
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1, 'position'=>50),
'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0, 'position'=>22),
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'b.clos'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
@ -525,7 +525,7 @@ foreach ($accounts as $key=>$type)
if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'&search_conciliated=0">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&id='.$objecttmp->id.'&search_account='.$objecttmp->id.'&search_conciliated=0&contextpage=banktransactionlist">';
print '<span class="badge badge-info classfortooltip" title="'.dol_htmlentities($langs->trans("TransactionsToConciliate")).'">';
print $result->nbtodo;
print '</span>';

View File

@ -115,6 +115,14 @@ class Facture extends CommonInvoice
public $date; // Date invoice
public $datem;
/**
* @var int Date expected for delivery
* @deprecated
*/
public $date_livraison; // deprecated; Use delivery_date instead.
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
/**
* @var string customer ref
*/
@ -1330,7 +1338,8 @@ class Facture extends CommonInvoice
$this->mode_reglement_id = $object->mode_reglement_id;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->delivery_date = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date);
$this->date_livraison = $object->delivery_date; // deprecated
$this->fk_delivery_address = $object->fk_delivery_address; // deprecated
$this->contact_id = $object->contact_id;
$this->ref_client = $object->ref_client;

View File

@ -44,7 +44,11 @@ class Cchargesociales
*/
public $table_element = 'c_chargesociales';
/**
* @var string Label
*/
public $libelle;
public $deductible;
public $active;
public $code;
@ -54,6 +58,9 @@ class Cchargesociales
*/
public $fk_pays;
/**
* @var string module
*/
public $module;
public $accountancy_code;
@ -504,13 +511,12 @@ class Cchargesociales
/**
* Trim object parameters
* @param string[] $parameters array of parameters to trim
*
* @param string[] $parameters array of parameters to trim
* @return void
*/
private function trimParameters($parameters)
{
if (!is_array($parameters)) return;
foreach ($parameters as $parameter) {
if (isset($this->$parameter)) {
$this->$parameter = trim($this->$parameter);

View File

@ -65,6 +65,11 @@ class Tva extends CommonObject
*/
public $fk_bank;
/**
* @var int accountid
*/
public $accountid;
/**
* @var int ID
*/

View File

@ -2183,7 +2183,7 @@ if (!empty($conf->margin->enabled) && $action == 'editline')
$(document).ready(function() {
var idprod = $("input[name='idprod']").val();
var fournprice = $("input[name='fournprice']").val();
var token = '<?php echo $_SESSION["token"]; ?>'; // For AJAX Call we use old 'token' and not 'newtoken'
var token = '<?php echo currentToken(); ?>'; // For AJAX Call we use old 'token' and not 'newtoken'
if (idprod > 0) {
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {
'idprod': idprod,

View File

@ -100,7 +100,7 @@ if ($action == 'setModuleOptions')
}
if ($upload_dir)
{
$result = dol_add_file_process($upload_dir, 0, 1, 'uploadfile', '');
$result = dol_add_file_process($upload_dir, 1, 1, 'uploadfile', '');
if ($result <= 0) $error++;
}
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2020 Frederic 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
@ -116,6 +116,7 @@ class box_members extends ModeleBoxes
$memberstatic->email = $objp->email;
$memberstatic->morphy = $objp->morphy;
$memberstatic->company = $objp->company;
$memberstatic->statut = $objp->status;
if (!empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;

View File

@ -86,7 +86,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql .= " s.code_client, s.code_fournisseur, s.email,";
$sql .= " s.logo,";
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, ";
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison as delivery_date, ";
$sql .= " c.total_ht,";
$sql .= " c.tva as total_tva,";
$sql .= " c.total_ttc,";
@ -96,11 +96,11 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC ";
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC";
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC";
$sql .= $this->db->plimit($max, 0);
$result = $this->db->query($sql);
@ -112,10 +112,10 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$date = $this->db->jdate($objp->date_commande);
$delivery_date = $this->db->jdate($objp->date_livraison);
$delivery_date = $this->db->jdate($objp->delivery_date);
$datem = $this->db->jdate($objp->tms);
$supplierorderstatic->date_livraison = $delivery_date;
$supplierorderstatic->delivery_date = $delivery_date;
$supplierorderstatic->statut = $objp->fk_statut;
$supplierorderstatic->id = $objp->rowid;

View File

@ -77,11 +77,11 @@ abstract class CommonDocGenerator
public function get_substitutionarray_user($user, $outputlangs)
{
// phpcs:enable
global $conf;
global $conf, $extrafields;
$logotouse = $conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo;
return array(
$array_user = array(
'myuser_lastname'=>$user->lastname,
'myuser_firstname'=>$user->firstname,
'myuser_fullname'=>$user->getFullName($outputlangs, 1),
@ -101,6 +101,53 @@ abstract class CommonDocGenerator
'myuser_job'=>$user->job,
'myuser_web'=>'' // url not exist in $user object
);
// Retrieve extrafields
if (is_array($user->array_options) && count($user->array_options)) {
$array_user = $this->fill_substitutionarray_with_extrafields($user, $array_user, $extrafields, 'myuser', $outputlangs);
}
return $array_user;
}
/**
* Define array with couple substitution key => substitution value
*
* @param Adherent $member Member
* @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code
*/
public function getSubstitutionarrayMember($member, $outputlangs)
{
global $conf, $extrafields;
$logotouse = $conf->adherent->dir_output.'/'.get_exdir($member->id, 2, 0, 1, $member, 'user').'/'.$member->photo;
$array_member = array(
'mymember_lastname' => $member->lastname,
'mymember_firstname' => $member->firstname,
'mymember_fullname' => $member->getFullName($outputlangs, 1),
'mymember_login' => $member->login,
'mymember_address' => $member->address,
'mymember_zip' => $member->zip,
'mymember_town' => $member->town,
'mymember_country_code' => $member->country_code,
'mymember_country' => $member->country,
'mymember_state_code' => $member->state_code,
'mymember_state' => $member->state,
'mymember_phone_perso' => $member->phone_perso,
'mymember_phone_pro' => $member->phone,
'mymember_phone_mobile' => $member->phone_mobile,
'mymember_email' => $member->email,
'mymember_logo' => $logotouse,
'mymember_gender' => $member->gender,
'mymember_birth_locale' => dol_print_date($member->birth, 'day', 'tzuser', $outputlangs),
'mymember_birth' => dol_print_date($member->birth, 'day', 'tzuser'),
);
// Retrieve extrafields
if (is_array($member->array_options) && count($member->array_options)) {
$array_member = $this->fill_substitutionarray_with_extrafields($member, $array_member, $extrafields, 'mymember', $outputlangs);
}
return $array_member;
}
@ -1249,7 +1296,7 @@ abstract class CommonDocGenerator
$html = '';
$fields = array();
if (is_array($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
{
// Enable extrafield ?

View File

@ -51,12 +51,22 @@ abstract class CommonObject
*/
public $id;
/**
* @var int The environment ID when using a multicompany module
*/
public $entity;
/**
* @var string Error string
* @see $errors
*/
public $error;
/**
* @var string Error string that is hidden but can be used to store complementatry technical code.
*/
public $errorhidden;
/**
* @var string[] Array of error strings
*/
@ -296,6 +306,11 @@ abstract class CommonObject
*/
public $cond_reglement_id;
/**
* @var int Demand reason ID
*/
public $demand_reason_id;
/**
* @var int Transport mode ID (For module intracomm report)
* @see setTransportMode()
@ -1238,9 +1253,7 @@ abstract class CommonObject
{
$sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,";
$sql .= " tc.code, tc.libelle";
//$sql.= ", s.fk_soc";
$sql .= " FROM (".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc)";
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as s ON ec.fk_socpeople=s.rowid"; // Si contact de type external, alors il est lie a une societe
$sql .= " WHERE ec.rowid =".$rowid;
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
$sql .= " AND tc.element = '".$this->db->escape($this->element)."'";
@ -2439,8 +2452,6 @@ abstract class CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET model_pdf = '".$this->db->escape($newmodelpdf)."'";
$sql .= " WHERE rowid = ".$this->id;
// if ($this->element == 'facture') $sql.= " AND fk_statut < 2";
// if ($this->element == 'propal') $sql.= " AND fk_statut = 0";
dol_syslog(get_class($this)."::setDocModel", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -2555,8 +2566,7 @@ abstract class CommonObject
} else dol_print_error($this->db);
if ($nl > 0)
{
// The goal of this part is to reorder all lines, with all children lines sharing the same
// counter that parents.
// The goal of this part is to reorder all lines, with all children lines sharing the same counter that parents.
$rows = array();
// We first search all lines that are parent lines (for multilevel details lines)
@ -4565,13 +4575,17 @@ abstract class CommonObject
{
foreach (array('doc', 'pdf') as $prefix)
{
if (in_array(get_class($this), array('Adherent'))) $file = $prefix."_".$modele.".class.php"; // Member module use prefix_module.class.php
else $file = $prefix."_".$modele.".modules.php";
if (in_array(get_class($this), array('Adherent'))) {
// Member module use prefix_modele.class.php
$file = $prefix."_".$modele.".class.php";
} else {
// Other module use prefix_modele.modules.php
$file = $prefix."_".$modele.".modules.php";
}
// On verifie l'emplacement du modele
$file = dol_buildpath($reldir.$modelspath.$file, 0);
if (file_exists($file))
{
if (file_exists($file)) {
$filefound = $file;
$classname = $prefix.'_'.$modele;
break;
@ -5078,7 +5092,7 @@ abstract class CommonObject
global $conf, $extrafields;
if (empty($rowid)) $rowid = $this->id;
if (empty($rowid)) $rowid = $this->rowid;
if (empty($rowid) && isset($this->rowid)) $rowid = $this->rowid; // deprecated
// To avoid SQL errors. Probably not the better solution though
if (!$this->table_element) {
@ -5445,7 +5459,6 @@ abstract class CommonObject
$sql .= ")";
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->lasterror();
@ -5913,8 +5926,7 @@ abstract class CommonObject
}
}
if (in_array($type, array('date', 'datetime')))
{
if (in_array($type, array('date', 'datetime'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
@ -5925,25 +5937,19 @@ abstract class CommonObject
// TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
} elseif (in_array($type, array('duration')))
{
} elseif (in_array($type, array('duration'))) {
$out = $form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1);
} elseif (in_array($type, array('int', 'integer')))
{
} elseif (in_array($type, array('int', 'integer'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
} elseif (in_array($type, array('real')))
{
} elseif (in_array($type, array('real'))) {
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
} elseif (preg_match('/varchar/', $type))
{
} elseif (preg_match('/varchar/', $type)) {
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
} elseif (in_array($type, array('mail', 'phone', 'url')))
{
} elseif (in_array($type, array('mail', 'phone', 'url'))) {
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>';
} elseif (preg_match('/^text/', $type))
{
} elseif (preg_match('/^text/', $type)) {
if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -5952,18 +5958,15 @@ abstract class CommonObject
} else {
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
}
} elseif (preg_match('/^html/', $type))
{
if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
{
} elseif (preg_match('/^html/', $type)) {
if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%');
$out = $doleditor->Create(1);
} else {
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
}
} elseif ($type == 'boolean')
{
} elseif ($type == 'boolean') {
$checked = '';
if (!empty($value)) {
$checked = ' checked value="1" ';
@ -5971,20 +5974,17 @@ abstract class CommonObject
$checked = ' value="1" ';
}
$out = '<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>';
} elseif ($type == 'price')
{
} elseif ($type == 'price') {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value = price($value);
}
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> '.$langs->getCurrencySymbol($conf->currency);
} elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type))
{
} elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type)) {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value = price($value);
}
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> ';
} elseif ($type == 'select')
{
} elseif ($type == 'select') {
$out = '';
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{
@ -6004,18 +6004,15 @@ abstract class CommonObject
$out .= '>'.$val.'</option>';
}
$out .= '</select>';
} elseif ($type == 'sellist')
{
} elseif ($type == 'sellist') {
$out = '';
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
}
$out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>';
if (is_array($param['options']))
{
if (is_array($param['options'])) {
$param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
$parentName = '';
@ -6161,12 +6158,10 @@ abstract class CommonObject
}
}
$out .= '</select>';
} elseif ($type == 'checkbox')
{
} elseif ($type == 'checkbox') {
$value_arr = explode(',', $value);
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
} elseif ($type == 'radio')
{
} elseif ($type == 'radio') {
$out = '';
foreach ($param['options'] as $keyopt => $val)
{
@ -6176,8 +6171,7 @@ abstract class CommonObject
$out .= ($value == $keyopt ? 'checked' : '');
$out .= '/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
}
} elseif ($type == 'chkbxlst')
{
} elseif ($type == 'chkbxlst') {
if (is_array($value)) {
$value_arr = $value;
} else {
@ -6318,8 +6312,7 @@ abstract class CommonObject
print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
}
}
} elseif ($type == 'link')
{
} elseif ($type == 'link') {
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]'
$param_list_array = explode(':', $param_list[0]);
$showempty = (($required && $default != '') ? 0 : 1);
@ -6344,25 +6337,20 @@ abstract class CommonObject
$out .= '<a class="butActionNew" title="'.$langs->trans("New").'" href="'.$url_path.'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].($paramforthenewlink ? '?'.$paramforthenewlink : '')).'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
}
}
} elseif ($type == 'password')
{
} elseif ($type == 'password') {
// If prefix is 'search_', field is used as a filter, we use a common text field.
$out = '<input type="'.($keyprefix == 'search_' ? 'text' : 'password').'" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'>';
} elseif ($type == 'array')
{
} elseif ($type == 'array') {
$newval = $val;
$newval['type'] = 'varchar(256)';
$out = '';
$inputs = array();
if (!empty($value)) {
foreach ($value as $option) {
$out .= '<span><a class="'.dol_escape_htmltag($keyprefix.$key.$keysuffix).'_del" href="javascript:;"><span class="fa fa-minus-circle valignmiddle"></span></a> ';
$out .= $this->showInputField($newval, $keyprefix.$key.$keysuffix.'[]', $option, $moreparam, '', '', $morecss).'<br></span>';
}
}
$out .= '<a id="'.dol_escape_htmltag($keyprefix.$key.$keysuffix).'_add" href="javascript:;"><span class="fa fa-plus-circle valignmiddle"></span></a>';
$newInput = '<span><a class="'.dol_escape_htmltag($keyprefix.$key.$keysuffix).'_del" href="javascript:;"><span class="fa fa-minus-circle valignmiddle"></span></a> ';
@ -6465,27 +6453,20 @@ abstract class CommonObject
if (empty($morecss))
{
if ($type == 'date')
{
if ($type == 'date') {
$morecss = 'minwidth100imp';
} elseif ($type == 'datetime' || $type == 'timestamp')
{
} elseif ($type == 'datetime' || $type == 'timestamp') {
$morecss = 'minwidth200imp';
} elseif (in_array($type, array('int', 'double', 'price')))
{
} elseif (in_array($type, array('int', 'double', 'price'))) {
$morecss = 'maxwidth75';
} elseif ($type == 'url')
{
} elseif ($type == 'url') {
$morecss = 'minwidth400';
} elseif ($type == 'boolean')
{
} elseif ($type == 'boolean') {
$morecss = '';
} else {
if (round($size) < 12)
{
if (round($size) < 12) {
$morecss = 'minwidth100';
} elseif (round($size) <= 48)
{
} elseif (round($size) <= 48) {
$morecss = 'minwidth200';
} else {
$morecss = 'minwidth400';
@ -6496,57 +6477,47 @@ abstract class CommonObject
// Format output value differently according to properties of field
if ($key == 'ref' && method_exists($this, 'getNomUrl')) $value = $this->getNomUrl(1, '', 0, '', 1);
elseif ($key == 'status' && method_exists($this, 'getLibStatut')) $value = $this->getLibStatut(3);
elseif ($type == 'date')
{
elseif ($type == 'date') {
if (!empty($value)) {
$value = dol_print_date($value, 'day');
} else {
$value = '';
}
} elseif ($type == 'datetime' || $type == 'timestamp')
{
} elseif ($type == 'datetime' || $type == 'timestamp') {
if (!empty($value)) {
$value = dol_print_date($value, 'dayhour');
} else {
$value = '';
}
} elseif ($type == 'duration')
{
} elseif ($type == 'duration') {
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (!is_null($value) && $value !== '') {
$value = convertSecondToTime($value, 'allhourmin');
}
} elseif ($type == 'double' || $type == 'real')
{
} elseif ($type == 'double' || $type == 'real') {
if (!is_null($value) && $value !== '') {
$value = price($value);
}
} elseif ($type == 'boolean')
{
} elseif ($type == 'boolean') {
$checked = '';
if (!empty($value)) {
$checked = ' checked ';
}
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
} elseif ($type == 'mail')
{
} elseif ($type == 'mail') {
$value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
} elseif ($type == 'url')
{
} elseif ($type == 'url') {
$value = dol_print_url($value, '_blank', 32, 1);
} elseif ($type == 'phone')
{
} elseif ($type == 'phone') {
$value = dol_print_phone($value, '', 0, 0, '', '&nbsp;', 1);
} elseif ($type == 'price')
{
if (!is_null($value) && $value !== '') {
$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
}
} elseif ($type == 'select')
{
} elseif ($type == 'select') {
$value = $param['options'][$value];
} elseif ($type == 'sellist')
{
} elseif ($type == 'sellist') {
$param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
@ -6618,11 +6589,9 @@ abstract class CommonObject
}
}
} else dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING);
} elseif ($type == 'radio')
{
} elseif ($type == 'radio') {
$value = $param['options'][$value];
} elseif ($type == 'checkbox')
{
} elseif ($type == 'checkbox') {
$value_arr = explode(',', $value);
$value = '';
if (is_array($value_arr) && count($value_arr) > 0)
@ -6633,8 +6602,7 @@ abstract class CommonObject
}
$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
}
} elseif ($type == 'chkbxlst')
{
} elseif ($type == 'chkbxlst') {
$value_arr = explode(',', $value);
$param_list = array_keys($param['options']);
@ -6700,8 +6668,7 @@ abstract class CommonObject
} else {
dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING);
}
} elseif ($type == 'link')
{
} elseif ($type == 'link') {
$out = '';
// only if something to display (perf)
@ -6727,14 +6694,11 @@ abstract class CommonObject
return 'Error bad setup of extrafield';
}
} else $value = '';
} elseif (preg_match('/^(text|html)/', $type))
{
} elseif (preg_match('/^(text|html)/', $type)) {
$value = dol_htmlentitiesbr($value);
} elseif ($type == 'password')
{
} elseif ($type == 'password') {
$value = preg_replace('/./i', '*', $value);
} elseif ($type == 'array')
{
} elseif ($type == 'array') {
$value = implode('<br>', $value);
}
@ -6971,34 +6935,37 @@ abstract class CommonObject
if (!empty($conf->use_javascript_ajax)) {
$out .= '
<script>
jQuery(document).ready(function() {
function showOptions(child_list, parent_list)
{
var val = $("select[name=\""+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").hide();
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
} else {
$("select[name=\""+child_list+"\"] option").show();
}
}
function setListDependencies() {
jQuery("select option[parent]").parent().each(function() {
var child_list = $(this).attr("name");
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
showOptions(child_list, parent_list);
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list);
});
});
jQuery(document).ready(function() {
function showOptions(child_list, parent_list, orig_select)
{
var val = $("select[name=\""+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
var options = orig_select.find("option[parent=\""+parentVal+"\"]").clone();
$("select[name=\""+child_list+"\"] option[parent]").remove();
$("select[name=\""+child_list+"\"]").append(options);
} else {
var options = orig_select.find("option[parent]").clone();
$("select[name=\""+child_list+"\"] option[parent]").remove();
$("select[name=\""+child_list+"\"]").append(options);
}
}
function setListDependencies() {
jQuery("select option[parent]").parent().each(function() {
var orig_select = {};
var child_list = $(this).attr("name");
orig_select[child_list] = $(this).clone();
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list, orig_select[child_list]);
});
});
}
setListDependencies();
});
setListDependencies();
});
</script>'."\n";
}
@ -7364,8 +7331,7 @@ abstract class CommonObject
*/
protected function isArray($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['type']) && $info['type'] == 'array') return true;
else return false;
}
@ -7392,8 +7358,7 @@ abstract class CommonObject
*/
public function isDuration($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['type']) && ($info['type'] == 'duration')) return true;
else return false;
} else return false;
@ -7407,8 +7372,7 @@ abstract class CommonObject
*/
public function isInt($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['type']) && ($info['type'] == 'int' || preg_match('/^integer/i', $info['type']))) return true;
else return false;
} else return false;
@ -7422,8 +7386,7 @@ abstract class CommonObject
*/
public function isFloat($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['type']) && (preg_match('/^(double|real|price)/i', $info['type']))) return true;
else return false;
}
@ -7438,8 +7401,7 @@ abstract class CommonObject
*/
public function isText($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['type']) && $info['type'] == 'text') return true;
else return false;
}
@ -7454,8 +7416,7 @@ abstract class CommonObject
*/
protected function canBeNull($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['notnull']) && $info['notnull'] != '1') return true;
else return false;
}
@ -7470,8 +7431,7 @@ abstract class CommonObject
*/
protected function isForcedToNullIfZero($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['notnull']) && $info['notnull'] == '-1') return true;
else return false;
}
@ -7486,8 +7446,7 @@ abstract class CommonObject
*/
protected function isIndex($info)
{
if (is_array($info))
{
if (is_array($info)) {
if (isset($info['index']) && $info['index'] == true) return true;
else return false;
}
@ -7574,8 +7533,7 @@ abstract class CommonObject
{
foreach ($this->fields as $field => $info)
{
if ($this->isDate($info))
{
if ($this->isDate($info)) {
if (empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0;
else $this->{$field} = strtotime($obj->{$field});
} elseif ($this->isArray($info))
@ -7587,12 +7545,10 @@ abstract class CommonObject
} else {
$this->{$field} = array();
}
} elseif ($this->isInt($info))
{
} elseif ($this->isInt($info)) {
if ($field == 'rowid') $this->id = (int) $obj->{$field};
else {
if ($this->isForcedToNullIfZero($info))
{
if ($this->isForcedToNullIfZero($info)) {
if (empty($obj->{$field})) $this->{$field} = null;
else $this->{$field} = (double) $obj->{$field};
} else {
@ -7603,10 +7559,8 @@ abstract class CommonObject
}
}
}
} elseif ($this->isFloat($info))
{
if ($this->isForcedToNullIfZero($info))
{
} elseif ($this->isFloat($info)) {
if ($this->isForcedToNullIfZero($info)) {
if (empty($obj->{$field})) $this->{$field} = null;
else $this->{$field} = (double) $obj->{$field};
} else {
@ -8365,8 +8319,8 @@ abstract class CommonObject
/**
* Trim object parameters
* @param string[] $parameters array of parameters to trim
*
* @param string[] $parameters array of parameters to trim
* @return void
*/
public function trimParameters($parameters)

View File

@ -1035,10 +1035,9 @@ class FormFile
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1)
{
// phpcs:enable
global $user, $conf, $langs, $hookmanager;
global $user, $conf, $langs, $hookmanager, $form;
global $sortfield, $sortorder, $maxheightmini;
global $dolibarr_main_url_root;
global $form;
if ($disablecrop == -1)
{
@ -1222,7 +1221,6 @@ class FormFile
// Size
$sizetoshow = dol_print_size($file['size'], 1, 1);
$sizetoshowbytes = dol_print_size($file['size'], 0, 1);
print '<td class="right nowraponall">';
if ($sizetoshow == $sizetoshowbytes) print $sizetoshow;
else {
@ -1407,9 +1405,9 @@ class FormFile
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show list of documents in a directory
* Show list of documents in a directory of ECM module.
*
* @param string $upload_dir Directory that was scanned
* @param string $upload_dir Directory that was scanned. This directory will contains files into subdirs REF/files
* @param array $filearray Array of files loaded by dol_dir_list function before calling this function
* @param string $modulepart Value for modulepart used by download wrapper
* @param string $param Parameters on sort links
@ -1427,9 +1425,10 @@ class FormFile
public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permissiontodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
{
// phpcs:enable
global $user, $conf, $langs, $form;
global $user, $conf, $langs, $hookmanager, $form;
global $sortfield, $sortorder;
global $search_doc_ref;
global $dolibarr_main_url_root;
dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart);
@ -1547,6 +1546,23 @@ class FormFile
$object_instance = new Mo($this->db);
}
//var_dump($filearray);
// Get list of files stored into database for same relative directory
$relativepathfromroot = preg_replace('/'.preg_quote(DOL_DATA_ROOT.'/', '/').'/', '', $upload_dir);
if ($relativepathfromroot)
{
completeFileArrayWithDatabaseInfo($filearray, $relativepathfromroot.'/%');
//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
{
$filearray = dol_sort_array($filearray, $sortfield, $sortorder);
}
}
//var_dump($filearray);
foreach ($filearray as $key => $file)
{
if (!is_dir($file['name'])
@ -1558,7 +1574,7 @@ class FormFile
// Define relative path used to store the file
$relativefile = preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']);
$id = 0; $ref = ''; $label = '';
$id = 0; $ref = '';
// To show ref or specific information according to view to show (defined by $module)
$reg = array();
@ -1590,7 +1606,7 @@ class FormFile
{
$found = 1;
} else {
//print 'Fetch '.$id." - ".$ref.'<br>';
//print 'Fetch '.$id." - ".$ref.' class='.get_class($object_instance).'<br>';
if ($id) {
$result = $object_instance->fetch($id);
@ -1619,13 +1635,12 @@ class FormFile
else print $langs->trans("ObjectDeleted", ($id ? $id : $ref));
//$modulesubdir=dol_sanitizeFileName($ref);
$modulesubdir = dirname($relativefile);
//$modulesubdir = dirname($relativefile);
//$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir = $file['path'];
//$filedir = $file['path'];
//$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
//print $formfile->getDocumentsLink($modulepart, $filename, $filedir);
print '</td>';
// File
@ -1639,12 +1654,43 @@ class FormFile
print '</a>';
//print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
print $this->showPreview($file, $modulepart, $file['relativename']);
print "</td>\n";
print '<td class="right">'.dol_print_size($file['size'], 1, 1).'</td>';
// Size
$sizetoshow = dol_print_size($file['size'], 1, 1);
$sizetoshowbytes = dol_print_size($file['size'], 0, 1);
print '<td class="right nowraponall">';
if ($sizetoshow == $sizetoshowbytes) print $sizetoshow;
else {
print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
}
print '</td>';
// Date
print '<td class="center">'.dol_print_date($file['date'], "dayhour").'</td>';
// Share link
print '<td class="right">';
if ($file['share']) {
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
//print '<span class="opacitymedium">'.$langs->trans("Hash").' : '.$file['share'].'</span>';
$forcedownload = 0;
$paramlink = '';
if (!empty($file['share'])) $paramlink .= ($paramlink ? '&' : '').'hashp='.$file['share']; // Hash for public share
if ($forcedownload) $paramlink .= ($paramlink ? '&' : '').'attachment=1';
$fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : '');
print img_picto($langs->trans("FileSharedViaALink"), 'globe').' ';
print '<input type="text" class="quatrevingtpercent width100" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
}
//if (! empty($useinecm) && $useinecm != 6) print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
//if ($forcedownload) print '&attachment=1';
//print '&file='.urlencode($relativefile).'">';

View File

@ -101,7 +101,7 @@ class SimpleOpenID
/**
* SetRequiredFields
*
* @param string $a Server
* @param string|array $a Server
* @return void
*/
public function SetRequiredFields($a)
@ -118,7 +118,7 @@ class SimpleOpenID
/**
* SetOptionalFields
*
* @param string $a Server
* @param string|array $a Server
* @return void
*/
public function SetOptionalFields($a)

View File

@ -228,8 +228,12 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
$sql .= " date_c, tms as date_m, fk_user_c, fk_user_m, acl, position, share";
if ($mode) $sql .= ", description";
$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files";
$sql .= " WHERE filepath = '".$db->escape($path)."'";
$sql .= " AND entity = ".$conf->entity;
$sql .= " WHERE entity = ".$conf->entity;
if (preg_match('/%$/', $path)) {
$sql .= " AND filepath LIKE '".$db->escape($path)."'";
} else {
$sql .= " AND filepath = '".$db->escape($path)."'";
}
$resql = $db->query($sql);
if ($resql)
@ -242,6 +246,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
$obj = $db->fetch_object($resql);
if ($obj)
{
$reg = array();
preg_match('/([^\/]+)\/[^\/]+$/', DOL_DATA_ROOT.'/'.$obj->filepath.'/'.$obj->filename, $reg);
$level1name = (isset($reg[1]) ? $reg[1] : '');
$file_list[] = array(
@ -289,7 +294,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
* Complete $filearray with data from database.
* This will call doldir_list_indatabase to complate filearray.
*
* @param array $filearray Array of files get using dol_dir_list
* @param array $filearray Array of files obtained using dol_dir_list
* @param string $relativedir Relative dir from DOL_DATA_ROOT
* @return void
*/
@ -315,19 +320,19 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
}
}
//var_dump($filearray);
//var_dump($filearrayindatabase);
/*var_dump($relativedir);
var_dump($filearray);
var_dump($filearrayindatabase);*/
// Complete filearray with properties found into $filearrayindatabase
foreach ($filearray as $key => $val)
{
$tmpfilename = preg_replace('/\.noexe$/', '', $filearray[$key]['name']);
$found = 0;
// Search if it exists into $filearrayindatabase
foreach ($filearrayindatabase as $key2 => $val2)
{
if ($filearrayindatabase[$key2]['name'] == $tmpfilename)
if (($filearrayindatabase[$key2]['path'] == $filearray[$key]['path']) && ($filearrayindatabase[$key2]['name'] == $tmpfilename))
{
$filearray[$key]['position_name'] = ($filearrayindatabase[$key2]['position'] ? $filearrayindatabase[$key2]['position'] : '0').'_'.$filearrayindatabase[$key2]['name'];
$filearray[$key]['position'] = $filearrayindatabase[$key2]['position'];
@ -348,6 +353,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
$filearray[$key]['acl'] = '';
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filearray[$key]['fullname']);
if (!preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filename)) // If not a tmp file
{
dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it");
@ -379,8 +385,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
}
}
}
/*var_dump($filearray);*/
//var_dump($filearray); var_dump($relativedir.' - tmpfilename='.$tmpfilename.' - found='.$found);
}

View File

@ -3190,7 +3190,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cubes',
'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'external-link-alt', 'external-link-square-alt',
'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
'help', 'holiday',
'intervention', 'label', 'language', 'list', 'listlight', 'lot',
@ -6260,7 +6260,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : '');
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '');
$substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? ($outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '')) : '');
$birthday = dol_print_date($object->birth, 'day');

View File

@ -90,16 +90,6 @@ function product_prepare_head($object)
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id;
$head[$h][1] = $langs->trans('Statistics');
$head[$h][2] = 'stats';
$h++;
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id;
$head[$h][1] = $langs->trans('Referers');
$head[$h][2] = 'referers';
$h++;
if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
global $db;
@ -149,6 +139,16 @@ function product_prepare_head($object)
}
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id;
$head[$h][1] = $langs->trans('Referers');
$head[$h][2] = 'referers';
$h++;
$head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id;
$head[$h][1] = $langs->trans('Statistics');
$head[$h][2] = 'stats';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -239,7 +239,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
}
print '</div>';
if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
print '<div class="poweredbypublicpayment opacitymedium right"><a href="https://www.dolibarr.org" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref?utm_medium=website&utm_source=poweredby" href="https://www.dolibarr.org" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
}
print '</div>';
}

View File

@ -137,7 +137,7 @@ function user_prepare_head($object)
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))
|| (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
|| (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all))
|| (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall))
) {
// Bank
$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;

View File

@ -1800,7 +1800,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
}
$newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all);
$newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall);
$newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
}

View File

@ -93,7 +93,7 @@ class pdf_ban extends ModeleBankAccountDoc
/**
* Fonction generant le projet sur le disque
*
* @param Project $object Object project a generer
* @param Account $object Object Account to generate
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
@ -114,8 +114,7 @@ class pdf_ban extends ModeleBankAccountDoc
//$nblines = count($object->lines); // This is set later with array of tasks
// Definition of $dir and $file
if ($object->specimen)
{
if ($object->specimen) {
$dir = $conf->bank->dir_output;
$file = $dir."/SPECIMEN.pdf";
} else {
@ -151,7 +150,7 @@ class pdf_ban extends ModeleBankAccountDoc
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -293,7 +292,7 @@ class pdf_ban extends ModeleBankAccountDoc
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Project $object Object to show
* @param Account $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -378,7 +377,7 @@ class pdf_ban extends ModeleBankAccountDoc
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Project $object Object to show
* @param Account $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
@ -388,7 +387,7 @@ class pdf_ban extends ModeleBankAccountDoc
// phpcs:enable
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
//return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}

View File

@ -90,16 +90,16 @@ class pdf_sepamandate extends ModeleBankAccountDoc
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant le projet sur le disque
* Function to create pdf of company bank account sepa mandate
*
* @param Project $object Object project a generer
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details (not used for this template)
* @param int $hidedesc Do not show desc (not used for this template)
* @param int $hideref Do not show ref (not used for this template)
* @param null|array $moreparams More parameters
* @return int 1 if OK, <=0 if KO
* @param CompanyBankAccount $object Object bank account to generate document for
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details (not used for this template)
* @param int $hidedesc Do not show desc (not used for this template)
* @param int $hideref Do not show ref (not used for this template)
* @param null|array $moreparams More parameters
* @return int 1 if OK, <=0 if KO
*/
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
@ -157,7 +157,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -447,10 +447,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @param TCPDF $pdf Object PDF
* @param CompanyBankAccount $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
*/
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
@ -485,11 +485,11 @@ class pdf_sepamandate extends ModeleBankAccountDoc
/**
* Show area for the customer to sign
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
* @param TCPDF $pdf Object PDF
* @param CompanyBankAccount $object Object invoice
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
protected function _signature_area(&$pdf, $object, $posy, $outputlangs)
{
@ -527,10 +527,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc
/**
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Project $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param TCPDF $pdf Object PDF
* @param CompanyBankAccount $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
@ -615,20 +615,20 @@ class pdf_sepamandate extends ModeleBankAccountDoc
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Show footer of page. Need this->emetteur object
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Project $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
* @param TCPDF $pdf PDF
* @param CompanyBankAccount $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
// phpcs:enable
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -132,7 +132,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -399,9 +399,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
// Line of free text
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);

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-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -204,7 +204,7 @@ class pdf_einstein extends ModelePDFCommandes
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Commande $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -280,7 +280,7 @@ class pdf_einstein extends ModelePDFCommandes
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
if (class_exists('TCPDF'))
{
@ -343,7 +343,7 @@ class pdf_einstein extends ModelePDFCommandes
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -655,7 +655,7 @@ class pdf_einstein extends ModelePDFCommandes
* Show payments table
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object order
* @param Commande $object Object order
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
@ -671,7 +671,7 @@ class pdf_einstein extends ModelePDFCommandes
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Commande $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return int
@ -741,7 +741,7 @@ class pdf_einstein extends ModelePDFCommandes
}*/
// Show planed date of delivery
if (!empty($object->date_livraison))
if (!empty($object->delivery_date))
{
$outputlangs->load("sendings");
$pdf->SetFont('', 'B', $default_font_size - 2);
@ -750,12 +750,12 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
$posy = $pdf->GetY() + 1;
} elseif ($object->availability_code || $object->availability) // Show availability conditions
{
} elseif ($object->availability_code || $object->availability) {
// Show availability conditions
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
@ -859,7 +859,7 @@ class pdf_einstein extends ModelePDFCommandes
* Show total to pay
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param Commande $object Object invoice
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
@ -1242,7 +1242,7 @@ class pdf_einstein extends ModelePDFCommandes
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Commande $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param Translate $outputlangsbis Object lang for output bis
@ -1495,7 +1495,7 @@ class pdf_einstein extends ModelePDFCommandes
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Commande $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -1504,7 +1504,7 @@ class pdf_einstein extends ModelePDFCommandes
{
// phpcs:enable
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

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-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -188,7 +188,7 @@ class pdf_eratosthene extends ModelePDFCommandes
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Commande $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -381,7 +381,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -876,7 +876,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* Show payments table
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object order
* @param Commande $object Object order
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
@ -889,7 +889,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Commande $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return int Pos y
@ -958,7 +958,7 @@ class pdf_eratosthene extends ModelePDFCommandes
}*/
// Show planed date of delivery
if (!empty($object->date_livraison))
if (!empty($object->delivery_date))
{
$outputlangs->load("sendings");
$pdf->SetFont('', 'B', $default_font_size - 2);
@ -967,7 +967,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
$posy = $pdf->GetY() + 1;
@ -1074,8 +1074,8 @@ class pdf_eratosthene extends ModelePDFCommandes
/**
* Show total to pay
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param TCPDF $pdf Object PDF
* @param Commande $object Object to show
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
@ -1404,7 +1404,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Commande $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param Translate $outputlangsbis Object lang for output bis
@ -1658,7 +1658,7 @@ class pdf_eratosthene extends ModelePDFCommandes
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Commande $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -1667,7 +1667,7 @@ class pdf_eratosthene extends ModelePDFCommandes
{
// phpcs:enable
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
@ -1676,7 +1676,7 @@ class pdf_eratosthene extends ModelePDFCommandes
/**
* Define Array Column Field
*
* @param object $object common object
* @param Commande $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc

View File

@ -63,7 +63,7 @@ class pdf_proforma extends pdf_eratosthene
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Commande $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param string $titlekey Translation key to show as title of document

View File

@ -6,7 +6,7 @@
* Copyright (C) 2011 Fabrice CHERRIER
* Copyright (C) 2013-2020 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -164,8 +164,8 @@ class pdf_strato extends ModelePDFContract
/**
* Function to build pdf onto disk
*
* @param CommonObject $object Id of object to generate
* @param object $outputlangs Lang output object
* @param Contrat $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
@ -226,7 +226,7 @@ class pdf_strato extends ModelePDFContract
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -580,7 +580,7 @@ class pdf_strato extends ModelePDFContract
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param CommonObject $object Object to show
* @param Contrat $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -756,7 +756,7 @@ class pdf_strato extends ModelePDFContract
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param CommonObject $object Object to show
* @param Contrat $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
@ -764,7 +764,7 @@ class pdf_strato extends ModelePDFContract
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'CONTRACT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -285,7 +285,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$heightforinfotot = 30; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -346,7 +346,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -652,7 +652,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Delivery $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
@ -730,7 +730,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Delivery $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -906,8 +906,8 @@ class pdf_storm extends ModelePDFDeliveryOrder
/**
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param TCPDF $pdf PDF
* @param Delivery $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -915,7 +915,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
@ -924,7 +924,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
/**
* Define Array Column Field
*
* @param object $object common object
* @param Delivery $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc

View File

@ -175,7 +175,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Delivery $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -240,7 +240,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$heightforinfotot = 30; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -318,7 +318,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -628,7 +628,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Delivery $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
@ -723,7 +723,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Delivery $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -897,7 +897,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Delivery $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -905,7 +905,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -139,7 +139,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
return 0;
}
$numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison);
$numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->delivery_date);
return $numFinal;
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -146,7 +146,7 @@ class pdf_espadon extends ModelePdfExpedition
/**
* Function to build pdf onto disk
*
* @param Object $object Object expedition to generate (or id if old method)
* @param Expedition $object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -270,7 +270,7 @@ class pdf_espadon extends ModelePdfExpedition
$heightforinfotot = 8; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -319,7 +319,7 @@ class pdf_espadon extends ModelePdfExpedition
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -672,7 +672,7 @@ class pdf_espadon extends ModelePdfExpedition
* Show total to pay
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param Expedition $object Object expedition
* @param int $deja_regle Amount already paid
* @param int $posy Start Position
* @param Translate $outputlangs Objet langs
@ -823,7 +823,7 @@ class pdf_espadon extends ModelePdfExpedition
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Expedition $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -1066,7 +1066,7 @@ class pdf_espadon extends ModelePdfExpedition
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Expedition $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -1074,14 +1074,14 @@ class pdf_espadon extends ModelePdfExpedition
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
/**
* Define Array Column Field
*
* @param object $object common object
* @param Expedition $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc

View File

@ -146,7 +146,7 @@ class pdf_merou extends ModelePdfExpedition
/**
* Function to build pdf onto disk
*
* @param Object $object Object expedition to generate (or id if old method)
* @param Expedition $object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -227,7 +227,7 @@ class pdf_merou extends ModelePdfExpedition
$heightforinfotot = 0; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -481,7 +481,7 @@ class pdf_merou extends ModelePdfExpedition
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Expedition $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
@ -510,7 +510,7 @@ class pdf_merou extends ModelePdfExpedition
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Expedition $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -178,7 +178,7 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Function to build pdf onto disk
*
* @param Object $object Object expedition to generate (or id if old method)
* @param Expedition $object Object expedition to generate (or id if old method)
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -291,7 +291,7 @@ class pdf_rouget extends ModelePdfExpedition
$heightforinfotot = 8; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -338,7 +338,7 @@ class pdf_rouget extends ModelePdfExpedition
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -662,8 +662,8 @@ class pdf_rouget extends ModelePdfExpedition
/**
* Show total to pay
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param TCPDF $pdf Object PDF
* @param Expedition $object Object invoice
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
@ -858,7 +858,7 @@ class pdf_rouget extends ModelePdfExpedition
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Expedition $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -1101,7 +1101,7 @@ class pdf_rouget extends ModelePdfExpedition
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Expedition $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -1109,7 +1109,7 @@ class pdf_rouget extends ModelePdfExpedition
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SHIPPING_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Francis Appels <francis.appels@z-application.com>
* Copyright (C) 2019 Markus Welters <markus@welters.de>
* Copyright (C) 2019 Rafael Ingenleuf <ingenleuf@welters.de>
@ -199,13 +199,13 @@ class pdf_standard extends ModeleExpenseReport
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
* @param ExpenseReport $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
@ -260,7 +260,7 @@ class pdf_standard extends ModeleExpenseReport
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 12; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
@ -558,13 +558,13 @@ class pdf_standard extends ModeleExpenseReport
}
/**
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $linenumber line number
* @param int $curY current y position
* @param int $default_font_size default siez of font
* @param Translate $outputlangs Object lang for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param TCPDF $pdf Object PDF
* @param ExpenseReport $object Object to show
* @param int $linenumber line number
* @param int $curY current y position
* @param int $default_font_size default siez of font
* @param Translate $outputlangs Object lang for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @return void
*/
protected function printLine(&$pdf, $object, $linenumber, $curY, $default_font_size, $outputlangs, $hidedetails = 0)
@ -644,10 +644,10 @@ class pdf_standard extends ModeleExpenseReport
/**
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param TCPDF $pdf Object PDF
* @param ExpenseReport $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
@ -981,11 +981,11 @@ class pdf_standard extends ModeleExpenseReport
/**
* Show payments table
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object invoice
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
* @param TCPDF $pdf Object PDF
* @param ExpenseReport $object Object expensereport
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
*/
protected function tablePayments(&$pdf, $object, $posy, $outputlangs)
{
@ -1093,16 +1093,16 @@ class pdf_standard extends ModeleExpenseReport
/**
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
* @param TCPDF $pdf PDF
* @param ExpenseReport $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
*/
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'EXPENSEREPORT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -220,7 +220,7 @@ class pdf_crabe extends ModelePDFFactures
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Facture $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -276,9 +276,9 @@ class pdf_crabe extends ModelePDFFactures
{
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_credit_notes_included = $object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_deposits_included = $object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
$amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0);
// Definition of $dir and $file
if ($object->specimen)
@ -322,9 +322,10 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetAutoPageBreak(1, 0);
$heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
if ($heightforinfotot > 220) $heightforinfotot = 220;
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
if (class_exists('TCPDF'))
{
@ -419,7 +420,7 @@ class pdf_crabe extends ModelePDFFactures
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm
if ($conf->incoterm->enabled)
if (! empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -781,7 +782,7 @@ class pdf_crabe extends ModelePDFFactures
* Show payments table
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object invoice
* @param Facture $object Object invoice
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @param int $heightforfooter height for footer
@ -966,7 +967,7 @@ class pdf_crabe extends ModelePDFFactures
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Facture $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
@ -1587,7 +1588,7 @@ class pdf_crabe extends ModelePDFFactures
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Facture $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -1890,7 +1891,7 @@ class pdf_crabe extends ModelePDFFactures
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Facture $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -1898,7 +1899,7 @@ class pdf_crabe extends ModelePDFFactures
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -197,7 +197,7 @@ class pdf_sponge extends ModelePDFFactures
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Facture $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -422,7 +422,7 @@ class pdf_sponge extends ModelePDFFactures
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -926,7 +926,7 @@ class pdf_sponge extends ModelePDFFactures
* Show payments table
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object invoice
* @param Facture $object Object invoice
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
@ -1064,7 +1064,7 @@ class pdf_sponge extends ModelePDFFactures
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Facture $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return int Pos y
@ -1829,7 +1829,7 @@ class pdf_sponge extends ModelePDFFactures
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Facture $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param Translate $outputlangsbis Object lang for output bis
@ -2150,7 +2150,7 @@ class pdf_sponge extends ModelePDFFactures
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Facture $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -2158,14 +2158,14 @@ class pdf_sponge extends ModelePDFFactures
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
/**
* Define Array Column Field
*
* @param object $object common object
* @param Facture $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc

View File

@ -156,7 +156,7 @@ class pdf_soleil extends ModelePDFFicheinter
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Fichinter $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -222,7 +222,7 @@ class pdf_soleil extends ModelePDFFicheinter
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -537,7 +537,7 @@ class pdf_soleil extends ModelePDFFicheinter
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Fichinter $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -710,7 +710,7 @@ class pdf_soleil extends ModelePDFFicheinter
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Fichinter $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
@ -718,7 +718,7 @@ class pdf_soleil extends ModelePDFFicheinter
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'FICHINTER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -0,0 +1,427 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/core/modules/member/doc/doc_generic_member_odt.modules.php
* \ingroup societe
* \brief File of class to build ODT documents for members
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_member.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
/**
* Class to build documents using ODF templates generator
*/
class doc_generic_member_odt extends ModelePDFMember
{
/**
* @var Societe Issuer
*/
public $emetteur;
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.6 = array(5, 6)
*/
public $phpmin = array(5, 6);
/**
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $conf, $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main", "companies"));
$this->db = $db;
$this->name = "ODT templates";
$this->description = $langs->trans("DocumentModelOdt");
$this->scandir = 'MEMBER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
// Page size for A4 format
$this->type = 'odt';
$this->page_largeur = 0;
$this->page_hauteur = 0;
$this->format = array($this->page_largeur, $this->page_hauteur);
$this->marge_gauche = 0;
$this->marge_droite = 0;
$this->marge_haute = 0;
$this->marge_basse = 0;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva MEMBER_TVAOPTION
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
// Recupere emetteur
$this->emetteur = $mysoc;
if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
}
/**
* Return description of a module
*
* @param Translate $langs Lang object to use for output
* @return string Description
*/
public function info($langs)
{
global $conf, $langs;
// Load translation files required by the page
$langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db);
$texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="MEMBER_ADDON_PDF_ODT_PATH">';
$texte .= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MEMBER_ADDON_PDF_ODT_PATH)));
$listoffiles = array();
foreach ($listofdir as $key=>$tmpdir)
{
$tmpdir = trim($tmpdir);
$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (!$tmpdir) {
unset($listofdir[$key]); continue;
}
if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
else {
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
// Add list of substitution keys
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->MEMBER_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte .= '<br></div></div>';
// Scan directories
if (count($listofdir))
{
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
foreach ($listoffiles as $file) {
$texte .= $file['name'].'<br>';
}
$texte .= '</div>';
}
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
$texte .= '<input type="hidden" value="MEMBER_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
$texte .= '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
$texte .= '</div>';
$texte .= '</td>';
$texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte .= '</td>';
$texte .= '</tr>';
$texte .= '</table>';
$texte .= '</form>';
return $texte;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
* @param Adherent $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $mode Tell if doc module is called for 'member', ...
* @param int $nooutput 1=Generate only file on disk and do not return it on response
* @return int 1 if OK, <=0 if KO
*/
public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
if (empty($srctemplatepath)) {
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
return -1;
}
// Add odtgeneration hook
if (!is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (!is_object($outputlangs)) $outputlangs = $langs;
$sav_charset_output = $outputlangs->charset_output;
$outputlangs->charset_output = 'UTF-8';
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "companies", "bills", "dict"));
if ($conf->adherent->dir_output) {
// If $object is id instead of object
if (!is_object($object)) {
$id = $object;
$object = new User($this->db);
$result = $object->fetch($id);
if ($result < 0) {
dol_print_error($this->db, $object->error);
return -1;
}
}
$object->fetch_thirdparty();
$dir = $conf->adherent->dir_output;
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
$file = $dir."/".$objectref.".odt";
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
if (file_exists($dir)) {
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile = basename($srctemplatepath);
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
$format = $conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format = '%Y%m%d%H%M%S';
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
}
$file = $dir.'/'.$filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
//print "conf->adherent->dir_temp=".$conf->adherent->dir_temp;
dol_mkdir($conf->adherent->dir_temp);
// If CUSTOMER contact defined on member, we use it
$usecontact = false;
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
if (count($arrayidcontact) > 0) {
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (!empty($usecontact)) {
// On peut utiliser le nom de la societe du contact
if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact;
} else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
} else {
$socobject = $object->thirdparty;
}
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
$odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->adherent->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
)
);
} catch (Exception $e)
{
$this->error = $e->getMessage();
dol_syslog($e->getMessage(), LOG_WARNING);
return -1;
}
// Make substitutions into odt
$array_member = $this->getSubstitutionarrayMember($object, $outputlangs);
$array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
$array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
$array_other = $this->get_substitutionarray_other($outputlangs);
// retrieve contact information for use in object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
$tmparray = array_merge($array_member, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
$tags = '';
foreach ($tmparray as $key => $value) {
$tags .= '{' . $key . '} => ' . $value ."\n";
}
$tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags));
// Call the ODTSubstitution hook
$parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs,
'substitutionarray'=>&$tmparray
);
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach ($tmparray as $key=>$value) {
try {
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) $odfHandler->setImage($key, $value);
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
} else {
// Text
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
} catch (OdfException $e) {
dol_syslog($e->getMessage(), LOG_WARNING);
}
}
// Replace labels translated
$tmparray = $outputlangs->get_translations_for_substitutions();
foreach ($tmparray as $key=>$value)
{
try {
$odfHandler->setVars($key, $value, true, 'UTF-8');
} catch (OdfException $e)
{
dol_syslog($e->getMessage(), LOG_WARNING);
}
}
// Call the beforeODTSave hook
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Write new file
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
try {
$odfHandler->exportAsAttachedPDF($file);
} catch (Exception $e) {
$this->error = $e->getMessage();
dol_syslog($e->getMessage(), LOG_WARNING);
return -1;
}
} else {
try {
$odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error = $e->getMessage();
dol_syslog($e->getMessage(), LOG_WARNING);
return -1;
}
}
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$odfHandler = null; // Destroy object
$this->result = array('fullpath'=>$file);
return 1; // Success
} else {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
return -1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get substitution array for object
*
* @param Adherent $object member
* @param Translate $outputlangs translation object
* @param string $array_key key for array
* @return array array of substitutions
*/
public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
{
// phpcs:enable
$array_other = array();
foreach ($object as $key => $value) {
if (!is_array($value) && !is_object($value)) {
$array_other[$array_key.'_'.$key] = $value;
}
}
return $array_other;
}
}

View File

@ -0,0 +1,66 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \class ModeleProductCode
* \brief Parent class for product code generators
*/
/**
* \file htdocs/core/modules/member/modules_member.php
* \ingroup members
* \brief File with parent class for generating members to PDF
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
/**
* Parent class to manage intervention document templates
*/
abstract class ModelePDFMember extends CommonDocGenerator
{
/**
* @var string Error code (or message)
*/
public $error = '';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
$type = 'member';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$list = getListOfModels($db, $type, $maxfilenamelength);
return $list;
}
}

View File

@ -60,7 +60,10 @@ class modAdherent extends DolibarrModules
$this->picto = 'member';
// Data directories to create when module is enabled
$this->dirs = array("/adherent/temp");
$this->dirs = array(
"/adherent/temp",
"/doctemplates/members",
);
// Config pages
$this->config_page_url = array("adherent.php@adherents");
@ -178,6 +181,13 @@ class modAdherent extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "MEMBER_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/members";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
// Boxes
//-------

View File

@ -140,14 +140,14 @@ class modHoliday extends DolibarrModules
$r = 0;
$this->rights[$r][0] = 20001; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read your own leave requests'; // Permission label
$this->rights[$r][1] = 'Read leave requests (yours and your subordinates)'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = 20002; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify your own leave requests'; // Permission label
$this->rights[$r][1] = 'Create/modify leave requests'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
@ -170,7 +170,7 @@ class modHoliday extends DolibarrModules
$this->rights[$r][0] = 20004; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read leave requests for everybody'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][4] = 'readall'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
@ -201,7 +201,7 @@ class modHoliday extends DolibarrModules
$this->export_code[$r] = 'leaverequest_'.$r;
$this->export_label[$r] = 'ListeCP';
$this->export_icon[$r] = 'holiday';
$this->export_permission[$r] = array(array("holiday", "read_all"));
$this->export_permission[$r] = array(array("holiday", "readall"));
$this->export_fields_array[$r] = array(
'd.rowid'=>"LeaveId", 'd.fk_type'=>'TypeOfLeaveId', 't.code'=>'TypeOfLeaveCode', 't.label'=>'TypeOfLeaveLabel', 'd.fk_user'=>'UserID',
'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.halfday'=>'HalfDay', 'none.num_open_days'=>'NbUseDaysCP',

View File

@ -246,9 +246,9 @@ class modResource extends DolibarrModules
$this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid';
$this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')';

View File

@ -101,7 +101,7 @@ class modSalaries extends DolibarrModules
$r++;
$this->rights[$r][0] = 511;
$this->rights[$r][1] = 'Read payments of employee salaries';
$this->rights[$r][1] = 'Read payments of employee salaries (yours and your subordinates)';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read';
@ -125,6 +125,13 @@ class modSalaries extends DolibarrModules
$r++;
$this->rights[$r][0] = 517;
$this->rights[$r][1] = 'Read payments of salariests of every employee';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'readall';
$r++;
$this->rights[$r][0] = 519;
$this->rights[$r][1] = 'Export payments of employee salaries';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
@ -132,6 +139,7 @@ class modSalaries extends DolibarrModules
$this->rights[$r][5] = '';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.

View File

@ -255,13 +255,16 @@ class modUser extends DolibarrModules
'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
);
$keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (empty($conf->adherent->enabled))
{
unset($this->export_fields_array[$r]['u.fk_member']);
unset($this->export_entities_array[$r]['u.fk_member']);
}
{
unset($this->export_fields_array[$r]['u.fk_member']);
unset($this->export_entities_array[$r]['u.fk_member']);
}
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
// Imports

View File

@ -1156,7 +1156,7 @@ class pdf_stdandard extends ModelePDFMovement
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2014-2018 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2014-2020 Frederic 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
@ -141,6 +141,8 @@ class printing_printipp extends PrintingDriver
$ipp->setPort($this->port);
$ipp->setJobName($file, true);
$ipp->setUserName($this->userid);
// Set default number of copy
$ipp->setCopies(1);
if (!empty($this->user)) $ipp->setAuthentication($this->user, $this->password);
// select printer uri for module order, propal,...
@ -148,10 +150,11 @@ class printing_printipp extends PrintingDriver
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj)
{
if ($obj) {
dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id);
$ipp->setPrinterURI($obj->printer_id);
// Set number of copy
$ipp->setCopies($obj->copy);
} else {
if (!empty($conf->global->PRINTIPP_URI_DEFAULT))
{
@ -167,8 +170,6 @@ class printing_printipp extends PrintingDriver
dol_print_error($this->db);
}
// Set number of copy
$ipp->setCopies($obj->copy);
$fileprint = $conf->{$module}->dir_output;
if ($subdir != '') $fileprint .= '/'.$subdir;
$fileprint .= '/'.$file;

View File

@ -221,7 +221,7 @@ class pdf_standard extends ModelePDFProduct
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
if (class_exists('TCPDF'))
{
@ -690,7 +690,7 @@ class pdf_standard extends ModelePDFProduct
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Product $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param string $titlekey Translation key to show as title of document
@ -837,7 +837,7 @@ class pdf_standard extends ModelePDFProduct
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Product $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -845,7 +845,7 @@ class pdf_standard extends ModelePDFProduct
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -38,26 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
class pdf_baleine extends ModelePDFProjects
{
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var string model name
*/
public $name;
/**
* @var string model description (short text)
*/
public $description;
/**
* @var string document type
*/
public $type;
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.6 = array(5, 6)
@ -70,44 +50,9 @@ class pdf_baleine extends ModelePDFProjects
*/
public $version = 'dolibarr';
/**
* @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;
/**
* Issuer
* @var Societe object that emits
* @var Societe Object that emits
*/
public $emetteur;
@ -149,10 +94,10 @@ class pdf_baleine extends ModelePDFProjects
// Define position of columns
$this->posxref = $this->marge_gauche + 1;
$this->posxlabel = $this->marge_gauche + 25;
$this->posxworkload = $this->marge_gauche + 120;
$this->posxprogress = $this->marge_gauche + 140;
$this->posxdatestart = $this->marge_gauche + 152;
$this->posxdateend = $this->marge_gauche + 170;
$this->posxworkload = $this->marge_gauche + 117;
$this->posxprogress = $this->marge_gauche + 137;
$this->posxdatestart = $this->marge_gauche + 147;
$this->posxdateend = $this->marge_gauche + 169;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxref -= 20;
@ -224,7 +169,7 @@ class pdf_baleine extends ModelePDFProjects
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
if (class_exists('TCPDF'))
{
@ -420,7 +365,8 @@ class pdf_baleine extends ModelePDFProjects
// Progress
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, $progress, 0, 'R');
// Date
// Date start and end
$pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C');
$pdf->SetXY($this->posxdateend, $curY);
@ -538,7 +484,7 @@ class pdf_baleine extends ModelePDFProjects
// Draw rect of all tab (title + lines). Rect takes a length in 3rd parameter
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height);
// line takes a position y in 3rd parameter
// Line takes a position y in 3rd parameter
$pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline);
$pdf->SetTextColor(0, 0, 0);
@ -556,11 +502,13 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetXY($this->posxprogress, $tab_top + 1);
$pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R');
// Date start
$pdf->SetXY($this->posxdatestart, $tab_top + 1);
$pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C');
$pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $outputlangs->trans("Start"), 0, 'C');
// Date end
$pdf->SetXY($this->posxdateend, $tab_top + 1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $outputlangs->trans("End"), 0, 'C');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
@ -667,7 +615,7 @@ class pdf_baleine extends ModelePDFProjects
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -111,14 +111,14 @@ class pdf_beluga extends ModelePDFProjects
if ($this->orientation == 'L' || $this->orientation == 'Landscape') {
$this->posxref = $this->marge_gauche + 1;
$this->posxdate = $this->marge_gauche + 105;
$this->posxsociety = $this->marge_gauche + 125;
$this->posxsociety = $this->marge_gauche + 126;
$this->posxamountht = $this->marge_gauche + 190;
$this->posxamountttc = $this->marge_gauche + 215;
$this->posxstatut = $this->marge_gauche + 245;
} else {
$this->posxref = $this->marge_gauche + 1;
$this->posxdate = $this->marge_gauche + 25;
$this->posxsociety = $this->marge_gauche + 45;
$this->posxsociety = $this->marge_gauche + 46;
$this->posxamountht = $this->marge_gauche + 110;
$this->posxamountttc = $this->marge_gauche + 135;
$this->posxstatut = $this->marge_gauche + 165;
@ -196,7 +196,7 @@ class pdf_beluga extends ModelePDFProjects
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
if (class_exists('TCPDF'))
{
@ -818,7 +818,7 @@ class pdf_beluga extends ModelePDFProjects
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -37,9 +37,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
class pdf_timespent extends ModelePDFProjects
{
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.6 = array(5, 6)
*/
public $phpmin = array(5, 6);
/**
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr';
/**
* Issuer
* @var Societe
* @var Societe Object that emits
*/
public $emetteur;
@ -81,25 +93,26 @@ class pdf_timespent extends ModelePDFProjects
// Define position of columns
$this->posxref = $this->marge_gauche + 1;
$this->posxlabel = $this->marge_gauche + 25;
$this->posxworkload = $this->marge_gauche + 100;
$this->posxtimespent = $this->marge_gauche + 120;
//$this->posxprogress=$this->marge_gauche+140;
$this->posxdatestart = $this->marge_gauche + 152;
$this->posxdateend = $this->marge_gauche + 170;
$this->posxuser = $this->marge_gauche + 147;
//$this->posxdateend = $this->marge_gauche + 169;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxref -= 20;
$this->posxlabel -= 20;
$this->posxtimespent -= 20;
//$this->posxprogress-=20;
$this->posxdatestart -= 20;
$this->posxdateend -= 20;
$this->posxuser -= 20;
//$this->posxdateend -= 20;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant le projet sur le disque
* Function to build pdf project onto disk
*
* @param Project $object Object project a generer
* @param Translate $outputlangs Lang output object
@ -156,6 +169,7 @@ class pdf_timespent extends ModelePDFProjects
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
if (class_exists('TCPDF'))
{
@ -227,7 +241,7 @@ class pdf_timespent extends ModelePDFProjects
// Rect takes a length in 3rd parameter
$pdf->SetDrawColor(192, 192, 192);
$pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
$pdf->Rect($this->marge_gauche, $tab_top - 2, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY + 6;
@ -240,6 +254,10 @@ class pdf_timespent extends ModelePDFProjects
$curY = $tab_top + $heightoftitleline + 1;
$nexY = $tab_top + $heightoftitleline + 1;
$tmpuser = new User($this->db);
// TODO We should loop on record of times spent grouped by user instead of lines of tasks
// Loop on each lines
for ($i = 0; $i < $nblines; $i++)
{
@ -340,22 +358,24 @@ class pdf_timespent extends ModelePDFProjects
$pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1;
}
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
$pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
// Ref of task
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
// timespent
$pdf->SetXY($this->posxtimespent, $curY);
$pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $duration ? $duration : '', 0, 'R');
$pdf->MultiCell($this->posxuser - $this->posxtimespent, 3, $duration ? $duration : '', 0, 'R');
// Progress
//$pdf->SetXY($this->posxprogress, $curY);
//$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
// Date
$pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $datestart, 0, 'C');
$pdf->SetXY($this->posxdateend, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdateend, 3, $dateend, 0, 'C');
//$pdf->MultiCell($this->posxuser-$this->posxprogress, 3, $progress, 0, 'R');
// User spending time
/*var_dump($object->lines[$i]);exit;
$tmpuser->fetch($object->lines[$i]->fk_user);
$pdf->SetXY($this->posxuser, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxuser, 3, $tmpuser->getFullName($outputlangs, 0, -1, 20), 0, 'C');
*/
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
@ -408,7 +428,7 @@ class pdf_timespent extends ModelePDFProjects
else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
// Pied de page
// Footer of the page
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
@ -469,7 +489,7 @@ class pdf_timespent extends ModelePDFProjects
// Draw rect of all tab (title + lines). Rect takes a length in 3rd parameter
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height);
// line prend une position y en 3eme param
// Line takes a position y in 3rd parameter
$pdf->line($this->marge_gauche, $tab_top + $heightoftitleline, $this->page_largeur - $this->marge_droite, $tab_top + $heightoftitleline);
$pdf->SetTextColor(0, 0, 0);
@ -482,16 +502,13 @@ class pdf_timespent extends ModelePDFProjects
$pdf->MultiCell($this->posxtimespent - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
$pdf->SetXY($this->posxtimespent, $tab_top + 1);
$pdf->MultiCell($this->posxdatestart - $this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R');
$pdf->MultiCell($this->posxuser - $this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R');
//$pdf->SetXY($this->posxprogress, $tab_top+1);
//$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R');
//$pdf->MultiCell($this->posxuser - $this->posxprogress, 3, '%', 0, 'R');
$pdf->SetXY($this->posxdatestart, $tab_top + 1);
$pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, $outputlangs->transnoentities("Date"), 0, 'C');
$pdf->SetXY($this->posxdateend, $tab_top + 1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
$pdf->SetXY($this->posxuser, $tab_top + 1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxuser, 3, '', 0, 'C');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
@ -598,7 +615,7 @@ class pdf_timespent extends ModelePDFProjects
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROJECT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -31,6 +31,61 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
*/
abstract class ModelePDFProjects extends CommonDocGenerator
{
/**
* @var DoliDb Database handler
*/
public $db;
/**
* @var string model name
*/
public $name;
/**
* @var string model description (short text)
*/
public $description;
/**
* @var string document type
*/
public $type;
/**
* @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;
/**
* @var string Error code (or message)
*/

View File

@ -204,7 +204,7 @@ class pdf_azur extends ModelePDFPropales
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Propal $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -383,7 +383,7 @@ class pdf_azur extends ModelePDFPropales
$heightforsignature = empty($conf->global->PROPAL_DISABLE_SIGNATURE) ? (pdfGetHeightForHtmlContent($pdf, $outputlangs->transnoentities("ProposalCustomerSignature")) + 10) : 0;
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
//print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit;
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
@ -396,7 +396,7 @@ class pdf_azur extends ModelePDFPropales
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -827,8 +827,8 @@ class pdf_azur extends ModelePDFPropales
/**
* Show payments table
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object proposal
* @param TCPDF $pdf Object PDF
* @param Propal $object Object proposal
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
@ -844,7 +844,7 @@ class pdf_azur extends ModelePDFPropales
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Propal $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
@ -870,7 +870,7 @@ class pdf_azur extends ModelePDFPropales
$posxval = 52;
// Show shipping date
if (!empty($object->date_livraison))
if (!empty($object->delivery_date))
{
$outputlangs->load("sendings");
$pdf->SetFont('', 'B', $default_font_size - 2);
@ -879,7 +879,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
$posy = $pdf->GetY() + 1;
@ -1415,7 +1415,7 @@ class pdf_azur extends ModelePDFPropales
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Propal $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
@ -1666,7 +1666,7 @@ class pdf_azur extends ModelePDFPropales
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Propal $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -1674,7 +1674,7 @@ class pdf_azur extends ModelePDFPropales
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
@ -1684,7 +1684,7 @@ class pdf_azur extends ModelePDFPropales
* Show area for the customer to sign
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param Propal $object Object invoice
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @return int Position pour suite

View File

@ -187,7 +187,7 @@ class pdf_cyan extends ModelePDFPropales
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Propal $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
@ -384,7 +384,7 @@ class pdf_cyan extends ModelePDFPropales
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -967,8 +967,8 @@ class pdf_cyan extends ModelePDFPropales
/**
* Show payments table
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object proposal
* @param TCPDF $pdf Object PDF
* @param Propal $object Object proposal
* @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK
@ -981,7 +981,7 @@ class pdf_cyan extends ModelePDFPropales
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Propal $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return int Pos y
@ -1006,7 +1006,7 @@ class pdf_cyan extends ModelePDFPropales
$posxval = 52;
// Show shipping date
if (!empty($object->date_livraison))
if (!empty($object->delivery_date))
{
$outputlangs->load("sendings");
$pdf->SetFont('', 'B', $default_font_size - 2);
@ -1015,7 +1015,7 @@ class pdf_cyan extends ModelePDFPropales
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
$posy = $pdf->GetY() + 1;
@ -1158,8 +1158,8 @@ class pdf_cyan extends ModelePDFPropales
/**
* Show total to pay
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param TCPDF $pdf Object PDF
* @param Propal $object Object proposal
* @param int $deja_regle Montant deja regle
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
@ -1507,7 +1507,7 @@ class pdf_cyan extends ModelePDFPropales
* Show top header of page.
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param Propal $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param Translate $outputlangsbis Object lang for output bis
@ -1553,8 +1553,7 @@ class pdf_cyan extends ModelePDFPropales
} else {
$logo = $logodir.'/logos/'.$this->emetteur->logo;
}
if (is_readable($logo))
{
if (is_readable($logo)) {
$height = pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
} else {
@ -1762,7 +1761,7 @@ class pdf_cyan extends ModelePDFPropales
* Show footer of page. Need this->emetteur object
*
* @param TCPDF $pdf PDF
* @param Object $object Object to show
* @param Propal $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text
@ -1770,15 +1769,15 @@ class pdf_cyan extends ModelePDFPropales
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
/**
* Show area for the customer to sign
*
* @param TCPDF $pdf Object PDF
* @param Facture $object Object invoice
* @param TCPDF $pdf Object PDF
* @param Propal $object Object proposal
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
@ -1813,7 +1812,7 @@ class pdf_cyan extends ModelePDFPropales
/**
* Define Array Column Field
*
* @param object $object common object
* @param Propal $object object proposal
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc

View File

@ -254,7 +254,7 @@ class pdf_squille extends ModelePdfReception
// Incoterm
$height_incoterms = 0;
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -1012,7 +1012,7 @@ class pdf_squille extends ModelePdfReception
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'RECEPTION_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -912,7 +912,7 @@ class pdf_standard extends ModelePDFStock
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'PRODUCT_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -275,7 +275,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
if (class_exists('TCPDF'))
{
@ -336,7 +336,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -1263,7 +1263,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -292,7 +292,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -342,7 +342,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -1276,11 +1276,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0, 0, 60);
$usehourmin = 'day';
if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour';
if (!empty($object->date_livraison))
if (!empty($object->delivery_date))
{
$posy += 4;
$pdf->SetXY($posx - 90, $posy);
$pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R');
$pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R');
}
if ($object->thirdparty->code_fournisseur)
@ -1425,7 +1425,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}

View File

@ -308,7 +308,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -370,7 +370,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
// Incoterm
if ($conf->incoterm->enabled)
if (!empty($conf->incoterm->enabled))
{
$desc_incoterms = $object->getIncotermsForPDF();
if ($desc_incoterms)
@ -1190,11 +1190,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetTextColor(0, 0, 60);
$usehourmin = 'day';
if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour';
if (!empty($object->date_livraison))
if (!empty($object->delivery_date))
{
$posy += 4;
$pdf->SetXY($posx - 90, $posy);
$pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R');
$pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R');
}
if ($object->thirdparty->code_fournisseur)
@ -1338,7 +1338,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -267,7 +267,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -798,7 +798,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -297,7 +297,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF'))
@ -724,7 +724,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$posxval = 52;
// Show shipping date
if (!empty($object->date_livraison))
if (!empty($object->delivery_date))
{
$outputlangs->load("sendings");
$pdf->SetFont('', 'B', $default_font_size - 2);
@ -733,7 +733,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
$posy = $pdf->GetY() + 1;
@ -745,7 +745,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
//$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true);
//$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true);
$pdf->MultiCell(80, 4, '', 0, 'L');
$posy = $pdf->GetY() + 1;
@ -1325,7 +1325,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison, "day", false, $outputlangs, true), '', 'R');
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R');
*/
if ($object->thirdparty->code_fournisseur)
@ -1469,7 +1469,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
}
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 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
@ -114,7 +114,7 @@ class doc_generic_user_odt extends ModelePDFUser
$form = new Form($this->db);
$texte = $this->description.".<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="USER_ADDON_PDF_ODT_PATH">';
@ -187,7 +187,17 @@ class doc_generic_user_odt extends ModelePDFUser
$texte .= "</td></tr>";
$texte .= '</table>';
}
$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
foreach ($listoffiles as $file) {
$texte .= $file['name'].'<br>';
}
$texte .= '</div>';
}
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
$texte .= '<input type="hidden" value="USER_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
$texte .= '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
$texte .= '</div>';
$texte .= '</td>';

View File

View File

@ -145,7 +145,7 @@ if ($permission)
$newcardbutton = '';
if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
{
$newcardbutton .= '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'" title="'.$langs->trans('NewContact').'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
$newcardbutton .= '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$selectedCompany.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'" title="'.$langs->trans('NewContact').'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
}
print $newcardbutton;
?>

View File

@ -693,7 +693,8 @@ if (!empty($usemargins) && $user->rights->margins->creer)
$("#buying_price").val("").show();
/* Call post to load content of combo list fournprice_predef */
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': '<?php echo newToken(); ?>' }, function(data) {
var token = '<?php echo currentToken(); ?>'; // For AJAX Call we use old 'token' and not 'newtoken'
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': token }, function(data) {
if (data && data.length > 0)
{
var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0;

View File

@ -434,7 +434,8 @@ jQuery(document).ready(function()
});
/* Init field buying_price and fournprice */
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product ? $line->fk_product : 0; ?>, 'token': '<?php echo newToken(); ?>'}, function(data) {
var token = '<?php echo currentToken(); ?>'; // For AJAX Call we use old 'token' and not 'newtoken'
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product ? $line->fk_product : 0; ?>, 'token': token }, function(data) {
if (data && data.length > 0) {
var options = '';
var trouve=false;

View File

@ -77,6 +77,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
{
if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
// Do not log events when trigger is for creating event (infinite loop)
if (preg_match('/^ACTION_/', $action)) {
return 0;
}
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
//var_dump($action.' - '.$conf->global->$key);exit;

View File

@ -310,23 +310,23 @@ $sectionauto = array();
if (!empty($conf->global->ECM_AUTO_TREE_ENABLED))
{
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBySupplierProposals")); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); }
if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); }
if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); }
if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); }
if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsByHolidays")); }
if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsByBankAccount")); }
if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsByMO")); }
if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsByCandidature")); }
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers"));
if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); }
if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); }
if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); }
if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); }
if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices"))); }
if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals"))); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders"))); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); }
if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); }
if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); }
if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); }
if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); }
if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays"))); }
if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); }
if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); }
if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); }
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
}
$head = ecm_prepare_dasboard_head('');

View File

@ -97,14 +97,23 @@ $userstatic = new User($db);
// Ajout rubriques automatiques
$rowspan = 0;
$sectionauto = array();
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>$conf->product->enabled, 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); }
if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); }
if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); }
if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); }
if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices"))); }
if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals"))); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders"))); }
if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); }
if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); }
if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); }
if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); }
if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); }
if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays"))); }
if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); }
if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); }
if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); }
//***********************

View File

@ -105,6 +105,8 @@ $hookmanager->initHooks(array('expeditioncard', 'globalcard'));
$permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php
//var_dump($object->lines[0]->detail_batch);
$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int'));
/*
* Actions
@ -201,8 +203,6 @@ if (empty($reshook))
$object->size_units = GETPOST('size_units', 'int');
$object->weight_units = GETPOST('weight_units', 'int');
$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int'));
// We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver
$classname = ucfirst($object->origin);
$objectsrc = new $classname($db);
@ -936,8 +936,7 @@ if ($action == 'create')
// Date delivery planned
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">';
//print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed.
$date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST
$date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
print "</td>\n";
print '</tr>';
@ -1048,7 +1047,7 @@ if ($action == 'create')
$i++;
}
print '});
jQuery("#autoreset").click(function() {';
jQuery("#autoreset").click(function() { console.log("Reset values to 0"); ';
$i = 0;
while ($i < $numAsked)
{
@ -1076,12 +1075,12 @@ if ($action == 'create')
print '<td class="center">'.$langs->trans("QtyToShip");
if (empty($conf->productbatch->enabled))
{
print '<br><a href="#" id="autofill">'.$langs->trans("Fill").'</a>';
print '<br><a href="#" id="autofill" class="opacitymedium link cursor cursorpointer">'.$langs->trans("Fill").'</a>';
print ' / ';
} else {
print '<br>';
}
print '<a href="#" id="autoreset">'.$langs->trans("Reset").'</a>';
print '<span id="autoreset" class="opacitymedium link cursor cursorpointer">'.img_picto($langs->trans("Reset"), 'eraser').'</span>';
print '</td>';
if (!empty($conf->stock->enabled))
{
@ -1115,7 +1114,7 @@ if ($action == 'create')
if (!empty($line->date_start)) $type = 1;
if (!empty($line->date_end)) $type = 1;
print '<!-- line '.$line->rowid.' for product -->'."\n";
print '<!-- line '.$line->id.' for product -->'."\n";
print '<tr class="oddeven">'."\n";
// Product label
@ -1126,13 +1125,16 @@ if ($action == 'create')
//var_dump($product->stock_warehouse[1]);
print '<td>';
print '<a name="'.$line->rowid.'"></a>'; // ancre pour retourner sur la ligne
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne
// Show product and description
$product_static->type = $line->fk_product_type;
$product_static->id = $line->fk_product;
$product_static->ref = $line->ref;
$product_static->status = $line->product_tosell;
$product_static->status_buy = $line->product_tobuy;
$product_static->status_batch = $line->product_tobatch;
$text = $product_static->getNomUrl(1);
$text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc));
@ -2049,7 +2051,7 @@ if ($action == 'create')
$sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot";
$sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
//if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received";
$sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
$sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch';
$sql .= ', p.description as product_desc';
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql .= ", ".MAIN_DB_PREFIX."expedition as e";
@ -2076,7 +2078,10 @@ if ($action == 'create')
if ($obj)
{
// $obj->rowid is rowid in $origin."det" table
$alreadysent[$obj->rowid][$obj->shipmentline_id] = array('shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery));
$alreadysent[$obj->rowid][$obj->shipmentline_id] = array(
'shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped,
'product_tosell'=>$obj->product_tosell, 'product_tobuy'=>$obj->product_tobuy, 'product_tobatch'=>$obj->product_tobatch,
'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery));
}
$i++;
}
@ -2085,6 +2090,7 @@ if ($action == 'create')
}
print '<tbody>';
// Loop on each product to send/sent
for ($i = 0; $i < $num_prod; $i++)
{
@ -2120,6 +2126,8 @@ if ($action == 'create')
$product_static->type = $lines[$i]->fk_product_type;
$product_static->id = $lines[$i]->fk_product;
$product_static->ref = $lines[$i]->ref;
$product_static->status = $lines[$i]->product_tosell;
$product_static->status_buy = $lines[$i]->product_tobuy;
$product_static->status_batch = $lines[$i]->product_tobatch;
$product_static->weight = $lines[$i]->weight;

View File

@ -619,10 +619,8 @@ class Expedition extends CommonObject
// Tracking url
$this->getUrlTrackingStatus($obj->tracking_number);
/*
* Thirdparty
*/
$result = $this->fetch_thirdparty();
// Thirdparty
$result = $this->fetch_thirdparty(); // TODO Remove this
// Retrieve extrafields
$this->fetch_optionals();
@ -919,6 +917,7 @@ class Expedition extends CommonObject
$line->entrepot_id = $entrepot_id;
$line->origin_line_id = $id;
$line->fk_origin_line = $id;
$line->qty = $qty;
$orderline = new OrderLine($this->db);
@ -931,31 +930,37 @@ class Expedition extends CommonObject
{
$fk_product = $orderline->fk_product;
if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS))
{
if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) {
$langs->load("errors");
$this->error = $langs->trans("ErrorWarehouseRequiredIntoShipmentLine");
return -1;
}
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)
{
// Check must be done for stock of product into warehouse if $entrepot_id defined
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) {
$product = new Product($this->db);
$result = $product->fetch($fk_product);
$product->fetch($fk_product);
// Check must be done for stock of product into warehouse if $entrepot_id defined
if ($entrepot_id > 0) {
$product->load_stock('warehouseopen');
$product_stock = $product->stock_warehouse[$entrepot_id]->real;
} else $product_stock = $product->stock_reel;
} else {
$product_stock = $product->stock_reel;
}
$product_type = $product->type;
if ($product_type == 0 && $product_stock < $qty)
{
$langs->load("errors");
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref);
$this->db->rollback();
return -3;
if ($product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$isavirtualproduct = ($product->hasFatherOrChild(1) > 0);
// The product is qualified for a check of quantity (must be enough in stock to be added into shipment).
if (!$isavirtualproduct || empty($conf->global->PRODUIT_SOUSPRODUITS) || ($isavirtualproduct && empty($conf->global->STOCK_EXCLUDE_VIRTUAL_PRODUCTS))) { // If STOCK_EXCLUDE_VIRTUAL_PRODUCTS is set, we do not manage stock for kits/virtual products.
if ($product_stock < $qty) {
$langs->load("errors");
$this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref);
$this->errorhidden = 'ErrorStockIsNotEnoughToAddProductOnShipment';
$this->db->rollback();
return -3;
}
}
}
}
}
@ -1060,13 +1065,13 @@ class Expedition extends CommonObject
// Clean parameters
if (isset($this->ref)) $this->ref = trim($this->ref);
if (isset($this->entity)) $this->entity = trim($this->entity);
if (isset($this->entity)) $this->entity = (int) $this->entity;
if (isset($this->ref_customer)) $this->ref_customer = trim($this->ref_customer);
if (isset($this->socid)) $this->socid = trim($this->socid);
if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author);
if (isset($this->fk_user_valid)) $this->fk_user_valid = trim($this->fk_user_valid);
if (isset($this->fk_delivery_address)) $this->fk_delivery_address = trim($this->fk_delivery_address);
if (isset($this->shipping_method_id)) $this->shipping_method_id = trim($this->shipping_method_id);
if (isset($this->socid)) $this->socid = (int) $this->socid;
if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author;
if (isset($this->fk_user_valid)) $this->fk_user_valid = (int) $this->fk_user_valid;
if (isset($this->fk_delivery_address)) $this->fk_delivery_address = (int) $this->fk_delivery_address;
if (isset($this->shipping_method_id)) $this->shipping_method_id = (int) $this->shipping_method_id;
if (isset($this->tracking_number)) $this->tracking_number = trim($this->tracking_number);
if (isset($this->statut)) $this->statut = (int) $this->statut;
if (isset($this->trueDepth)) $this->trueDepth = trim($this->trueDepth);
@ -1122,15 +1127,11 @@ class Expedition extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
if (!$error)
{
if (!$notrigger)
{
// Call trigger
$result = $this->call_trigger('SHIPPING_MODIFY', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('SHIPPING_MODIFY', $user);
if ($result < 0) { $error++; }
// End call triggers
}
// Commit or rollback
@ -1171,21 +1172,16 @@ class Expedition extends CommonObject
// Add a protection to refuse deleting if shipment has at least one delivery
$this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment
if (count($this->linkedObjectsIds) > 0)
{
if (count($this->linkedObjectsIds) > 0) {
$this->error = 'ErrorThereIsSomeDeliveries';
$error++;
}
if (!$error)
{
if (!$notrigger)
{
// Call trigger
$result = $this->call_trigger('SHIPPING_CANCEL', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('SHIPPING_CANCEL', $user);
if ($result < 0) { $error++; }
// End call triggers
}
// Stock control
@ -1383,15 +1379,11 @@ class Expedition extends CommonObject
$error++;
}
if (!$error)
{
if (!$notrigger)
{
// Call trigger
$result = $this->call_trigger('SHIPPING_DELETE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('SHIPPING_DELETE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
// Stock control
@ -1589,7 +1581,7 @@ class Expedition extends CommonObject
$sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang";
$sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
$sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
$sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch";
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
$sql .= " WHERE ed.fk_expedition = ".$this->id;
@ -1651,6 +1643,8 @@ class Expedition extends CommonObject
$line->product_ref = $obj->product_ref;
$line->product_label = $obj->product_label;
$line->libelle = $obj->product_label; // TODO deprecated
$line->product_tosell = $obj->product_tosell;
$line->product_tobuy = $obj->product_tobuy;
$line->product_tobatch = $obj->product_tobatch;
$line->label = $obj->custom_label;
$line->description = $obj->description;

View File

@ -212,7 +212,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl);
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,";
$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,";
$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
@ -618,6 +618,7 @@ if ($resql)
$object = new Expedition($db);
$object->fetch($obj->rowid);
print '<tr class="oddeven">';
// Ref
@ -705,7 +706,7 @@ if ($resql)
if (!empty($arrayfields['e.date_delivery']['checked']))
{
print '<td class="center">';
print dol_print_date($db->jdate($obj->date_livraison), "dayhour");
print dol_print_date($db->jdate($obj->delivery_date), "dayhour");
/*$now = time();
if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 )
{

View File

@ -354,7 +354,7 @@ if ($id > 0 || !empty($ref))
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">';
print dol_print_date($object->date, 'day');
if ($object->hasDelay() && empty($object->date_livraison)) {
if ($object->hasDelay() && empty($object->delivery_date)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
print '</td>';
@ -374,12 +374,12 @@ if ($id > 0 || !empty($ref))
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdatedelivery">';
print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
print dol_print_date($object->date_livraison, 'dayhour');
if ($object->hasDelay() && !empty($object->date_livraison)) {
print dol_print_date($object->delivery_date, 'dayhour');
if ($object->hasDelay() && !empty($object->delivery_date)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}

View File

@ -114,6 +114,12 @@ class CommandeFournisseur extends CommonOrder
public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set
public $date_commande;
/**
* @var int Date expected for delivery
* @deprecated See delivery_date
*/
public $date_livraison;
/**
* Delivery date
*/
@ -313,7 +319,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= " c.localtax1, c.localtax2, ";
$sql .= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,";
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,";
$sql .= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,";
$sql .= " c.date_commande as date_commande, c.date_livraison as delivery_date, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,";
$sql .= " c.fk_account,";
$sql .= " c.note_private, c.note_public, c.model_pdf, c.extraparams, c.billed,";
$sql .= " c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc,";
@ -369,7 +375,8 @@ class CommandeFournisseur extends CommonOrder
$this->date_approve = $this->db->jdate($obj->date_approve);
$this->date_approve2 = $this->db->jdate($obj->date_approve2);
$this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$this->delivery_date = $this->db->jdate($obj->delivery_date);
$this->remise_percent = $obj->remise_percent;
$this->methode_commande_id = $obj->fk_input_method;
$this->methode_commande = $obj->methode_commande;
@ -771,16 +778,24 @@ class CommandeFournisseur extends CommonOrder
if (isset($this->statut)) {
$label .= ' '.$this->getLibStatut(5);
}
if (!empty($this->ref))
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_supplier))
}
if (!empty($this->ref_supplier)) {
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
if (!empty($this->total_ht))
}
if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_tva))
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ttc))
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->delivery_date)) {
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
}
}
$picto = 'order';
@ -1250,9 +1265,10 @@ class CommandeFournisseur extends CommonOrder
$error = 0;
$now = dol_now();
// $date_commande is deprecated
// set tmp vars
$date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set
if (empty($date)) $date = $now;
$delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
// Clean parameters
if (empty($this->source)) $this->source = 0;
@ -1301,7 +1317,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= ", ".$this->socid;
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
$sql .= ", '".$this->db->idate($date)."'";
$sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null");
$sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null");
$sql .= ", ".$user->id;
$sql .= ", ".self::STATUS_DRAFT;
$sql .= ", ".$this->db->escape($this->source);
@ -2313,6 +2329,7 @@ class CommandeFournisseur extends CommonOrder
{
$this->oldcopy = clone $this;
$this->date_livraison = $delivery_date;
$this->delivery_date = $delivery_date;
}
if (!$notrigger && empty($error))
@ -2889,7 +2906,7 @@ class CommandeFournisseur extends CommonOrder
}
$sql .= $clause." c.entity = ".$conf->entity;
if ($mode === 'awaiting') {
$sql .= " AND c.fk_statut = ".self::STATUS_ORDERSENT;
$sql .= " AND c.fk_statut IN (".self::STATUS_ORDERSENT.", ".self::STATUS_RECEIVED_PARTIALLY.")";
} else {
$sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.", ".self::STATUS_ACCEPTED.")";
}
@ -2910,14 +2927,15 @@ class CommandeFournisseur extends CommonOrder
if ($mode === 'awaiting') {
$response->label = $langs->trans("SuppliersOrdersAwaitingReception");
$response->labelShort = $langs->trans("AwaitingReception");
$response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3&mainmenu=commercial&leftmenu=orders_suppliers';
$response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3,4&mainmenu=commercial&leftmenu=orders_suppliers';
}
while ($obj = $this->db->fetch_object($resql))
{
$response->nbtodo++;
$commandestatic->date_livraison = $this->db->jdate($obj->delivery_date);
$commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
$commandestatic->delivery_date = $this->db->jdate($obj->delivery_date);
$commandestatic->date_commande = $this->db->jdate($obj->date_commande);
$commandestatic->statut = $obj->fk_statut;
@ -3070,12 +3088,12 @@ class CommandeFournisseur extends CommonOrder
{
global $conf;
if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility
if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility
$now = dol_now();
$date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery;
$date_to_test = empty($this->delivery_date) ? $this->date_commande : $this->delivery_date;
return ($this->statut > 0 && $this->statut < 4) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay);
return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay);
}
/**
@ -3087,9 +3105,9 @@ class CommandeFournisseur extends CommonOrder
{
global $conf, $langs;
if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility
if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility
if (empty($this->date_delivery)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
if (empty($this->delivery_date)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
else $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day');
$text .= ' '.($conf->commande->fournisseur->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->fournisseur->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today");

View File

@ -1145,7 +1145,8 @@ if (empty($reshook))
$object->fk_account = GETPOST('fk_account', 'int');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->date_livraison = $datelivraison;
$object->date_livraison = $datelivraison; // deprecated
$object->delivery_date = $datelivraison;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1199,7 +1200,8 @@ if (empty($reshook))
$result = $srcobject->fetch($object->origin_id);
if ($result > 0)
{
$object->setDeliveryDate($user, $srcobject->date_livraison);
$tmpdate = ($srcobject->delivery_date ? $srcobject->delivery_date : $srcobject->date_livraison);
$object->setDeliveryDate($user, $tmpdate);
$object->set_id_projet($user, $srcobject->fk_project);
$lines = $srcobject->lines;
@ -1551,7 +1553,7 @@ if ($action == 'create')
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '';
$datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
$datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''));
if (!empty($conf->multicurrency->enabled))
{
@ -2000,9 +2002,9 @@ if ($action == 'create')
if ($object->methode_commande_id > 0)
{
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>';
if ($object->date_commande)
{
print dol_print_date($object->date_commande, "dayhour")."\n";
print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin) : '';
if ($object->hasDelay() && !empty($object->date_delivery) && !empty($object->date_commande)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
print "</td></tr>";
@ -2160,14 +2162,14 @@ if ($action == 'create')
print '<input type="hidden" name="action" value="setdate_livraison">';
$usehourmin = 0;
if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 1;
print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison");
print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison");
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
$usehourmin = 'day';
if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour';
print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : '&nbsp;';
if ($object->hasDelay() && !empty($object->date_livraison)) {
print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : '&nbsp;';
if ($object->hasDelay() && !empty($object->delivery_date)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}

View File

@ -1050,6 +1050,7 @@ if ($resql)
$objectstatic->total_ht = $obj->total_ht;
$objectstatic->total_tva = $obj->total_tva;
$objectstatic->total_ttc = $obj->total_ttc;
$objectstatic->date_commande = $db->jdate($obj->date_commande);
$objectstatic->date_delivery = $db->jdate($obj->date_delivery);
$objectstatic->note_public = $obj->note_public;
$objectstatic->note_private = $obj->note_private;
@ -1159,8 +1160,10 @@ if ($resql)
if (!empty($arrayfields['cf.date_commande']['checked']))
{
print '<td class="center">';
if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day');
else print '';
print dol_print_date($db->jdate($obj->date_commande), 'day');
if ($objectstatic->hasDelay() && !empty($objectstatic->date_delivery)) {
print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning");
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@ -73,7 +73,7 @@ if (($id > 0) || $ref)
// Check current user can read this leave request
$canread = 0;
if (!empty($user->rights->holiday->read_all)) $canread = 1;
if (!empty($user->rights->holiday->readall)) $canread = 1;
if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) $canread = 1;
if (!$canread)
{

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