Merge remote-tracking branch 'upstream/develop' into 12.0_a23

This commit is contained in:
Alexandre SPANGARO 2020-03-23 05:50:07 +01:00
commit 7d22ccbd12
41 changed files with 448 additions and 202 deletions

View File

@ -16,7 +16,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
stale-label: 'Issue Stale (automatic label)'
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE)'
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE),Analysis of PR in progres'
days-before-stale: 365
days-before-close: 15
operations-per-run: 100

View File

@ -91,14 +91,6 @@ print '<br>';
// Show info setup module
print img_picto('', 'puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
/*
$nbofactivatedmodules=count($conf->modules);
$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules));
if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
print '<br>'.$moreinfo;
*/
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
{
$langs->load("errors");

View File

@ -147,13 +147,13 @@ dol_fiche_head($head, 'card', $langs->trans("MenuUsersAndGroups"), -1, 'user');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '</tr>';
// Mail required for members
// Mail required for users
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UserMailRequired").'</td>';
@ -206,6 +206,8 @@ else
dol_print_error($db);
}
print load_fiche_titre($langs->trans("UsersDocModules"), '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';

View File

@ -152,6 +152,8 @@ else
dol_print_error($db);
}
print load_fiche_titre($langs->trans("GroupsDocModules"), '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';

View File

@ -243,7 +243,49 @@ class Categorie extends CommonObject
*/
public function __construct($db)
{
global $hookmanager;
$this->db = $db;
if (is_object($hookmanager)) {
$hookmanager->initHooks(array('category'));
$parameters = array();
$reshook = $hookmanager->executeHooks('constructCategory', $parameters, $this); // Note that $action and $object may have been modified by some hooks
if ($reshook >= 0 && !empty($hookmanager->resArray)) {
$mapList = $hookmanager->resArray;
$mapId = $mapList['id'];
$mapCode = $mapList['code'];
self::$MAP_ID_TO_CODE[$mapId] = $mapCode;
$this->MAP_ID[$mapCode] = $mapId;
$this->MAP_CAT_FK[$mapCode] = $mapList['cat_fk'];
$this->MAP_CAT_TABLE[$mapCode] = $mapList['cat_table'];
$this->MAP_OBJ_CLASS[$mapCode] = $mapList['obj_class'];
$this->MAP_OBJ_TABLE[$mapCode] = $mapList['obj_table'];
}
}
}
/**
* Get map list
*
* @return array
*/
public function getMapList()
{
$mapList = array();
foreach ($this->MAP_ID as $mapCode => $mapId) {
$mapList[] = array(
'id' => $mapId,
'code' => $mapCode,
'cat_fk' => $this->MAP_CAT_FK[$mapCode],
'cat_table' => $this->MAP_CAT_TABLE[$mapCode],
'obj_class' => $this->MAP_OBJ_CLASS[$mapCode],
'obj_table' => $this->MAP_OBJ_TABLE[$mapCode]
);
}
return $mapList;
}
/**

View File

@ -40,6 +40,7 @@ $id = GETPOST('id', 'int');
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
$catname = GETPOST('catname', 'alpha');
$categstatic = new Categorie($db);
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
@ -47,25 +48,13 @@ if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backwar
* View
*/
$categstatic = new Categorie($db);
$form = new Form($db);
if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; }
elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; }
elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; }
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; }
elseif ($type == Categorie::TYPE_ACTIONCOMM) {
$title = $langs->trans("ActionCommCategoriesArea");
$typetext = 'actioncomm';
} else {
$title = $langs->trans("CategoriesArea");
$typetext = 'unknown';
}
$typetext = $type;
if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea');
elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea');
elseif ($type == Categorie::TYPE_ACTIONCOMM) $title = $langs->trans('ActionCommCategoriesArea');
else $title = $langs->trans(ucfirst($type). 'sCategoriesArea');
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');

View File

@ -36,15 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
$langs->loadlangs(array('categories', 'bills'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref');
$type = GETPOST('type');
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$label = GETPOST('label', 'alpha');
$type = GETPOST('type');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm');
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
if ($id == "")
if ($id == '' && $label == '')
{
dol_print_error('', 'Missing parameter id');
exit();
@ -54,13 +52,17 @@ if ($id == "")
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
if ($id > 0)
{
$result = $object->fetch($id);
$upload_dir = $conf->categorie->multidir_output[$object->entity];
$result = $object->fetch($id, $label, $type);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$upload_dir = $conf->categorie->multidir_output[$object->entity];
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
/*
* Actions
@ -126,7 +128,7 @@ if ($object->id)
dol_fiche_head($head, 'photos', $title, -1, 'category');
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = ' type = ' . $object->type;
$object->ref = $object->label;
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
@ -136,7 +138,7 @@ if ($object->id)
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1);
/*
* Confirmation de la suppression de photo

View File

@ -36,18 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->loadLangs(array('categories', 'languages'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$label = GETPOST('label', 'alpha');
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$type = GETPOST('type', 'aZ09');
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
if ($id == "")
if ($id == '' && $label == '')
{
dol_print_error('', 'Missing parameter id');
exit();
@ -57,7 +51,16 @@ if ($id == "")
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result = $object->fetch($id, $label, $type);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$object->fetch_optionals();
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
/*
* Actions
@ -159,8 +162,6 @@ $cancel != $langs->trans("Cancel") &&
}
}
$result = $object->fetch($id, $ref);
/*
* View
@ -197,7 +198,7 @@ if (!empty($object->multilangs))
dol_fiche_head($head, 'translation', $title, -1, 'category');
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = ' type = ' . $object->type;
$object->ref = $object->label;
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
@ -207,7 +208,7 @@ foreach ($ways as $way)
}
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1);
print '<br>';

View File

@ -71,7 +71,7 @@ if ($id == "" && $label == "")
$result = restrictedArea($user, 'categorie', $id, '&category');
$object = new Categorie($db);
$result = $object->fetch($id, $label);
$result = $object->fetch($id, $label, $type);
if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
@ -80,7 +80,6 @@ if ($result <= 0) {
dol_print_error($db, $object->error); exit;
}
$type = $object->type;
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$extrafields = new ExtraFields($db);
@ -222,8 +221,8 @@ $head = categories_prepare_head($object, $type);
dol_fiche_head($head, 'card', $title, -1, 'category');
$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
$linkback = '<a href="'.$backtolist.'\">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" type = ".$object->type;
$linkback = '<a href="'.$backtolist.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = ' type = ' . $object->type;
$object->ref = $object->label;
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
@ -233,7 +232,7 @@ foreach ($ways as $way)
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1);
/*

View File

@ -218,7 +218,7 @@ $dolibarr_main_authentication='dolibarr';
// 0 = No forced redirect
// 1 = Force redirect to https, until SCRIPT_URI start with https into response
// 2 = Force redirect to https, until SERVER["HTTPS"] is 'on' into response
// 'https://my.domain.com' = Force reditect to https using this domain name.
// 'https://my.domain.com' = Force redirect to https using this domain name.
// Warning: If you enable this parameter, your web server must be configured to
// respond URL with https protocol.
// According to your web server setup, some values may works and other not. Try
@ -226,7 +226,7 @@ $dolibarr_main_authentication='dolibarr';
// Default value: 0
// Possible values: 0, 1, 2 or 'https://my.domain.com'
// Examples:
// $dolibarr_main_force_https='0';
// $dolibarr_main_force_https='1';
//
$dolibarr_main_force_https='0';

View File

@ -316,6 +316,33 @@ class Form
return $ret;
}
/**
* Output edit in place form
*
* @param string $fieldname Name of the field
* @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
* @return string HTML code for the edit of alternative language
*/
public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string')
{
global $conf, $langs;
$result = '';
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
$result ='<div class="inline-block paddingleft field-'.$object->element.'-'.$fieldname.'">';
$s=picto_from_langcode($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$result .= $s;
$result .= '</div>';
}
return $result;
}
/**
* Output edit in place form
*
@ -3514,11 +3541,11 @@ class Form
* Return list of payment methods
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
*
* @param string $selected Id du mode de paiement pre-selectionne
* @param string $htmlname Nom de la zone select
* @param string $selected Id or code or preselected payment mode
* @param string $htmlname Name of select field
* @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
* @param int $empty 1=peut etre vide, 0 sinon
* @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code
* @param int $empty 1=can be empty, 0 otherwise
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $maxlength Max length of label
* @param int $active Active or not, -1 = all
@ -3559,9 +3586,12 @@ class Form
elseif ($format == 1) print '<option value="'.$arraytypes['code'].'"';
elseif ($format == 2) print '<option value="'.$arraytypes['code'].'"';
elseif ($format == 3) print '<option value="'.$id.'"';
// Si selected est text, on compare avec code, sinon avec id
if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) print ' selected';
elseif ($selected == $id) print ' selected';
// Print attribute selected or not
if ($format==1 || $format==2) {
if ($selected == $arraytypes['code']) print ' selected';
} else {
if ($selected == $id) print ' selected';
}
print '>';
if ($format == 0) $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
elseif ($format == 1) $value = $arraytypes['code'];

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2016 Sergio Sanchis <sergiosanchis@hotmail.com>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Destailleur Laurent <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,26 +36,9 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H
top_httphead('text/javascript; charset=UTF-8');
$nowtime = time();
//$nowtimeprevious = floor($nowtime / 60) * 60; // auto_check_events_not_before is rounded to previous minute
// TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when.
/* session already started into main
session_cache_limiter('public');
header('Cache-Control: no-cache');
session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
session_start();*/
if (! isset($_SESSION['auto_check_events_not_before']))
{
print 'console.log("_SESSION[auto_check_events_not_before] is not set");'."\n";
// Round to eliminate the seconds
$_SESSION['auto_check_events_not_before'] = $nowtime;
}
print 'var nowtime = ' . $nowtime . ';' . "\n";
print 'var login = \'' . $_SESSION['dol_login'] . '\';' . "\n";
print 'var auto_check_events_not_before = '.$_SESSION['auto_check_events_not_before']. ';'."\n";
print 'var time_js_next_test = Math.max(nowtime, auto_check_events_not_before);'."\n";
print 'var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined
print 'var time_js_next_test = (Date.now() + time_auto_update);'."\n";
?>
/* Check if permission ok */
@ -66,7 +50,7 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
var time_first_execution = (time_auto_update - (nowtime - time_js_next_test)) * 1000; //need milliseconds
if (login != '') {
console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" auto_check_events_not_before (val in session)= "+auto_check_events_not_before+" time_js_next_test (max now,auto_check_events_not_before) = "+time_js_next_test+" time_auto_update="+time_auto_update);
console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_test = "+time_js_next_test+" time_auto_update="+time_auto_update);
setTimeout(first_execution, time_first_execution);
} //first run auto check

View File

@ -268,12 +268,12 @@ function user_admin_prepare_head()
$h++;
$head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Users").")";
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/user/admin/group_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields")." ".$langs->trans("Groups");
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("Groups").")";
$head[$h][2] = 'attributes_group';
$h++;

View File

@ -421,7 +421,6 @@ function dolSaveReadme($file, $content)
function showWebsiteTemplates(Website $website)
{
global $conf, $langs, $db, $form;
global $bc;
$dirthemes = array('/doctemplates/websites');
if (!empty($conf->modules_parts['websitetemplates'])) // Using this feature slow down application
@ -521,21 +520,3 @@ function showWebsiteTemplates(Website $website)
print '</td></tr>';
print '</table>';
}
/**
* Return HTML content to add structured data for an article, news or Blog Post.
*
* @return string HTML content
*/
function getRSSForBlogPosts()
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
return $out;
}

View File

@ -336,7 +336,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
* @param string $url Url
* @return int < 0 if ko, Nb of events in file if ok
*/
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = "", $url="")
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '')
{
global $user, $conf, $langs;
global $dolibarr_main_url_root;
@ -534,7 +534,7 @@ function calEncode($line)
// Take char at position $j
$char = substr($line, $j, 1);
if ((dol_strlen($newpara) + dol_strlen($char)) >= 75 )
if ((dol_strlen($newpara) + dol_strlen($char)) >= 75)
{
// CRLF + Space for cal
$out .= $newpara . "\r\n ";

View File

@ -55,7 +55,7 @@ if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
$langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'supplier_proposal', 'deliveries', 'products', 'stocks', 'productbatch'));
$langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'receptions', 'supplier_proposal', 'deliveries', 'products', 'stocks', 'productbatch'));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
$id = GETPOST('id', 'int');
@ -2483,11 +2483,14 @@ elseif (!empty($object->id))
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)))
{
$labelofbutton = $langs->trans('ReceiveProducts');
if ($conf->reception->enabled) $labelofbutton = $langs->trans("CreateReception");
if (in_array($object->statut, array(3, 4, 5))) {
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id.'">'.$langs->trans('ReceiveProducts').'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id.'">'.$labelofbutton.'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ReceiveProducts').'</a></div>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$labelofbutton.'</a></div>';
}
}
}

View File

@ -379,7 +379,7 @@ $warehouse_static = new Entrepot($db);
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js'));
llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js.php'));
if ($id > 0 || !empty($ref)) {
$soc = new Societe($db);
@ -807,15 +807,13 @@ if ($id > 0 || !empty($ref)) {
print '<td>';
if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) {
$type = 'batch';
//print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$i.', \''.$type.'\')"');
}
else
{
$type = 'dispatch';
print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$i.', \''.$type.'\')"');
}
print '</td>';
if (! empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
@ -894,7 +892,8 @@ if ($id > 0 || !empty($ref)) {
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
}
empty($conf->reception->enabled) ? $dispatchBt = $langs->trans("DispatchVerb") : $dispatchBt = $langs->trans("Receive");
$dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive") : $langs->trans("CreateReception");
print '<br><input type="submit" class="button" name="dispatch" value="'.dol_escape_htmltag($dispatchBt).'"';
if (count($listwarehouses) <= 0)

View File

@ -1,3 +1,4 @@
<?php
// Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
// Copyright (C) 2017 Francis Appels <francis.appels@z-application.com>
//
@ -15,14 +16,33 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// or see https://www.gnu.org/
//
// \file htdocs/core/js/lib_dispatch.js
// \brief File that include javascript functions used dispatch.php
//
/**
* \file htdocs/fourn/js/lib_dispatch.js.php
* \brief File that include javascript functions used for dispatching qty/stock/lot
*/
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
if (! defined('NOLOGIN')) define('NOLOGIN', 1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter('public');
require_once '../../main.inc.php';
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
else header('Cache-Control: no-cache');
?>
/**
* addDispatchLine
* Adds new table row for dispatching to multiple stock locations
* Adds new table row for dispatching to multiple stock locations or multiple lot/serial
*
* @param index int index of product line. 0 = first product line
* @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch)
@ -32,12 +52,12 @@ function addDispatchLine(index, type, mode)
{
mode = mode || 'qtymissing'
console.log("fourn/js/lib_dispatch.js Split line type="+type+" index="+index+" mode="+mode);
var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object
nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch
qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows
qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()),
qtyDispatched;
console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode);
var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true); // clone first batch line to jQuery object
var nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length; // position of line for batch
var qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()); // Qty ordered is same for all rows
var qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val());
var qtyDispatched;
if (mode === 'lessone')
{
@ -46,8 +66,17 @@ function addDispatchLine(index, type, mode)
else
{
qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + qty;
// If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line
if (qtyDispatched == qtyOrdered && qtyDispatched > 1) {
qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + 1;
mode = 'lessone';
}
}
console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered);
if (qtyOrdered <= 1) {
window.alert("Quantity can't be split");
}
if (qtyDispatched < qtyOrdered)
{
//replace tr suffix nbr
@ -97,7 +126,7 @@ function addDispatchLine(index, type, mode)
*
* Change event handler for dispatch qty input field,
* recalculate qty dispatched when qty input has changed.
* If qty is more then qty ordered reset input qty to max qty to dispatch.
* If qty is more than qty ordered reset input qty to max qty to dispatch.
*
* element requires arbitrary data qty (value before change), type (type of dispatch) and index (index of product line)
*/

View File

@ -193,8 +193,9 @@ ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype;
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy;
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra;
ALTER TABLE llx_entrepot ADD COLUMN fax varchar(20) DEFAULT NULL AFTER fk_pays;
ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL AFTER fk_pays;
ALTER TABLE llx_entrepot ADD COLUMN fax varchar(20) DEFAULT NULL;
ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL;
ALTER TABLE llx_accounting_account ADD COLUMN reconcilable tinyint DEFAULT 0 NOT NULL after active;
ALTER TABLE llx_categorie MODIFY type integer NOT NULL DEFAULT 1;

View File

@ -26,7 +26,7 @@ create table llx_categorie
fk_parent integer DEFAULT 0 NOT NULL,
label varchar(180) NOT NULL, -- category ref/name
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
type tinyint DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member)
type integer DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member)
description text, -- description of the category
color varchar(8), -- color
fk_soc integer DEFAULT NULL, -- not used by default. Used when option CATEGORY_ASSIGNED_TO_A_CUSTOMER is set.

View File

@ -1108,8 +1108,8 @@ Delays_MAIN_DELAY_EXPENSEREPORTS=Expense report to approve
Delays_MAIN_DELAY_HOLIDAYS=Leave requests to approve
SetupDescription1=Before starting to use Dolibarr some initial parameters must be defined and modules enabled/configured.
SetupDescription2=The following two sections are mandatory (the two first entries in the Setup menu):
SetupDescription3=<a href="%s">%s -> %s</a><br>Basic parameters used to customize the default behavior of your application (e.g for country-related features).
SetupDescription4=<a href="%s">%s -> %s</a><br>This software is a suite of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module.
SetupDescription3=<a href="%s">%s -> %s</a><br><br>Basic parameters used to customize the default behavior of your application (e.g for country-related features).
SetupDescription4=<a href="%s">%s -> %s</a><br><br>This software is a suite of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module.
SetupDescription5=Other Setup menu entries manage optional parameters.
LogEvents=Security audit events
Audit=Audit
@ -1264,6 +1264,8 @@ RuleForGeneratedPasswords=Rules to generate and validate passwords
DisableForgetPasswordLinkOnLogonPage=Do not show the "Password Forgotten" link on the Login page
UsersSetup=Users module setup
UserMailRequired=Email required to create a new user
UsersDocModules=Document templates for documents generated from user record
GroupsDocModules=Document templates for documents generated from a group record
##### HRM setup #####
HRMSetup=HRM module setup
##### Company setup #####
@ -1980,5 +1982,5 @@ MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server
FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled
EmailTemplate=Template for email
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some text title in your PDF duplicated in 2 different languages in the same generate PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF.
PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated in 2 different languages in the same generated PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF.
FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book.

View File

@ -210,7 +210,7 @@ $sessionname = 'DOLSESSID_'.$prefix;
$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
if (!empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
session_name($sessionname);
session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
// This create lock, released when session_write_close() or end of page.
// We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
if (!defined('NOSESSION'))
@ -257,7 +257,7 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
}
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url')
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on'))
{
@ -284,6 +284,7 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV
// Start redirect
if ($newurl)
{
header_remove(); // Clean header already set to be sure to remove any header like "Set-Cookie: DOLSESSID_..." from non HTTPS answers
dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
header("Location: ".$newurl);
exit;
@ -625,7 +626,7 @@ if (!defined('NOLOGIN'))
dol_syslog('User not found, connexion refused');
session_destroy();
session_name($sessionname);
session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie
session_start();
if ($resultFetchUser == 0)
@ -682,7 +683,7 @@ if (!defined('NOLOGIN'))
dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
session_destroy();
session_name($sessionname);
session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie
session_start();
if ($resultFetchUser == 0)

View File

@ -0,0 +1,136 @@
<?php
// Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
// Copyright (C) 2017 Francis Appels <francis.appels@z-application.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// or see https://www.gnu.org/
/**
* \file htdocs/mrp/js/lib_dispatch.js.php
* \brief File that include javascript functions used for dispatching qty/stock/lot
*/
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
if (! defined('NOLOGIN')) define('NOLOGIN', 1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter('public');
require_once '../../main.inc.php';
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
else header('Cache-Control: no-cache');
?>
/**
* addDispatchLine
* Adds new table row for dispatching to multiple stock locations or multiple lot/serial
*
* @param index int index of product line. 0 = first product line
* @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch)
* @param mode string 'qtymissing' will create new line with qty missing, 'lessone' will keep 1 in old line and the rest in new one
*/
function addDispatchLine(index, type, mode)
{
mode = mode || 'qtymissing'
console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode);
var nbrTrs = $("tr[name^='"+type+"_"+index+"']").length; // position of line for batch
var $row = $("tr[name='"+type+'_'+index+"_1']").clone(true); // clone last batch line to jQuery object
var qtyOrdered = parseFloat($("#qty_ordered_"+index).val()); // Qty ordered is same for all rows
var qty = parseFloat($("#qtytoproduce-"+index+"-"+nbrTrs).val());
var qtyDispatched;
if (mode === 'lessone')
{
qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + 1;
}
else
{
qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + qty;
console.log(qty);
// If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line
if (qtyDispatched == qtyOrdered && qtyDispatched > 1) {
qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + 1;
mode = 'lessone';
}
}
console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered);
if (qtyOrdered <= 1) {
window.alert("Quantity can't be split");
}
if (qtyDispatched < qtyOrdered)
{
//replace tr suffix nbr
var re1 = new RegExp('_'+index+'_1', 'g');
var re2 = new RegExp('-'+index+'-1', 'g');
$row.html($row.html().replace(re1, '_'+index+'_'+(nbrTrs+1)));
$row.html($row.html().replace(re2, '-'+index+'-'+(nbrTrs+1)));
//create new select2 to avoid duplicate id of cloned one
$row.find("select[name='"+'idwarehousetoproduce-'+index+'-'+(nbrTrs+1)+"']").select2();
// TODO find solution to copy selected option to new select
// TODO find solution to keep new tr's after page refresh
//clear value
$row.find("input[name^='qtytoproduce']").val('');
//change name of new row
$row.attr('name',type+'_'+index+'_'+(nbrTrs+1));
//insert new row before last row
$("tr[name^='"+type+"_"+index+"_"+nbrTrs+"']:last").after($row);
//remove cloned select2 with duplicate id.
$("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); // old way to find duplicated select2 component
$(".csswarehouse_"+index+"_"+(nbrTrs+1)+":first-child").parent("span.selection").parent(".select2").detach();
/* Suffix of lines are: index _ trs.length */
$("#qtytoproduce-"+index+"-"+(nbrTrs+1)).focus();
if ($("#qtytoproduce-"+index+"-"+(nbrTrs)).val() == 0) {
$("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1);
}
var totalonallines = 0;
for (let i = 1; i <= nbrTrs; i++) {
console.log(i+" = "+parseFloat($("#qtytoproduce-"+index+"-"+i).val()));
totalonallines = totalonallines + parseFloat($("#qtytoproduce-"+index+"-"+i).val());
}
console.log("totalonallines="+totalonallines);
if (totalonallines == qtyOrdered && qtyOrdered > 1) {
var prevouslineqty = $("#qtytoproduce-"+index+"-"+nbrTrs).val();
$("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1);
$("#qtytoproduce-"+index+"-"+(nbrTrs+1)).val(prevouslineqty - 1);
}
$("#qty_dispatched_"+index).val(qtyDispatched);
//hide all buttons then show only the last one
$("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide();
$("tr[name^='"+type+"_'][name$='_"+index+"']:last .splitbutton").show();
if (mode === 'lessone')
{
qty = 1; // keep 1 in old line
$("#qty_"+(nbrTrs-1)+"_"+index).val(qty);
}
// Store arbitrary data for dispatch qty input field change event
$("#qtytoproduce-"+index+(nbrTrs)).data('qty', qty);
$("#qtytoproduce-"+index+(nbrTrs)).data('type', type);
$("#qtytoproduce-"+index+(nbrTrs)).data('index', index);
}
}

View File

@ -57,7 +57,7 @@ dol_include_once('/mrp/class/mo.class.php');
dol_include_once('/mrp/lib/mrp_mo.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("mrp", "stocks", "other"));
$langs->loadLangs(array("mrp", "stocks", "other", "productbatch"));
// Get parameters
$id = GETPOST('id', 'int');
@ -397,7 +397,8 @@ $formproduct = new FormProduct($db);
$tmpwarehouse = new Entrepot($db);
$tmpbatch = new Productlot($db);
llxHeader('', $langs->trans('Mo'), '');
$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication';
llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php'));
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
@ -621,11 +622,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline')))
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" class="formconsumeproduce">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" class="'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? 'formconsumeproduce' : '').'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="confirm_'.$action.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$id.'">';
// Note: closing form is add end of page
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
$defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref);
@ -686,7 +688,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'maxwidth300');
print '</td>';
print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50"></td>';
print '<td class="right"><input type="text" name="qtytoadd" value="1" class="width50 right"></td>';
print '<td class="right"></td>';
print '<td>';
print '<input type="submit" class="button" name="addconsumelinebutton" value="'.$langs->trans("Add").'">';
@ -773,8 +775,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td class="right">'.$line2['qty'].'</td>';
print '<td>';
if ($line2['fk_warehouse'] > 0) {
$tmpwarehouse->fetch($line2['fk_warehouse']);
print $tmpwarehouse->getNomUrl(1);
$result = $tmpwarehouse->fetch($line2['fk_warehouse']);
if ($result > 0) print $tmpwarehouse->getNomUrl(1);
}
print '</td>';
// Lot Batch
@ -793,7 +795,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>'.$langs->trans("ToConsume").'</td>';
$preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed));
if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) $preselected = 0;
print '<td class="right"><input type="text" class="width50" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
print '<td class="right"><input type="text" class="width50 right" name="qty-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
print '<td></td>';
print '<td>';
if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
@ -845,6 +847,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>';
if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) print $langs->trans("Batch");
print '</td>';
print '<td></td>';
}
print '</tr>';
@ -860,6 +863,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$nblinetoproducecursor = 0;
foreach ($object->lines as $line) {
if ($line->role == 'toproduce') {
$i=1;
$nblinetoproducecursor++;
$tmpproduct = new Product($db);
@ -871,6 +876,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$alreadyproduced += $line2['qty'];
}
$suffix = '_'.$line->id;
print '<!-- Line to dispatch '.$suffix.' -->'."\n";
// hidden fields for js function
print '<input id="qty_ordered'.$suffix.'" type="hidden" value="'.$line->qty.'">';
print '<input id="qty_dispatched'.$suffix.'" type="hidden" value="'.$alreadyproduced.'">';
print '<tr>';
print '<td>'.$tmpproduct->getNomUrl(1).'</td>';
print '<td class="right">'.$line->qty.'</td>';
@ -898,6 +909,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td>';
if ($conf->productbatch->enabled) {
print '<td></td>'; // Lot
print '<td></td>';
}
print '</tr>';
@ -911,30 +923,33 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td class="right">'.$line2['qty'].'</td>';
print '<td>';
if ($line2['fk_warehouse'] > 0) {
$tmpwarehouse->fetch($line2['fk_warehouse']);
print $tmpwarehouse->getNomUrl(1);
$result = $tmpwarehouse->fetch($line2['fk_warehouse']);
if ($result > 0) print $tmpwarehouse->getNomUrl(1);
}
print '</td>';
print '<td>';
if ($line2['batch'] != '') {
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
print $tmpbatch->getNomUrl(1);
if ($conf->productbatch->enabled) {
print '<td>';
if ($line2['batch'] != '') {
$tmpbatch->fetch(0, $line2['fk_product'], $line2['batch']);
print $tmpbatch->getNomUrl(1);
}
print '</td>';
print '<td></td>';
}
print '</td>';
print '</tr>';
}
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
print '<tr>';
print '<tr name="batch_'.$line->id.'_'.$i.'">';
print '<td>'.$langs->trans("ToProduce").'</td>';
$preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced));
if ($action == 'consumeorproduce' && !GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) $preselected = 0;
print '<td class="right"><input type="text" class="width50" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
print '<td class="right"><input type="text" class="width50 right" id="qtytoproduce-'.$line->id.'-'.$i.'" name="qtytoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'"></td>';
print '<td></td>';
print '<td>';
if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$preselected = (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i) ? GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse : 'ifone'));
print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1);
print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'csswarehouse_'.$line->id.'_'.$i);
} else {
print '<span class="opacitymedium">'.$langs->trans("NoStockChangeOnServices").'</span>';
}
@ -946,6 +961,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<input type="text" class="width50" name="batchtoproduce-'.$line->id.'-'.$i.'" value="'.$preselected.'">';
}
print '</td>';
print '<td>';
if ($tmpproduct->status_batch) {
$type = 'batch';
print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$line->id.', \''.$type.'\', \'qtymissing\')"');
}
print '</td>';
}
print '</tr>';
}

View File

@ -4381,6 +4381,12 @@ class Product extends CommonObject
if (!empty($this->label)) {
$label .= '<br><b>'.$langs->trans('ProductLabel').':</b> '.$this->label;
}
if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
if (!empty($conf->productbatch->enabled)) {
$langs->load("productbatch");
$label .= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2);
}
}
if (!empty($conf->barcode->enabled)) {
$label .= '<br><b>'.$langs->trans('BarCode').':</b> '.$this->barcode;
}
@ -4390,28 +4396,26 @@ class Product extends CommonObject
if ($this->weight) {
$label .= "<br><b>".$langs->trans("Weight").'</b>: '.$this->weight.' '.measuringUnitString(0, "weight", $this->weight_units);
}
$labelsize = "";
if ($this->length) {
$label .= "<br><b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units);
$labelsize .= ($labelsize ? " - ": "")."<b>".$langs->trans("Length").'</b>: '.$this->length.' '.measuringUnitString(0, 'size', $this->length_units);
}
if ($this->width) {
$label .= "<br><b>".$langs->trans("Width").'</b>: '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units);
$labelsize .= ($labelsize ? " - ": "")."<b>".$langs->trans("Width").'</b>: '.$this->width.' '.measuringUnitString(0, 'size', $this->width_units);
}
if ($this->height) {
$label .= "<br><b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units);
$labelsize .= ($labelsize ? " - ": "")."<b>".$langs->trans("Height").'</b>: '.$this->height.' '.measuringUnitString(0, 'size', $this->height_units);
}
if ($labelsize) $label .= "<br>".$labelsize;
$labelsurfacevolume = "";
if ($this->surface) {
$label .= "<br><b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units);
$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Surface").'</b>: '.$this->surface.' '.measuringUnitString(0, 'surface', $this->surface_units);
}
if ($this->volume) {
$label .= "<br><b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
}
}
if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
if (!empty($conf->productbatch->enabled)) {
$langs->load("productbatch");
$label .= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2);
$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
}
if ($labelsurfacevolume) $label .= "<br>".$labelsurfacevolume;
}
if (!empty($conf->accounting->enabled) && $this->status) {

View File

@ -47,7 +47,7 @@ class Reception extends CommonObject
public $fk_element = "fk_reception";
public $table_element = "reception";
public $table_element_line = "commande_fournisseur_dispatch";
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png

View File

@ -98,6 +98,13 @@ if (!empty($canvas))
// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas);
$permissiontoread = $user->rights->societe->lire;
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->societe->delete || ($permissiontoadd && isset($object->status) && $object->status == 0);
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
/*
* Actions
@ -1186,7 +1193,7 @@ else
print '<table class="border centpercent">';
// Name, firstname
print '<tr><td class="titlefieldcreate">';
print '<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
if ($object->particulier || $private)
{
print '<span id="TypeName" class="fieldrequired">'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').'</span>';
@ -1196,7 +1203,9 @@ else
print '<span id="TypeName" class="fieldrequired">'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).'</span>';
}
print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus"></td>';
print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus">';
print $form->widgetForTranslation("name", $object, $permissiontoadd);
print '</td>';
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<td>'.$langs->trans('Prefix').'</td><td><input type="text" size="5" maxlength="5" name="prefix_comm" value="'.$object->prefix_comm.'"></td>';
@ -1286,16 +1295,20 @@ else
// Barcode
if (!empty($conf->barcode->enabled))
{
print '<tr><td>'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).'</td>';
print '<tr><td>'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).'</td>';
print '<td colspan="3"><input type="text" name="barcode" id="barcode" value="'.$object->barcode.'">';
print '</td></tr>';
}
// Address
print '<tr><td class="tdtop">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
print '<tr><td class="tdtop">';
print $form->editfieldkey('Address', 'address', '', $object, 0);
print '</td>';
print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.'" wrap="soft">';
print $object->address;
print '</textarea></td></tr>';
print '</textarea>';
print $form->widgetForTranslation("address", $object, $permissiontoadd);
print '</td></tr>';
// Zip / Town
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
@ -1304,6 +1317,7 @@ else
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
print $form->widgetForTranslation("town", $object, $permissiontoadd);
print '</td></tr>';
// Country

View File

@ -712,6 +712,7 @@ class Societe extends CommonObject
*/
public $multicurrency_code;
/**
* Constructor
*

View File

@ -228,7 +228,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
if ($action == "change") // Change customer for TakePOS
{
$idcustomer = GETPOST('idcustomer', 'int');
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
// Check if draft invoice already exists, if not create it
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
@ -1031,7 +1031,7 @@ while ($i < min($num, $limit))
print '<tr class="oddeven"';
if ($contextpage == 'poslist')
{
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant
$place = (GETPOST('place', 'alpha') > 0 ? GETPOST('place', 'alpha') : 0); // $place is id of table for Bar or Restaurant
print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"';
}
print '>';

View File

@ -83,7 +83,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackT
print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
$head = takepos_prepare_head();
dol_fiche_head($head, 'receipt', 'TakePOS', -1);
print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 : $terminal).'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -71,20 +71,12 @@ if ($action == 'set')
$db->begin();
if (GETPOST('socid', 'int') < 0) $_POST["socid"] = '';
$res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_ADDON", GETPOST('TAKEPOS_ADDON', 'alpha'), 'int', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity);
if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) {
@ -142,7 +134,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackT
print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
$head = takepos_prepare_head();
dol_fiche_head($head, 'setup', 'TakePOS', -1);
print '<br>';
// Numbering modules
$now = dol_now();

View File

@ -42,7 +42,7 @@ $action = GETPOST('action', 'alpha');
$left = GETPOST('left', 'alpha');
$top = GETPOST('top', 'alpha');
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$newname = GETPOST('newname', 'alpha');
$mode = GETPOST('mode', 'alpha');

View File

@ -40,7 +40,7 @@ global $mysoc;
$langs->loadLangs(array("bills", "cashdesk"));
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'alpha') > 0 ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$idline = GETPOST('idline', 'int');
$action = GETPOST('action', 'alpha');

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Bar or Restaurant or multiple sales
$action = GETPOST('action', 'alpha');
$setterminal = GETPOST('setterminal', 'int');
@ -732,7 +732,9 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
echo '<span class="hideonsmartphone"> - '.dol_print_date(dol_now(), "day").'</span>';
?>
</a></div>
<div class="inline-block valignmiddle"><a class="valignmiddle" id="customer" onclick="Customer();"></a></div>
<div class="inline-block valignmiddle" id="customerandsales">
<a class="valignmiddle" id="customer" onclick="Customer();"></a>
</div>
<div class="inline-block valignmiddle" id="moreinfo"></div>
<div class="inline-block valignmiddle" id="infowarehouse"></div>
</div>

View File

@ -44,7 +44,7 @@ $langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks"
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'alpha');
$idproduct = GETPOST('idproduct', 'int');
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Bar or Restaurant
$placeid = 0; // $placeid is ID of invoice
if (empty($user->rights->takepos->run)) {
@ -713,9 +713,28 @@ $( document ).ready(function() {
}
?>
$("a#customer").html('<?php print dol_escape_js($s); ?>');
$("#customerandsales").html('<a class="valignmiddle" id="customer" onclick="Customer();"><?php print dol_escape_js($s); ?></a>');
<?php
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture where ref LIKE '(PROV-POS".$_SESSION["takeposterminal"]."-0%'";
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
echo '$("#customerandsales").append(\'';
if ($placeid==$obj->rowid) echo "<b>";
echo '<a class="valignmiddle" onclick="location.href=\\\'index.php?place=';
$num_sale=str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
echo $num_sale;
if (str_replace("-", "", $num_sale)>$max_sale) $max_sale=str_replace("-", "", $num_sale);
echo '\\\'">'.date('H:i', strtotime($obj->datec));
if ($placeid==$obj->rowid) echo "</b>";
echo '</a>\');';
}
echo '$("#customerandsales").append(\'<a onclick="location.href=\\\'index.php?place=0-';
echo $max_sale+1;
echo '\\\'"><span class="fa fa-plus-square"></a>\');';
}
$s = '';
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];

View File

@ -34,7 +34,7 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$invoiceid = GETPOST('invoiceid', 'int');

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$action = GETPOST('action', 'alpha');
$setterminal = GETPOST('setterminal', 'int');

View File

@ -30,7 +30,7 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$langs->loadLangs(array("main", "cashdesk", "companies"));
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$facid = GETPOST('facid', 'int');

View File

@ -34,7 +34,7 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$invoiceid = GETPOST('invoiceid', 'int');

View File

@ -71,10 +71,10 @@ if (GETPOSTISSET('type')) $type=GETPOST('type', 'alpha');
else $type=dol_mimetype($original_file);
// Security: Delete string ../ into $original_file
$original_file=str_replace("../","/", $original_file);
$original_file = str_replace("../", "/", $original_file);
// Cache or not
if (GETPOST("cache",'none') || image_format_supported($original_file) >= 0)
if (GETPOST("cache", 'none') || image_format_supported($original_file) >= 0)
{
// Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access.
@ -257,4 +257,4 @@ else
readfile($fullpath_original_file_osencoded);
}
if (is_object($db)) $db->close();
// END PHP ?>
// END PHP

View File

@ -328,7 +328,7 @@ if ($resql) {
dol_syslog("error for emailing id " . $id . " #" . $i . ($mail->error ? ' - ' . $mail->error : ''), LOG_DEBUG);
$sqlerror = "UPDATE " . MAIN_DB_PREFIX . "mailing_cibles";
$sqlerror .= " SET statut=-1, date_envoi=" . $db->idate($now) . " WHERE rowid=" . $obj->rowid;
$sqlerror .= " SET statut=-1, date_envoi='" . $db->idate($now) . "' WHERE rowid=" . $obj->rowid;
$resqlerror = $db->query($sqlerror);
if (! $resqlerror) {
dol_print_error($db);