Fix with php-cs-fixer

This commit is contained in:
Laurent Destailleur 2023-12-04 13:49:31 +01:00
parent 1c9429643a
commit 4daacd3371
139 changed files with 1534 additions and 859 deletions

View File

@ -632,13 +632,15 @@ class Partnership extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'partnership/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@ -762,13 +764,15 @@ class Partnership extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'partnership/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@ -987,7 +991,7 @@ class Partnership extends CommonObject
$label = $langs->trans("ShowPartnership");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -117,7 +117,9 @@ class PartnershipUtils
$obj = $this->db->fetch_object($resql);
if ($obj) {
if (!empty($partnershipsprocessed[$obj->rowid])) continue;
if (!empty($partnershipsprocessed[$obj->rowid])) {
continue;
}
if ($somethingdoneonpartnership >= $MAXPERCALL) {
dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doCancelStatusOfMemberPartnership to avoid to reach email quota.", LOG_WARNING);
@ -139,8 +141,11 @@ class PartnershipUtils
$error++;
$this->error = $object->error;
if (is_array($object->errors) && count($object->errors)) {
if (is_array($this->errors)) $this->errors = array_merge($this->errors, $object->errors);
else $this->errors = $object->errors;
if (is_array($this->errors)) {
$this->errors = array_merge($this->errors, $object->errors);
} else {
$this->errors = $object->errors;
}
}
} else {
$partnershipsprocessed[$object->id] = $object->ref;
@ -158,7 +163,9 @@ class PartnershipUtils
// Define output language
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@ -191,7 +198,9 @@ class PartnershipUtils
if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
$this->errors[] = $cmail->error;
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
if (is_array($cmail->errors) && count($cmail->errors) > 0) {
$this->errors += $cmail->errors;
}
} else {
// Initialisation of datas of object to call trigger
if (is_object($object)) {
@ -200,7 +209,8 @@ class PartnershipUtils
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
$object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
$object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);
; // Short text ($langs->transnoentities('MailSentBy')...);
if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
$object->actionmsg2 = $subject; // Short text
}
@ -240,12 +250,16 @@ class PartnershipUtils
if (!$error) {
$this->db->commit();
$this->output = $numofexpiredmembers.' expired partnership members found'."\n";
if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
if ($erroremail) {
$this->output .= '. Got errors when sending some email : '.$erroremail;
}
} else {
$this->db->rollback();
$this->output = "Rollback after error\n";
$this->output .= $numofexpiredmembers.' expired partnership members found'."\n";
if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
if ($erroremail) {
$this->output .= '. Got errors when sending some email : '.$erroremail;
}
}
return ($error ? 1 : 0);
@ -374,7 +388,9 @@ class PartnershipUtils
// Define output language
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@ -402,7 +418,9 @@ class PartnershipUtils
if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
$this->errors[] = $cmail->error;
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
if (is_array($cmail->errors) && count($cmail->errors) > 0) {
$this->errors += $cmail->errors;
}
} else {
// Initialisation of datas of object to call trigger
if (is_object($object)) {
@ -414,7 +432,8 @@ class PartnershipUtils
}
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
$object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
$object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);
; // Short text ($langs->transnoentities('MailSentBy')...);
if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
$object->actionmsg2 = $subject; // Short text
}
@ -475,9 +494,15 @@ class PartnershipUtils
$this->output = "Rollback after error\n";
}
$this->output .= $numofexpiredmembers.' partnership checked'."\n";
if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n";
if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
if ($erroremail) {
$this->output .= '. Got errors when sending some email : '.$erroremail."\n";
}
if ($emailnotfound) {
$this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
}
if ($websitenotfound) {
$this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
}
$this->output .= "\nSQL used to find partnerships to scan: ".$sql;
return ($error ? 1 : 0);

View File

@ -83,7 +83,8 @@ class mod_partnership_standard extends ModeleNumRefPartnership
{
global $conf, $langs, $db;
$coyymm = ''; $max = '';
$coyymm = '';
$max = '';
$posindice = strlen($this->prefix) + 6;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
@ -99,7 +100,8 @@ class mod_partnership_standard extends ModeleNumRefPartnership
if ($resql) {
$row = $db->fetch_row($resql);
if ($row) {
$coyymm = substr($row[0], 0, 6); $max = $row[0];
$coyymm = substr($row[0], 0, 6);
$max = $row[0];
}
}
if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {

View File

@ -38,7 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFPartnership extends CommonDocGenerator
{
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules

View File

@ -54,7 +54,7 @@ if (GETPOST('actioncode', 'array')) {
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -93,10 +93,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
if (empty($conf->partnership->enabled)) {
accessforbidden();
}
if (empty($permissiontoread)) {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
accessforbidden();
}

View File

@ -93,8 +93,12 @@ if (!isModEnabled('partnership')) {
if (!$permissiontoread) {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
accessforbidden();
}
/*
@ -252,7 +256,9 @@ if (empty($reshook)) {
}
}
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) $object->fields['reason_decline_or_cancel']['visible'] = 3;
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) {
$object->fields['reason_decline_or_cancel']['visible'] = 3;
}
@ -539,9 +545,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$object->formAddObjectLine(1, $mysoc, $soc);
}
}
}

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("partnership", "companies", "other", "mails"));
$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$id = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
$lineid = GETPOST('lineid', 'int');
$socid = GETPOST('socid', 'int');
@ -59,10 +59,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
if (empty($conf->partnership->enabled)) {
accessforbidden();
}
if (empty($permissiontoread)) {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
accessforbidden();
}

View File

@ -83,10 +83,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
if (empty($conf->partnership->enabled)) {
accessforbidden();
}
if (empty($permissiontoread)) {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
accessforbidden();
}
@ -118,7 +126,7 @@ if ($object->id) {
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {
$totalsize += $file['size'];

View File

@ -90,7 +90,9 @@ $error = 0;
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = '';
if ($managedfor != 'member' && $sortfield == 'd.datefin') {
$sortfield = '';
}
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) {
@ -156,10 +158,18 @@ $permissiontodelete = $user->rights->partnership->delete;
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
if (empty($conf->partnership->enabled)) {
accessforbidden();
}
if (empty($permissiontoread)) {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
accessforbidden();
}
/*

View File

@ -66,10 +66,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
if (empty($conf->partnership->enabled)) {
accessforbidden();
}
if (empty($permissiontoread)) {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') {
accessforbidden();
}
if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') {
accessforbidden();
}
/*
@ -145,7 +153,7 @@ if ($id > 0 || !empty($ref)) {
}
}
}*/
$morehtmlref .= '</div>';
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -100,7 +100,7 @@ if ($action == 'setvalue' && $user->admin) {
if (!($result > 0)) {
$error++;
}
$result = dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity);
$result = dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity);
if (!($result > 0)) {
$error++;
}

View File

@ -146,8 +146,8 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG)
"&PBX_OUTPUT=".$IBS_OUTPUT.
"&PBX_SOURCE=".$PBX_SOURCE.
"&PBX_TYPEPAIEMENT=".$PBX_TYPEPAIEMENT;
"&PBX_HASH=".$PBX_HASH;
"&PBX_TIME=".$PBX_TIME;
"&PBX_HASH=".$PBX_HASH;
"&PBX_TIME=".$PBX_TIME;
$binKey = pack("H*", dol_decode($conf->global->PAYBOX_HMAC_KEY));

View File

@ -78,4 +78,4 @@ $PROXY_HOST = $conf->global->MAIN_PROXY_HOST;
$PROXY_PORT = $conf->global->MAIN_PROXY_PORT;
$PROXY_USER = $conf->global->MAIN_PROXY_USER;
$PROXY_PASS = $conf->global->MAIN_PROXY_PASS;
$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ?false:true;
$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ? false : true;

View File

@ -67,9 +67,9 @@ if ($action == 'edit_updater') {
if (!empty($action) && empty($cancel)) {
//Global variable actions
if ($action == 'create_variable' || $action == 'edit_variable') {
$price_globals->code = GETPOSTISSET('code') ?GETPOST('code', 'alpha') : $price_globals->code;
$price_globals->description = GETPOSTISSET('description') ?GETPOST('description', 'restricthtml') : $price_globals->description;
$price_globals->value = GETPOSTISSET('value') ?GETPOST('value', 'int') : $price_globals->value;
$price_globals->code = GETPOSTISSET('code') ? GETPOST('code', 'alpha') : $price_globals->code;
$price_globals->description = GETPOSTISSET('description') ? GETPOST('description', 'restricthtml') : $price_globals->description;
$price_globals->value = GETPOSTISSET('value') ? GETPOST('value', 'int') : $price_globals->value;
//Check if record already exists only when saving
if (!empty($save)) {
foreach ($price_globals->listGlobalVariables() as $entry) {

View File

@ -29,16 +29,31 @@
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--;
$j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
if (!$res) die("Include of main fails");
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
@ -52,13 +67,17 @@ $form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'inventory'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
if (!$user->admin) {
accessforbidden();
}
/*

View File

@ -166,7 +166,9 @@ if ($action == 'specimen') { // For products
$product->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0);
@ -321,7 +323,7 @@ foreach ($dirproduct as $dirroot) {
dol_syslog($e->getMessage(), LOG_ERR);
}
$modCodeProduct = new $file;
$modCodeProduct = new $file();
// Show modules according to features level
if ($modCodeProduct->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@ -436,7 +438,7 @@ foreach ($dirmodels as $reldir) {
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);

View File

@ -31,8 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
$langs->loadLangs(array("admin", "products", "productbatch"));
// Security check
if (!$user->admin || (empty($conf->productbatch->enabled)))
if (!$user->admin || (empty($conf->productbatch->enabled))) {
accessforbidden();
}
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
@ -55,7 +56,9 @@ if ($action == 'updateMaskLot') {
if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) {
$res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity);
if ($res <= 0) $error++;
if ($res <= 0) {
$error++;
}
}
if (!$error) {
@ -69,7 +72,9 @@ if ($action == 'updateMaskLot') {
if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) {
$res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity);
if ($res <= 0) $error++;
if ($res <= 0) {
$error++;
}
}
if (!$error) {
@ -209,8 +214,12 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue;
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
}
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
continue;
}
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
@ -220,9 +229,13 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
if (preg_match('/^Error/', $tmp)) {
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
} else {
print $tmp;
}
print '</td>'."\n";
print '<td class="center">';
@ -245,8 +258,9 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval);
}
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
@ -301,8 +315,12 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue;
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue;
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
continue;
}
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
continue;
}
if ($module->isEnabled()) {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
@ -312,9 +330,13 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
if (preg_match('/^Error/', $tmp)) {
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
} else {
print $tmp;
}
print '</td>'."\n";
print '<td class="center">';
@ -337,8 +359,9 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval);
}
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
@ -428,7 +451,7 @@ foreach ($dirmodels as $reldir) {
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);

View File

@ -108,7 +108,9 @@ if ($action == 'convert') {
$objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step
$ret = $objectstatic->fetch($obj->rowid);
if ($ret > 0) {
$ret = 0; $retm = 0; $updatelevel1 = false;
$ret = 0;
$retm = 0;
$updatelevel1 = false;
// Update multiprice
$listofmulti = array_reverse($objectstatic->multiprices, true); // To finish with level 1
@ -209,7 +211,9 @@ if ($action == 'convert') {
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
$ret = $objectstatic2->fetch_product_fournisseur_price($obj->rowid);
if ($ret > 0) {
$ret = 0; $retm = 0; $updatelevel1 = false;
$ret = 0;
$retm = 0;
$updatelevel1 = false;
$price_base_type = 'HT';
//$price_base_type = $objectstatic2->price_base_type; // Get price_base_type of product/service to keep the same for update

View File

@ -29,16 +29,31 @@
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--;
$j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
if (!$res) die("Include of main fails");
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
@ -52,13 +67,17 @@ $form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'stock_mouvement'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
if (!$user->admin) {
accessforbidden();
}
/*

View File

@ -44,7 +44,7 @@ if (GETPOST('actioncode', 'array')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
@ -56,7 +56,7 @@ if ($user->socid) {
$id = $user->socid;
}
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -493,9 +493,9 @@ if (empty($reshook)) {
}
if (empty($ref)) {
if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors');
$action = "create";
$error++;
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors');
$action = "create";
$error++;
}
}
if (!empty($duration_value) && empty($duration_unit)) {
@ -529,7 +529,10 @@ if (empty($reshook)) {
$vatratecode = '';
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
$localtax1 = 0;
$localtax2 = 0;
$localtax1_type = '0';
$localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
$reg = array();
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
@ -596,8 +599,8 @@ if (empty($reshook)) {
$object->duration_unit = $duration_unit;
$object->fk_default_warehouse = GETPOST('fk_default_warehouse', 'int');
$object->fk_default_workstation = GETPOST('fk_default_workstation', 'int');
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ?GETPOST('seuil_stock_alerte') : 0;
$object->desiredstock = GETPOST('desiredstock') ?GETPOST('desiredstock') : 0;
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ? GETPOST('seuil_stock_alerte') : 0;
$object->desiredstock = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0;
$object->canvas = GETPOST('canvas');
$object->net_measure = GETPOST('net_measure');
$object->net_measure_units = GETPOST('net_measure_units'); // This is not the fk_unit but the power of unit
@ -1283,7 +1286,7 @@ if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM'))
}
}
if ($res > 0) {
$modBarCodeProduct = new $module();
$modBarCodeProduct = new $module();
}
}
@ -1460,7 +1463,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
if ($showbarcode) {
print '<tr><td>'.$langs->trans('BarcodeType').'</td><td>';
if (GETPOSTISSET('fk_barcode_type')) {
$fk_barcode_type = GETPOST('fk_barcode_type')?GETPOST('fk_barcode_type'):0;
$fk_barcode_type = GETPOST('fk_barcode_type') ? GETPOST('fk_barcode_type') : 0;
} else {
if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) {
$fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE");
@ -1528,11 +1531,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
}
if ($type == $object::TYPE_SERVICE && isModEnabled("workstation")) {
// Default workstation
print '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>';
print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1);
print '</td></tr>';
// Default workstation
print '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>';
print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"');
print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1);
print '</td></tr>';
}
// Duration
@ -1568,7 +1571,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"');
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
print '</td></tr>';
}
@ -1579,21 +1582,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print '<input name="size" class="width50" value="'.GETPOST('size').'"> x ';
print '<input name="sizewidth" class="width50" value="'.GETPOST('sizewidth').'"> x ';
print '<input name="sizeheight" class="width50" value="'.GETPOST('sizeheight').'">';
print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ?GETPOST('size_units', 'alpha') : '0', 0, 2);
print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units', 'alpha') : '0', 0, 2);
print '</td></tr>';
}
if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) {
// Brut Surface
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
print '<input name="surface" size="4" value="'.GETPOST('surface').'">';
print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ?GETPOST('surface_units', 'alpha') : '0', 0, 2);
print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units', 'alpha') : '0', 0, 2);
print '</td></tr>';
}
if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) {
// Brut Volume
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
print '<input name="volume" size="4" value="'.GETPOST('volume').'">';
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ?GETPOST('volume_units', 'alpha') : '0', 0, 2);
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units', 'alpha') : '0', 0, 2);
print '</td></tr>';
}
@ -1601,7 +1604,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td>';
print '<input name="net_measure" size="4" value="'.GETPOST('net_measure').'">';
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0);
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0);
print '</td></tr>';
}
}
@ -1660,13 +1663,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
// Note (private, no output on invoices, propales...)
//if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode
//{
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%');
$doleditor->Create();
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%');
$doleditor->Create();
print "</td></tr>";
print "</td></tr>";
//}
if (isModEnabled('categorie')) {
@ -2622,7 +2625,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
$warehouse->fetch($object->fk_default_warehouse);
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print (!empty($warehouse->id) ? $warehouse->getNomUrl(1) : '');
print(!empty($warehouse->id) ? $warehouse->getNomUrl(1) : '');
print '</td>';
}
@ -2631,7 +2634,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
$res = $workstation->fetch($object->fk_default_workstation);
print '<tr><td>'.$langs->trans("DefaultWorkstation").'</td><td>';
print (!empty($workstation->id) ? $workstation->getNomUrl(1) : '');
print(!empty($workstation->id) ? $workstation->getNomUrl(1) : '');
print '</td>';
}
@ -2666,7 +2669,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
} elseif ($object->duration_value > 0) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
}
print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? "&nbsp;".$langs->trans($dur[$object->duration_unit])."&nbsp;" : '');
print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? "&nbsp;".$langs->trans($dur[$object->duration_unit])."&nbsp;" : '');
// Mandatory period
if ($object->duration_value > 0) {

View File

@ -319,7 +319,7 @@ class FormProduct
}
$out .= '<select '.($multiselect ? 'multiple ' : '').'class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled' : '');
$out .= ' id="'.$htmlname.'" name="'.($htmlname.($multiselect?'[]':'').($disabled ? '_disabled' : '')).'"';
$out .= ' id="'.$htmlname.'" name="'.($htmlname.($multiselect ? '[]' : '').($disabled ? '_disabled' : '')).'"';
//$out .= ' placeholder="todo"'; // placeholder for select2 must be added by setting the id+placeholder js param when calling select2
$out .= '>';
if ($empty) {

View File

@ -323,7 +323,7 @@ class Product extends CommonObject
*/
public $finished;
/**
/**
* fk_default_bom indicates the default bom
*
* @var int
@ -757,7 +757,7 @@ class Product extends CommonObject
$module = substr($module, 0, dol_strlen($module) - 4);
}
dol_include_once('/core/modules/product/'.$module.'.php');
$modCodeProduct = new $module;
$modCodeProduct = new $module();
if (!empty($modCodeProduct->code_auto)) {
$this->ref = $modCodeProduct->getNextValue($this, $this->type);
}
@ -1289,7 +1289,7 @@ class Product extends CommonObject
$sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1);
$sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL');
$sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
$sql .= ", mandatory_period = ".($this->mandatory_period );
$sql .= ", mandatory_period = ".($this->mandatory_period);
// stock field is not here because it is a denormalized value from product_stock.
$sql .= " WHERE rowid = ".((int) $id);
@ -1860,7 +1860,6 @@ class Product extends CommonObject
*/
private function getArrayForPriceCompare($level = 0)
{
$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
foreach ($testExit as $field) {
@ -4392,7 +4391,7 @@ class Product extends CommonObject
return -1;
}
}
// End call triggers
// End call triggers
return 1;
}
@ -5090,7 +5089,7 @@ class Product extends CommonObject
$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
$sql.= " ORDER BY pa.rang";
dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG);
dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
if ($level == 1) {
$alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly
@ -5323,7 +5322,7 @@ class Product extends CommonObject
$label = $langs->trans("ShowProduct");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"';
@ -5500,7 +5499,7 @@ class Product extends CommonObject
$labelStatus = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatch') : $langs->transnoentitiesnoconv('ProductStatusOnSerial'));
$labelStatusShort = ($status == 1 ? $langs->transnoentitiesnoconv('ProductStatusOnBatchShort') : $langs->transnoentitiesnoconv('ProductStatusOnSerialShort'));
}
} elseif ( $type == 2 && $status == 2 ) {
} elseif ($type == 2 && $status == 2) {
$labelStatus = $langs->transnoentitiesnoconv('ProductStatusOnSerial');
$labelStatusShort = $langs->transnoentitiesnoconv('ProductStatusOnSerialShort');
}
@ -5711,7 +5710,7 @@ class Product extends CommonObject
$sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")";
}
$sql .= " ORDER BY ps.reel ".(getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE')?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation;
$sql .= " ORDER BY ps.reel ".(getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE') ? 'DESC' : 'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation;
dol_syslog(get_class($this)."::load_stock", LOG_DEBUG);
$result = $this->db->query($sql);
@ -6194,7 +6193,7 @@ class Product extends CommonObject
}
}
$var = $conf->global->BARCODE_PRODUCT_ADDON_NUM;
$mod = new $var;
$mod = new $var();
$result = $mod->getNextValue($object, $type);
@ -6515,7 +6514,7 @@ class Product extends CommonObject
}
/**
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
@ -6533,8 +6532,8 @@ class Product extends CommonObject
$return .= '<div class="info-box-img">';
$label = '';
if ($this->is_photo_available($conf->product->multidir_output[$this->entity])) {
$label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 120, 160, 0, 0, 0, '', 'photoref photokanban');
$return .= $label;
$label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 120, 160, 0, 0, 0, '', 'photoref photokanban');
$return .= $label;
} else {
if ($this->type == Product::TYPE_PRODUCT) {
$label .= img_picto('', 'product');

View File

@ -120,7 +120,8 @@ class Productbatch extends CommonObject
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
$this->id = $this->db->last_insert_id($this->db->prefix().self::$_table_element);
@ -222,7 +223,8 @@ class Productbatch extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@ -259,7 +261,8 @@ class Productbatch extends CommonObject
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -459,7 +462,9 @@ class Productbatch extends CommonObject
$sql .= " t.eatby as oldeatby,"; // deprecated but may not be migrated into new table
$sql .= " t.batch,";
$sql .= " t.qty,";
if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) $sql .= " MAX(sm.datem) as date_entree,";
if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) {
$sql .= " MAX(sm.datem) as date_entree,";
}
$sql .= " t.import_key";
if ($fk_product > 0) {
$sql .= ", pl.rowid as lotid, pl.eatby as eatby, pl.sellby as sellby";
@ -490,9 +495,11 @@ class Productbatch extends CommonObject
if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) {
$sql .= 'date_entree ASC,t.batch ASC,';
}
if ($fk_product > 0) { $sql .= "pl.eatby ASC, pl.sellby ASC, "; }
if ($fk_product > 0) {
$sql .= "pl.eatby ASC, pl.sellby ASC, ";
}
$sql .= "t.eatby ASC, t.sellby ASC ";
$sql .= ", t.qty ".(!getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE')?'ASC':'DESC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation
$sql .= ", t.qty ".(!getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE') ? 'ASC' : 'DESC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation
$sql .= ", t.batch ASC";
dol_syslog("productbatch::findAll", LOG_DEBUG);

View File

@ -122,7 +122,6 @@ class ProductCustomerPrice extends CommonObject
*/
public function create($user, $notrigger = 0, $forceupdateaffiliate = 0)
{
global $conf, $langs;
$error = 0;
@ -174,8 +173,8 @@ class ProductCustomerPrice extends CommonObject
$this->import_key = trim($this->import_key);
}
// Check parameters
// Put here code to add control on parameters values
// Check parameters
// Put here code to add control on parameters values
if ($this->price != '' || $this->price == 0) {
if ($this->price_base_type == 'TTC') {
@ -601,7 +600,6 @@ class ProductCustomerPrice extends CommonObject
*/
public function update($user = 0, $notrigger = 0, $forceupdateaffiliate = 0)
{
global $conf, $langs;
$error = 0;
@ -653,8 +651,8 @@ class ProductCustomerPrice extends CommonObject
$this->import_key = trim($this->import_key);
}
// Check parameters
// Put here code to add a control on parameters values
// Check parameters
// Put here code to add a control on parameters values
if ($this->price != '' || $this->price == 0) {
if ($this->price_base_type == 'TTC') {
@ -1007,7 +1005,6 @@ class ProductCustomerPrice extends CommonObject
*/
public function initAsSpecimen()
{
$this->id = 0;
$this->entity = '';

View File

@ -177,8 +177,12 @@ class ProductFournisseurPrice extends CommonObject
$this->db = $db;
if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
$this->fields['rowid']['visible'] = 0;
}
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
$this->fields['entity']['enabled'] = 0;
}
// Unset fields that are disabled
foreach ($this->fields as $key => $val) {
@ -220,7 +224,9 @@ class ProductFournisseurPrice extends CommonObject
// Load source object
$result = $object->fetchCommon($fromid);
if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
if ($result > 0 && !empty($object->table_element_line)) {
$object->fetchLines();
}
// get lines so they will be clone
//foreach($this->lines as $line)
@ -232,11 +238,21 @@ class ProductFournisseurPrice extends CommonObject
unset($object->import_key);
// Clear fields
if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; }
if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); }
if (property_exists($object, 'date_modification')) { $object->date_modification = null; }
if (property_exists($object, 'ref')) {
$object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
}
if (property_exists($object, 'label')) {
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
}
if (property_exists($object, 'status')) {
$object->status = self::STATUS_DRAFT;
}
if (property_exists($object, 'date_creation')) {
$object->date_creation = dol_now();
}
if (property_exists($object, 'date_modification')) {
$object->date_modification = null;
}
// ...
// Clear extrafields that are unique
if (is_array($object->array_options) && count($object->array_options) > 0) {
@ -270,8 +286,9 @@ class ProductFournisseurPrice extends CommonObject
if (!$error) {
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid) {
if ($this->copy_linked_contact($object, 'external') < 0)
if ($this->copy_linked_contact($object, 'external') < 0) {
$error++;
}
}
}
@ -320,8 +337,11 @@ class ProductFournisseurPrice extends CommonObject
$sql = "SELECT ";
$sql .= $this->getFieldList();
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($this->element).")";
else $sql .= " WHERE 1 = 1";
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= " WHERE t.entity IN (".getEntity($this->element).")";
} else {
$sql .= " WHERE 1 = 1";
}
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@ -437,8 +457,12 @@ class ProductFournisseurPrice extends CommonObject
$sql = "UPDATE ".$this->db->prefix().$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " status = ".self::STATUS_VALIDATED;
if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."'";
if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".$user->id;
if (!empty($this->fields['date_validation'])) {
$sql .= ", date_validation = '".$this->db->idate($now)."'";
}
if (!empty($this->fields['fk_user_valid'])) {
$sql .= ", fk_user_valid = ".$user->id;
}
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@ -452,7 +476,9 @@ class ProductFournisseurPrice extends CommonObject
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('PRODUCTFOURNISSEURPRICE_VALIDATE', $user);
if ($result < 0) $error++;
if ($result < 0) {
$error++;
}
// End call triggers
}
}
@ -467,13 +493,15 @@ class ProductFournisseurPrice extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'productfournisseurprice/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'productfournisseurprice/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'productfournisseurprice/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@ -581,7 +609,9 @@ class ProductFournisseurPrice extends CommonObject
{
global $conf, $langs, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1;
} // Force disable tooltips
$result = '';
@ -613,7 +643,9 @@ class ProductFournisseurPrice extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
$linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>';
@ -622,7 +654,9 @@ class ProductFournisseurPrice extends CommonObject
$result .= $linkstart;
if (empty($this->showphoto_on_popup)) {
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
} else {
if ($withpicto) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -648,7 +682,9 @@ class ProductFournisseurPrice extends CommonObject
}
}
if ($withpicto != 2) $result .= $this->ref;
if ($withpicto != 2) {
$result .= $this->ref;
}
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@ -657,8 +693,11 @@ class ProductFournisseurPrice extends CommonObject
$hookmanager->initHooks(array('productfournisseurpricedao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}
@ -698,7 +737,9 @@ class ProductFournisseurPrice extends CommonObject
$statusType = 'status'.$status;
//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
if ($status == self::STATUS_CANCELED) $statusType = 'status6';
if ($status == self::STATUS_CANCELED) {
$statusType = 'status6';
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}

View File

@ -128,7 +128,8 @@ class Propalmergepdfproduct extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@ -324,7 +325,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@ -363,7 +365,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -410,7 +413,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -450,7 +454,8 @@ class Propalmergepdfproduct extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}

View File

@ -399,8 +399,8 @@ if ($id > 0 || !empty($ref)) {
$totalsell = 0;
$total = 0;
if (count($prods_arbo)) {
foreach ($prods_arbo as $value) {
if (count($prods_arbo)) {
foreach ($prods_arbo as $value) {
$productstatic->fetch($value['id']);
if ($value['level'] <= 1) {
@ -425,7 +425,9 @@ if ($id > 0 || !empty($ref)) {
if ($product_fourn->product_fourn_price_id > 0) {
print $product_fourn->display_price_product_fournisseur(0, 0);
} else {
print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++;
print $langs->trans("NotDefined");
$notdefined++;
$atleastonenotdefined++;
}
}
print '</td>';
@ -440,7 +442,7 @@ if ($id > 0 || !empty($ref)) {
$total += $totalline;
print '<td class="right nowraponall">';
print ($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : '').'<span class="amount">'.price($unitline, '', '', 0, 0, -1, $conf->currency)).'</span>';
print($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : '').'<span class="amount">'.price($unitline, '', '', 0, 0, -1, $conf->currency)).'</span>';
print '</td>';
// Best selling price
@ -452,7 +454,7 @@ if ($id > 0 || !empty($ref)) {
$totalsell += $totallinesell;
}
print '<td class="right" colspan="2">';
print ($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : ''));
print($notdefined ? '' : ($value['nb'] > 1 ? $value['nb'].'x ' : ''));
if (is_numeric($pricesell)) {
print '<span class="amount">'.price($pricesell, '', '', 0, 0, -1, $conf->currency).'</span>';
} else {
@ -551,7 +553,7 @@ if ($id > 0 || !empty($ref)) {
if ($atleastonenotdefined) {
print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
}
print ($atleastonenotdefined ? '' : price($total, '', '', 0, 0, -1, $conf->currency));
print($atleastonenotdefined ? '' : price($total, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Minimum selling price
@ -563,7 +565,7 @@ if ($id > 0 || !empty($ref)) {
if ($atleastonenotdefined) {
print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
}
print ($atleastonenotdefined ? '' : price($totalsell, '', '', 0, 0, -1, $conf->currency));
print($atleastonenotdefined ? '' : price($totalsell, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Stock

View File

@ -226,10 +226,10 @@ if ($object->id) {
}
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { // For backward compatiblity, we scan also old dirs
$filearrayold = dol_dir_list($upload_dirold, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$filearrayold = dol_dir_list($upload_dirold, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$filearray = array_merge($filearray, $filearrayold);
}

View File

@ -100,7 +100,8 @@ class PriceExpression
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@ -153,7 +154,7 @@ class PriceExpression
return 0;
}
} else {
$this->error = "Error ".$this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
return -1;
}
}
@ -217,7 +218,7 @@ class PriceExpression
return 0;
}
} else {
$this->error = "Error ".$this->db->lasterror();
$this->error = "Error ".$this->db->lasterror();
return -1;
}
}
@ -253,7 +254,8 @@ class PriceExpression
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@ -271,13 +273,13 @@ class PriceExpression
}
/**
* Delete object in database
*
* @param User $user User that deletes
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
/**
* Delete object in database
*
* @param User $user User that deletes
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function delete(User $user, $notrigger = 0)
{
$error = 0;
@ -293,7 +295,8 @@ class PriceExpression
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}

View File

@ -101,7 +101,8 @@ class PriceGlobalVariable
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@ -190,7 +191,8 @@ class PriceGlobalVariable
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// if (! $error)
@ -255,7 +257,8 @@ class PriceGlobalVariable
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}

View File

@ -117,7 +117,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@ -214,7 +215,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// if (! $error)
@ -263,13 +265,13 @@ class PriceGlobalVariableUpdater
//{
// if (! $notrigger)
// {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
// }
//}
@ -280,7 +282,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -577,7 +580,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback
@ -621,7 +625,8 @@ class PriceGlobalVariableUpdater
dol_syslog(__METHOD__);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// Commit or rollback

View File

@ -108,8 +108,7 @@ class PriceParser
return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]);
} elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) { //Internal errors
return $langs->trans("ErrorPriceExpressionInternal", $code);
} else //Unknown errors
{
} else { //Unknown errors
return $langs->trans("ErrorPriceExpressionUnknown", $code);
}
}
@ -270,8 +269,8 @@ class PriceParser
$supplier_min_price = 0;
$supplier_min_price_with_discount = 0;
} else {
$supplier_min_price = $productFournisseur->fourn_unitprice;
$supplier_min_price_with_discount = $productFournisseur->fourn_unitprice_with_discount;
$supplier_min_price = $productFournisseur->fourn_unitprice;
$supplier_min_price_with_discount = $productFournisseur->fourn_unitprice_with_discount;
}
//Accessible values by expressions

View File

@ -53,7 +53,7 @@ $ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'pricesuppliercard';
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'pricesuppliercard';
$socid = GETPOST('socid', 'int');
$cost_price = price2num(GETPOST('cost_price', 'alpha'), '', 2);
@ -81,10 +81,10 @@ if (!$user->hasRight('fournisseur', 'lire') && (!isModEnabled('margin') && !$use
accessforbidden();
}
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
$page = (GETPOST("page", 'int') ? GETPOST("page", 'int') : 0);
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
@ -640,7 +640,7 @@ if ($id > 0 || $ref) {
$default_vat = $object->tva_tx;
}
}
$vattosuggest = (GETPOSTISSET("tva_tx") ? vatrate(GETPOST("tva_tx")) : ($default_vat != '' ?vatrate($default_vat) : ''));
$vattosuggest = (GETPOSTISSET("tva_tx") ? vatrate(GETPOST("tva_tx")) : ($default_vat != '' ? vatrate($default_vat) : ''));
$vattosuggest = preg_replace('/\s*\(.*\)$/', '', $vattosuggest);
print '<input type="text" class="flat" size="5" name="tva_tx" value="'.$vattosuggest.'">';
print '</td></tr>';
@ -697,7 +697,7 @@ if ($id > 0 || $ref) {
$pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : ''));
print '<td><input class="flat" name="multicurrency_price" size="8" value="'.price($pricesupplierincurrencytouse).'">';
print '&nbsp;';
print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ?GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices
print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ? GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices
print '</td></tr>';
// Price qty min
@ -786,7 +786,7 @@ END;
// Discount qty min
print '<tr><td>'.$langs->trans("DiscountQtyMin").'</td>';
print '<td><input class="flat" name="remise_percent" size="4" value="'.(GETPOSTISSET('remise_percent') ? vatrate(price2num(GETPOST('remise_percent'), '', 2)) : (isset($object->fourn_remise_percent) ?vatrate($object->fourn_remise_percent) : '')).'"> %';
print '<td><input class="flat" name="remise_percent" size="4" value="'.(GETPOSTISSET('remise_percent') ? vatrate(price2num(GETPOST('remise_percent'), '', 2)) : (isset($object->fourn_remise_percent) ? vatrate($object->fourn_remise_percent) : '')).'"> %';
print '</td>';
print '</tr>';
@ -1103,7 +1103,7 @@ END;
}
if (is_object($hookmanager)) {
$parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields);
$parameters = array('id_fourn'=>(!empty($id_fourn) ? $id_fourn : ''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@ -1286,7 +1286,7 @@ END;
}
if (is_object($hookmanager)) {
$parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn) ? $id_fourn : ''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action);
}

View File

@ -341,9 +341,9 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
$product_static->status_buy = $objp->tobuy;
$product_static->status_batch = $objp->tobatch;
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'read');
if ($product_static->isService()) {
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'read');
}
// Multilangs

View File

@ -38,7 +38,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$include_sub_warehouse = !empty(GETPOST('include_sub_warehouse')) ? GETPOST('include_sub_warehouse') : 0;

View File

@ -40,10 +40,10 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$listoffset = GETPOST('listoffset', 'alpha');
$limit = GETPOST('limit', 'int') > 0 ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') > 0 ? GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
@ -197,7 +197,9 @@ if (empty($reshook)) {
//$inventorycode = 'INV'.$object->id;
$inventorycode = 'INV-'.$object->ref;
$price = 0;
if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) $price = $line->pmp_real;
if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) {
$price = $line->pmp_real;
}
$idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch);
if ($idstockmove < 0) {
@ -825,7 +827,7 @@ if ($action == 'updatebyscaning') {
result=false;
tabproduct.forEach(product => {
$.ajax({ url: \''.DOL_URL_ROOT.'/product/inventory/ajax/searchfrombarcode.php\',
data: { "token":"'.newToken().'", "action":"existbarcode", '.(!empty($object->fk_warehouse)?'"fk_entrepot":'.$object->fk_warehouse.', ':'').(!empty($object->fk_product)?'"fk_product":'.$object->fk_product.', ':'').'"barcode":element, "product":product, "mode":mode},
data: { "token":"'.newToken().'", "action":"existbarcode", '.(!empty($object->fk_warehouse) ? '"fk_entrepot":'.$object->fk_warehouse.', ' : '').(!empty($object->fk_product) ? '"fk_product":'.$object->fk_product.', ' : '').'"barcode":element, "product":product, "mode":mode},
type: \'POST\',
async: false,
success: function(response) {
@ -1083,8 +1085,11 @@ if ($resql) {
if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) {
//PMP Expected
if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
else $pmp_expected = $product_static->pmp;
if (!empty($obj->pmp_expected)) {
$pmp_expected = $obj->pmp_expected;
} else {
$pmp_expected = $product_static->pmp;
}
$pmp_valuation = $pmp_expected * $valuetoshow;
print '<td class="right">';
print price($pmp_expected);
@ -1105,8 +1110,11 @@ if ($resql) {
print '<td class="right">';
if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
else $pmp_real = $product_static->pmp;
if (!empty($obj->pmp_real)) {
$pmp_real = $obj->pmp_real;
} else {
$pmp_real = $product_static->pmp;
}
$pmp_valuation_real = $pmp_real * $qty_view;
print '<input type="text" class="maxwidth75 right realpmp'.$obj->fk_product.'" name="realpmp_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input_pmp" value="'.price2num($pmp_real).'">';
print '</td>';
@ -1134,8 +1142,11 @@ if ($resql) {
} else {
if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) {
//PMP Expected
if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
else $pmp_expected = $product_static->pmp;
if (!empty($obj->pmp_expected)) {
$pmp_expected = $obj->pmp_expected;
} else {
$pmp_expected = $product_static->pmp;
}
$pmp_valuation = $pmp_expected * $valuetoshow;
print '<td class="right">';
print price($pmp_expected);
@ -1150,8 +1161,11 @@ if ($resql) {
//PMP Real
print '<td class="right">';
if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
else $pmp_real = $product_static->pmp;
if (!empty($obj->pmp_real)) {
$pmp_real = $obj->pmp_real;
} else {
$pmp_real = $product_static->pmp;
}
$pmp_valuation_real = $pmp_real * $obj->qty_view;
print price($pmp_real);
print '</td>';

View File

@ -34,7 +34,7 @@ if (isModEnabled('categorie')) {
// Load translation files required by the page
$langs->loadLangs(array("stocks", "other"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
@ -48,7 +48,7 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier
$id = GETPOST('id', 'int');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -70,7 +70,7 @@ $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
// Search Criterias
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_id = GETPOST("search_id", 'alpha');
$search_ref = GETPOST("search_ref", 'alpha');
$search_ref_supplier = GETPOST("search_ref_supplier", 'alpha');
@ -117,7 +117,7 @@ if (isModEnabled('variants')) {
$diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -136,14 +136,16 @@ if (!$sortorder) {
}
// Initialize context for list
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'productservicelist';
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productservicelist';
if ((string) $type == '1') {
$contextpage = 'servicelist'; if ($search_type == '') {
$contextpage = 'servicelist';
if ($search_type == '') {
$search_type = '1';
}
}
if ((string) $type == '0') {
$contextpage = 'productlist'; if ($search_type == '') {
$contextpage = 'productlist';
if ($search_type == '') {
$search_type = '0';
}
}
@ -1557,9 +1559,9 @@ while ($i < $imaxinloop) {
$object = $product_static;
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'lire');
if ($product_static->isService()) {
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'lire');
}
if ($mode == 'kanban') {
@ -1705,7 +1707,7 @@ while ($i < $imaxinloop) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
}
print $duration_value;
print ((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : '');
print((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : '');
} elseif (!preg_match('/^[a-z]$/i', $obj->duration)) { // If duration is a simple char (like 's' of 'm'), we do not show value
print $obj->duration;
}
@ -2053,9 +2055,13 @@ while ($i < $imaxinloop) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
if ($usercancreadprice) {
if ($product_static->stock_reel < 0) { print '<span class="warning">'; }
if ($product_static->stock_reel < 0) {
print '<span class="warning">';
}
print price(price2num($product_static->stock_reel, 'MS'), 0, $langs, 1, 0);
if ($product_static->stock_reel < 0) { print '</span>'; }
if ($product_static->stock_reel < 0) {
print '</span>';
}
}
}
print '</td>';
@ -2071,9 +2077,13 @@ while ($i < $imaxinloop) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
if ($usercancreadprice) {
if ($product_static->stock_theorique < 0) { print '<span class="warning">'; }
if ($product_static->stock_theorique < 0) {
print '<span class="warning">';
}
print price(price2num($product_static->stock_theorique, 'MS'), 0, $langs, 1, 0);
if ($product_static->stock_theorique < 0) { print '</span>'; }
if ($product_static->stock_theorique < 0) {
print '</span>';
}
}
}
print '</td>';

View File

@ -44,7 +44,7 @@ if (!empty($user->socid)) {
$socid = $user->socid;
}
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -134,7 +134,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
$localtax1 = 0;
$localtax2 = 0;
$localtax1_type = '0';
$localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
@ -389,7 +392,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
$localtax1 = 0;
$localtax2 = 0;
$localtax1_type = '0';
$localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
// We look into database using code
@ -643,7 +649,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
$localtax1 = 0;
$localtax2 = 0;
$localtax1_type = '0';
$localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
// We look into database using code
@ -763,7 +772,10 @@ if (empty($reshook)) {
$tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
$localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0';
$localtax1 = 0;
$localtax2 = 0;
$localtax1_type = '0';
$localtax2_type = '0';
// If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes
if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) {
// We look into database using code
@ -1520,8 +1532,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) {
print '</form>';
} else {
print '<!-- Edit price per level -->'."\n";
?>
print '<!-- Edit price per level -->'."\n"; ?>
<script>
var showHidePriceRules = function () {
@ -1912,7 +1923,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
$page = (GETPOST("page", 'int') ? GETPOST("page", 'int') : 0);
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
@ -1926,7 +1937,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
$sortfield = "soc.nom";
}
// Build filter to diplay only concerned lines
// Build filter to diplay only concerned lines
$filter = array('t.fk_product' => $object->id);
if (!empty($search_soc)) {
@ -2007,7 +2018,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
print '<div class="center">';
// Update all child soc
// Update all child soc
print '<div class="marginbottomonly">';
print '<input type="checkbox" name="updatechildprice" id="updatechildprice" value="1"> ';
print '<label for="updatechildprice">'.$langs->trans('ForceUpdateChildPriceSoc').'</label>';

View File

@ -40,7 +40,7 @@ $langs->loadLangs(array('products', 'stocks'));
$action = GETPOST('action', 'aZ09');
$sref = GETPOST("sref", 'alpha');
$snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT;
$search_barcode = GETPOST("search_barcode", 'alpha');
$search_toolowstock = GETPOST('search_toolowstock');
@ -62,7 +62,7 @@ if (!$sortfield) {
if (!$sortorder) {
$sortorder = "ASC";
}
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
@ -134,7 +134,9 @@ $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
$form = new Form($db);
$htmlother = new FormOther($db);
if (!empty($objp->stock_physique) && $objp->stock_physique < 0) { print '<span class="warning">'; }
if (!empty($objp->stock_physique) && $objp->stock_physique < 0) {
print '<span class="warning">';
}
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql .= ' p.fk_product_type, p.tms as datem,';
@ -549,9 +551,13 @@ if ($resql) {
if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) {
print img_warning($langs->trans("StockLowerThanLimit", $objp->seuil_stock_alerte)).' ';
}
if ($objp->stock_physique < 0) { print '<span class="warning">'; }
if ($objp->stock_physique < 0) {
print '<span class="warning">';
}
print price(price2num($objp->stock_physique, 'MS'), 0, $langs, 1, 0);
if ($objp->stock_physique < 0) { print '</span>'; }
if ($objp->stock_physique < 0) {
print '</span>';
}
print '</td>';
// Details per warehouse
@ -571,9 +577,13 @@ if ($resql) {
if ($objp->seuil_stock_alerte != '' && ($product->stock_theorique < (float) $objp->seuil_stock_alerte)) {
print img_warning($langs->trans("StockLowerThanLimit", $objp->seuil_stock_alerte)).' ';
}
if ($objp->stock_physique < 0) { print '<span class="warning">'; }
if ($objp->stock_physique < 0) {
print '<span class="warning">';
}
print price(price2num($product->stock_theorique, 'MS'), 0, $langs, 1, 0);
if ($objp->stock_physique < 0) { print '</span>'; }
if ($objp->stock_physique < 0) {
print '</span>';
}
print '</td>';
}
// Units

View File

@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
// Load translation files required by the page
$langs->loadLangs(array('products', 'stocks', 'productbatch', 'categories'));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
@ -63,7 +63,7 @@ $sbarcode = GETPOST("sbarcode", 'int');
$search_stock_physique = GETPOST('search_stock_physique', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -210,10 +210,10 @@ if (empty($reshook)) {
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
}
// Mass actions
// Mass actions
/*$objectclass = 'MyObject';
$objectlabel = 'MyObject';
$uploaddir = $conf->mymodule->dir_output;
@ -574,7 +574,7 @@ if (isModEnabled('categorie')) {
$moreforfilter .= '</div>';
}
$moreforfilter.='<label for="search_subjecttolotserial">'.$langs->trans("SubjectToLotSerialOnly").' </label><input type="checkbox" id="search_subjecttolotserial" name="search_subjecttolotserial" value="1"'.($search_subjecttolotserial?' checked':'').'>';
$moreforfilter.='<label for="search_subjecttolotserial">'.$langs->trans("SubjectToLotSerialOnly").' </label><input type="checkbox" id="search_subjecttolotserial" name="search_subjecttolotserial" value="1"'.($search_subjecttolotserial ? ' checked' : '').'>';
if (!empty($moreforfilter)) {
@ -830,17 +830,25 @@ while ($i < $imaxinloop) {
//if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
if (is_null($objp->stock_physique)) {
if (!empty($objp->reel)) {
if ($objp->reel < 0) { print '<span class="warning">'; }
if ($objp->reel < 0) {
print '<span class="warning">';
}
print price2num($objp->reel, 'MS');
if ($objp->reel < 0) { print '</span>'; }
print ($objp->stock_physique < 0 ? ' '.img_warning() : '');
if ($objp->reel < 0) {
print '</span>';
}
print($objp->stock_physique < 0 ? ' '.img_warning() : '');
}
} else {
if (!empty($objp->stock_physique)) {
if ($objp->stock_physique < 0) { print '<span class="warning">'; }
if ($objp->stock_physique < 0) {
print '<span class="warning">';
}
print price2num($objp->stock_physique, 'MS');
if ($objp->stock_physique < 0) { print '</span>'; }
print ($objp->stock_physique < 0 ? ' '.img_warning() : (($objp->stock_physique > 1 && $objp->tobatch == 2) ? ' '.img_warning($langs->trans('IlligalQtyForSerialNumbers')): ''));
if ($objp->stock_physique < 0) {
print '</span>';
}
print($objp->stock_physique < 0 ? ' '.img_warning() : (($objp->stock_physique > 1 && $objp->tobatch == 2) ? ' '.img_warning($langs->trans('IlligalQtyForSerialNumbers')) : ''));
}
}
print '</td>';

View File

@ -50,7 +50,7 @@ $mesg = '';
$option = '';
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -180,7 +180,7 @@ if ($id > 0 || !empty($ref)) {
}
$bomtmp->fk_product = $objp->fk_product;
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
$bom_data_result[$objp->rowid]['product'] = (array_key_exists($objp->fk_product, $product_cache)? $product_cache[$objp->fk_product]->getNomUrl(1): '');
$bom_data_result[$objp->rowid]['product'] = (array_key_exists($objp->fk_product, $product_cache) ? $product_cache[$objp->fk_product]->getNomUrl(1) : '');
$bom_data_result[$objp->rowid]['qty_toproduce'] += ($objp->qty_toproduce > 0 ? $objp->qty_toproduce : 0);
$bom_data_result[$objp->rowid]['qty_toconsume'] = 0;
$bom_data_result[$objp->rowid]['date_valid'] = dol_print_date($db->jdate($objp->date_valid), 'dayhour');
@ -243,7 +243,7 @@ if ($id > 0 || !empty($ref)) {
if (!array_key_exists($objp->rowid, $bom_data_result)) {
$bom_data_result[$objp->rowid]['link'] = $bomtmp->getNomUrl(1, 'production');
$bom_data_result[$objp->rowid]['product'] = (array_key_exists($objp->fk_product, $product_cache)? $product_cache[$objp->fk_product]->getNomUrl(1): '');
$bom_data_result[$objp->rowid]['product'] = (array_key_exists($objp->fk_product, $product_cache) ? $product_cache[$objp->fk_product]->getNomUrl(1) : '');
$bom_data_result[$objp->rowid]['qty_toproduce'] = 0;
$bom_data_result[$objp->rowid]['qty_toconsume'] += ($objp->qty_toconsume > 0 ? $objp->qty_toconsume : 0);
$bom_data_result[$objp->rowid]['date_valid'] = dol_print_date($db->jdate($objp->date_valid), 'dayhour');

View File

@ -169,7 +169,8 @@ if ((!($id > 0) && empty($ref)) || $notab) {
$title = $langs->trans("ListProductServiceByPopularity");
if ((string) $type == '0') {
$title = $langs->trans("ListProductByPopularity");
} if ((string) $type == '1') {
}
if ((string) $type == '1') {
$title = $langs->trans("ListServiceByPopularity");
}

View File

@ -49,7 +49,7 @@ if (!empty($user->socid)) {
$hookmanager->initHooks(array('productstatsorder'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -49,7 +49,7 @@ $hookmanager->initHooks(array('productstatssupplierorder'));
$mesg = '';
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -46,7 +46,7 @@ if ($user->socid) {
$hookmanager->initHooks(array('productstatscontract'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -58,7 +58,7 @@ $search_array_options = $extrafields->getOptionalsFromPost('facture', '', 'searc
$showmessage = GETPOST('showmessage');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -50,7 +50,7 @@ if (!empty($user->socid)) {
$hookmanager->initHooks(array('productstatssupplierinvoice'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -53,7 +53,7 @@ $hookmanager->initHooks(array('productstatsinvoice'));
$showmessage = GETPOST('showmessage');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -48,7 +48,7 @@ if ($user->socid) {
$hookmanager->initHooks(array('productstatsmo'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -50,7 +50,7 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product
$hookmanager->initHooks(array('productstatspropal'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -49,7 +49,7 @@ if (!empty($user->socid)) {
$hookmanager->initHooks(array('productstatssupplierpropal'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -57,7 +57,7 @@ $socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
if (!$sortfield) {
@ -335,7 +335,7 @@ if ($action == 'create') {
print '</td></tr>';
print '<tr><td>'.$langs->trans('Address').'</td><td><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
print (!empty($object->address) ? $object->address : '');
print(!empty($object->address) ? $object->address : '');
print '</textarea></td></tr>';
// Zip / Town
@ -601,9 +601,9 @@ if ($action == 'create') {
$totalarray = array();
$totalarray['val'] = array ();
$totalarray['pos'] = array ();
$totalarray['type'] = array ();
$totalarray['val'] = array();
$totalarray['pos'] = array();
$totalarray['type'] = array();
$totalarray['nbfield'] = 0;
// TODO Create $arrayfields with all fields to show

View File

@ -806,7 +806,7 @@ class Entrepot extends CommonObject
$label = $langs->trans("Warehouse");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -232,12 +232,18 @@ class MouvementStock extends CommonObject
// Clean parameters
$price = price2num($price, 'MU'); // Clean value for the casse we receive a float zero value, to have it a real zero value.
if (empty($price)) $price = 0;
if (empty($price)) {
$price = 0;
}
$now = (!empty($datem) ? $datem : dol_now());
// Check parameters
if (!($fk_product > 0)) return 0;
if (!($entrepot_id > 0)) return 0;
if (!($fk_product > 0)) {
return 0;
}
if (!($entrepot_id > 0)) {
return 0;
}
if (is_numeric($eatby) && $eatby < 0) {
dol_syslog(get_class($this)."::_create start ErrorBadValueForParameterEatBy eatby = ".$eatby);
@ -280,7 +286,9 @@ class MouvementStock extends CommonObject
// Define if we must make the stock change (If product type is a service or if stock is used also for services)
// Only record into stock tables wil be disabled by this (the rest like writing into lot table or movement of subproucts are done)
$movestock = 0;
if ($product->type != Product::TYPE_SERVICE || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) $movestock = 1;
if ($product->type != Product::TYPE_SERVICE || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
$movestock = 1;
}
$this->db->begin();
@ -416,7 +424,9 @@ class MouvementStock extends CommonObject
}
$foundforbatch = 1;
if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty;
if ($prodbatch->qty < abs($qty)) {
$qtyisnotenough = $prodbatch->qty;
}
break;
}
if (!$foundforbatch || $qtyisnotenough) {
@ -618,7 +628,9 @@ class MouvementStock extends CommonObject
if ($movestock && !$error) {
// Call trigger
$result = $this->call_trigger('STOCK_MOVEMENT', $user);
if ($result < 0) $error++;
if ($result < 0) {
$error++;
}
// End call triggers
// Check unicity for serial numbered equipments once all movement were done.
@ -864,7 +876,9 @@ class MouvementStock extends CommonObject
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj) $nb = $obj->nb;
if ($obj) {
$nb = $obj->nb;
}
return (empty($nb) ? 0 : $nb);
} else {
dol_print_error($this->db);
@ -1278,7 +1292,6 @@ class MouvementStock extends CommonObject
*/
public function reverseMouvement()
{
$formattedDate = "REVERTMV" .dol_print_date($this->datem, '%Y%m%d%His');
if ($this->label == 'Annulation mouvement ID'.$this->id) {
return -1;

View File

@ -313,22 +313,22 @@ class Productlot extends CommonObject
// Clean parameters
if (isset($this->entity)) {
$this->entity = (int) $this->entity;
$this->entity = (int) $this->entity;
}
if (isset($this->fk_product)) {
$this->fk_product = (int) $this->fk_product;
$this->fk_product = (int) $this->fk_product;
}
if (isset($this->batch)) {
$this->batch = trim($this->batch);
$this->batch = trim($this->batch);
}
if (isset($this->fk_user_creat)) {
$this->fk_user_creat = (int) $this->fk_user_creat;
$this->fk_user_creat = (int) $this->fk_user_creat;
}
if (isset($this->fk_user_modif)) {
$this->fk_user_modif = (int) $this->fk_user_modif;
$this->fk_user_modif = (int) $this->fk_user_modif;
}
if (isset($this->import_key)) {
$this->import_key = trim($this->import_key);
$this->import_key = trim($this->import_key);
}
// Check parameters
@ -527,22 +527,22 @@ class Productlot extends CommonObject
// Clean parameters
if (isset($this->entity)) {
$this->entity = (int) $this->entity;
$this->entity = (int) $this->entity;
}
if (isset($this->fk_product)) {
$this->fk_product = (int) $this->fk_product;
$this->fk_product = (int) $this->fk_product;
}
if (isset($this->batch)) {
$this->batch = trim($this->batch);
$this->batch = trim($this->batch);
}
if (isset($this->fk_user_creat)) {
$this->fk_user_creat = (int) $this->fk_user_creat;
$this->fk_user_creat = (int) $this->fk_user_creat;
}
if (isset($this->fk_user_modif)) {
$this->fk_user_modif = (int) $this->fk_user_modif;
$this->fk_user_modif = (int) $this->fk_user_modif;
}
if (isset($this->import_key)) {
$this->import_key = trim($this->import_key);
$this->import_key = trim($this->import_key);
}
// $this->oldcopy should have been set by the caller of update (here properties were already modified)
@ -666,15 +666,15 @@ class Productlot extends CommonObject
// TODO
//if (!$error) {
//if (!$notrigger) {
// Uncomment this and change PRODUCTLOT to your own tag if you
// want this action calls a trigger.
//if (!$notrigger) {
// Uncomment this and change PRODUCTLOT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('PRODUCTLOT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
//}
//// Call triggers
//$result=$this->call_trigger('PRODUCTLOT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
//}
//}
if (!$error) {
@ -1145,7 +1145,7 @@ class Productlot extends CommonObject
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -371,13 +371,13 @@ class ProductStockEntrepot extends CommonObject
}
//if (!$error && !$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
//}
// Commit or rollback
@ -409,13 +409,13 @@ class ProductStockEntrepot extends CommonObject
$this->db->begin();
//if (!$error && !$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
//}
if (!$error) {

View File

@ -201,7 +201,7 @@ if ($resql) {
$tmplotstatic->eatby = $objp->eatby;
print '<tr class="oddeven">';
print '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>';
print '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>';
print '<td class="tdoverflowmax150">';
print $producttmp->getNomUrl(1);
print "</td>\n";

View File

@ -49,9 +49,9 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '
$toselect = GETPOST('toselect', 'array');
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST("sref", "alpha") ?GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha");
$search_label = GETPOST("snom", "alpha") ?GETPOST("snom", "alpha") : GETPOST("search_label", "alpha");
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST("sref", "alpha") ? GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha");
$search_label = GETPOST("snom", "alpha") ? GETPOST("snom", "alpha") : GETPOST("search_label", "alpha");
$search_status = GETPOST("search_status", "int");
if (isModEnabled('categorie')) {
@ -59,7 +59,7 @@ if (isModEnabled('categorie')) {
}
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -58,7 +58,7 @@ $msid = GETPOST('msid', 'int');
$product_id = GETPOST("product_id", 'int');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist';
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'movementlist';
$idproduct = GETPOST('idproduct', 'int');
$year = GETPOST("year", 'int');
@ -74,7 +74,7 @@ $search_batch = trim(GETPOST("search_batch", 'alpha'));
$search_qty = trim(GETPOST("search_qty", 'alpha'));
$search_type_mouvement = GETPOST('search_type_mouvement', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
@ -133,7 +133,8 @@ $usercandelete = (($user->rights->stock->mouvement->supprimer));
*/
if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = '';
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';

View File

@ -90,7 +90,7 @@ $search_fk_project=GETPOST("search_fk_project", 'int');
$type = GETPOST("type", "int");
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -973,7 +973,7 @@ if ((empty($action) || $action == 'list') && $id > 0) {
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
// modified by hook
if (empty($reshook)) {
if ($user->hasRight('stock', 'mouvement', 'creer')) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=correction">'.$langs->trans("CorrectStock").'</a>';
@ -1166,10 +1166,10 @@ if (!empty($arrayfields['m.datem']['checked'])) {
// Date
print '<td class="liste_titre center">';
print '<div class="nowrapfordate">';
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel');
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel');
print '</div>';
print '<div class="nowrapfordate">';
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'), 'tzuserrel');
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'), 'tzuserrel');
print '</div>';
print '</td>';
}

View File

@ -117,11 +117,11 @@ $error = 0;
$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'lire')));
$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->hasRight('service', 'creer')));
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'lire');
if ($object->isService()) {
$label = $langs->trans('Service');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'lire');
}
if ($object->id > 0) {
@ -1050,7 +1050,7 @@ if (!$variants) {
print $entrepotstatic->getNomUrl(1);
if (!empty($conf->use_javascript_ajax) && isModEnabled('productbatch') && $object->hasbatch()) {
print '<a class="collapse_batch marginleftonly" id="ent' . $entrepotstatic->id . '" href="#">';
print (!getDolGlobalString('STOCK_SHOW_ALL_BATCH_BY_DEFAULT') ? '(+)' : '(-)');
print(!getDolGlobalString('STOCK_SHOW_ALL_BATCH_BY_DEFAULT') ? '(+)' : '(-)');
print '</a>';
}
print '</td>';
@ -1068,7 +1068,8 @@ if (!$variants) {
}
// Sell price
$minsellprice = null; $maxsellprice = null;
$minsellprice = null;
$maxsellprice = null;
print '<td class="right nowraponall">';
if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
foreach ($object->multiprices as $priceforlevel) {
@ -1181,7 +1182,7 @@ if (!$variants) {
$colspan--;
print '<td class="center">'.dol_print_date($pdluo->eatby, 'day').'</td>';
}
print '<td class="right" colspan="'.$colspan.'">'.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : (($pdluo->qty > 1 && $object->status_batch == 2) ? ' '.img_warning($langs->trans('IlligalQtyForSerialNumbers')): '')).'</td>';
print '<td class="right" colspan="'.$colspan.'">'.$pdluo->qty.($pdluo->qty < 0 ? ' '.img_warning() : (($pdluo->qty > 1 && $object->status_batch == 2) ? ' '.img_warning($langs->trans('IlligalQtyForSerialNumbers')) : '')).'</td>';
print '<td colspan="4"></td>';
print '<td class="center tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("TransferStock")).'">';
if ($entrepotstatic->status != $entrepotstatic::STATUS_CLOSED) {
@ -1222,7 +1223,7 @@ if (!$variants) {
print '<td class="liste_total right">'.price2num($total, 'MS').'</td>';
print '<td class="liste_total right">';
if ($usercancreadprice) {
print ($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : '&nbsp;'); // This value may have rounding errors
print($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : '&nbsp;'); // This value may have rounding errors
}
print '</td>';
// Value purchase
@ -1331,8 +1332,7 @@ if (!$variants) {
print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0);
print '<div class="div-table-responsive">';
?>
print '<div class="div-table-responsive">'; ?>
<table class="liste">
<tr class="liste_titre">
<td class="liste_titre"><?php echo $langs->trans('Product') ?></td>
@ -1349,8 +1349,7 @@ if (!$variants) {
foreach ($productCombinations as $currcomb) {
$prodstatic->fetch($currcomb->fk_product_child);
$prodstatic->load_stock();
$stock_total += $prodstatic->stock_reel;
?>
$stock_total += $prodstatic->stock_reel; ?>
<tr class="oddeven">
<td><?php echo $prodstatic->getNomUrl(1) ?></td>
<td>
@ -1386,8 +1385,7 @@ if (!$variants) {
print '</tr>';
} else {
print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
?>
} ?>
</table>
<?php

View File

@ -165,7 +165,7 @@ if ($object->id) {
}
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {

View File

@ -53,7 +53,7 @@ $search_fk_user_modif = GETPOST('search_fk_user_modif', 'int');
$search_import_key = GETPOST('search_import_key', 'int');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -147,7 +147,9 @@ if ($user->socid > 0) { // Protection if external user
accessforbidden();
}
//$result = restrictedArea($user, 'productbatch');
if (!$permissiontoread) accessforbidden();
if (!$permissiontoread) {
accessforbidden();
}
/*

View File

@ -54,7 +54,7 @@ $hookmanager->initHooks(array('stockreplenishlist'));
$action = GETPOST('action', 'aZ09');
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$type = GETPOST('type', 'int');
$tobuy = GETPOST('tobuy', 'int');
$salert = GETPOST('salert', 'alpha');
@ -93,7 +93,7 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;
if (!$sortfield) {
@ -429,11 +429,11 @@ if ($usevirtualstock) {
$sqlExpeditionsCli = "(SELECT ".$db->ifsql("SUM(ed2.qty) IS NULL", "0", "SUM(ed2.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
$sqlExpeditionsCli .= " FROM ".MAIN_DB_PREFIX."expedition as e2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."expeditiondet as ed2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commande as c2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commande as c2,";
$sqlExpeditionsCli .= " ".MAIN_DB_PREFIX."commandedet as cd2";
$sqlExpeditionsCli .= " WHERE ed2.fk_expedition = e2.rowid AND cd2.rowid = ed2.fk_origin_line AND e2.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'expedition').")";
$sqlExpeditionsCli .= " AND cd2.fk_commande = c2.rowid";
$sqlExpeditionsCli .= " AND c2.fk_statut IN (1,2)";
$sqlExpeditionsCli .= " AND cd2.fk_commande = c2.rowid";
$sqlExpeditionsCli .= " AND c2.fk_statut IN (1,2)";
$sqlExpeditionsCli .= " AND cd2.fk_product = p.rowid";
$sqlExpeditionsCli .= " AND e2.fk_statut IN (1,2))";
} else {
@ -672,8 +672,12 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('
if ($limit > 0 && $limit != $conf->liste_limit) {
$filters .= '&limit='.((int) $limit);
}
if (!empty($includeproductswithoutdesiredqty)) $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
if (!empty($salert)) $filters .= '&salert='.urlencode($salert);
if (!empty($includeproductswithoutdesiredqty)) {
$filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
}
if (!empty($salert)) {
$filters .= '&salert='.urlencode($salert);
}
$param = (isset($type) ? '&type='.urlencode($type) : '');
$param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder);
@ -681,8 +685,12 @@ $param .= '&search_ref='.urlencode($search_ref);
$param .= '&mode='.urlencode($mode);
$param .= '&fk_supplier='.urlencode($fk_supplier);
$param .= '&fk_entrepot='.urlencode($fk_entrepot);
if (!empty($includeproductswithoutdesiredqty)) $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
if (!empty($salert)) $param .= '&salert='.urlencode($salert);
if (!empty($includeproductswithoutdesiredqty)) {
$param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
}
if (!empty($salert)) {
$param .= '&salert='.urlencode($salert);
}
$stocklabel = $langs->trans('Stock');
$stocklabelbis = $langs->trans('Stock');
@ -805,7 +813,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
exit;
}
$prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock?', novirtual':''), $draftchecked);
$prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock ? ', novirtual' : ''), $draftchecked);
// Multilangs
if (getDolGlobalInt('MAIN_MULTILANGS')) {
@ -885,9 +893,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$stockforcompare = ($usevirtualstock ? $stock : $stock + $ordered);
/*if ($stockforcompare >= $desiredstock)
{
$picto = img_picto('', 'help');
$picto = img_picto('', 'help');
} else {
$picto = img_picto('', 'help');
$picto = img_picto('', 'help');
}*/
} else {
$picto = img_picto($langs->trans("NoPendingReceptionOnSupplierOrder"), 'help');

View File

@ -53,7 +53,7 @@ $search_dateday = GETPOST('search_dateday', 'int');
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
$optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
if (!$sortorder) {

View File

@ -56,7 +56,7 @@ $hookmanager->initHooks(array('batchproductstatssupplierorder'));
$showmessage = GETPOST('showmessage');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -81,7 +81,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->hasRight('produit', 'lire')) accessforbidden();
if (!$user->hasRight('produit', 'lire')) {
accessforbidden();
}
/*

View File

@ -56,7 +56,7 @@ $hookmanager->initHooks(array('batchproductstatsexpedition'));
$showmessage = GETPOST('showmessage');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -81,7 +81,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->hasRight('produit', 'lire')) accessforbidden();
if (!$user->hasRight('produit', 'lire')) {
accessforbidden();
}
/*

View File

@ -49,7 +49,7 @@ if ($user->socid) {
$hookmanager->initHooks(array('batchproductstatsmo'));
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -74,7 +74,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->hasRight('produit', 'lire')) accessforbidden();
if (!$user->hasRight('produit', 'lire')) {
accessforbidden();
}
/*

View File

@ -56,7 +56,7 @@ $hookmanager->initHooks(array('batchproductstatsreception'));
$showmessage = GETPOST('showmessage');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -81,7 +81,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_year = '';
}
if (!$user->hasRight('produit', 'lire')) accessforbidden();
if (!$user->hasRight('produit', 'lire')) {
accessforbidden();
}
/*

View File

@ -556,7 +556,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
//}
} else {
//if ($productid > 0) {
$currentstock = $stock_prod[$objp->rowid];
$currentstock = $stock_prod[$objp->rowid];
//} else {
// $currentstock = $objp->stock;
//}
@ -639,7 +639,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
if ($nbofmovement > 0) {
print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?idproduct='.$objp->rowid;
foreach ($search_fk_warehouse as $val) {
print ($val > 0 ? '&search_warehouse='.$val : '');
print($val > 0 ? '&search_warehouse='.$val : '');
}
print '">'.$langs->trans("Movements").'</a>';
print ' <span class="tabs"><span class="badge">'.$nbofmovement.'</span></span>';

View File

@ -170,7 +170,7 @@ class StockTransfer extends CommonObject
public $model_pdf;
public $status;
/**
/**
* @var StockTransferLine[] stock transfer line
*/
public $lines;
@ -192,8 +192,12 @@ class StockTransfer extends CommonObject
$this->db = $db;
$this->origin_type = 'StockTransfer@product/stock/stocktransfer';
if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
$this->fields['rowid']['visible'] = 0;
}
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
$this->fields['entity']['enabled'] = 0;
}
// Example to show how to set values of fields definition dynamically
/*if ($user->rights->stocktransfer->stocktransfer->read) {
@ -230,10 +234,16 @@ class StockTransfer extends CommonObject
public function create(User $user, $notrigger = false)
{
$model_pdf = GETPOST('model');
if (!empty($model_pdf)) $this->model_pdf = $model_pdf;
if (!empty($model_pdf)) {
$this->model_pdf = $model_pdf;
}
$this->status = (int) $this->status;
if ($this->fk_warehouse_source <= 0) $this->fk_warehouse_source = 0;
if ($this->fk_warehouse_destination <= 0) $this->fk_warehouse_destination = 0;
if ($this->fk_warehouse_source <= 0) {
$this->fk_warehouse_source = 0;
}
if ($this->fk_warehouse_destination <= 0) {
$this->fk_warehouse_destination = 0;
}
return $this->createCommon($user, $notrigger);
}
@ -257,7 +267,9 @@ class StockTransfer extends CommonObject
// Load source object
$result = $object->fetchCommon($fromid);
if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
if ($result > 0 && !empty($object->table_element_line)) {
$object->fetchLines();
}
// get lines so they will be clone
//foreach($this->lines as $line)
@ -309,8 +321,9 @@ class StockTransfer extends CommonObject
if (!$error) {
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid) {
if ($this->copy_linked_contact($object, 'external') < 0)
if ($this->copy_linked_contact($object, 'external') < 0) {
$error++;
}
}
}
@ -339,7 +352,9 @@ class StockTransfer extends CommonObject
$this->socid = $this->fk_soc;
if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
return $result;
}
@ -365,7 +380,7 @@ class StockTransfer extends CommonObject
* @param Object $b 2nd element to test
* @return int
*/
static public function stocktransferCmpRank($a, $b)
public static function stocktransferCmpRank($a, $b)
{
if ($a->rang == $b->rang) {
return 0;
@ -380,12 +395,15 @@ class StockTransfer extends CommonObject
*/
public function getValorisationTotale()
{
$total_pmp = 0;
if (empty($this->lines)) $this->fetchLines();
if (empty($this->lines)) {
$this->fetchLines();
}
if (!empty($this->lines)) {
foreach ($this->lines as $l) $total_pmp+= ($l->pmp * $l->qty);
foreach ($this->lines as $l) {
$total_pmp+= ($l->pmp * $l->qty);
}
}
return $total_pmp;
@ -413,8 +431,11 @@ class StockTransfer extends CommonObject
$sql = 'SELECT ';
$sql .= $this->getFieldList();
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
else $sql .= ' WHERE 1 = 1';
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
} else {
$sql .= ' WHERE 1 = 1';
}
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@ -569,8 +590,12 @@ class StockTransfer extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " status = ".self::STATUS_VALIDATED;
if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."',";
if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".((int) $user->id);
if (!empty($this->fields['date_validation'])) {
$sql .= ", date_validation = '".$this->db->idate($now)."',";
}
if (!empty($this->fields['fk_user_valid'])) {
$sql .= ", fk_user_valid = ".((int) $user->id);
}
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@ -584,7 +609,9 @@ class StockTransfer extends CommonObject
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('STOCKTRANSFER_VALIDATE', $user);
if ($result < 0) $error++;
if ($result < 0) {
$error++;
}
// End call triggers
}
}
@ -599,13 +626,15 @@ class StockTransfer extends CommonObject
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'stocktransfer/".$this->db->escape($this->ref)."' and entity = ".((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'stocktransfer/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'stocktransfer/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@ -734,7 +763,9 @@ class StockTransfer extends CommonObject
{
global $conf, $langs, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1;
} // Force disable tooltips
$result = '';
@ -766,7 +797,9 @@ class StockTransfer extends CommonObject
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
$linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>';
@ -775,7 +808,9 @@ class StockTransfer extends CommonObject
$result .= $linkstart;
if (empty($this->showphoto_on_popup)) {
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
} else {
if ($withpicto) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -801,7 +836,9 @@ class StockTransfer extends CommonObject
}
}
if ($withpicto != 2) $result .= $this->ref;
if ($withpicto != 2) {
$result .= $this->ref;
}
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@ -810,8 +847,11 @@ class StockTransfer extends CommonObject
$hookmanager->initHooks(array('stocktransferdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}
@ -853,7 +893,9 @@ class StockTransfer extends CommonObject
$statusType = 'status'.$status;
//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
if ($status == self::STATUS_CLOSED) $statusType = 'status6';
if ($status == self::STATUS_CLOSED) {
$statusType = 'status6';
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}

View File

@ -134,8 +134,12 @@ class StockTransferLine extends CommonObjectLine
$this->db = $db;
if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
$this->fields['rowid']['visible'] = 0;
}
if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
$this->fields['entity']['enabled'] = 0;
}
// Example to show how to set values of fields definition dynamically
/*if ($user->rights->stocktransfer->stocktransferline->read) {
@ -194,7 +198,9 @@ class StockTransferLine extends CommonObjectLine
// Load source object
$result = $object->fetchCommon($fromid);
if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
if ($result > 0 && !empty($object->table_element_line)) {
$object->fetchLines();
}
// get lines so they will be clone
//foreach($this->lines as $line)
@ -241,8 +247,9 @@ class StockTransferLine extends CommonObjectLine
if (!$error) {
// copy external contacts if same company
if (property_exists($this, 'socid') && $this->socid == $object->socid) {
if ($this->copy_linked_contact($object, 'external') < 0)
if ($this->copy_linked_contact($object, 'external') < 0) {
$error++;
}
}
}
@ -268,7 +275,9 @@ class StockTransferLine extends CommonObjectLine
public function fetch($id, $ref = null)
{
$result = $this->fetchCommon($id, $ref);
if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
if ($result > 0 && !empty($this->table_element_line)) {
$this->fetchLines();
}
return $result;
}
@ -306,8 +315,11 @@ class StockTransferLine extends CommonObjectLine
$sql = 'SELECT ';
$sql .= $this->getFieldList();
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
else $sql .= ' WHERE 1 = 1';
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
} else {
$sql .= ' WHERE 1 = 1';
}
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
@ -413,7 +425,6 @@ class StockTransferLine extends CommonObjectLine
*/
public function doStockMovement($label, $code_inv, $fk_entrepot, $direction = 1)
{
global $conf, $user, $langs;
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
@ -443,14 +454,16 @@ class StockTransferLine extends CommonObjectLine
$this->fk_stocktransfer
);*/
$result = $movementstock->_create($user,
$p->id,
$fk_entrepot,
$op[$direction],
$direction,
empty($direction) ? $this->pmp : 0,
$label,
$code_inv);
$result = $movementstock->_create(
$user,
$p->id,
$fk_entrepot,
$op[$direction],
$direction,
empty($direction) ? $this->pmp : 0,
$label,
$code_inv
);
if ($result < 0) {
setEventMessages($p->error, $p->errors, 'errors');
@ -482,18 +495,20 @@ class StockTransferLine extends CommonObjectLine
GETPOST("codemove")
);*/
$result = $movementstock->_create($user,
$p->id,
$fk_entrepot,
$op[$direction],
$direction,
empty($direction) ? $this->pmp : 0,
$label,
$code_inv,
'',
$dlc,
$dluo,
$this->batch);
$result = $movementstock->_create(
$user,
$p->id,
$fk_entrepot,
$op[$direction],
$direction,
empty($direction) ? $this->pmp : 0,
$label,
$code_inv,
'',
$dlc,
$dluo,
$this->batch
);
if ($result < 0) {
setEventMessages($p->error, $p->errors, 'errors');
@ -554,8 +569,12 @@ class StockTransferLine extends CommonObjectLine
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " status = ".self::STATUS_VALIDATED;
if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."',";
if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".((int) $user->id);
if (!empty($this->fields['date_validation'])) {
$sql .= ", date_validation = '".$this->db->idate($now)."',";
}
if (!empty($this->fields['fk_user_valid'])) {
$sql .= ", fk_user_valid = ".((int) $user->id);
}
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@ -569,7 +588,9 @@ class StockTransferLine extends CommonObjectLine
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('STOCKTRANSFERLINE_VALIDATE', $user);
if ($result < 0) $error++;
if ($result < 0) {
$error++;
}
// End call triggers
}
}
@ -584,13 +605,15 @@ class StockTransferLine extends CommonObjectLine
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'stocktransferline/".$this->db->escape($this->ref)."' and entity = ".((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'stocktransferline/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filepath = 'stocktransferline/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
$error++;
$this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
@ -719,7 +742,9 @@ class StockTransferLine extends CommonObjectLine
{
global $conf, $langs, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1;
} // Force disable tooltips
$result = '';
@ -751,7 +776,9 @@ class StockTransferLine extends CommonObjectLine
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
$linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>';
@ -760,7 +787,9 @@ class StockTransferLine extends CommonObjectLine
$result .= $linkstart;
if (empty($this->showphoto_on_popup)) {
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
} else {
if ($withpicto) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -786,7 +815,9 @@ class StockTransferLine extends CommonObjectLine
}
}
if ($withpicto != 2) $result .= $this->ref;
if ($withpicto != 2) {
$result .= $this->ref;
}
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@ -795,8 +826,11 @@ class StockTransferLine extends CommonObjectLine
$hookmanager->initHooks(array('stocktransferlinedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}
@ -836,7 +870,9 @@ class StockTransferLine extends CommonObjectLine
$statusType = 'status'.$status;
//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
if ($status == self::STATUS_CANCELED) $statusType = 'status6';
if ($status == self::STATUS_CANCELED) {
$statusType = 'status6';
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}

View File

@ -46,18 +46,26 @@ function stocktransferPrepareHead($object)
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_contact.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
if ($nbContact > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
}
$head[$h][2] = 'contact';
$h++;
}
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
if (!empty($object->note_private)) {
$nbNote++;
}
if (!empty($object->note_public)) {
$nbNote++;
}
$head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_note.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
if ($nbNote > 0) {
$head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
}
$head[$h][2] = 'note';
$h++;
}
@ -69,7 +77,9 @@ function stocktransferPrepareHead($object)
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_document.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
if (($nbFiles + $nbLinks) > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
}
$head[$h][2] = 'document';
$h++;

View File

@ -43,23 +43,31 @@ $backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0';
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) $sortfield = 'a.datep,a.id';
if (!$sortorder) $sortorder = 'DESC,DESC';
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical objects
$object = new StockTransfer($db);
@ -71,7 +79,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
}
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
@ -87,7 +97,9 @@ $permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used b
$parameters = array('id'=>$id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Cancel
@ -117,7 +129,9 @@ if ($object->id > 0) {
$help_url = '';
llxHeader('', $title, $help_url);
if (isModEnabled('notification')) $langs->load("mails");
if (isModEnabled('notification')) {
$langs->load("mails");
}
$head = stocktransferPrepareHead($object);
@ -191,7 +205,9 @@ if ($object->id > 0) {
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
if (get_class($objthirdparty) == 'Societe') {
$out .= '&amp;socid='.$objthirdparty->id;
}
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1';
//$out.=$langs->trans("AddAnAction").' ';
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
@ -213,8 +229,12 @@ if ($object->id > 0) {
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
$param = '&id='.$object->id.'&socid='.$socid;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
//print load_fiche_titre($langs->trans("ActionsOnStockTransfer"), '', '');

View File

@ -37,7 +37,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/stocktransfer/modules_stocktransfe
// Load translation files required by the page
$langs->loadLangs(array("stocks", "other", "productbatch", "companies"));
if (isModEnabled('incoterm')) $langs->load('incoterm');
if (isModEnabled('incoterm')) {
$langs->load('incoterm');
}
// Get parameters
$id = GETPOST('id', 'int');
@ -45,7 +47,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'stocktransfercard'; // To manage different context of search
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'stocktransfercard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$qty = GETPOST('qty', 'int');
@ -72,10 +74,14 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
$search_all = trim(GETPOST("search_all", 'alpha'));
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
if (GETPOST('search_'.$key, 'alpha')) {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
}
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
if (empty($action) && empty($id) && empty($ref)) {
$action = 'view';
}
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
@ -94,7 +100,9 @@ $upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $ob
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
accessforbidden();
}
/*
@ -107,7 +115,9 @@ $formproject = new FormProjets($db);
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$error = 0;
@ -116,8 +126,11 @@ if (empty($reshook)) {
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
}
$triggermodname = 'STOCKTRANSFER_STOCKTRANSFER_MODIFY'; // Name of trigger action code to execute when we modify record
@ -183,8 +196,10 @@ if (empty($reshook)) {
if (empty($error)) {
$line = new StockTransferLine($db);
$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')'));
if (!empty($records[key($records)])) $line = $records[key($records)];
$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'").')'));
if (!empty($records[key($records)])) {
$line = $records[key($records)];
}
$line->fk_stocktransfer = $id;
$line->qty += $qty;
$line->fk_warehouse_source = $fk_warehouse_source;
@ -193,8 +208,9 @@ if (empty($reshook)) {
$line->batch = $batch;
$line->pmp = $prod->pmp;
if ($line->id > 0) $line->update($user);
else {
if ($line->id > 0) {
$line->update($user);
} else {
$line->rang = (is_array($object->lines) || $object->lines instanceof Countable) ? count($object->lines) + 1 : 1;
$line->create($user);
}
@ -257,10 +273,15 @@ if (empty($reshook)) {
$db->begin();
foreach ($lines as $line) {
$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source);
if ($res <= 0) $error++;
if ($res <= 0) {
$error++;
}
}
if (empty($error)) {
$db->commit();
} else {
$db->rollback();
}
if (empty($error)) $db->commit();
else $db->rollback();
}
if (empty($error)) {
$object->setStatut($object::STATUS_TRANSFERED, $id);
@ -278,10 +299,15 @@ if (empty($reshook)) {
$db->begin();
foreach ($lines as $line) {
$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source, 0);
if ($res <= 0) $error++;
if ($res <= 0) {
$error++;
}
}
if (empty($error)) {
$db->commit();
} else {
$db->rollback();
}
if (empty($error)) $db->commit();
else $db->rollback();
}
if (empty($error)) {
$object->setStatut($object::STATUS_VALIDATED, $id);
@ -299,10 +325,15 @@ if (empty($reshook)) {
$db->begin();
foreach ($lines as $line) {
$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination, 0);
if ($res <= 0) $error++;
if ($res <= 0) {
$error++;
}
}
if (empty($error)) {
$db->commit();
} else {
$db->rollback();
}
if (empty($error)) $db->commit();
else $db->rollback();
}
if (empty($error)) {
$object->setStatut($object::STATUS_CLOSED, $id);
@ -320,10 +351,15 @@ if (empty($reshook)) {
$db->begin();
foreach ($lines as $line) {
$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination);
if ($res <= 0) $error++;
if ($res <= 0) {
$error++;
}
}
if (empty($error)) {
$db->commit();
} else {
$db->rollback();
}
if (empty($error)) $db->commit();
else $db->rollback();
}
if (empty($error)) {
$object->setStatut($object::STATUS_TRANSFERED, $id);
@ -368,7 +404,9 @@ jQuery(document).ready(function() {';
// Affichage alerte date prévue de départ si transfert concerné
$date_prevue_depart = $object->date_prevue_depart;
$date_prevue_depart_plus_delai = $date_prevue_depart;
if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
if ($object->lead_time_for_warning > 0) {
$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
}
if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
print "$('.valuefield.fieldname_date_prevue_depart').append('";
print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
@ -386,8 +424,12 @@ if ($action == 'create') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
print dol_get_fiche_head(array(), '');
@ -443,8 +485,12 @@ if (($id || $ref) && $action == 'edit') {
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
}
print dol_get_fiche_head();
@ -545,8 +591,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$formconfirm = $hookmanager->resPrint;
}
// Print form confirm
print $formconfirm;
@ -616,8 +665,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td class="right">';
if ($permissiontoadd && $action != 'editincoterm') print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
if ($permissiontoadd && $action != 'editincoterm') {
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
} else {
print '&nbsp;';
}
print '</td></tr></table>';
print '</td>';
print '<td>';
@ -706,7 +758,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id.'">
';
if ($lineid > 0) print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
if ($lineid > 0) {
print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
}
print '<table id="tablelines" class="liste centpercent">';
//print '<div class="tagtable centpercent">';
@ -753,32 +807,47 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.'>';
print '<td class="titlefield">';
if ($action === 'editline' && $line->id == $lineid) $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
else print $productstatic->getNomUrl(1).' - '.$productstatic->label;
if ($action === 'editline' && $line->id == $lineid) {
$form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
} else {
print $productstatic->getNomUrl(1).' - '.$productstatic->label;
}
print '</td>';
if (isModEnabled('productbatch')) {
print '<td>';
if ($action === 'editline' && $line->id == $lineid) print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
else {
if ($action === 'editline' && $line->id == $lineid) {
print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
} else {
$productlot = new Productlot($db);
if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) {
print $productlot->getNomUrl(1);
} elseif (!empty($line->batch)) print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
} elseif (!empty($line->batch)) {
print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
}
}
print '</td>';
}
print '<td>';
if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
else print $warehousestatics->getNomUrl(1);
if ($action === 'editline' && $line->id == $lineid) {
print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
} else {
print $warehousestatics->getNomUrl(1);
}
print '</td>';
print '<td>';
if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
else print $warehousestatict->getNomUrl(1);
if ($action === 'editline' && $line->id == $lineid) {
print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
} else {
print $warehousestatict->getNomUrl(1);
}
print '</td>';
if ($action === 'editline' && $line->id == $lineid) print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
else print '<td class="center">'.$line->qty.'</td>';
if ($action === 'editline' && $line->id == $lineid) {
print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
} else {
print '<td class="center">'.$line->qty.'</td>';
}
if ($conf->global->PRODUCT_USE_UNITS) {
print '<td class="linecoluseunit nowrap left">';
@ -840,7 +909,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Product
print '<td class="titlefield">';
$filtertype = 0;
if (getDolGlobalString('STOCK_SUPPORTS_SERVICES')) $filtertype = '';
if (getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
$filtertype = '';
}
if (getDolGlobalInt('PRODUIT_LIMIT_SIZE') <= 0) {
$limit = '';
} else {
@ -864,7 +935,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$source_ent = new Entrepot($db);
$source_ent->fetch($object->fk_warehouse_source);
foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) {
$TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
}
}
}
@ -874,7 +947,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$dest_ent = new Entrepot($db);
$dest_ent->fetch($object->fk_warehouse_destination);
foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) {
$TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
}
}
}
@ -919,7 +994,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="tabsAction">'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Send
@ -1043,7 +1120,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
//Select mail models is same action as presend
if (GETPOST('modelselected')) $action = 'presend';
if (GETPOST('modelselected')) {
$action = 'presend';
}
// Presend form
$modelmail = 'stocktransfer';

View File

@ -36,7 +36,9 @@ $lineid = GETPOST('lineid', 'int');
$action = GETPOST('action', 'alpha');
// Security check
if ($user->socid) $socid = $user->socid;
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'stocktransfer', $id, '', 'stocktransfer');
@ -176,7 +178,9 @@ if ($object->id > 0) {
$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
foreach ($dirtpls as $reldir) {
$res = @include dol_buildpath($reldir.'/contacts.tpl.php');
if ($res) break;
if ($res) {
break;
}
}
}

View File

@ -45,12 +45,18 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name";
if (!$sortorder) {
$sortorder = "ASC";
}
if (!$sortfield) {
$sortfield = "name";
}
//if (! $sortfield) $sortfield="position_name";
// Initialize technical objects
@ -65,7 +71,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
//if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity?$object->entity:$conf->entity] . "/stocktransfer/" . dol_sanitizeFileName($object->id);
if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity]."/stocktransfer/".dol_sanitizeFileName($object->ref);
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity]."/stocktransfer/".dol_sanitizeFileName($object->ref);
}
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
@ -104,7 +112,7 @@ if ($object->id) {
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {
$totalsize += $file['size'];

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer
// Load translation files required by the page
$langs->loadLangs(array("stocks", "other"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
@ -51,7 +51,9 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$page = 0;
} // If $page is not defined, or '' or -1 or if we click on clear filters
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -69,14 +71,20 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) {
$sortfield = "t.".key($object->fields);
} // Set here default search field. By default 1st field in definition.
if (!$sortorder) {
$sortorder = "ASC";
}
// Initialize array of search criterias
$search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml'));
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
if (GETPOST('search_'.$key, 'alpha') !== '') {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
}
// List of fields to search into when doing a "search in all"
@ -91,7 +99,9 @@ foreach ($object->fields as $key => $val) {
$arrayfields = array();
foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
if (!empty($val['visible'])) {
$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
}
}
//var_dump($object->fields);
// Extra fields
@ -116,14 +126,18 @@ $permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write');
$permissiontodelete = $user->hasRight('stocktransfer', 'stocktransfer', 'delete');
// Security check
if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
if (empty($conf->stocktransfer->enabled)) {
accessforbidden('Module not enabled');
}
$socid = 0;
if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'stocktransfer', $id, '');
if (!$permissiontoread) accessforbidden();
if (!$permissiontoread) {
accessforbidden();
}
@ -131,12 +145,19 @@ if (!$permissiontoread) accessforbidden();
* Actions
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Selection of new fields
@ -196,18 +217,29 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
else $sql .= " WHERE 1 = 1";
if ($object->ismultientitymanaged == 1) {
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
} else {
$sql .= " WHERE 1 = 1";
}
foreach ($search as $key => $val) {
if ($key == 'status' && $search[$key] == -1) continue;
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') $search[$key] = '';
if ($search[$key] == '-1') {
$search[$key] = '';
}
$mode_search = 2;
}
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@ -249,7 +281,9 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
if ($limit) {
$sql .= $db->plimit($limit + 1, $offset);
}
$resql = $db->query($sql);
if (!$resql) {
@ -292,13 +326,24 @@ jQuery(document).ready(function() {
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit);
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
else $param .= '&search_'.$key.'='.urlencode($search[$key]);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
} else {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -309,12 +354,18 @@ $arrayofmassactions = array(
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
@ -336,7 +387,9 @@ $trackid = 'xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) {
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
}
@ -347,8 +400,11 @@ $moreforfilter.= '</div>';*/
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
@ -369,10 +425,15 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
@ -405,10 +466,15 @@ print '</tr>'."\n";
print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
}
@ -441,7 +507,9 @@ $i = 0;
$totalarray = array();
while ($i < ($limit ? min($num, $limit) : $num)) {
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
if (empty($obj)) {
break;
} // Should not happen
// Store properties in $object
$object->setVarsFromFetchObj($obj);
@ -450,31 +518,48 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<tr class="oddeven">';
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center';
}
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
if (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif ($key == 'ref') {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
}
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'right';
}
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5);
else {
if ($key == 'status') {
print $object->getLibStatut(5);
} else {
print $object->showOutputField($val, $key, $object->$key, '');
if ($key === 'date_prevue_depart' && $object->lead_time_for_warning > 0 && $object->$key > 0) {
$date_prevue_depart = $object->$key;
$date_prevue_depart_plus_delai = $date_prevue_depart;
if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
if ($object->lead_time_for_warning > 0) {
$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
}
if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
}
}
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
if (!empty($val['isameasure'])) {
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
}
$totalarray['val']['t.'.$key] += $object->$key;
}
}
@ -489,11 +574,15 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) $selected = 1;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
@ -506,7 +595,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
@ -524,7 +617,9 @@ print '</form>'."\n";
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
$hidegeneratedfilelistifempty = 1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
$hidegeneratedfilelistifempty = 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile = new FormFile($db);

View File

@ -52,7 +52,9 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
}
$permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php

View File

@ -36,7 +36,9 @@ if (empty($conf) || !is_object($conf)) {
<?php
// Other attributes
if (!isset($parameters)) $parameters = array();
if (!isset($parameters)) {
$parameters = array();
}
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -105,7 +105,7 @@ print '<tr>';
if ($object->element == 'product') {
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td>';
$ident = (GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ? GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
$ident = (GETPOST("dwid") ? GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ? GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
if (empty($ident) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE')) {
$ident = $conf->global->MAIN_DEFAULT_WAREHOUSE;
}
@ -152,8 +152,8 @@ if (ismodEnabled('productbatch') &&
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
if ($pdluoid > 0) {
// If form was opened for a specific pdluoid, field is disabled
print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
} else {
print img_picto('', 'barcode', 'class="pictofixedwidth"').'<input type="text" name="batch_number" class="minwidth300" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
}

View File

@ -73,7 +73,7 @@ if ($object->element == 'product') {
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td>';
print img_picto('', 'stock');
$selected = (GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
$selected = (GETPOST("dwid") ? GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ? GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
$warehousestatus = 'warehouseopen,warehouseinternal';
print $formproduct->selectWarehouses($selected, 'id_entrepot', $warehousestatus, 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
print '</td>';
@ -101,8 +101,8 @@ if (isModEnabled('productbatch') &&
print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
if ($pdluoid > 0) {
// If form was opened for a specific pdluoid, field is disabled
print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
} else {
print img_picto('', 'barcode', 'class="pictofixedwidth"').'<input type="text" name="batch_number" class="minwidth300 widthcentpercentminusx maxwidth300" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
}

View File

@ -35,7 +35,7 @@ $result = restrictedArea($user, 'stock');
$sref = GETPOST("sref", 'alpha');
$snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
@ -49,7 +49,7 @@ $page = $_GET["page"];
if ($page < 0) {
$page = 0;
}
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page;
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');

View File

@ -262,7 +262,7 @@ if ($action == 'edit') {
$i++;
$s = picto_from_langcode($key);
print ($i > 1 ? "<br>" : "").($s ? $s.' ' : '').' <div class="inline-block margintop marginbottomonly"><b>'.$langs->trans('Language_'.$key).'</b></div><div class="inline-block floatright"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom marginrightonly"').'</a></div>';
print($i > 1 ? "<br>" : "").($s ? $s.' ' : '').' <div class="inline-block margintop marginbottomonly"><b>'.$langs->trans('Language_'.$key).'</b></div><div class="inline-block floatright"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom marginrightonly"').'</a></div>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
@ -296,7 +296,7 @@ if ($action == 'edit') {
$i++;
$s = picto_from_langcode($key);
print ($i > 1 ? "<br>" : "").($s ? $s.' ' : '').' <div class="inline-block marginbottomonly"><b>'.$langs->trans('Language_'.$key).'</b></div><div class="inline-block floatright"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom marginrightonly"').'</a></div>';
print($i > 1 ? "<br>" : "").($s ? $s.' ' : '').' <div class="inline-block marginbottomonly"><b>'.$langs->trans('Language_'.$key).'</b></div><div class="inline-block floatright"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom marginrightonly"').'</a></div>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View File

@ -43,7 +43,7 @@ $mode = GETPOST("mode", 'alpha');
$id = GETPOST('id', 'int');
$taskid = GETPOST('taskid', 'int');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'perdaycard';
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'perdaycard';
$mine = 0;
if ($mode == 'mine') {
@ -62,10 +62,10 @@ $result = restrictedArea($user, 'projet', $projectid);
$now = dol_now();
$year = GETPOST('reyear', 'int') ?GETPOST('reyear', 'int') : (GETPOST("year", "int") ?GETPOST("year", "int") : (GETPOST("addtimeyear", "int") ?GETPOST("addtimeyear", "int") : date("Y")));
$month = GETPOST('remonth', 'int') ?GETPOST('remonth', 'int') : (GETPOST("month", "int") ?GETPOST("month", "int") : (GETPOST("addtimemonth", "int") ?GETPOST("addtimemonth", "int") : date("m")));
$day = GETPOST('reday', 'int') ?GETPOST('reday', 'int') : (GETPOST("day", "int") ?GETPOST("day", "int") : (GETPOST("addtimeday", "int") ?GETPOST("addtimeday", "int") : date("d")));
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$year = GETPOST('reyear', 'int') ? GETPOST('reyear', 'int') : (GETPOST("year", "int") ? GETPOST("year", "int") : (GETPOST("addtimeyear", "int") ? GETPOST("addtimeyear", "int") : date("Y")));
$month = GETPOST('remonth', 'int') ? GETPOST('remonth', 'int') : (GETPOST("month", "int") ? GETPOST("month", "int") : (GETPOST("addtimemonth", "int") ? GETPOST("addtimemonth", "int") : date("m")));
$day = GETPOST('reday', 'int') ? GETPOST('reday', 'int') : (GETPOST("day", "int") ? GETPOST("day", "int") : (GETPOST("addtimeday", "int") ? GETPOST("addtimeday", "int") : date("d")));
$week = GETPOST("week", "int") ? GETPOST("week", "int") : date("W");
$day = (int) $day;
@ -96,8 +96,11 @@ if ($year && $month && $day) {
}
$daytoparsegmt = dol_now('gmt');
if ($yearofday && $monthofday && $dayofday) $daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt'); // xxxofday is value of day after submit action 'addtime'
elseif ($year && $month && $day) $daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt'); // this are value submited after submit of action 'submitdateselect'
if ($yearofday && $monthofday && $dayofday) {
$daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt');
} elseif ($year && $month && $day) { // xxxofday is value of day after submit action 'addtime'
$daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt');
} // this are value submited after submit of action 'submitdateselect'
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
$usertoprocess = $user;
@ -750,11 +753,11 @@ if (count($tasksarray) > 0) {
$timeonothertasks = ($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
//if ($timeonothertasks)
//{
print '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled="" id="timespent[-1][0]" name="task[-1][0]" value="';
print '<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled="" id="timespent[-1][0]" name="task[-1][0]" value="';
if ($timeonothertasks) {
print convertSecondToTime($timeonothertasks, 'allhourmin');
}
print '"></span>';
print '"></span>';
//}
print '</td>';
print ' <td class="liste_total"></td>';

View File

@ -58,11 +58,11 @@ $result = restrictedArea($user, 'projet', $projectid);
$now = dol_now();
$year = GETPOST('reyear') ?GETPOST('reyear', 'int') : (GETPOST("year") ?GETPOST("year", "int") : date("Y"));
$month = GETPOST('remonth') ?GETPOST('remonth', 'int') : (GETPOST("month") ?GETPOST("month", "int") : date("m"));
$day = GETPOST('reday') ?GETPOST('reday', 'int') : (GETPOST("day") ?GETPOST("day", "int") : date("d"));
$year = GETPOST('reyear') ? GETPOST('reyear', 'int') : (GETPOST("year") ? GETPOST("year", "int") : date("Y"));
$month = GETPOST('remonth') ? GETPOST('remonth', 'int') : (GETPOST("month") ? GETPOST("month", "int") : date("m"));
$day = GETPOST('reday') ? GETPOST('reday', 'int') : (GETPOST("day") ? GETPOST("day", "int") : date("d"));
$day = (int) $day;
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$week = GETPOST("week", "int") ? GETPOST("week", "int") : date("W");
//$search_categ = GETPOST("search_categ", 'alpha');
$search_usertoprocessid = GETPOST('search_usertoprocessid', 'int');

View File

@ -43,7 +43,7 @@ $mode = GETPOST("mode", 'alpha');
$id = GETPOST('id', 'int');
$taskid = GETPOST('taskid', 'int');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'perweekcard';
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'perweekcard';
$mine = 0;
if ($mode == 'mine') {
@ -62,10 +62,10 @@ $result = restrictedArea($user, 'projet', $projectid);
$now = dol_now();
$year = GETPOST('reyear', 'int') ?GETPOST('reyear', 'int') : (GETPOST("year", 'int') ?GETPOST("year", "int") : date("Y"));
$month = GETPOST('remonth', 'int') ?GETPOST('remonth', 'int') : (GETPOST("month", 'int') ?GETPOST("month", "int") : date("m"));
$day = GETPOST('reday', 'int') ?GETPOST('reday', 'int') : (GETPOST("day", 'int') ?GETPOST("day", "int") : date("d"));
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$year = GETPOST('reyear', 'int') ? GETPOST('reyear', 'int') : (GETPOST("year", 'int') ? GETPOST("year", "int") : date("Y"));
$month = GETPOST('remonth', 'int') ? GETPOST('remonth', 'int') : (GETPOST("month", 'int') ? GETPOST("month", "int") : date("m"));
$day = GETPOST('reday', 'int') ? GETPOST('reday', 'int') : (GETPOST("day", 'int') ? GETPOST("day", "int") : date("d"));
$week = GETPOST("week", "int") ? GETPOST("week", "int") : date("W");
$day = (int) $day;

View File

@ -99,7 +99,9 @@ if ($action == 'updateMaskTask') {
$project->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/project/doc/pdf_".$modele.".modules.php", 0);
@ -133,7 +135,9 @@ if ($action == 'updateMaskTask') {
$project->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/project/task/doc/pdf_".$modele.".modules.php", 0);
@ -318,7 +322,7 @@ foreach ($dirmodels as $reldir) {
require_once $dir.$file.'.php';
$module = new $file;
$module = new $file();
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@ -414,7 +418,7 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
require_once $dir.$file.'.php';
$module = new $file;
$module = new $file();
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@ -555,7 +559,7 @@ foreach ($dirmodels as $reldir) {
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
@ -695,7 +699,7 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);

View File

@ -38,7 +38,7 @@ $socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "aZ09comma");
$sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -60,7 +60,7 @@ if (GETPOST('actioncode', 'array')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
@ -147,7 +147,7 @@ $morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref.
if (!$user->hasRight('projet', 'all', 'lire')) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
$object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -220,7 +220,7 @@ if (!empty($object->id)) {
$cachekey = 'count_events_project_'.$object->id;
$nbEvent = dol_getcache($cachekey);
$titlelist = $langs->trans("ActionsOnProject").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': '');
$titlelist = $langs->trans("ActionsOnProject").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);

View File

@ -490,7 +490,7 @@ if (empty($reshook)) {
$clone_task_files = GETPOST('clone_task_files') ? 1 : 0;
$clone_notes = GETPOST('clone_notes') ? 1 : 0;
$move_date = GETPOST('move_date') ? 1 : 0;
$clone_thirdparty = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : 0;
$clone_thirdparty = GETPOST('socid', 'int') ? GETPOST('socid', 'int') : 0;
$result = $object->createFromClone($user, $object->id, $clone_contacts, $clone_tasks, $clone_project_files, $clone_task_files, $clone_notes, $move_date, 0, $clone_thirdparty);
if ($result <= 0) {
@ -573,7 +573,9 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
$modele = !getDolGlobalString('PROJECT_ADDON') ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
@ -586,7 +588,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
if ($filefound) {
$result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
$modProject = new $classname;
$modProject = new $classname();
$defaultref = $modProject->getNextValue($thirdparty, $object);
}
@ -690,7 +692,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
print '<br>';
}
if (isModEnabled('eventorganization')) {
print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') ? ' checked="checked"' : '') :'').'"> ';
print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') ? ' checked="checked"' : '') : '').'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print '<label for="usage_organize_event">'.$form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext).'</label>';
print '<script>';
@ -718,9 +720,9 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
// Thirdparty
if (isModEnabled('societe')) {
print '<tr><td>';
print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '<span class="fieldrequired">');
print(!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '<span class="fieldrequired">');
print $langs->trans("ThirdParty");
print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '</span>');
print(!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '</span>');
print '</td><td class="maxwidthonsmartphone">';
$filter = '';
if (getDolGlobalString('PROJECT_FILTER_FOR_THIRDPARTY_LIST')) {
@ -1105,9 +1107,9 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
// Thirdparty
if (isModEnabled('societe')) {
print '<tr><td>';
print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '<span class="fieldrequired">');
print(!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '<span class="fieldrequired">');
print $langs->trans("ThirdParty");
print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '</span>');
print(!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : '</span>');
print '</td><td>';
$filter = '';
if (getDolGlobalString('PROJECT_FILTER_FOR_THIRDPARTY_LIST')) {
@ -1158,7 +1160,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'minwidth150 inline-block valignmiddle', 1, 1);
// Opportunity probability
print ' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans("OpportunityProbability")).'" value="'.(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ?vatrate($object->opp_percent) : '')).'"> %';
print ' <input class="width50 right" type="text" id="opp_percent" name="opp_percent" title="'.dol_escape_htmltag($langs->trans("OpportunityProbability")).'" value="'.(GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ? vatrate($object->opp_percent) : '')).'"> %';
print '<span id="oldopppercent" class="opacitymedium"></span>';
print '</div>';
@ -1369,10 +1371,10 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
// Date start - end project
print '<tr><td>'.$langs->trans("Dates").'</td><td>';
$start = dol_print_date($object->date_start, 'day');
print ($start ? $start : '?');
print($start ? $start : '?');
$end = dol_print_date($object->date_end, 'day');
print ' <span class="opacitymedium">-</span> ';
print ($end ? $end : '?');
print($end ? $end : '?');
if ($object->hasDelay()) {
print img_warning("Late");
}
@ -1517,7 +1519,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
// modified by hook
if (empty($reshook)) {
if ($action != "edit" && $action != 'presend') {
// Create event

View File

@ -1431,7 +1431,7 @@ class Project extends CommonObject
$label = $langs->trans("ShowProject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
@ -1733,14 +1733,16 @@ class Project extends CommonObject
$defaultref = '';
$obj = !getDolGlobalString('PROJECT_ADDON') ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/project/".$obj.'.php', 0);
if (file_exists($file)) {
$filefound = 1;
dol_include_once($reldir."core/modules/project/".$obj.'.php');
$modProject = new $obj;
$modProject = new $obj();
$defaultref = $modProject->getNextValue(is_object($clone_project->thirdparty) ? $clone_project->thirdparty : null, $clone_project);
break;
}
@ -2413,7 +2415,7 @@ class Project extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic = new Task($this->db);
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
return 1;
}

View File

@ -113,7 +113,7 @@ class ProjectStats extends Stats
} else {
$other += $row[1];
}
$i++;
$i++;
}
if ($num > $limit) {
$result[$i] = array(
@ -121,7 +121,7 @@ class ProjectStats extends Stats
$other
);
}
$this->db->free($resql);
$this->db->free($resql);
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this).'::'.__METHOD__.' '.$this->error, LOG_ERR);

View File

@ -259,7 +259,8 @@ class Task extends CommonObjectLine
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) {
@ -470,7 +471,8 @@ class Task extends CommonObjectLine
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
// Update extrafield
@ -492,7 +494,7 @@ class Task extends CommonObjectLine
function ($allTasksCompleted, $task) {
return $allTasksCompleted && $task->progress >= 100;
},
1
1
);
if ($projectCompleted) {
if ($project->setClose($user) <= 0) {
@ -563,7 +565,6 @@ class Task extends CommonObjectLine
*/
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -603,7 +604,8 @@ class Task extends CommonObjectLine
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -613,7 +615,8 @@ class Task extends CommonObjectLine
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -623,7 +626,8 @@ class Task extends CommonObjectLine
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -688,7 +692,8 @@ class Task extends CommonObjectLine
dol_syslog(get_class($this)."::hasChildren", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
} else {
$obj = $this->db->fetch_object($resql);
if ($obj) {
@ -722,7 +727,8 @@ class Task extends CommonObjectLine
dol_syslog(get_class($this)."::hasTimeSpent", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
} else {
$obj = $this->db->fetch_object($resql);
if ($obj) {
@ -818,7 +824,7 @@ class Task extends CommonObjectLine
$label = $langs->trans("ShowTask");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.' nowraponall"';
} else {
$linkclose .= ' class="nowraponall"';
@ -1876,7 +1882,8 @@ class Task extends CommonObjectLine
$res_del = $timespent->delete($user);
if ($res_del < 0) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
@ -1951,7 +1958,7 @@ class Task extends CommonObjectLine
$obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) {
require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php';
$modTask = new $obj;
$modTask = new $obj();
$defaultref = $modTask->getNextValue(0, $clone_task);
}
@ -1985,7 +1992,7 @@ class Task extends CommonObjectLine
}
if (!$clone_prog) {
$clone_task->progress = 0;
$clone_task->progress = 0;
}
// Create clone
@ -2333,7 +2340,8 @@ class Task extends CommonObjectLine
// phpcs:enable
global $user;
$mine = 0; $socid = $user->socid;
$mine = 0;
$socid = $user->socid;
$projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $mine, 1, $socid);

View File

@ -315,7 +315,7 @@ if ($id > 0 || !empty($ref)) {
// Define a complementary filter for search of next/prev ref.
if (!$user->hasRight('projet', 'all', 'lire')) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
$object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -406,10 +406,10 @@ if ($id > 0 || !empty($ref)) {
// Date start - end project
print '<tr><td>'.$langs->trans("Dates").'</td><td>';
$start = dol_print_date($object->date_start, 'day');
print ($start ? $start : '?');
print($start ? $start : '?');
$end = dol_print_date($object->date_end, 'day');
print ' <span class="opacitymedium">-</span> ';
print ($end ? $end : '?');
print($end ? $end : '?');
if ($object->hasDelay()) {
print img_warning("Late");
}

View File

@ -122,7 +122,7 @@ if ($object->id > 0) {
print dol_get_fiche_head($head, 'document', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
// Files list constructor
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {
$totalsize += $file['size'];
@ -151,7 +151,7 @@ if ($object->id > 0) {
// Define a complementary filter for search of next/prev ref.
if (!$user->hasRight('projet', 'all', 'lire')) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
$object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -239,7 +239,7 @@ $morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref.
if (!$user->hasRight('projet', 'all', 'lire')) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = "te.rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
$object->next_prev_filter = "te.rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -331,10 +331,10 @@ print '</td></tr>';
// Date start - end project
print '<tr><td>'.$langs->trans("Dates").'</td><td>';
$start = dol_print_date($object->date_start, 'day');
print ($start ? $start : '?');
print($start ? $start : '?');
$end = dol_print_date($object->date_end, 'day');
print ' - ';
print ($end ? $end : '?');
print($end ? $end : '?');
if ($object->hasDelay()) {
print img_warning("Late");
}
@ -888,7 +888,7 @@ foreach ($listofreferent as $key => $value) {
|| !empty($dates) && empty($datee) && $loanSchedule->datep >= $dates && $loanSchedule->datep <= dol_now()
|| empty($dates) && !empty($datee) && $loanSchedule->datep <= $datee
) {
$total_ht_by_line -= $loanSchedule->amount_capital;
$total_ht_by_line -= $loanSchedule->amount_capital;
}
}
}
@ -1312,7 +1312,9 @@ foreach ($listofreferent as $key => $value) {
print "</td>\n";
// Date or TimeSpent
$date = ''; $total_time_by_line = null; $total_time = 0;
$date = '';
$total_time_by_line = null;
$total_time = 0;
if ($tablename == 'expensereport_det') {
$date = $element->date; // No draft status on lines
} elseif ($tablename == 'stock_mouvement') {
@ -1533,8 +1535,11 @@ foreach ($listofreferent as $key => $value) {
$total_ht_by_third += $total_ht_by_line;
$total_ttc_by_third += $total_ttc_by_line;
if (!isset($total_time)) $total_time = $total_time_by_line;
else $total_time += $total_time_by_line;
if (!isset($total_time)) {
$total_time = $total_time_by_line;
} else {
$total_time += $total_time_by_line;
}
}
if (canApplySubtotalOn($tablename)) {

View File

@ -303,4 +303,3 @@ function findChildGanttLine($tarr, $parent, $task_dependencies, $level)
}
}
}

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