Merge branch '6.0' into 6.0

This commit is contained in:
Laurent Destailleur 2017-12-28 08:46:22 +01:00 committed by GitHub
commit 3ac413084f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 1800 additions and 1075 deletions

View File

@ -2,6 +2,27 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 6.0.4 compared to 6.0.3 *****
FIX: #7737
FIX: #7751
FIX: #7756 Add better error message
FIX: #7786
FIX: #7806
FIX: #7824
FIX: add line bad price and ref
FIX: A lot of several fix on local taxes and NPR tax
FIX: createfromorder
FIX: CSS for IE10
FIX: external user cannot be set as internal
FIX: Filter type on actioncomm with multiselect doesn't work
FIX: list of donation not filtered on multicompany
FIX: list of module not complete when module mb_strlen not available
FIX: Locatax were not propagated when cloning order or proposal
FIX: Searching translation should not be case sensitive
FIX: Search into language is ok for file into external modules two.
FIX: test for filter fk_status
FIX: too much users on holiday list
FIX: Wrong alias sql
***** ChangeLog for 6.0.3 compared to 6.0.2 ***** ***** ChangeLog for 6.0.3 compared to 6.0.2 *****
FIX: #7211 Update qty dispatched on qty change FIX: #7211 Update qty dispatched on qty change

View File

@ -131,7 +131,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
*/ */
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; $regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install)$'; // Exclude dirs $regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir=''; $dir='';
$needtoclose=0; $needtoclose=0;

View File

@ -556,9 +556,6 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.pl`; # Avoid errors into rpmlint
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
#$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball #$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball

View File

@ -111,3 +111,24 @@ to get
if ($className == 'Luracast\Restler\mixed') return; if ($className == 'Luracast\Restler\mixed') return;
... ...
PARSEDOWN
---------
* Fix to avoid fatal error when mb_strlen not available:
// @CHANGE LDR Fix when mb_strlen is not available
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
else $len = strlen($line);
$shortage = 4 - $len % 4;
JEDITABLE.JS
------------
* <button type="submit" /> => <button class="button" type="submit" />
* <button type="cancel" /> => <button class="button" type="cancel" />

View File

@ -15,6 +15,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; $prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT; $format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; $nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;

View File

@ -14,8 +14,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_CREATE.TPL.PHP DEFAULT --> <!-- BEGIN PHP TEMPLATE ADHERENTCARD_CREATE.TPL.PHP DEFAULT -->

View File

@ -14,9 +14,16 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
?> ?>

View File

@ -14,10 +14,18 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
?> ?>
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT --> <!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->

View File

@ -36,7 +36,7 @@ $langs->load("users");
if (!$user->rights->adherent->lire) if (!$user->rights->adherent->lire)
accessforbidden(); accessforbidden();
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; $rowid=GETPOST("rowid",'int');
@ -44,10 +44,10 @@ $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
* View * View
*/ */
llxHeader();
$form = new Form($db); $form = new Form($db);
llxHeader();
$object = new Subscription($db); $object = new Subscription($db);
$result = $object->fetch($rowid); $result = $object->fetch($rowid);

View File

@ -15,8 +15,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -212,7 +212,7 @@ if ($xml)
// Defined qualified files (must be same than into generate_filelist_xml.php) // Defined qualified files (must be same than into generate_filelist_xml.php)
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; $regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install)$'; // Exclude dirs $regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude); $scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
// Fill file_list with files in signature, new files, modified files // Fill file_list with files in signature, new files, modified files

View File

@ -19,6 +19,14 @@
* *
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("cashdesk"); $langs->load("cashdesk");

View File

@ -17,6 +17,14 @@
* *
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';

View File

@ -19,6 +19,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';

View File

@ -16,6 +16,15 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$langs->load("main"); $langs->load("main");

View File

@ -16,6 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");
$langs->load("banks"); $langs->load("banks");

View File

@ -17,6 +17,14 @@
* *
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
$langs->load("main"); $langs->load("main");
$langs->load("bills"); $langs->load("bills");

View File

@ -30,7 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$langs->load("orders"); $langs->load("orders");
$langs->load("companies"); $langs->load("companies");
$_socid = $_GET["id"]; $id = GETPOST('id','int');
$_socid = GETPOST("id",'int');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
@ -45,10 +46,10 @@ if ($user->societe_id > 0)
if ($_POST["action"] == 'setpricelevel') if ($_POST["action"] == 'setpricelevel')
{ {
$soc = New Societe($db); $soc = New Societe($db);
$soc->fetch($_GET["id"]); $soc->fetch($id);
$soc->set_price_level($_POST["price_level"],$user); $soc->set_price_level($_POST["price_level"],$user);
header("Location: multiprix.php?id=".$_GET["id"]); header("Location: multiprix.php?id=".$id);
exit; exit;
} }

View File

@ -867,13 +867,33 @@ if (empty($reshook))
// Add custom code and origin country into description // Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{ {
$tmptxt = '('; // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id','alpha'))
$newlang = GETPOST('lang_id','alpha');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
}
if (! empty($prod->customcode))
$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code))
$tmptxt .= ' - ';
if (! empty($prod->country_code))
$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
} else {
if (! empty($prod->customcode)) if (! empty($prod->customcode))
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) if (! empty($prod->customcode) && ! empty($prod->country_code))
$tmptxt .= ' - '; $tmptxt .= ' - ';
if (! empty($prod->country_code)) if (! empty($prod->country_code))
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
}
$tmptxt .= ')'; $tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt); $desc = dol_concatdesc($desc, $tmptxt);
} }

View File

@ -22,6 +22,14 @@
* \ingroup propal * \ingroup propal
* \brief Template to show objects linked to proposals * \brief Template to show objects linked to proposals
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -824,12 +824,33 @@ if (empty($reshook))
// Add custom code and origin country into description // Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
$tmptxt = '('; $tmptxt = '(';
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id','alpha'))
$newlang = GETPOST('lang_id','alpha');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
}
if (! empty($prod->customcode))
$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code))
$tmptxt .= ' - ';
if (! empty($prod->country_code))
$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
} else {
if (! empty($prod->customcode)) if (! empty($prod->customcode))
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) if (! empty($prod->customcode) && ! empty($prod->country_code))
$tmptxt .= ' - '; $tmptxt .= ' - ';
if (! empty($prod->country_code)) if (! empty($prod->country_code))
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
}
$tmptxt .= ')'; $tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt); $desc = dol_concatdesc($desc, $tmptxt);
} }

View File

@ -15,8 +15,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -1644,12 +1644,32 @@ if (empty($reshook))
// Add custom code and origin country into description // Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
$tmptxt = '('; $tmptxt = '(';
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id','alpha'))
$newlang = GETPOST('lang_id','alpha');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
if (! empty($prod->customcode))
$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code))
$tmptxt .= ' - ';
if (! empty($prod->country_code))
$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
} else {
if (! empty($prod->customcode)) if (! empty($prod->customcode))
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
if (! empty($prod->customcode) && ! empty($prod->country_code)) if (! empty($prod->customcode) && ! empty($prod->country_code))
$tmptxt .= ' - '; $tmptxt .= ' - ';
if (! empty($prod->country_code)) if (! empty($prod->country_code))
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
}
$tmptxt .= ')'; $tmptxt .= ')';
$desc = dol_concatdesc($desc, $tmptxt); $desc = dol_concatdesc($desc, $tmptxt);
} }
@ -2515,8 +2535,8 @@ if ($action == 'create')
print $desc; print $desc;
print '<div id="credit_note_options" class="clearboth">'; print '<div id="credit_note_options" class="clearboth">';
print '&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>"; print '&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>"; print '<br>&nbsp;&nbsp;&nbsp; <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="$(\'#credit_note_options input[type=checkbox]\').not(this).prop(\'checked\', false);" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div>'; print '</div>';
print '</div></div>'; print '</div></div>';

View File

@ -939,6 +939,7 @@ class Facture extends CommonInvoice
{ {
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
else else
{ {
@ -989,6 +990,8 @@ class Facture extends CommonInvoice
$line->special_code = $object->lines[$i]->special_code; $line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line; $line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_unit = $object->lines[$i]->fk_unit; $line->fk_unit = $object->lines[$i]->fk_unit;
$line->date_start = $object->lines[$i]->date_start;
$line->date_end = $object->lines[$i]->date_end;
$line->fk_fournprice = $object->lines[$i]->fk_fournprice; $line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
@ -2194,6 +2197,7 @@ class Facture extends CommonInvoice
else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num)); else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarr",$num));
if ($result < 0) { if ($result < 0) {
$error++; $error++;
$this->error = $mouvP->error;
} }
} }
} }

View File

@ -4,7 +4,11 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -193,6 +197,6 @@ else
print $langs->trans("ErrorUnknown"); print $langs->trans("ErrorUnknown");
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -552,14 +552,14 @@ if ($resql)
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category); if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category);
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1); if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1);
if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2); if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2);
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_status != '') $param.='&search_status='.urlencode($search_status);
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode); if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode);
if ($show_files) $param.='&show_files=' .$show_files; if ($show_files) $param.='&show_files=' .$show_files;
if ($option) $param.="&option=".$option; if ($option) $param.="&option=".$option;
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;

View File

@ -15,8 +15,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -15,8 +15,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -102,7 +102,7 @@ if (empty($reshook))
$tmpinvoice=new Facture($db); $tmpinvoice=new Facture($db);
foreach ($_POST as $key => $value) foreach ($_POST as $key => $value)
{ {
if (substr($key,0,7) == 'amount_') if (substr($key,0,7) == 'amount_' && GETPOST($key) != '')
{ {
$cursorfacid = substr($key,7); $cursorfacid = substr($key,7);
$amounts[$cursorfacid] = price2num(trim(GETPOST($key))); $amounts[$cursorfacid] = price2num(trim(GETPOST($key)));

View File

@ -46,14 +46,14 @@ $confirm=GETPOST('confirm', 'alpha');
// Security check // Security check
$fieldname = (! empty($ref)?'ref':'rowid'); $fieldname = (! empty($ref)?'ref':'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','fk_user_author',$fieldname);
$sortfield=GETPOST('sortfield', 'alpha'); $sortfield=GETPOST('sortfield', 'alpha');
$sortorder=GETPOST('sortorder', 'alpha'); $sortorder=GETPOST('sortorder', 'alpha');
$page=GETPOST('page', 'int'); $page=GETPOST('page', 'int');
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="b.dateo,b.rowid"; if (! $sortfield) $sortfield="b.dateo,b.rowid";
if ($page < 0) { $page = 0 ; } if (empty($page) || $page == -1) { $page = 0; }
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page ; $offset = $limit * $page ;
@ -492,10 +492,12 @@ if ($action == 'new')
{ {
foreach ($lines[$bid] as $lid => $value) foreach ($lines[$bid] as $lid => $value)
{ {
$account_id = $bid; //$account_id = $bid; FIXME not used
if (! isset($accounts[$bid]))
// FIXME $accounts[$bid] is a label !
/*if (! isset($accounts[$bid]))
$accounts[$bid]=0; $accounts[$bid]=0;
$accounts[$bid] += 1; $accounts[$bid] += 1;*/
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.dol_print_date($value["date"],'day').'</td>'; print '<td>'.dol_print_date($value["date"],'day').'</td>';
@ -688,10 +690,12 @@ else
{ {
while ($objp = $db->fetch_object($resql)) while ($objp = $db->fetch_object($resql))
{ {
$account_id = $objp->bid; //$account_id = $objp->bid; FIXME not used
if (! isset($accounts[$objp->bid]))
// FIXME $accounts[$objp->bid] is a label
/*if (! isset($accounts[$objp->bid]))
$accounts[$objp->bid]=0; $accounts[$objp->bid]=0;
$accounts[$objp->bid] += 1; $accounts[$objp->bid] += 1;*/
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td align="center">'.$i.'</td>'; print '<td align="center">'.$i.'</td>';

View File

@ -13,8 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE CONTACTCARD_CREATE.TPL.PHP DEFAULT --> <!-- BEGIN PHP TEMPLATE CONTACTCARD_CREATE.TPL.PHP DEFAULT -->

View File

@ -13,9 +13,16 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
?> ?>

View File

@ -13,9 +13,16 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
?> ?>

View File

@ -68,6 +68,9 @@ $search_categ_thirdparty=GETPOST("search_categ_thirdparty",'int');
$search_categ_supplier=GETPOST("search_categ_supplier",'int'); $search_categ_supplier=GETPOST("search_categ_supplier",'int');
$search_status=GETPOST("search_status",'int'); $search_status=GETPOST("search_status",'int');
$search_type=GETPOST('search_type','alpha'); $search_type=GETPOST('search_type','alpha');
$search_zip=GETPOST('search_zip','alpha');
$search_town=GETPOST('search_town','alpha');
if ($search_status=='') $search_status=1; // always display activ customer first if ($search_status=='') $search_status=1; // always display activ customer first
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
@ -289,7 +292,7 @@ if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_pos
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso); if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone); if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone);
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile); if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
if (strlen($search_fax)) $sql.= natural_search('p.phone_fax', $search_fax); if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax);
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype); if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
if (strlen($search_email)) $sql.= natural_search('p.email', $search_email); if (strlen($search_email)) $sql.= natural_search('p.email', $search_email);
if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status); if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status);
@ -396,6 +399,7 @@ if ($search_email != '') $param.='&amp;search_email='.urlencode($search_email);
if ($search_status != '') $param.='&amp;search_status='.urlencode($search_status); if ($search_status != '') $param.='&amp;search_status='.urlencode($search_status);
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {
@ -491,12 +495,6 @@ if (! empty($arrayfields['p.firstname']['checked']))
print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">'; print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['p.poste']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
print '</td>';
}
if (! empty($arrayfields['p.zip']['checked'])) if (! empty($arrayfields['p.zip']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -509,6 +507,12 @@ if (! empty($arrayfields['p.town']['checked']))
print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">'; print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['p.poste']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
print '</td>';
}
if (! empty($arrayfields['p.phone']['checked'])) if (! empty($arrayfields['p.phone']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';

View File

@ -1840,7 +1840,7 @@ else
{ {
$tmpaction='unactivateline'; $tmpaction='unactivateline';
$tmpactionpicto='playstop'; $tmpactionpicto='playstop';
$tmpactiontext=$langs->trans("Unactivate"); $tmpactiontext=$langs->trans("Disable");
} }
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver))
{ {
@ -1982,7 +1982,7 @@ else
print '<tr '.$bc[false].'>'; print '<tr '.$bc[false].'>';
print '<td class="nohover">'.$langs->trans("Comment").'</td><td class="nohover"><input size="70" type="text" class="flat" name="comment" value="'.dol_escape_htmltag(GETPOST('comment', 'alpha')).'"></td>'; print '<td class="nohover">'.$langs->trans("Comment").'</td><td class="nohover"><input size="70" type="text" class="flat" name="comment" value="'.dol_escape_htmltag(GETPOST('comment', 'alpha')).'"></td>';
print '<td class="nohover right">'; print '<td class="nohover right">';
print '<input type="submit" class="button" name="close" value="'.$langs->trans("Unactivate").'"> &nbsp; '; print '<input type="submit" class="button" name="close" value="'.$langs->trans("Disable").'"> &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -14,6 +14,14 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -91,11 +91,15 @@ if ($action == 'builddoc' && $permissioncreate)
} }
else else
{ {
if (empty($donotredirect)) // This is se when include is done by bulk action "Bill Orders" if (empty($donotredirect)) // This is set when include is done by bulk action "Bill Orders"
{ {
setEventMessages($langs->trans("FileGenerated"), null); setEventMessages($langs->trans("FileGenerated"), null);
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc'); $urltoredirect = $_SERVER['REQUEST_URI'];
$urltoredirect = preg_replace('/#builddoc$/', '', $urltoredirect);
$urltoredirect = preg_replace('/action=builddoc&?/', '', $urltoredirect); // To avoid infinite loop
header('Location: '.$urltoredirect.'#builddoc');
exit; exit;
} }
} }

View File

@ -413,6 +413,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$object->trackid = $trackid; $object->trackid = $trackid;
$object->fk_element = $object->id; $object->fk_element = $object->id;
$object->elementtype = $object->element; $object->elementtype = $object->element;
$object->attachedfiles = $attachedfiles;
// Call of triggers // Call of triggers
if (! empty($trigger_name)) if (! empty($trigger_name))

View File

@ -94,10 +94,30 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
} }
else $newelement = $element; else $newelement = $element;
$_POST['action']='update'; // Hack so restrictarea will test permissions on write too
$feature = $newelement;
$feature2 = $subelement;
$object_id = $fk_element;
if ($feature == 'expedition' || $feature == 'shipping')
{
$feature = 'commande';
$object_id = 0;
}
if ($feature == 'shipping') $feature = 'commande';
if ($feature == 'payment') { $feature = 'facture'; }
if ($feature == 'payment_supplier') { $feature = 'fournisseur'; $feature2 = 'facture'; }
//var_dump(GETPOST('action','aZ09'));
//var_dump($newelement.'-'.$subelement."-".$feature."-".$object_id);
$check_access = restrictedArea($user, $feature, $object_id, '', $feature2);
//var_dump($user->rights);
/*
if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write) if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write)
|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write))) || (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
|| ($element == 'payment' && $user->rights->facture->paiement) || ($element == 'payment' && $user->rights->facture->paiement)
|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer)) || ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
*/
if ($check_access)
{ {
// Clean parameters // Clean parameters
$newvalue = trim($value); $newvalue = trim($value);

View File

@ -166,7 +166,7 @@ class Form
$ret.='<input type="hidden" name="action" value="set'.$htmlname.'">'; $ret.='<input type="hidden" name="action" value="set'.$htmlname.'">';
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$ret.='<input type="hidden" name="id" value="'.$object->id.'">'; $ret.='<input type="hidden" name="id" value="'.$object->id.'">';
if (empty($notabletag)) $ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; if (empty($notabletag)) $ret.='<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
if (empty($notabletag)) $ret.='<tr><td>'; if (empty($notabletag)) $ret.='<tr><td>';
if (preg_match('/^(string|email)/',$typeofdata)) if (preg_match('/^(string|email)/',$typeofdata))
{ {
@ -189,7 +189,7 @@ class Form
$morealt=' style="width: '.$cols.'"'; $morealt=' style="width: '.$cols.'"';
$cols=''; $cols='';
} }
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'').$morealt.'">'.($editvalue?$editvalue:$value).'</textarea>'; $ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'class="quatrevingtpercent"').$morealt.'">'.($editvalue?$editvalue:$value).'</textarea>';
} }
else if ($typeofdata == 'day' || $typeofdata == 'datepicker') else if ($typeofdata == 'day' || $typeofdata == 'datepicker')
{ {

View File

@ -1,5 +1,5 @@
// Copyright (C) 2011-2014 Regis Houssin <regis.houssin@capnetworks.com> // Copyright (C) 2011-2014 Regis Houssin <regis.houssin@capnetworks.com>
// Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> // Copyright (C) 2011-2017 Laurent Destailleur <eldy@users.sourceforge.net>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -26,6 +26,50 @@ $(document).ready(function() {
var table_element = $('#jeditable_table_element').html(); var table_element = $('#jeditable_table_element').html();
var fk_element = $('#jeditable_fk_element').html(); var fk_element = $('#jeditable_fk_element').html();
if ($('.editval_string').length > 0) {
$('.editval_string').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : withInPlace, /* Size of string area in px ? */
tooltip : tooltipInPlace,
placeholder : placeholderInPlace,
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
submitdata : function(result, settings) {
return getParameters(this, 'string');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_string').hover(
function () {
console.log("We are hover (entry) an editkey_string");
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
},
function () {
console.log("We are no more hover an editkey_string");
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}
);
$('.editkey_string').click(function() {
console.log("We click on the edit field");
$('#viewval_' + $(this).attr('id')).click();
$('#viewval_' + $(this).attr('id')).hide();
$('#editval_' + $(this).attr('id')).show().click();
});
$('.viewval_string.active').click(function() {
console.log("We click on the viewed value");
$('#viewval_' + $(this).attr('id').substr(8)).hide();
$('#editval_' + $(this).attr('id').substr(8)).show().click();
});
}
if ($('.editval_textarea').length > 0) { if ($('.editval_textarea').length > 0) {
$('.editval_textarea').editable(urlSaveInPlace, { $('.editval_textarea').editable(urlSaveInPlace, {
type : 'textarea', type : 'textarea',
@ -127,49 +171,6 @@ $(document).ready(function() {
}); });
} }
if ($('.editval_string').length > 0) {
$('.editval_string').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : withInPlace, /* Size of string area in px ? */
tooltip : tooltipInPlace,
placeholder : placeholderInPlace,
cancel : cancelInPlace,
submit : submitInPlace,
indicator : indicatorInPlace,
submitdata : function(result, settings) {
return getParameters(this, 'string');
},
callback : function(result, settings) {
getResult(this, result);
},
onreset : function(result, settings) {
getDefault(settings);
}
});
$('.editkey_string').hover(
function () {
console.log("We are hover (entry) an editkey_string");
$('#viewval_' + $(this).attr('id')).addClass("viewval_hover");
},
function () {
console.log("We are no more hover an editkey_string");
$('#viewval_' + $(this).attr('id')).removeClass("viewval_hover");
}
);
$('.editkey_string').click(function() {
$( '#viewval_' + $(this).attr('id') ).click();
});
$('.viewval_string.active').click(function() {
$('#viewval_' + $(this).attr('id').substr(8)).hide();
$('#editval_' + $(this).attr('id').substr(8)).show().click();
});
$('.editkey_string').click(function() {
$('#viewval_' + $(this).attr('id')).hide();
$('#editval_' + $(this).attr('id')).show().click();
});
}
if ($('.editval_numeric').length > 0) { if ($('.editval_numeric').length > 0) {
$('.editval_numeric').editable(urlSaveInPlace, { $('.editval_numeric').editable(urlSaveInPlace, {
type : 'text', type : 'text',

View File

@ -1359,10 +1359,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour'); else $out.='-'.dol_print_date($histo[$key]['dateend'],'dayhour');
} }
$late=0; $late=0;
if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; if ($histo[$key]['percent'] == 0 && ! $histo[$key]['datestart'] && $histo[$key]['dateend'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $db->jdate($histo[$key]['dateend']) < ($now - $delay_warning)) $late=1; if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $histo[$key]['dateend'] < ($now - $delay_warning)) $late=1;
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1; if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late=1;
if ($late) $out.=img_warning($langs->trans("Late")).' '; if ($late) $out.=img_warning($langs->trans("Late")).' ';
$out.="</td>\n"; $out.="</td>\n";

View File

@ -46,7 +46,7 @@ function dol_basename($pathfile)
* @param int $recursive Determines whether subdirectories are searched * @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function, * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
* but must not contains the start and end '/'. Filter is checked into basename only. * but must not contains the start and end '/'. Filter is checked into basename only.
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked into fullpath. * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked both into fullpath and into basename (So '^xxx' may exclude 'xxx/dirscanned/...' and dirscanned/xxx').
* @param string $sortcriteria Sort criteria ("","fullname","relativename","name","date","size") * @param string $sortcriteria Sort criteria ("","fullname","relativename","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
@ -107,6 +107,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
while (false !== ($file = readdir($dir))) // $file is always a basename (into directory $newpath) while (false !== ($file = readdir($dir))) // $file is always a basename (into directory $newpath)
{ {
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in utf8 in memory if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in utf8 in memory
$fullpathfile=($newpath?$newpath.'/':'').$file;
$qualified=1; $qualified=1;
@ -120,10 +121,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// Check if file is qualified // Check if file is qualified
foreach($excludefilterarray as $filt) foreach($excludefilterarray as $filt)
{ {
if (preg_match('/'.$filt.'/i',$file)) { if (preg_match('/'.$filt.'/i', $file) || preg_match('/'.$filt.'/i', $fullpathfile)) {
$qualified=0; break; $qualified=0; break;
} }
} }
//print $fullpathfile.' '.$file.' '.$qualified.'<br>';
if ($qualified) if ($qualified)
{ {

View File

@ -238,6 +238,17 @@ function dol_shutdown()
} }
/**
* Return true if we are in a context of submitting a parameter
*
* @param string $paramname Name or parameter to test
* @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty)
*/
function GETPOSTISSET($paramname)
{
return (isset($_POST[$paramname]) || isset($_GET[$paramname]));
}
/** /**
* Return value of a param into GET or POST supervariable. * Return value of a param into GET or POST supervariable.
* Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder'] * Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
@ -4306,6 +4317,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
{ {
$product->get_buyprice($idprodfournprice,0,0,0); $product->get_buyprice($idprodfournprice,0,0,0);
$ret=$product->vatrate_supplier; $ret=$product->vatrate_supplier;
if ($product->default_vat_code) $ret.=' ('.$product->default_vat_code.')';
} }
else else
{ {

View File

@ -306,6 +306,9 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
else if ($feature == 'ftp') else if ($feature == 'ftp')
{ {
if (! $user->rights->ftp->write) $deleteok=0; if (! $user->rights->ftp->write) $deleteok=0;
}else if ($feature == 'salaries')
{
if (! $user->rights->salaries->delete) $deleteok=0;
} }
else if (! empty($feature2)) // This should be used for future changes else if (! empty($feature2)) // This should be used for future changes
{ {

View File

@ -65,7 +65,7 @@ class mailing_fraise extends MailingTargets
*/ */
function getSqlArrayForStats() function getSqlArrayForStats()
{ {
global $langs; global $conf, $langs;
$langs->load("members"); $langs->load("members");
@ -73,7 +73,7 @@ class mailing_fraise extends MailingTargets
$statssql=array(); $statssql=array();
$statssql[0] ="SELECT '".$this->db->escape($langs->trans("FundationMembers"))."' as label, count(*) as nb"; $statssql[0] ="SELECT '".$this->db->escape($langs->trans("FundationMembers"))."' as label, count(*) as nb";
$statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1"; $statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1 and entity IN (".getEntity('member').")";
return $statssql; return $statssql;
} }
@ -89,9 +89,11 @@ class mailing_fraise extends MailingTargets
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {
global $conf;
$sql = "SELECT count(distinct(a.email)) as nb"; $sql = "SELECT count(distinct(a.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql .= " WHERE (a.email IS NOT NULL AND a.email != '')"; $sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity IN (".getEntity('member').")";
// La requete doit retourner un champ "nb" pour etre comprise // La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients // par parent::getNbOfRecipients
@ -201,7 +203,7 @@ class mailing_fraise extends MailingTargets
$sql.= " a.lastname, a.firstname,"; $sql.= " a.lastname, a.firstname,";
$sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields $sql.= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
$sql.= " WHERE a.email <> ''"; // Note that null != '' is false $sql.= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
$sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; $sql.= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1"; if (isset($_POST["filter"]) && $_POST["filter"] == '-1') $sql.= " AND a.statut=-1";
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'"; if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql.= " AND a.statut=1 AND a.datefin >= '".$this->db->idate($now)."'";

View File

@ -26,6 +26,13 @@
* $elementtype * $elementtype
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE admin_extrafields_add.tpl.php --> <!-- BEGIN PHP TEMPLATE admin_extrafields_add.tpl.php -->

View File

@ -25,6 +25,13 @@
* $elementtype * $elementtype
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE admin_extrafields_edit.tpl.php --> <!-- BEGIN PHP TEMPLATE admin_extrafields_edit.tpl.php -->

View File

@ -22,6 +22,14 @@
* $extrafield * $extrafield
* $elementtype * $elementtype
*/ */
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php --> <!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->

View File

@ -13,8 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- START TEMPLATE FILE UPLOAD MAIN --> <!-- START TEMPLATE FILE UPLOAD MAIN -->

View File

@ -13,8 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- START TEMPLATE FILE UPLOAD --> <!-- START TEMPLATE FILE UPLOAD -->

View File

@ -19,6 +19,14 @@
* You can use this if you want to be abale to drag and drop rows of a table. * You can use this if you want to be abale to drag and drop rows of a table.
* You must add id="tablelines" on table level tag and have ($nboflines or count($object->lines) or count($taskarray) > 0) * You must add id="tablelines" on table level tag and have ($nboflines or count($object->lines) or count($taskarray) > 0)
*/ */
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP - Script to enable drag and drop on tables --> <!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP - Script to enable drag and drop on tables -->

View File

@ -16,6 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($blocname))
{
print "Error, template page can't be called as URL";
exit;
}
$hide = true; // Hide by default $hide = true; // Hide by default
if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocbydefault']) ? true : false); if (isset($parameters['showblocbydefault'])) $hide=(empty($parameters['showblocbydefault']) ? true : false);
if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false); if (isset($object->extraparams[$blocname]['showhide'])) $hide = (empty($object->extraparams[$blocname]['showhide']) ? true : false);

View File

@ -21,6 +21,14 @@
* $withproject (if we are on task contact) * $withproject (if we are on task contact)
*/ */
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';

View File

@ -24,6 +24,14 @@
// $modulepart = for download // $modulepart = for download
// $param = param to add to download links // $param = param to add to download links
// Protection to avoid direct call of template
if (empty($langs) || ! is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
}
$langs->load("link"); $langs->load("link");
if (empty($relativepathwithnofile)) $relativepathwithnofile=''; if (empty($relativepathwithnofile)) $relativepathwithnofile='';
if (empty($permtoedit)) $permtoedit=-1; if (empty($permtoedit)) $permtoedit=-1;

View File

@ -24,6 +24,14 @@
* $parameters * $parameters
* $cols * $cols
*/ */
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php --> <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
<?php <?php

View File

@ -19,6 +19,14 @@
// Need global variable $title to be defined by caller (like dol_loginfunction) // Need global variable $title to be defined by caller (like dol_loginfunction)
// Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...); // Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
header('Cache-Control: Public, must-revalidate'); header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client); header("Content-type: text/html; charset=".$conf->file->character_set_client);
@ -54,7 +62,7 @@ print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disable
<?php if (empty($conf->dol_use_jmobile)) { ?> <?php if (empty($conf->dol_use_jmobile)) { ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
// Set focus on correct field /* Set focus on correct field */
<?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element <?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
}); });
</script> </script>

View File

@ -17,6 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
// $cssclass must be defined by caller. For example cssclass='fieldtitle" // $cssclass must be defined by caller. For example cssclass='fieldtitle"
$module = $object->element; $module = $object->element;
$note_public = 'note_public'; $note_public = 'note_public';

View File

@ -30,6 +30,13 @@
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/ */
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
$usemargins=0; $usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande')))

View File

@ -30,6 +30,13 @@
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
*/ */
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
$usemargins=0; $usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;

View File

@ -37,6 +37,14 @@
* $type, $text, $description, $line * $type, $text, $description, $line
*/ */
// Protection to avoid direct call of template
if (empty($object) || ! is_object($object))
{
print "Error, template page can't be called as URL";
exit;
}
global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
$usemargins=0; $usemargins=0;

View File

@ -13,8 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php --> <!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->

View File

@ -16,6 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
header('Cache-Control: Public, must-revalidate'); header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client); header("Content-type: text/html; charset=".$conf->file->character_set_client);
@ -40,7 +48,7 @@ print top_htmlhead('',$langs->trans('SendNewPassword'));
<?php if (empty($conf->dol_use_jmobile)) { ?> <?php if (empty($conf->dol_use_jmobile)) { ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
// Set focus on correct field /* Set focus on correct field */
<?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element <?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
}); });
</script> </script>

View File

@ -1,6 +1,14 @@
<!-- BEGIN TEMPLATE resource_add.tpl.php --> <!-- BEGIN TEMPLATE resource_add.tpl.php -->
<?php <?php
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'); require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
$form = new Form($db); $form = new Form($db);

View File

@ -1,6 +1,12 @@
<!-- BEGIN TEMPLATE resource_view.tpl.php --> <!-- BEGIN TEMPLATE resource_view.tpl.php -->
<?php <?php
//var_dump($linked_resources); // Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$form= new Form($db); $form= new Form($db);

View File

@ -54,7 +54,7 @@ $nb=array();
$somme=array(); $somme=array();
$sql = "SELECT count(d.rowid) as nb, sum(d.amount) as somme , d.fk_statut"; $sql = "SELECT count(d.rowid) as nb, sum(d.amount) as somme , d.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d WHERE d.entity IN (".getEntity('donation').")";
$sql.= " GROUP BY d.fk_statut"; $sql.= " GROUP BY d.fk_statut";
$sql.= " ORDER BY d.fk_statut"; $sql.= " ORDER BY d.fk_statut";

View File

@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
$sql.= " d.amount, d.fk_statut as statut, "; $sql.= " d.amount, d.fk_statut as statut, ";
$sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " p.rowid as pid, p.ref, p.title, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1"; $sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
if ($statut != '' && $statut != '-1') if ($statut != '' && $statut != '-1')
{ {
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")"; $sql .= " AND d.fk_statut IN (".$db->escape($statut).")";

View File

@ -16,6 +16,14 @@
* *
* Output javascript for interactions code of ecm module * Output javascript for interactions code of ecm module
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php --> <!-- BEGIN PHP TEMPLATE ecm/tpl/enablefiletreeajax.tpl.php -->

View File

@ -127,7 +127,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Set incoterm // Reopen
if ($action == 'reopen' && $user->rights->expedition->creer) if ($action == 'reopen' && $user->rights->expedition->creer)
{ {
$object->fetch($id); $object->fetch($id);
@ -503,8 +503,8 @@ if (empty($reshook))
} }
} }
// Action update description of emailing // Action update
else if ($action == 'settrackingnumber' || $action == 'settrackingurl' else if ($action == 'settracking_number' || $action == 'settracking_url'
|| $action == 'settrueWeight' || $action == 'settrueWeight'
|| $action == 'settrueWidth' || $action == 'settrueWidth'
|| $action == 'settrueHeight' || $action == 'settrueHeight'
@ -513,8 +513,8 @@ if (empty($reshook))
{ {
$error=0; $error=0;
if ($action == 'settrackingnumber') $object->tracking_number = trim(GETPOST('trackingnumber','alpha')); if ($action == 'settracking_number') $object->tracking_number = trim(GETPOST('tracking_number','alpha'));
if ($action == 'settrackingurl') $object->tracking_url = trim(GETPOST('trackingurl','int')); if ($action == 'settracking_url') $object->tracking_url = trim(GETPOST('tracking_url','int'));
if ($action == 'settrueWeight') { if ($action == 'settrueWeight') {
$object->trueWeight = trim(GETPOST('trueWeight','int')); $object->trueWeight = trim(GETPOST('trueWeight','int'));
$object->weight_units = GETPOST('weight_units','int'); $object->weight_units = GETPOST('weight_units','int');
@ -1692,8 +1692,8 @@ else if ($id || $ref)
print '</tr>'; print '</tr>';
// Tracking Number // Tracking Number
print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber",'tracking_number',$object->tracking_number,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number); print $form->editfieldval("TrackingNumber",'tracking_number',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number);
print '</td></tr>'; print '</td></tr>';
// Incoterms // Incoterms

View File

@ -30,9 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("sendings"); $langs->loadLangs(array("sendings","deliveries",'companies','bills'));
$langs->load("deliveries");
$langs->load('companies');
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
// Security check // Security check

View File

@ -14,8 +14,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -15,8 +15,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -13,8 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));

View File

@ -14,8 +14,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -17,6 +17,14 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -33,7 +33,7 @@ $langs->load("orders");
$langs->load("companies"); $langs->load("companies");
// Security check // Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:''; $socid = GETPOST("socid", 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe',$socid,''); $result = restrictedArea($user, 'societe',$socid,'');

View File

@ -989,7 +989,7 @@ class Holiday extends CommonObject
while ($i < $nbUser) while ($i < $nbUser)
{ {
$now_holiday = $this->getCPforUser($users[$i]['rowid'], $val['rowid']); $now_holiday = $this->getCPforUser($users[$i]['rowid'], $val['rowid']);
$new_solde = $now_holiday + $this->getConfCP('nbHolidayEveryMonth'); $new_solde = $now_holiday + $nb_holiday;
// We add a log for each user // We add a log for each user
$this->addLogCP($user->id, $users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $new_solde, $val['rowid']); $this->addLogCP($user->id, $users[$i]['rowid'], $langs->trans('HolidaysMonthlyUpdate'), $new_solde, $val['rowid']);
@ -1309,15 +1309,15 @@ class Holiday extends CommonObject
// List for Dolibarr users // List for Dolibarr users
if ($type) if ($type)
{ {
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut"; $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE (ug.fk_user = u.rowid"; $sql.= " WHERE ((ug.fk_user = u.rowid";
$sql.= " AND ug.entity = ".$conf->entity.")"; $sql.= " AND ug.entity = ".$conf->entity.")";
$sql.= " OR u.admin = 1"; $sql.= " OR u.admin = 1)";
} }
else else
$sql.= " WHERE u.entity IN (0,".$conf->entity.")"; $sql.= " WHERE u.entity IN (0,".$conf->entity.")";

View File

@ -424,7 +424,7 @@
}); });
/* otherwise use button with given string as text */ /* otherwise use button with given string as text */
} else { } else {
var submit = $('<button type="submit" />'); var submit = $('<button class="button" type="submit" />');
submit.html(settings.submit); submit.html(settings.submit);
} }
$(this).append(submit); $(this).append(submit);
@ -435,7 +435,7 @@
var cancel = $(settings.cancel); var cancel = $(settings.cancel);
/* otherwise use button with given string as text */ /* otherwise use button with given string as text */
} else { } else {
var cancel = $('<button type="cancel" />'); var cancel = $('<button class="button" type="cancel" />');
cancel.html(settings.cancel); cancel.html(settings.cancel);
} }
$(this).append(cancel); $(this).append(cancel);

View File

@ -141,7 +141,11 @@ class Parsedown
foreach ($parts as $part) foreach ($parts as $part)
{ {
$shortage = 4 - mb_strlen($line, 'utf-8') % 4; // @CHANGE LDR Fix when mb_strlen is not available
//$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
if (function_exists('mb_strlen')) $len = mb_strlen($line, 'utf-8');
else $len = strlen($line);
$shortage = 4 - $len % 4;
$line .= str_repeat(' ', $shortage); $line .= str_repeat(' ', $shortage);
$line .= $part; $line .= $part;

View File

@ -367,7 +367,7 @@ $showweather=empty($conf->global->MAIN_DISABLE_METEO)?1:0;
$dashboardlines=array(); $dashboardlines=array();
// Do not include sections without management permission // Do not include sections without management permission
require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
// Number of actions to do (late) // Number of actions to do (late)
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)
@ -548,7 +548,7 @@ if (! empty($valid_dashboardlines))
$boxwork.='<tr class="nohover"><td class="tdboxstats nohover flexcontainer centpercent">'; $boxwork.='<tr class="nohover"><td class="tdboxstats nohover flexcontainer centpercent">';
foreach($valid_dashboardlines as $board) foreach($valid_dashboardlines as $board)
{ {
if (empty($boad->nbtodo)) $nbworkboardempty++; if (empty($board->nbtodo)) $nbworkboardempty++;
$textlate = $langs->trans("NActionsLate",$board->nbtodolate); $textlate = $langs->trans("NActionsLate",$board->nbtodolate);
$textlate.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; $textlate.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';

View File

@ -172,7 +172,7 @@ NumberOfSupplierOrders=Nombre de commandes fournisseurs
NumberOfSupplierInvoices=Nombre de factures fournisseurs NumberOfSupplierInvoices=Nombre de factures fournisseurs
NumberOfUnitsProposals=Quantités présentes dans les propositions commerciales NumberOfUnitsProposals=Quantités présentes dans les propositions commerciales
NumberOfUnitsCustomerOrders=Quantités présentes dans les commandes clients NumberOfUnitsCustomerOrders=Quantités présentes dans les commandes clients
NumberOfUnitsCustomerInvoices=Quantités présentes dans les factures fournisseurs NumberOfUnitsCustomerInvoices=Quantités présentes dans les factures clients
NumberOfUnitsSupplierProposals=Quantités présentes dans les demande de prix NumberOfUnitsSupplierProposals=Quantités présentes dans les demande de prix
NumberOfUnitsSupplierOrders=Quantités présentes dans les commandes fournisseurs NumberOfUnitsSupplierOrders=Quantités présentes dans les commandes fournisseurs
NumberOfUnitsSupplierInvoices=Quantités présentes dans les factures fournisseurs NumberOfUnitsSupplierInvoices=Quantités présentes dans les factures fournisseurs

View File

@ -344,13 +344,13 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Accountancy_account_insurance // Accountancy_account_insurance
print '<tr><td>'.$langs->trans("LoanAccountancyInsuranceCode").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInsuranceCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1); print $formaccounting->select_account($object->accountancy_account_insurance, 'accountancy_account_insurance', 1, '', 0, 1);
print '</td></tr>'; print '</td></tr>';
// Accountancy_account_interest // Accountancy_account_interest
print '<tr><td>'.$langs->trans("LoanAccountancyInterestCode").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("LoanAccountancyInterestCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1); print $formaccounting->select_account($object->accountancy_account_interest, 'accountancy_account_interest', 1, '', 0, 1);
print '</td></tr>'; print '</td></tr>';
@ -556,7 +556,7 @@ if ($id > 0)
{ {
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 0, 1); print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 1, 1);
} }
else else
{ {
@ -581,7 +581,7 @@ if ($id > 0)
{ {
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 0, 1); print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 1, 1);
} }
else else
{ {
@ -606,7 +606,7 @@ if ($id > 0)
{ {
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 0, 1); print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 1, 1);
} }
else else
{ {

View File

@ -153,9 +153,19 @@ class Loan extends CommonObject
$this->error="ErrorBadParameter"; $this->error="ErrorBadParameter";
return -2; return -2;
} }
if (($conf->accounting->enabled) && empty($this->account_capital) && empty($this->account_insurance) && empty($this->account_interest)) if (($conf->accounting->enabled) && empty($this->account_capital))
{ {
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Accounting")); $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyCapitalCode"));
return -2;
}
if (($conf->accounting->enabled) && empty($this->account_insurance))
{
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInsuranceCode"));
return -2;
}
if (($conf->accounting->enabled) && empty($this->account_interest))
{
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("LoanAccountancyInterestCode"));
return -2; return -2;
} }

View File

@ -81,6 +81,7 @@ function test_sql_and_script_inject($val, $type)
// For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests)
if ($type != 2) if ($type != 2)
{ {
$inj += preg_match('/updatexml\(/i', $val);
$inj += preg_match('/delete\s+from/i', $val); $inj += preg_match('/delete\s+from/i', $val);
$inj += preg_match('/create\s+table/i', $val); $inj += preg_match('/create\s+table/i', $val);
$inj += preg_match('/update.+set.+=/i', $val); $inj += preg_match('/update.+set.+=/i', $val);
@ -1244,7 +1245,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! defined('DISABLE_JQUERY_JEDITABLE')) if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! defined('DISABLE_JQUERY_JEDITABLE'))
{ {
print '<!-- JS to manage editInPlace feature -->'."\n"; print '<!-- JS to manage editInPlace feature -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.min.js'.($ext?'?'.$ext:'').'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext?'?'.$ext:'').'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext?'?'.$ext:'').'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext?'?'.$ext:'').'"></script>'."\n";
print '<script type="text/javascript">'."\n"; print '<script type="text/javascript">'."\n";

View File

@ -23,5 +23,13 @@
* Put detailed description here. * Put detailed description here.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
/** Your code here. */ /** Your code here. */
echo "Hello world!"; echo "Hello world!";

View File

@ -15,6 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$object=$GLOBALS['object']; $object=$GLOBALS['object'];
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));

View File

@ -15,6 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$object=$GLOBALS['object']; $object=$GLOBALS['object'];
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));

View File

@ -15,6 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$object=$GLOBALS['object']; $object=$GLOBALS['object'];
?> ?>

View File

@ -13,8 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -13,9 +13,16 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$object=$GLOBALS['object']; $object=$GLOBALS['object'];
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));

View File

@ -15,6 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$object=$GLOBALS['object']; $object=$GLOBALS['object'];
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));

View File

@ -15,6 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
$object=$GLOBALS['object']; $object=$GLOBALS['object'];
?> ?>

View File

@ -13,8 +13,15 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -1505,6 +1505,7 @@ class Product extends CommonObject
// We do a first seach with a select by searching with couple prodfournprice and qty only (later we will search on triplet qty/product_id/fourn_ref) // We do a first seach with a select by searching with couple prodfournprice and qty only (later we will search on triplet qty/product_id/fourn_ref)
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.remise_percent,"; $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.remise_percent,";
$sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql.= " pfp.fk_product, pfp.ref_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression";
$sql.= " ,pfp.default_vat_code";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.rowid = ".$prodfournprice; $sql.= " WHERE pfp.rowid = ".$prodfournprice;
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
@ -1537,9 +1538,11 @@ class Product extends CommonObject
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier
$this->fourn_price_base_type = 'HT'; // Price base type $this->fourn_price_base_type = 'HT'; // Price base type
$this->ref_fourn = $obj->ref_fourn; // deprecated $this->ref_fourn = $obj->ref_fourn; // deprecated
$this->product_fourn_price_id = $obj->rowid; // supplier price id
$this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->ref_supplier = $obj->ref_fourn; // Ref supplier
$this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$this->default_vat_code = $obj->default_vat_code; // Vat code supplier
$result=$obj->fk_product; $result=$obj->fk_product;
return $result; return $result;
} }
@ -1548,6 +1551,7 @@ class Product extends CommonObject
// We do a second search by doing a select again but searching with less reliable criteria: couple qty/id product, and if set fourn_ref or fk_soc. // We do a second search by doing a select again but searching with less reliable criteria: couple qty/id product, and if set fourn_ref or fk_soc.
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
$sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression"; $sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression";
$sql.= " ,pfp.default_vat_code";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.fk_product = ".$product_id; $sql.= " WHERE pfp.fk_product = ".$product_id;
if ($fourn_ref != 'none') $sql.= " AND pfp.ref_fourn = '".$fourn_ref."'"; if ($fourn_ref != 'none') $sql.= " AND pfp.ref_fourn = '".$fourn_ref."'";
@ -1583,10 +1587,12 @@ class Product extends CommonObject
$this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier
$this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier
$this->product_fourn_price_id = $obj->rowid; // supplier price id
$this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_fourn = $obj->ref_supplier; // deprecated
$this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->ref_supplier = $obj->ref_supplier; // Ref supplier
$this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed
$this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier
$this->default_vat_code = $obj->default_vat_code; // Vat code supplier
$result=$obj->fk_product; $result=$obj->fk_product;
return $result; return $result;
} }

View File

@ -1,3 +1,13 @@
<?php
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?>
<script type="text/javascript"> <script type="text/javascript">
function save_qty(k) { function save_qty(k) {

View File

@ -29,7 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once './lib/replenishment.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/lib/replenishment.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("products"); $langs->load("products");
$langs->load("stocks"); $langs->load("stocks");
@ -44,9 +45,12 @@ $sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha'); $snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user', 'alpha'); $suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc', 'alpha'); $sttc = GETPOST('search_ttc', 'alpha');
$sdate = GETPOST('search_date', 'alpha');
$page = GETPOST('page', 'int'); $page = GETPOST('page', 'int');
$sproduct = GETPOST('sproduct', 'int'); $sproduct = GETPOST('sproduct', 'int');
$search_dateyear = GETPOST('search_dateyear', 'int');
$search_datemonth = GETPOST('search_datemonth', 'int');
$search_dateday = GETPOST('search_dateday', 'int');
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield"); $sortfield = GETPOST("sortfield");
@ -58,7 +62,6 @@ if ($page < 0) $page = 0;
$offset = $limit * $page; $offset = $limit * $page;
/* /*
* Actions * Actions
*/ */
@ -70,7 +73,10 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$snom=""; $snom="";
$suser=""; $suser="";
$sttc=""; $sttc="";
$sdate=''; $search_date='';
$search_datemonth='';
$search_dateday='';
$search_dateyear='';
$sproduct=0; $sproduct=0;
} }
@ -125,17 +131,19 @@ if ($sref) $sql .= natural_search('cf.ref', $sref);
if ($snom) $sql .= natural_search('s.nom', $snom); if ($snom) $sql .= natural_search('s.nom', $snom);
if ($suser) $sql .= natural_search('u.login', $suser); if ($suser) $sql .= natural_search('u.login', $suser);
if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1); if ($sttc) $sql .= natural_search('cf.total_ttc', $sttc, 1);
if ($sdate)
if ($search_datemonth > 0)
{ {
if (GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int') && GETPOST('search_dateyear', 'int')) if ($search_dateyear > 0 && empty($search_dateday))
{ $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,$search_datemonth,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,$search_datemonth,false))."'";
$date = dol_mktime(0, 0, 0, GETPOST('search_datemonth', 'int'), GETPOST('search_dateday', 'int'), GETPOST('search_dateyear', 'int')); else if ($search_dateyear > 0 && ! empty($search_dateday))
} $sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_datemonth, $search_dateday, $search_dateyear))."'";
else else
{ $sql.= " AND date_format(cf.date_creation, '%m') = '".$search_datemonth."'";
$date = dol_stringtotime($sdate);
} }
$sql .= " AND cf.date_creation = '" . $db->idate($date) . "'"; else if ($search_dateyear > 0)
{
$sql.= " AND cf.date_creation BETWEEN '".$db->idate(dol_get_first_day($search_dateyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_dateyear,12,false))."'";
} }
if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall); if ($sall) $sql .= natural_search(array('cf.ref','cf.note'), $sall);
if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid; if (!empty($socid)) $sql .= ' AND s.rowid = ' . $socid;
@ -146,7 +154,6 @@ $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom'; $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit+1, $offset); $sql .= $db->plimit($limit+1, $offset);
//print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -158,25 +165,38 @@ if ($resql)
print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, ''); print_barre_liste('', $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, 0, '');
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sref) $param.='&search_ref='.urlencode($sref);
if ($snom) $param.='&search_nom='.urlencode($snom);
if ($suser) $param.='&search_user='.urlencode($suser);
if ($sttc) $param.='&search_ttc='.urlencode($sttc);
if ($search_dateyear) $param.='&search_dateyear='.urlencode($search_dateyear);
if ($search_datemonth) $param.='&search_datemonth='.urlencode($search_datemonth);
if ($search_dateday) $param.='&search_dateday='.urlencode($search_dateday);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre_filter">'. print '<tr class="liste_titre_filter">';
'<td class="liste_titre">'. print '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ref" value="' . $sref . '">'. '<input type="text" class="flat" name="search_ref" value="' . dol_escape_htmltag($sref) . '">'.
'</td>'. '</td>'.
'<td class="liste_titre">'. '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_nom" value="' . $snom . '">'. '<input type="text" class="flat" name="search_nom" value="' . dol_escape_htmltag($snom) . '">'.
'</td>'. '</td>'.
'<td class="liste_titre">'. '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_user" value="' . $suser . '">'. '<input type="text" class="flat" name="search_user" value="' . dol_escape_htmltag($suser) . '">'.
'</td>'. '</td>'.
'<td class="liste_titre">'. '<td class="liste_titre">'.
'<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">'. '<input type="text" class="flat" name="search_ttc" value="' . dol_escape_htmltag($sttc) . '">'.
'</td>'. '</td>'.
'<td class="liste_titre">'. '<td class="liste_titre">'.
$form->select_date('', 'search_date', 0, 0, 1, '', 1, 0, 1, 0, ''). $form->select_date($search_date, 'search_date', 0, 0, 1, '', 1, 0, 1, 0, '').
'</td>'. '</td>'.
'<td class="liste_titre" align="right">'; '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
@ -190,7 +210,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.ref', 'cf.ref',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@ -200,7 +220,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
's.nom', 's.nom',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@ -220,7 +240,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.total_ttc', 'cf.total_ttc',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@ -230,7 +250,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.date_creation', 'cf.date_creation',
'', '',
'', $param,
'', '',
$sortfield, $sortfield,
$sortorder $sortorder
@ -240,7 +260,7 @@ if ($resql)
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
'cf.fk_statut', 'cf.fk_statut',
'', '',
'', $param,
'align="right"', 'align="right"',
$sortfield, $sortfield,
$sortorder $sortorder

View File

@ -17,6 +17,14 @@
* $object must be defined * $object must be defined
* $backtopage * $backtopage
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP --> <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->

View File

@ -17,6 +17,14 @@
* $object must be defined * $object must be defined
* $backtopage * $backtopage
*/ */
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
?> ?>
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP --> <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->

View File

@ -237,7 +237,7 @@ if ($action == 'addtime' && $user->rights->projet->lire)
$object->fetch($key); $object->fetch($key);
$object->progress = GETPOST($key.'progress', 'int'); $object->progress = GETPOST($key.'progress', 'int');
$object->timespent_duration = $val; $object->timespent_duration = $val;
$object->timespent_fk_user = $user->id; $object->timespent_fk_user = $usertoprocess->id;
$object->timespent_note = GETPOST($key.'note'); $object->timespent_note = GETPOST($key.'note');
if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered
{ {

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