Merge remote-tracking branch 'uptream/develop' into 7.0-accountancyproductvariant
# Conflicts: # htdocs/install/mysql/migration/6.0.0-7.0.0.sql
This commit is contained in:
commit
2d17e4094c
27
ChangeLog
27
ChangeLog
@ -5,6 +5,7 @@ English Dolibarr ChangeLog
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
For users:
|
||||
|
||||
For developers:
|
||||
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
||||
@ -28,6 +29,32 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Remove js library fileupload that was not used by core code.
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
|
||||
FIX: #7211 Update qty dispatched on qty change
|
||||
FIX: #7458
|
||||
FIX: #7593
|
||||
FIX: #7616
|
||||
FIX: #7619
|
||||
FIX: #7626
|
||||
FIX: #7648
|
||||
FIX: #7675
|
||||
FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart
|
||||
FIX: API to get object does not return data of linked objects
|
||||
FIX: Bad localtax apply
|
||||
FIX: Bad ressource list in popup in gantt view
|
||||
FIX: bankentries search conciliated if val 0
|
||||
FIX: hook formObjectOptions() must use $expe and not $object
|
||||
FIX: make of link to other object during creation
|
||||
FIX: Missing function getLinesArray
|
||||
FIX: old batch not shown in multi shipping
|
||||
FIX: paid supplier invoices are shown as abandoned
|
||||
FIX: selection of thirdparty was lost on stats page of invoices
|
||||
FIX: sql syntax error because of old field accountancy_journal
|
||||
FIX: Stats on invoices show nothing
|
||||
FIX: substitution in ODT of thirdparties documents
|
||||
FIX: wrong key in selectarray
|
||||
FIX: wrong personnal project time spent
|
||||
|
||||
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
||||
FIX: #7148
|
||||
FIX: #7288
|
||||
|
||||
@ -571,6 +571,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`;
|
||||
@ -579,6 +580,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`;
|
||||
@ -590,6 +592,8 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
|
||||
|
||||
|
||||
print "Remove subdir of custom dir\n";
|
||||
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
|
||||
|
||||
@ -78,15 +78,17 @@ $sqls=array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'propal',
|
||||
),
|
||||
'supplier_order'=>array(
|
||||
'supplier_proposal'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
||||
),
|
||||
'supplier_order'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
|
||||
),
|
||||
'supplier_invoice'=>array(
|
||||
'supplier_invoice'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
|
||||
),
|
||||
'delivery'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
|
||||
@ -114,8 +116,10 @@ $sqls=array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_batch',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product_lot',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'product',
|
||||
),
|
||||
'project'=>array(
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
|
||||
@ -128,12 +132,13 @@ $sqls=array(
|
||||
),
|
||||
'thirdparty'=>array(
|
||||
'@contact',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
|
||||
'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib',
|
||||
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
|
||||
)
|
||||
);
|
||||
|
||||
@ -152,27 +157,37 @@ $mode = $argv[1];
|
||||
$option = $argv[2];
|
||||
|
||||
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
|
||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||
print "\n";
|
||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
|
||||
print "Usage: $script_file (test|confirm) (all|option)\n";
|
||||
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
|
||||
print "\n";
|
||||
print "option can be ".implode(',',array_keys($sqls))."\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Replace database handler
|
||||
if (! empty($argv[3]))
|
||||
{
|
||||
$db->close();
|
||||
unset($db);
|
||||
$db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]);
|
||||
$user=new User($db);
|
||||
}
|
||||
|
||||
//var_dump($user->db->database_name);
|
||||
$ret=$user->fetch('','admin');
|
||||
if (! $ret > 0)
|
||||
{
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
|
||||
print 'An admin user with login "admin" must exists to use this script.'."\n";
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
//$user->getrights();
|
||||
|
||||
|
||||
print "Purge all data for this database:\n";
|
||||
print "Server = ".$db->database_host."\n";
|
||||
@ -190,14 +205,14 @@ if (! $confirmed)
|
||||
|
||||
/**
|
||||
* Process sql requests of a family
|
||||
*
|
||||
*
|
||||
* @param string $family Name of family key of array $sqls
|
||||
* @return int -1 if KO, 1 if OK
|
||||
*/
|
||||
function processfamily($family)
|
||||
{
|
||||
global $db, $sqls;
|
||||
|
||||
|
||||
$error=0;
|
||||
foreach($sqls[$family] as $sql)
|
||||
{
|
||||
@ -207,7 +222,7 @@ function processfamily($family)
|
||||
processfamily($newfamily);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
print "Run sql: ".$sql."\n";
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
@ -217,7 +232,7 @@ function processfamily($family)
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error)
|
||||
{
|
||||
print $db->lasterror();
|
||||
@ -225,7 +240,7 @@ function processfamily($family)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error) return -1;
|
||||
else return 1;
|
||||
}
|
||||
@ -242,7 +257,7 @@ foreach($sqls as $family => $familysql)
|
||||
$oldfamily = $family;
|
||||
|
||||
$result=processfamily($family);
|
||||
if ($result < 0)
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -44,6 +44,10 @@ $search_doc_ref = GETPOST("search_doc_ref");
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
|
||||
$search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int'));
|
||||
$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
|
||||
$search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification_startmonth', 'int'), GETPOST('date_modification_startday', 'int'), GETPOST('date_modification_startyear', 'int'));
|
||||
$search_date_modification_end = dol_mktime(0, 0, 0, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int'));
|
||||
|
||||
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
|
||||
$action = 'delbookkeepingyear';
|
||||
@ -53,7 +57,6 @@ if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOS
|
||||
}
|
||||
|
||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
||||
|
||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
@ -64,7 +67,6 @@ if ($search_accountancy_code_end == - 1) {
|
||||
}
|
||||
|
||||
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
|
||||
|
||||
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
|
||||
if ($search_accountancy_aux_code_start == - 1) {
|
||||
$search_accountancy_aux_code_start = '';
|
||||
@ -102,15 +104,30 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
|
||||
$arrayfields=array(
|
||||
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
|
||||
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
|
||||
't.doc_ref'=>array('label'=>$langs->trans("Docref"), 'checked'=>1),
|
||||
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
|
||||
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
|
||||
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
|
||||
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
|
||||
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
|
||||
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
|
||||
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_mvt_num = '';
|
||||
@ -128,6 +145,10 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_ledger_code = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_date_creation_start = '';
|
||||
$search_date_creation_end = '';
|
||||
$search_date_modification_start = '';
|
||||
$search_date_modification_end = '';
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
@ -196,6 +217,26 @@ if (! empty($search_mvt_num)) {
|
||||
$filter['t.piece_num'] = $search_mvt_num;
|
||||
$param .= '&search_mvt_num=' . $search_mvt_num;
|
||||
}
|
||||
if (! empty($search_date_creation_start)) {
|
||||
$filter['t.date_creation>='] = $search_date_creation_start;
|
||||
$tmp=dol_getdate($search_date_creation_start);
|
||||
$param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year'];
|
||||
}
|
||||
if (! empty($search_date_creation_end)) {
|
||||
$filter['t.date_creation<='] = $search_date_creation_end;
|
||||
$tmp=dol_getdate($search_date_creation_end);
|
||||
$param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year'];
|
||||
}
|
||||
if (! empty($search_date_modification_start)) {
|
||||
$filter['t.tms>='] = $search_date_modification_start;
|
||||
$tmp=dol_getdate($search_date_modification_start);
|
||||
$param .= '&date_modification_startmonth=' . $tmp['mon'] . '&date_modification_startday=' . $tmp['mday'] . '&date_modification_startyear=' . $tmp['year'];
|
||||
}
|
||||
if (! empty($search_date_modification_end)) {
|
||||
$filter['t.tms<='] = $search_date_modification_end;
|
||||
$tmp=dol_getdate($search_date_modification_end);
|
||||
$param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year'];
|
||||
}
|
||||
|
||||
if ($action == 'delbookkeeping') {
|
||||
|
||||
@ -370,137 +411,288 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste" width="100%">';
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
// Movement number
|
||||
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
|
||||
}
|
||||
else
|
||||
// Date document
|
||||
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
// Ref document
|
||||
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
|
||||
}
|
||||
else
|
||||
// Accountancy account
|
||||
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
// Subledger account
|
||||
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Label operation
|
||||
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||
print '</td>';
|
||||
}
|
||||
// Debit
|
||||
if (! empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
}
|
||||
// Credit
|
||||
if (! empty($arrayfields['t.credit']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
}
|
||||
// Code journal
|
||||
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
}
|
||||
// Date creation
|
||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->select_date($search_date_creation_start, 'date_creation_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->select_date($search_date_creation_end, 'date_creation_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->select_date($search_date_modification_start, 'date_modification_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->select_date($search_date_modification_end, 'date_modification_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
$checkpicto='';
|
||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre("DateModification", $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
$i=0;
|
||||
while ($i < min($num, $limit))
|
||||
if ($num > 0)
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||
print '<td>' . $line->label_operation . '</td>';
|
||||
print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
// Piece number
|
||||
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||
{
|
||||
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$line->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
||||
print '<td align="center">' . $journaltoshow . '</td>';
|
||||
// Document date
|
||||
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||
{
|
||||
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
// Document ref
|
||||
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
// Account number
|
||||
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||
{
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Subledger account
|
||||
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||
{
|
||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label operation
|
||||
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||
{
|
||||
print '<td>' . $line->label_operation . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount debit
|
||||
if (! empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td align="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||
$totalarray['totaldebit'] += $line->debit;
|
||||
}
|
||||
|
||||
// Amount credit
|
||||
if (! empty($arrayfields['t.credit']['checked']))
|
||||
{
|
||||
print '<td align="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalcredit'] += $line->credit;
|
||||
}
|
||||
|
||||
// Journal code
|
||||
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('',$line->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
|
||||
print '<td align="center">' . $journaltoshow . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Creation operation date
|
||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||
{
|
||||
print '<td align="center">' . dol_print_date($line->date_creation, 'day') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Modification operation date
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">' . dol_print_date($line->date_modification, 'day') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||
{
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td align="right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td align="right">'.price($totalarray['totalcredit']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
if ($num < $limit) print '<td align="left" colspan="7">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left" colspan="7">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_credit);
|
||||
print '</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -564,7 +564,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||
@ -603,6 +604,7 @@ class BookKeeping extends CommonObject
|
||||
$this->code_journal = $obj->code_journal;
|
||||
$this->journal_label = $obj->journal_label;
|
||||
$this->piece_num = $obj->piece_num;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -658,7 +660,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation";
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
@ -675,6 +678,8 @@ class BookKeeping extends CommonObject
|
||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||
} elseif ($key == 't.label_operation') {
|
||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||
} else {
|
||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
@ -725,6 +730,7 @@ class BookKeeping extends CommonObject
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $obj->date_creation;
|
||||
|
||||
$this->lines[] = $line;
|
||||
}
|
||||
@ -777,7 +783,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
@ -793,6 +800,10 @@ class BookKeeping extends CommonObject
|
||||
$sqlwhere[] = $key . '=' . $value;
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
|
||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
|
||||
} else {
|
||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
@ -841,6 +852,7 @@ class BookKeeping extends CommonObject
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $obj->date_creation;
|
||||
|
||||
$this->lines[] = $line;
|
||||
}
|
||||
@ -1336,6 +1348,7 @@ class BookKeeping extends CommonObject
|
||||
$this->code_journal = 'VT';
|
||||
$this->journal_label = 'Journal de vente';
|
||||
$this->piece_num = '';
|
||||
$this->date_creation = $now;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1348,7 +1361,7 @@ class BookKeeping extends CommonObject
|
||||
public function fetchPerMvt($piecenum, $mode='') {
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type";
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||
@ -1364,6 +1377,7 @@ class BookKeeping extends CommonObject
|
||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||
$this->doc_ref = $obj->doc_ref;
|
||||
$this->doc_type = $obj->doc_type;
|
||||
$this->date_creation = $obj->date_creation;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
||||
@ -1414,7 +1428,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
|
||||
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
|
||||
@ -1447,6 +1461,7 @@ class BookKeeping extends CommonObject
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $obj->date_creation;
|
||||
|
||||
$this->linesmvt[] = $line;
|
||||
}
|
||||
@ -1785,4 +1800,5 @@ class BookKeepingLine
|
||||
public $code_journal;
|
||||
public $journal_label;
|
||||
public $piece_num;
|
||||
public $date_creation;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ $langs->load("agenda");
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
|
||||
$search_event = GETPOST('search_event', 'alpha');
|
||||
|
||||
// Get list of triggers available
|
||||
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
|
||||
@ -70,6 +71,12 @@ else
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_event = '';
|
||||
}
|
||||
|
||||
if ($action == "save" && empty($cancel))
|
||||
{
|
||||
$i=0;
|
||||
@ -78,10 +85,13 @@ if ($action == "save" && empty($cancel))
|
||||
|
||||
foreach ($triggers as $trigger)
|
||||
{
|
||||
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$keyparam='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
//print "param=".$param." - ".$_POST[$param];
|
||||
$res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $keyparam))
|
||||
{
|
||||
$res = dolibarr_set_const($db,$keyparam,(GETPOST($keyparam,'alpha')?GETPOST($keyparam,'alpha'):''),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -140,6 +150,8 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="save">';
|
||||
|
||||
$param = '';
|
||||
$param.= '&search_event='.urlencode($search_event);
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
|
||||
@ -151,8 +163,19 @@ print "<br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre">'.$langs->trans("ActionsEvents").'</th>';
|
||||
print '<th class="liste_titre"></th>';
|
||||
print '<th class="liste_titre"><a href="'.$_SERVER["PHP_SELF"].'?action=selectall'.($param?$param:'').'">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone'.($param?$param:'').'">'.$langs->trans("None").'</a></th>';
|
||||
print '</tr>'."\n";
|
||||
// Show each trigger (list is in c_action_trigger)
|
||||
if (! empty($triggers))
|
||||
@ -173,15 +196,17 @@ if (! empty($triggers))
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$trigger['code'].'</td>';
|
||||
print '<td>'.$trigger['label'].'</td>';
|
||||
print '<td align="right" width="40">';
|
||||
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$value=$conf->global->$key;
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
|
||||
print '</td></tr>'."\n";
|
||||
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $trigger['code']))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$trigger['code'].'</td>';
|
||||
print '<td>'.$trigger['label'].'</td>';
|
||||
print '<td align="right" width="40">';
|
||||
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$value=$conf->global->$key;
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,6 +352,15 @@ else
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
|
||||
@ -381,15 +390,6 @@ print '<td align="right">'."\n";
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -258,14 +258,14 @@ $var=true;
|
||||
|
||||
$var=! $var;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -539,7 +539,7 @@ print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -550,7 +550,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='ORDER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -573,7 +573,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext);
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -474,7 +474,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'));
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -482,8 +482,7 @@ $htmltext.='</i>';
|
||||
|
||||
$var=! $var;
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
//print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2);
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print '<br>';
|
||||
$variablename='CONTRACT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
@ -501,8 +500,7 @@ print '</td></tr>'."\n";
|
||||
//Use draft Watermark
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
//print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2);
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
@ -193,20 +193,14 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
|
||||
//$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.$langs->trans("Disabled").'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableDefaultValues");
|
||||
$enabledisablehtml.='</span>';
|
||||
$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$enabledisablehtml.= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
|
||||
//$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.$langs->trans("Activated").'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableDefaultValues");
|
||||
$enabledisablehtml.='</span>';
|
||||
$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
||||
$enabledisablehtml.= '</a>';
|
||||
}
|
||||
|
||||
|
||||
@ -477,14 +477,14 @@ print "<tr class=\"liste_titre\">";
|
||||
print "<td>".$langs->trans("Parameter")."</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SHIPPING_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -499,7 +499,7 @@ else
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.$conf->global->SHIPPING_DRAFT_WATERMARK.'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
@ -482,7 +482,7 @@ print '<td align="center" width="60"></td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -490,7 +490,7 @@ $htmltext.='</i>';
|
||||
|
||||
$var=! $var;
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='EXPENSEREPORT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -507,7 +507,7 @@ print '</td></tr>'."\n";
|
||||
//Use draft Watermark
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
@ -711,7 +711,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -722,7 +722,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='INVOICE_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -744,7 +744,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext);
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td>';
|
||||
print '<td><input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -534,7 +534,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -544,7 +544,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='FICHINTER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -567,7 +567,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.$conf->global->FICHINTER_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -454,7 +454,7 @@ print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -465,7 +465,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='DELIVERY_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -116,7 +116,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -545,7 +545,7 @@ print "</td></tr>\n";
|
||||
print '</form>';
|
||||
*/
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -555,7 +555,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='PROPOSAL_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -577,7 +577,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -471,14 +471,14 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_INVOICE_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -537,14 +537,14 @@ else
|
||||
}
|
||||
*/
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_ORDER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -500,7 +500,7 @@ print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
|
||||
print "<td> </td>\n";
|
||||
print "</tr>";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -511,7 +511,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -533,7 +533,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="SUPPLIER_PROPOSAL_DRAFT_WATERMARK" value="'.$conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -210,7 +210,7 @@ llxHeader('',$langs->trans("Setup"),$wikihelp);
|
||||
$param='&mode='.$mode;
|
||||
|
||||
$enabledisablehtml='';
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
|
||||
$enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
|
||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
// Button off, click to enable
|
||||
@ -298,9 +298,9 @@ if ($mode == 'overwrite')
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="'.(!empty($transkey)?$transkey:"").'">';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" id="transkey" value="'.(!empty($transkey)?$transkey:"").'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="'.(!empty($transvalue)?$transvalue:"").'">';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" id="transvalue" value="'.(!empty($transvalue)?$transvalue:"").'">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
@ -403,6 +403,9 @@ if ($mode == 'searchkey')
|
||||
|
||||
$recordtoshow=array();
|
||||
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
$nbempty=0;
|
||||
/*var_dump($langcode);
|
||||
var_dump($transkey);
|
||||
@ -416,29 +419,30 @@ if ($mode == 'searchkey')
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load all translations keys
|
||||
foreach($conf->file->dol_document_root as $keydir => $searchdir)
|
||||
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
|
||||
foreach($modulesdir as $keydir => $tmpsearchdir)
|
||||
{
|
||||
// Directory of translation files
|
||||
$dir_lang = $searchdir."/langs/".$langcode;
|
||||
$dir_lang_osencoded=dol_osencode($dir_lang);
|
||||
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
|
||||
|
||||
$filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
// Directory of translation files
|
||||
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
|
||||
$dir_lang_osencoded=dol_osencode($dir_lang);
|
||||
|
||||
foreach($filearray as $file)
|
||||
{
|
||||
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
||||
$newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite
|
||||
$newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only
|
||||
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
||||
}
|
||||
$filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
foreach($filearray as $file)
|
||||
{
|
||||
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
||||
$newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite
|
||||
$newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only
|
||||
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Now search into translation array
|
||||
foreach($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/', $key)) continue;
|
||||
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/', $val)) continue;
|
||||
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/i', $key)) continue;
|
||||
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/i', $val)) continue;
|
||||
$recordtoshow[$key]=$val;
|
||||
}
|
||||
}
|
||||
@ -566,6 +570,10 @@ dol_fiche_end();
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
if (! empty($langcode))
|
||||
{
|
||||
dol_set_focus('#transvalue');
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
// Search available module
|
||||
dol_syslog("Scan directory ".$dir." for module descriptor to after search for API files");
|
||||
dol_syslog("Scan directory ".$dir." for module descriptor files, then search for API files");
|
||||
|
||||
$handle=@opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
@ -139,14 +139,14 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
|
||||
{
|
||||
$module = strtolower($regmod[1]);
|
||||
$moduledirforclass = getModuleDirForApiClass($module);
|
||||
$moduleforperm = $module;
|
||||
if ($module == 'propale') { $moduleforperm='propal'; }
|
||||
$modulenameforenabled = $module;
|
||||
if ($module == 'propale') { $modulenameforenabled='propal'; }
|
||||
|
||||
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
|
||||
dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled=true;
|
||||
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
|
||||
if (empty($conf->$modulenameforenabled->enabled)) $enabled=false;
|
||||
|
||||
if ($enabled)
|
||||
{
|
||||
@ -235,7 +235,13 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
|
||||
if ($module == 'order') { $classname='Commande'; }
|
||||
//var_dump($classfile);var_dump($classname);exit;
|
||||
|
||||
require_once $dir_part_file;
|
||||
$res = include_once $dir_part_file;
|
||||
if (! $res)
|
||||
{
|
||||
print 'API not found (failed to include API file)';
|
||||
header('HTTP/1.1 501 API not found (failed to include API file)');
|
||||
exit(0);
|
||||
}
|
||||
if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/');
|
||||
}
|
||||
else
|
||||
@ -247,7 +253,14 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
|
||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
||||
$classname=ucwords($module);
|
||||
|
||||
require_once $dir_part_file;
|
||||
$res = include_once $dir_part_file;
|
||||
if (! $res)
|
||||
{
|
||||
print 'API not found (failed to include API file)';
|
||||
header('HTTP/1.1 501 API not found (failed to include API file)');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (class_exists($classname)) $api->r->addAPIClass($classname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,11 +180,11 @@ class BlockedLog
|
||||
public function setObjectData(&$object)
|
||||
{
|
||||
// Set date
|
||||
if($object->element == 'payment' || $object->element == 'payment_supplier')
|
||||
if ($object->element == 'payment' || $object->element == 'payment_supplier')
|
||||
{
|
||||
$this->date_object = $object->datepaye;
|
||||
}
|
||||
if ($object->element=='payment_salary')
|
||||
elseif ($object->element=='payment_salary')
|
||||
{
|
||||
$this->date_object = $object->datev;
|
||||
}
|
||||
|
||||
@ -35,111 +35,117 @@ function printBookmarksList($aDb, $aLangs)
|
||||
$db = $aDb;
|
||||
$langs = $aLangs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$url= $_SERVER["PHP_SELF"];
|
||||
|
||||
if (! empty($_SERVER["QUERY_STRING"]))
|
||||
{
|
||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||
}
|
||||
else
|
||||
{
|
||||
global $sortfield,$sortorder;
|
||||
$tmpurl='';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
}
|
||||
}
|
||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||
}
|
||||
|
||||
$ret = '';
|
||||
|
||||
// Menu bookmark
|
||||
$ret.= '<div class="menu_top"></div>'."\n";
|
||||
|
||||
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
||||
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||
// Url to go on create new bookmark page
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
|
||||
}
|
||||
// Menu with all bookmarks
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||
{
|
||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||
$sql.= " AND entity IN (".getEntity('bookmarks').")";
|
||||
$sql.= " ORDER BY position";
|
||||
if ($resql = $db->query($sql) )
|
||||
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$url= $_SERVER["PHP_SELF"];
|
||||
|
||||
if (! empty($_SERVER["QUERY_STRING"]))
|
||||
{
|
||||
$i=0;
|
||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'">';
|
||||
//$ret.='<span class="fa fa-print">aa</span>';
|
||||
$ret.=img_picto('','object_bookmark').' ';
|
||||
$ret.=$obj->title;
|
||||
$ret.='</option>';
|
||||
$i++;
|
||||
}
|
||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
global $sortfield,$sortorder;
|
||||
$tmpurl='';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
}
|
||||
}
|
||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||
}
|
||||
|
||||
$ret = '';
|
||||
|
||||
// Menu bookmark
|
||||
$ret.= '<div class="menu_top"></div>'."\n";
|
||||
|
||||
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
||||
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||
// Url to go on create new bookmark page
|
||||
if (! empty($user->rights->bookmark->creer))
|
||||
{
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
|
||||
}
|
||||
// Menu with all bookmarks
|
||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
||||
{
|
||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||
$sql.= " AND entity IN (".getEntity('bookmarks').")";
|
||||
$sql.= " ORDER BY position";
|
||||
if ($resql = $db->query($sql) )
|
||||
{
|
||||
$i=0;
|
||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
||||
{
|
||||
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'">';
|
||||
//$ret.='<span class="fa fa-print">aa</span>';
|
||||
$ret.=img_picto('','object_bookmark').' ';
|
||||
$ret.=dol_escape_htmltag($obj->title);
|
||||
$ret.='</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
$ret.= '</select>';
|
||||
$ret.= '</form>';
|
||||
|
||||
$ret.=ajax_combobox('boxbookmark');
|
||||
|
||||
$ret.='<script type="text/javascript">
|
||||
$(document).ready(function () {';
|
||||
$ret.=' jQuery("#boxbookmark").change(function() {
|
||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
||||
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
|
||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
||||
if (! urltarget) { urltarget=""; }
|
||||
jQuery("form#actionbookmark").attr("target",urltarget);
|
||||
jQuery("form#actionbookmark").attr("action",urlselected);
|
||||
|
||||
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
|
||||
|
||||
// Method is POST for internal link, GET for external
|
||||
if (urlselected.startsWith(\'http\'))
|
||||
{
|
||||
var newmethod=\'GET\';
|
||||
jQuery("form#actionbookmark").attr("method", newmethod);
|
||||
console.log("We change method to newmethod="+newmethod);
|
||||
jQuery("#actionbookmark").submit();
|
||||
console.log("We restore method to POST");
|
||||
jQuery("form#actionbookmark").attr("method", \'POST\');
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#actionbookmark").submit();
|
||||
}
|
||||
});';
|
||||
$ret.='})</script>';
|
||||
}
|
||||
|
||||
$ret.= '</select>';
|
||||
$ret.= '</form>';
|
||||
|
||||
$ret.=ajax_combobox('boxbookmark');
|
||||
|
||||
$ret.='<script type="text/javascript">
|
||||
$(document).ready(function () {';
|
||||
$ret.=' jQuery("#boxbookmark").change(function() {
|
||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
||||
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
|
||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
||||
if (! urltarget) { urltarget=""; }
|
||||
jQuery("form#actionbookmark").attr("target",urltarget);
|
||||
jQuery("form#actionbookmark").attr("action",urlselected);
|
||||
|
||||
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
|
||||
|
||||
// Method is POST for internal link, GET for external
|
||||
if (urlselected.startsWith(\'http\'))
|
||||
{
|
||||
var newmethod=\'GET\';
|
||||
jQuery("form#actionbookmark").attr("method", newmethod);
|
||||
console.log("We change method to newmethod="+newmethod);
|
||||
jQuery("#actionbookmark").submit();
|
||||
console.log("We restore method to POST");
|
||||
jQuery("form#actionbookmark").attr("method", \'POST\');
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#actionbookmark").submit();
|
||||
}
|
||||
});';
|
||||
$ret.='})</script>';
|
||||
$ret .= '<div class="menu_end"></div>';
|
||||
$ret.= '<div class="menu_end"></div>'."\n";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1135,7 +1135,6 @@ class ActionComm extends CommonObject
|
||||
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
|
||||
}
|
||||
|
||||
|
||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
@ -1204,10 +1203,13 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
|
||||
}
|
||||
$result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'class="valigntextbottom"':'class="classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1).$linkend;
|
||||
}
|
||||
if ($withpicto==1) $result.=' ';
|
||||
$result.=$linkstart.$libelleshort.$linkend;
|
||||
|
||||
$result.=$linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'class="'.(($withpicto != 2) ? 'paddingright ' : '').'valigntextbottom"':'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1);
|
||||
$result.=$libelleshort;
|
||||
$result.=$linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1341,6 +1343,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
// Note: Output of sql request is encoded in $conf->file->character_set_client
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
$diff = 0;
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$qualified=true;
|
||||
@ -1377,6 +1380,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
$eventarray[]=$event;
|
||||
}
|
||||
$diff++;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1528,10 +1532,18 @@ class ActionComm extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
// TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done
|
||||
|
||||
|
||||
|
||||
// Delete also very old past events (we do not keep more than 1 month record in past)
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->jdate($now - (3600 * 24 * 32))."'";
|
||||
$this->db->query($sql);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
229
htdocs/comm/action/class/actioncommreminder.class.php
Normal file
229
htdocs/comm/action/class/actioncommreminder.class.php
Normal file
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file class/actioncommreminder.class.php
|
||||
* \ingroup agenda
|
||||
* \brief This file is a CRUD class file for ActionCommReminder (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class for ActionCommReminder
|
||||
*/
|
||||
class ActionCommReminder extends CommonObject
|
||||
{
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
public $element = 'actioncomm_reminder';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'actioncomm_reminder';
|
||||
/**
|
||||
* @var array Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
public $ismultientitymanaged = 0;
|
||||
/**
|
||||
* @var string String with name of icon for actioncommreminder. Must be the part after the 'object_' into object_actioncommreminder.png
|
||||
*/
|
||||
public $picto = 'generic';
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format.
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
* 'showoncombobox' if field must be shown into the label of combobox
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'dateremind' => array('type'=>'datetime', 'label'=>'DateRemind', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>1, 'index'=>1,),
|
||||
'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",),
|
||||
'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,),
|
||||
'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,),
|
||||
'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')),
|
||||
);
|
||||
public $rowid;
|
||||
public $dateremind;
|
||||
public $typeremind;
|
||||
public $fk_user;
|
||||
public $offsetvalue;
|
||||
public $offsetunit;
|
||||
public $status;
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
|
||||
if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->createCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->deleteCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le libelle du status d'un user (actif, inactif)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status
|
||||
*
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
static function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($status == 1) return $langs->trans('Done');
|
||||
if ($status == 0) return $langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Done');
|
||||
if ($status == 0) return $langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
|
||||
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Done'),'statut4');
|
||||
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
|
||||
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
|
||||
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
|
||||
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->initAsSpecimenCommon();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1364,7 +1364,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print '>';
|
||||
print '<table class="centpercent cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
|
||||
print 'background: #'.$color.';';
|
||||
print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($color, 0).'), to(#'.dol_color_minus($color, 1).'));';
|
||||
print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($color, -4).'), to(#'.dol_color_minus($color, -3).'));';
|
||||
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
|
||||
//print ' -moz-border-radius:4px;"';
|
||||
@ -1572,7 +1572,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
* Change color with a delta
|
||||
*
|
||||
* @param string $color Color
|
||||
* @param int $minus Delta (1 = 16 unit)
|
||||
* @param int $minus Delta (1 = 16 unit). Positive value = darker color, Negative value = brighter color.
|
||||
* @param int $minusunit Minus unit
|
||||
* @return string New color
|
||||
*/
|
||||
|
||||
@ -3357,11 +3357,11 @@ class Propal extends CommonObject
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto)
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), $this->picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2)
|
||||
$result.=' ';
|
||||
$result.=$linkstart.$this->ref.$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1906,6 +1906,40 @@ class Commande extends CommonOrder
|
||||
return $nb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count numbe rof shipments for this order
|
||||
*
|
||||
* @return int <0 if KO, Nb of shipment found if OK
|
||||
*/
|
||||
function getNbOfShipments()
|
||||
{
|
||||
$nb = 0;
|
||||
|
||||
$sql = 'SELECT COUNT(DISTINCT ed.fk_expedition) as nb';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expeditiondet as ed,';
|
||||
$sql.= ' '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||
$sql.= ' WHERE';
|
||||
$sql.= ' ed.fk_origin_line = cd.rowid';
|
||||
$sql.= ' AND cd.fk_commande =' .$this->id;
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this)."::getNbOfShipments", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $nb = $obj->nb;
|
||||
|
||||
$this->db->free($resql);
|
||||
return $nb;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
||||
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
|
||||
@ -1932,18 +1966,18 @@ class Commande extends CommonOrder
|
||||
//print $sql;
|
||||
|
||||
dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->expeditions[$obj->rowid] = $obj->qty;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free();
|
||||
$this->db->free($resql);
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
@ -1951,7 +1985,6 @@ class Commande extends CommonOrder
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2002,18 +2035,18 @@ class Commande extends CommonOrder
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
|
||||
$sql.= " WHERE ps.fk_product IN (".join(',',$array_of_product).")";
|
||||
$sql.= ' GROUP BY fk_product ';
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->stocks[$obj->fk_product] = $obj->total;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free();
|
||||
$this->db->free($resql);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -3368,7 +3401,6 @@ class Commande extends CommonOrder
|
||||
|
||||
if ($short) return $url;
|
||||
|
||||
$picto = 'order';
|
||||
$label = '';
|
||||
|
||||
if ($user->rights->commande->lire) {
|
||||
@ -3402,9 +3434,11 @@ class Commande extends CommonOrder
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$linkstart.$this->ref.$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1324,11 +1324,14 @@ class Account extends CommonObject
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$link = '<a href="'.$url.$linkclose;
|
||||
$linkend='</a>';
|
||||
$linkstart = '<a href="'.$url.$linkclose;
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '');
|
||||
$result .= $linkend;
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -710,9 +710,9 @@ class Invoices extends DolibarrApi
|
||||
* @throws 405
|
||||
*/
|
||||
function useCreditNote($id, $discountid) {
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
@ -745,7 +745,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
*
|
||||
* @url GET {id}/getpayments
|
||||
* @url GET {id}/payments
|
||||
*
|
||||
* @return array
|
||||
* @throws 400
|
||||
@ -775,10 +775,124 @@ class Invoices extends DolibarrApi
|
||||
if( $result < 0) {
|
||||
throw new RestException(405, $this->invoice->error);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add payment line to a specific invoice
|
||||
*
|
||||
* The model schema is defined by the PaymentData class.
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
* @param string $datepaye {@from body} Payment date {@type timestamp}
|
||||
* @param int $paiementid {@from body} Payment mode Id {@min 1}
|
||||
* @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no}
|
||||
* @param int $accountid {@from body} Account Id {@min 1}
|
||||
* @param string $num_paiement {@from body} Payment number (optional)
|
||||
* @param string $comment {@from body} Note (optional)
|
||||
* @param string $chqemetteur {@from body} Payment issuer (mandatory if paiementcode = 'CHQ')
|
||||
* @param string $chqbank {@from body} Issuer bank name (optional)
|
||||
*
|
||||
* @url POST {id}/payments
|
||||
*
|
||||
* @return int Payment ID
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') {
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($id)) {
|
||||
throw new RestException(400, 'Invoice ID is mandatory');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $payment_data;
|
||||
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
if(empty($accountid)) {
|
||||
throw new RestException(400, 'Account ID is mandatory');
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($paiementid)) {
|
||||
throw new RestException(400, 'Paiement ID or Paiement Code is mandatory');
|
||||
}
|
||||
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
// Calculate amount to pay
|
||||
$totalpaye = $this->invoice->getSommePaiement();
|
||||
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
|
||||
$totaldeposits = $this->invoice->getSumDepositsUsed();
|
||||
$resteapayer = price2num($this->invoice->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
$this->db->begin();
|
||||
// Clean parameters amount if payment is for a credit note
|
||||
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$resteapayer = price2num($resteapayer,'MT');
|
||||
$amounts[$id] = -$resteapayer;
|
||||
// Multicurrency
|
||||
$newvalue = price2num($this->invoice->multicurrency_total_ttc,'MT');
|
||||
$multicurrency_amounts[$id] = -$newvalue;
|
||||
} else {
|
||||
$resteapayer = price2num($resteapayer,'MT');
|
||||
$amounts[$id] = $resteapayer;
|
||||
// Multicurrency
|
||||
$newvalue = price2num($this->invoice->multicurrency_total_ttc,'MT');
|
||||
$multicurrency_amounts[$id] = $newvalue;
|
||||
}
|
||||
|
||||
|
||||
// Creation of payment line
|
||||
$paiement = new Paiement($this->db);
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||
$paiement->paiementid = $paiementid;
|
||||
$paiement->paiementcode = dol_getIdFromCode($this->db,$paiementid,'c_paiement','id','code',1);
|
||||
$paiement->num_paiement = $num_paiement;
|
||||
$paiement->note = $comment;
|
||||
|
||||
$paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices=='yes'?1:0)); // This include closing invoices
|
||||
if ($paiement_id < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
throw new RestException(400, 'Payment error : '.$paiement->error);
|
||||
}
|
||||
|
||||
if (! empty($conf->banque->enabled)) {
|
||||
$label='(CustomerInvoicePayment)';
|
||||
|
||||
if($paiement->paiementcode == 'CHQ' && empty($chqemetteur)) {
|
||||
throw new RestException(400, 'Emetteur is mandatory when payment code is '.$paiement->paiementcode);
|
||||
}
|
||||
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) $label='(CustomerInvoicePaymentBack)'; // Refund of a credit note
|
||||
$result=$paiement->addPaymentToBank(DolibarrApiAccess::$user,'payment',$label,$accountid,$chqemetteur,$chqbank);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
throw new RestException(400, 'Add payment to bank error : '.$paiement->error);
|
||||
}
|
||||
}
|
||||
$this->db->commit();
|
||||
return $paiement_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
|
||||
@ -79,6 +79,8 @@ class Facture extends CommonInvoice
|
||||
public $remise_percent;
|
||||
public $total_ht=0;
|
||||
public $total_tva=0;
|
||||
public $total_localtax1=0;
|
||||
public $total_localtax2=0;
|
||||
public $total_ttc=0;
|
||||
public $revenuestamp;
|
||||
|
||||
@ -977,6 +979,8 @@ class Facture extends CommonInvoice
|
||||
$line->subprice = $object->lines[$i]->subprice;
|
||||
$line->total_ht = $object->lines[$i]->total_ht;
|
||||
$line->total_tva = $object->lines[$i]->total_tva;
|
||||
$line->total_localtax1 = $object->lines[$i]->total_localtax1;
|
||||
$line->total_localtax2 = $object->lines[$i]->total_localtax2;
|
||||
$line->total_ttc = $object->lines[$i]->total_ttc;
|
||||
$line->vat_src_code = $object->lines[$i]->vat_src_code;
|
||||
$line->tva_tx = $object->lines[$i]->tva_tx;
|
||||
@ -1128,6 +1132,10 @@ class Facture extends CommonInvoice
|
||||
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
$label.= '<br><b>' . $langs->trans('LT1') . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
$label.= '<br><b>' . $langs->trans('LT2') . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_ttc))
|
||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
|
||||
@ -1153,9 +1161,10 @@ class Facture extends CommonInvoice
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($max?dol_trunc($this->ref,$max):$this->ref);
|
||||
$result .= $linkend;
|
||||
|
||||
if ($addlinktonotes)
|
||||
{
|
||||
|
||||
@ -138,7 +138,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ class Contact extends CommonObject
|
||||
public $element='contact';
|
||||
public $table_element='socpeople';
|
||||
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
public $picto = 'contact';
|
||||
|
||||
public $civility_id; // In fact we store civility_code
|
||||
public $civility_code;
|
||||
@ -1053,8 +1054,12 @@ class Contact extends CommonObject
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$linkstart.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
|
||||
|
||||
$result.=$linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.=($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs));
|
||||
$result.=$linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -326,7 +326,6 @@ if (empty($reshook))
|
||||
{
|
||||
$label = $lines[$i]->product_label;
|
||||
}
|
||||
|
||||
$desc = ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1878,7 +1878,6 @@ class Contrat extends CommonObject
|
||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
||||
//}
|
||||
|
||||
$picto = 'contract';
|
||||
$label = '';
|
||||
|
||||
if ($user->rights->contrat->lire) {
|
||||
@ -1913,9 +1912,11 @@ class Contrat extends CommonObject
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$linkstart.$this->ref.$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2089,10 +2090,10 @@ class Contrat extends CommonObject
|
||||
if ($mode == 'inactives') {
|
||||
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
|
||||
$label = $langs->trans("BoardNotActivatedServices");
|
||||
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
} else {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$label = $langs->trans("BoardRunningServices");
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ foreach($listofstatus as $status)
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
@ -210,7 +210,7 @@ foreach($listofstatus as $status)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
else $bool=false;
|
||||
print "</tr>\n";
|
||||
@ -468,7 +468,7 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
@ -548,7 +548,7 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
|
||||
@ -137,7 +137,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contrat/services.php
|
||||
* \file htdocs/contrat/services_list.php
|
||||
* \ingroup contrat
|
||||
* \brief Page to list services in contracts
|
||||
*/
|
||||
@ -134,7 +134,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("contrat/services.php", LOG_DEBUG);
|
||||
dol_syslog("contrat/services_list.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -160,6 +160,10 @@ if ($action == 'add')
|
||||
}
|
||||
}
|
||||
|
||||
// Visibility: -1=not visible by default in list, 1=visible, 0=hidden
|
||||
$visibility = GETPOST('list', 'alpha');
|
||||
if ($type == 'separate') $visibility=3;
|
||||
|
||||
$result=$extrafields->addExtraField(
|
||||
GETPOST('attrname', 'alpha'),
|
||||
GETPOST('label', 'alpha'),
|
||||
@ -173,7 +177,7 @@ if ($action == 'add')
|
||||
$params,
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
|
||||
$visibility,
|
||||
0,
|
||||
GETPOST('computed_value','alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
@ -323,6 +327,10 @@ if ($action == 'update')
|
||||
}
|
||||
}
|
||||
|
||||
// Visibility: -1=not visible by default in list, 1=visible, 0=hidden
|
||||
$visibility = GETPOST('list', 'alpha');
|
||||
if ($type == 'separate') $visibility=3;
|
||||
|
||||
$result=$extrafields->update(
|
||||
GETPOST('attrname', 'alpha'),
|
||||
GETPOST('label', 'alpha'),
|
||||
@ -335,7 +343,7 @@ if ($action == 'update')
|
||||
$params,
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
|
||||
$visibility,
|
||||
0,
|
||||
GETPOST('default_value','alpha'),
|
||||
GETPOST('computed_value','alpha'),
|
||||
|
||||
@ -567,7 +567,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$input_files.=' '.escapeshellarg($f);
|
||||
}
|
||||
|
||||
$cmd = 'pdftk '.$input_files.' cat output '.escapeshellarg($file);
|
||||
$cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file);
|
||||
exec($cmd);
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
|
||||
@ -89,9 +89,7 @@ else // For no ajax call
|
||||
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
|
||||
|
||||
// Load traductions files
|
||||
$langs->load("ecm");
|
||||
$langs->load("companies");
|
||||
$langs->load("other");
|
||||
$langs->loadLangs(array("ecm","companies","other"));
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -75,7 +75,7 @@ class box_ficheinter extends ModeleBoxes
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastFicheInter",$max));
|
||||
|
||||
if ($user->rights->ficheinter->lire)
|
||||
if (! empty($user->rights->ficheinter->lire))
|
||||
{
|
||||
$sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut,";
|
||||
$sql.= " f.datec,";
|
||||
|
||||
@ -340,16 +340,6 @@ abstract class CommonObject
|
||||
|
||||
// No constructor as it is an abstract class
|
||||
|
||||
/**
|
||||
* Return if an object manage the multicompany field and how.
|
||||
*
|
||||
* @return int 0=No entity field managed, 1=Test with field entity, 2=Test with link to thirdparty (and sales representative)
|
||||
*/
|
||||
function getIsmultientitymanaged()
|
||||
{
|
||||
return $this->ismultientitymanaged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check an object id/ref exists
|
||||
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
|
||||
@ -553,6 +543,90 @@ abstract class CommonObject
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the link of last main doc file for direct public download.
|
||||
*
|
||||
* @param string $modulepart Module related to document
|
||||
* @param int $initsharekey Init the share key if it was not yet defined
|
||||
* @return string Link or empty string if there is no download link
|
||||
*/
|
||||
function getLastMainDocLink($modulepart, $initsharekey=0)
|
||||
{
|
||||
global $user, $dolibarr_main_url_root;
|
||||
|
||||
if (empty($this->last_main_doc))
|
||||
{
|
||||
return ''; // No known last doc
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', $this->last_main_doc);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error = $ecmfile->error;
|
||||
$this->errors = $ecmfile->errors;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (empty($ecmfile->id))
|
||||
{
|
||||
// Add entry into index
|
||||
if ($initsharekey)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
// TODO We can't, we dont' have full path of file, only last_main_doc adn ->element, so we must rebuild full path first
|
||||
/*
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
$ecmfile->fullpath_orig = '';
|
||||
$ecmfile->gen_or_uploaded = 'generated';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$ecmfile->share = getRandomPassword(true);
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error = $ecmfile->error;
|
||||
$this->errors = $ecmfile->errors;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else return '';
|
||||
}
|
||||
elseif (empty($ecmfile->share))
|
||||
{
|
||||
// Add entry into index
|
||||
if ($initsharekey)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$ecmfile->share = getRandomPassword(true);
|
||||
$ecmfile->update($user);
|
||||
}
|
||||
else return '';
|
||||
}
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$forcedownload=1;
|
||||
$rellink='/document.php?modulepart='.$modulepart;
|
||||
if ($forcedownload) $rellink.='&attachment=1';
|
||||
if (! empty($ecmfile->entity)) $rellink.='&entity='.$ecmfile->entity;
|
||||
//$rellink.='&file='.urlencode($filepath); // No need of name of file for public link, we will use the hash
|
||||
$fulllink=$urlwithroot.$rellink;
|
||||
//if (! empty($object->ref)) $fulllink.='&hashn='.$object->ref; // Hash of file path
|
||||
//elseif (! empty($object->label)) $fulllink.='&hashc='.$object->label; // Hash of file content
|
||||
if (! empty($ecmfile->share)) $fulllink.='&hashp='.$ecmfile->share; // Hash for public share
|
||||
|
||||
// Here $ecmfile->share is defined
|
||||
return $fulllink;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a link between element $this->element and a contact
|
||||
*
|
||||
@ -3628,8 +3702,7 @@ abstract class CommonObject
|
||||
if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
|
||||
{
|
||||
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
|
||||
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"';
|
||||
else $placeholder=' title="'.$langs->trans("Label").'"';
|
||||
$placeholder=' placeholder="'.$langs->trans("Label").'"';
|
||||
|
||||
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
|
||||
|
||||
@ -4091,7 +4164,12 @@ abstract class CommonObject
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
||||
|
||||
if (! empty($conf->global->PROPOSAL_USE_ONLINE_SIGN))
|
||||
// Set the public "share" key
|
||||
$setsharekey = false;
|
||||
if ($this->element == 'propal' && ! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
if ($this->element == 'commande' && ! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
if ($this->element == 'facture' && ! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD)) $setsharekey=true;
|
||||
if ($setsharekey)
|
||||
{
|
||||
if (empty($ecmfile->share)) // Because object not found or share not set yet
|
||||
{
|
||||
@ -4115,6 +4193,7 @@ abstract class CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$ecmfile->entity = $conf->entity;
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||
|
||||
@ -1010,8 +1010,7 @@ class Form
|
||||
$out.='<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
||||
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
|
||||
else if ($hidelabel > 1) {
|
||||
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
|
||||
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
|
||||
$placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
|
||||
if ($hidelabel == 2) {
|
||||
$out.= img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
@ -1818,8 +1817,7 @@ class Form
|
||||
}
|
||||
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
|
||||
else if ($hidelabel > 1) {
|
||||
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
|
||||
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
|
||||
$placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
|
||||
if ($hidelabel == 2) {
|
||||
print img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
@ -2566,6 +2564,8 @@ class Form
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
$out.=ajax_combobox($htmlname);
|
||||
|
||||
if (empty($outputmode)) return $out;
|
||||
return $outarray;
|
||||
}
|
||||
@ -5642,9 +5642,9 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
* Show a multiselect form from an array.
|
||||
* Show a multiselect dropbox from an array.
|
||||
*
|
||||
* @param string $htmlname Name of select
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
|
||||
* @param string $varpage Id of context for page. Can be set by caller with $varpage=(empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage);
|
||||
* @return string HTML multiselect string
|
||||
|
||||
@ -249,16 +249,16 @@ class FormActions
|
||||
print $action->type;
|
||||
print '</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td align="center">'.dol_print_date($action->datep,'dayhour');
|
||||
print '<td align="center">'.dol_print_date($action->datep, 'dayhour', 'tzuserrel');
|
||||
if ($action->datef)
|
||||
{
|
||||
$tmpa=dol_getdate($action->datep);
|
||||
$tmpb=dol_getdate($action->datef);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year'])
|
||||
{
|
||||
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($action->datef,'hour');
|
||||
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($action->datef, 'hour', 'tzuserrel');
|
||||
}
|
||||
else print '-'.dol_print_date($action->datef,'dayhour');
|
||||
else print '-'.dol_print_date($action->datef, 'dayhour', 'tzuserrel');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
|
||||
@ -517,22 +517,31 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
|
||||
if (preg_match('/[^0-9,]+/i',$out)) $out='';
|
||||
break;
|
||||
case 'alpha':
|
||||
$out=trim($out);
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
if (preg_match('/"/',$out)) $out='';
|
||||
else if (preg_match('/\.\.\//',$out)) $out='';
|
||||
if (! is_array($out))
|
||||
{
|
||||
$out=trim($out);
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
if (preg_match('/"/',$out)) $out='';
|
||||
else if (preg_match('/\.\.\//',$out)) $out='';
|
||||
}
|
||||
break;
|
||||
case 'san_alpha':
|
||||
$out=filter_var($out,FILTER_SANITIZE_STRING);
|
||||
break;
|
||||
case 'aZ':
|
||||
$out=trim($out);
|
||||
if (preg_match('/[^a-z]+/i',$out)) $out='';
|
||||
if (! is_array($out))
|
||||
{
|
||||
$out=trim($out);
|
||||
if (preg_match('/[^a-z]+/i',$out)) $out='';
|
||||
}
|
||||
break;
|
||||
case 'aZ09':
|
||||
$out=trim($out);
|
||||
if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
|
||||
if (! is_array($out))
|
||||
{
|
||||
$out=trim($out);
|
||||
if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
|
||||
}
|
||||
break;
|
||||
case 'array':
|
||||
if (! is_array($out) || empty($out)) $out=array();
|
||||
@ -541,12 +550,15 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
|
||||
$out=dol_string_nohtmltag($out);
|
||||
break;
|
||||
case 'alphanohtml': // Recommended for search params
|
||||
$out=trim($out);
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
if (preg_match('/"/',$out)) $out='';
|
||||
else if (preg_match('/\.\.\//',$out)) $out='';
|
||||
$out=dol_string_nohtmltag($out);
|
||||
if (! is_array($out))
|
||||
{
|
||||
$out=trim($out);
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
// '../' is dangerous because it allows dir transversals
|
||||
if (preg_match('/"/',$out)) $out='';
|
||||
else if (preg_match('/\.\.\//',$out)) $out='';
|
||||
$out=dol_string_nohtmltag($out);
|
||||
}
|
||||
break;
|
||||
case 'custom':
|
||||
if (empty($filter)) return 'BadFourthParameterForGETPOST';
|
||||
@ -927,10 +939,10 @@ function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
|
||||
function dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
|
||||
{
|
||||
// escape quotes and backslashes, newlines, etc.
|
||||
$tmp=html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html form content
|
||||
$tmp=html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags
|
||||
if (! $keepb) $tmp=strtr($tmp, array("<b>"=>'','</b>'=>''));
|
||||
if (! $keepn) $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n'));
|
||||
return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html form content
|
||||
return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags
|
||||
}
|
||||
|
||||
|
||||
@ -1610,7 +1622,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false)
|
||||
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
|
||||
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
|
||||
* false or 'tzserver' => output string is for local PHP server TZ usage
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst)
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
|
||||
* 'tzuserrel' => output string is for user TZ (current browser TZ with dst or not, depending on date position) (TODO not implemented yet)
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param boolean $encodetooutput false=no convert into output pagecode
|
||||
@ -1641,8 +1653,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
{
|
||||
$to_gmt=true;
|
||||
$offsettzstring=(empty($_SESSION['dol_tz_string'])?'UTC':$_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
|
||||
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
|
||||
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60;
|
||||
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60; // Will not be used anymore
|
||||
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60; // Will not be used anymore
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1699,8 +1711,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$time,$reg)
|
||||
|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i',$time,$reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
{
|
||||
// This part of code should not be used. TODO Remove this.
|
||||
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
// TODO Remove this.
|
||||
// This part of code should not be used.
|
||||
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR);
|
||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
|
||||
$syear = (! empty($reg[1]) ? $reg[1] : '');
|
||||
$smonth = (! empty($reg[2]) ? $reg[2] : '');
|
||||
@ -1710,22 +1723,26 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
||||
|
||||
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true);
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Date is a timestamps
|
||||
if ($time < 100000000000) // Protection against bad date values
|
||||
{
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$ret=adodb_strftime($format, $timetouse, $to_gmt);
|
||||
}
|
||||
else $ret='Bad value '.$time.' for date';
|
||||
}
|
||||
|
||||
if (preg_match('/__b__/i',$format))
|
||||
{
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||
$month=adodb_strftime('%m', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$month=adodb_strftime('%m', $timetouse);
|
||||
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||
if ($encodetooutput)
|
||||
{
|
||||
@ -1745,7 +1762,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
}
|
||||
if (preg_match('/__a__/i',$format))
|
||||
{
|
||||
$w=adodb_strftime('%w', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$w=adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w);
|
||||
$ret=str_replace('__A__',$dayweek,$ret);
|
||||
$ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret);
|
||||
@ -2714,19 +2733,17 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($picto == 'switch_off')
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
{
|
||||
$fakey = $picto; $facolor=''; $fasize='';
|
||||
if ($picto == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; }
|
||||
if ($picto == 'switch_on') { $fakey = 'fa-toggle-on'; $facolor='#227722'; $fasize='2em'; }
|
||||
if ($picto == 'off') { $fakey = 'fa-square-o'; $fasize='1.3em'; }
|
||||
if ($picto == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; }
|
||||
$enabledisablehtml='';
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation");
|
||||
$enabledisablehtml.='</span>';
|
||||
return $enabledisablehtml;
|
||||
}
|
||||
if ($picto == 'switch_on')
|
||||
{
|
||||
$enabledisablehtml='';
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation");
|
||||
$enabledisablehtml.='<span class="fa '.$fakey.' valignmiddle" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$titlealt;
|
||||
$enabledisablehtml.='</span>';
|
||||
return $enabledisablehtml;
|
||||
}
|
||||
@ -4947,7 +4964,7 @@ function picto_required()
|
||||
*/
|
||||
function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
{
|
||||
// TODO Try to replace with strip_tags($stringtoclean)
|
||||
// TODO Try to replace with strip_tags($stringtoclean)
|
||||
$pattern = "/<[^<>]+>/";
|
||||
$stringtoclean = preg_replace('/<br[^>]*>/', "\n", $stringtoclean);
|
||||
$temp = dol_html_entity_decode($stringtoclean,ENT_COMPAT,$pagecodeto);
|
||||
@ -5465,6 +5482,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:'';
|
||||
$substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object)?$object->total_ht:'';
|
||||
$substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
|
||||
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object)?($object->total_localtax1?$object->total_localtax1:$object->total_localtax1):'';
|
||||
if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3__'] = is_object($object)?($object->total_localtax2?$object->total_localtax2:$object->total_localtax2):'';
|
||||
|
||||
/* TODO Add key for multicurrency
|
||||
$substitutionarray['__AMOUNT_FORMATED__'] = is_object($object)?price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency_code):'';
|
||||
$substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object)?price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code):'';
|
||||
|
||||
@ -132,9 +132,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; // addslashes is escape for PHP
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>'".$val['help']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; // addslashes is escape for PHP
|
||||
if ($val['arrayofkeyval'])
|
||||
{
|
||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||
@ -215,8 +215,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
$pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php';
|
||||
|
||||
// Edit .sql file
|
||||
$pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($objectname).'.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
|
||||
$pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
|
||||
if (! dol_is_file($pathoffiletoeditsrc))
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -287,8 +287,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
}
|
||||
|
||||
// Edit .key.sql file
|
||||
$pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
|
||||
$pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
|
||||
|
||||
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
|
||||
|
||||
@ -301,7 +301,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
$i++;
|
||||
if ($val['index'])
|
||||
{
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($objectname)." ADD INDEX idx_".strtolower($objectname)."_".$key." (".$key.");";
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
|
||||
$texttoinsert.= "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,10 +61,13 @@ function commande_prepare_head(Commande $object)
|
||||
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|
||||
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
|
||||
{
|
||||
$nbShipments=$object->getNbOfShipments(); $nbReceiption=0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id;
|
||||
if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipments");
|
||||
if ($nbShipments > 0) $text.= ' <span class="badge">'.$nbShipments.'</span>';
|
||||
if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
|
||||
if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings");
|
||||
if ($nbReceiption > 0) $text.= ' <span class="badge">'.$nbReceiption.'</span>';
|
||||
$head[$h][1] = $text;
|
||||
$head[$h][2] = 'shipping';
|
||||
$h++;
|
||||
|
||||
@ -590,16 +590,17 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
|
||||
|
||||
|
||||
/**
|
||||
* Return array of possible substitutions for PDF content (without external module substitutions).
|
||||
* Return array of possible substitutions for PDF content (without external module substitutions).
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
||||
* @param Object $object Object
|
||||
* @return array Array of substitutions
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
||||
* @param Object $object Object
|
||||
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip)
|
||||
* @return array Array of substitutions
|
||||
*/
|
||||
function pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null)
|
||||
function pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykeys=0)
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $exclude, $object);
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, $onlykeys, $exclude, $object);
|
||||
$substitutionarray['__FROM_NAME__']='__FROM_NAME__';
|
||||
$substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__';
|
||||
return $substitutionarray;
|
||||
@ -1822,7 +1823,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
|
||||
{
|
||||
if (empty($hookmanager)) global $hookmanager;
|
||||
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
|
||||
@ -589,9 +589,10 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||
* @param int $preselectedday Preselected day
|
||||
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
|
||||
* @param int $oldprojectforbreak Old project id of last project break
|
||||
* @return $inc
|
||||
*/
|
||||
function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable)
|
||||
function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0)
|
||||
{
|
||||
global $conf, $db, $user, $bc, $langs;
|
||||
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
|
||||
@ -611,7 +612,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
}
|
||||
}
|
||||
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break
|
||||
if (empty($oldprojectforbreak))
|
||||
{
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break
|
||||
}
|
||||
|
||||
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
@ -818,8 +822,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$level++;
|
||||
if ($lines[$i]->id > 0)
|
||||
{
|
||||
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable);
|
||||
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable);
|
||||
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak);
|
||||
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak);
|
||||
}
|
||||
$level--;
|
||||
}
|
||||
@ -847,9 +851,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
* @param string $mine Show only task lines I am assigned to
|
||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
|
||||
* @param int $oldprojectforbreak Old project id of last project break
|
||||
* @return $inc
|
||||
*/
|
||||
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable)
|
||||
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0)
|
||||
{
|
||||
global $conf, $db, $user, $bc, $langs;
|
||||
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
|
||||
@ -871,7 +876,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
|
||||
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
||||
if (empty($oldprojectforbreak))
|
||||
{
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
||||
}
|
||||
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
@ -1065,8 +1073,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$level++;
|
||||
if ($lines[$i]->id > 0)
|
||||
{
|
||||
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable);
|
||||
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable);
|
||||
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak);
|
||||
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak);
|
||||
}
|
||||
$level--;
|
||||
}
|
||||
|
||||
@ -294,6 +294,8 @@ function exportWebSite($website)
|
||||
*/
|
||||
function importWebSite($pathtofile)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$result = 0;
|
||||
|
||||
$filename = basename($pathtofile);
|
||||
|
||||
@ -154,11 +154,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/list.php?leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
|
||||
-- Commercial - Interventions
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
|
||||
|
||||
@ -182,7 +182,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='accountancy';
|
||||
|
||||
$menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("Accountancy"), 0, $showmode, $atarget, "accountancy", '', 52, $id, $idsel, $classname);
|
||||
$menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuAccountancy"), 0, $showmode, $atarget, "accountancy", '', 52, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
|
||||
@ -768,11 +768,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000);
|
||||
$newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer);
|
||||
$newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire);
|
||||
$newmenu->add("/contrat/services.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
|
||||
$newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
|
||||
}
|
||||
|
||||
// Interventions
|
||||
|
||||
@ -553,10 +553,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($langs->trans("Module".$this->numero."Name") != ("Module".$this->numero."Name"))
|
||||
if ($langs->transnoentitiesnoconv("Module".$this->numero."Name") != ("Module".$this->numero."Name"))
|
||||
{
|
||||
// If module name translation exists
|
||||
return $langs->trans("Module".$this->numero."Name");
|
||||
return $langs->transnoentitiesnoconv("Module".$this->numero."Name");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -572,11 +572,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if ($langs->trans("Module".$this->name."Name") != ("Module".$this->name."Name"))
|
||||
{
|
||||
// If module name translation exists
|
||||
return $langs->trans("Module".$this->name."Name");
|
||||
return $langs->transnoentitiesnoconv("Module".$this->name."Name");
|
||||
}
|
||||
|
||||
// Last chance with simple label
|
||||
return $langs->trans($this->name);
|
||||
return $langs->transnoentitiesnoconv($this->name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,10 +591,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($langs->trans("Module".$this->numero."Desc") != ("Module".$this->numero."Desc"))
|
||||
if ($langs->transnoentitiesnoconv("Module".$this->numero."Desc") != ("Module".$this->numero."Desc"))
|
||||
{
|
||||
// If module description translation exists
|
||||
return $langs->trans("Module".$this->numero."Desc");
|
||||
return $langs->transnoentitiesnoconv("Module".$this->numero."Desc");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -607,7 +607,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
}
|
||||
}
|
||||
|
||||
if ($langs->trans("Module".$this->name."Desc") != ("Module".$this->name."Desc"))
|
||||
if ($langs->transnoentitiesnoconv("Module".$this->name."Desc") != ("Module".$this->name."Desc"))
|
||||
{
|
||||
// If module name translation exists
|
||||
return $langs->trans("Module".$this->name."Desc");
|
||||
@ -665,7 +665,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
}
|
||||
}
|
||||
|
||||
$content = $langs->trans($this->descriptionlong);
|
||||
$content = $langs->transnoentitiesnoconv($this->descriptionlong);
|
||||
}
|
||||
}
|
||||
|
||||
@ -797,13 +797,13 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$ret='';
|
||||
|
||||
$newversion=preg_replace('/_deprecated/','',$this->version);
|
||||
if ($newversion == 'experimental') $ret=($translated?$langs->trans("VersionExperimental"):$newversion);
|
||||
elseif ($newversion == 'development') $ret=($translated?$langs->trans("VersionDevelopment"):$newversion);
|
||||
if ($newversion == 'experimental') $ret=($translated?$langs->transnoentitiesnoconv("VersionExperimental"):$newversion);
|
||||
elseif ($newversion == 'development') $ret=($translated?$langs->transnoentitiesnoconv("VersionDevelopment"):$newversion);
|
||||
elseif ($newversion == 'dolibarr') $ret=DOL_VERSION;
|
||||
elseif ($newversion) $ret=$newversion;
|
||||
else $ret=($translated?$langs->trans("VersionUnknown"):'unknown');
|
||||
else $ret=($translated?$langs->transnoentitiesnoconv("VersionUnknown"):'unknown');
|
||||
|
||||
if (preg_match('/_deprecated/',$this->version)) $ret.=($translated?' ('.$langs->trans("Deprecated").')':$this->version);
|
||||
if (preg_match('/_deprecated/',$this->version)) $ret.=($translated?' ('.$langs->transnoentitiesnoconv("Deprecated").')':$this->version);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -874,12 +874,12 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if ($langs->trans($langstring) == $langstring)
|
||||
{
|
||||
// Translation not found
|
||||
return $langs->trans($this->import_label[$r]);
|
||||
return $langs->transnoentitiesnoconv($this->import_label[$r]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Translation found
|
||||
return $langs->trans($langstring);
|
||||
return $langs->transnoentitiesnoconv($langstring);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -77,9 +77,6 @@ if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
|
||||
}
|
||||
else
|
||||
{
|
||||
$conf->global->MAIN_HTML5_PLACEHOLDER = 1;
|
||||
|
||||
|
||||
$usedbyinclude = 1; // Used into next include
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
|
||||
|
||||
|
||||
@ -35,9 +35,10 @@ $langs->load("modulebuilder");
|
||||
jQuery(document).ready(function() {
|
||||
function init_typeoffields(type)
|
||||
{
|
||||
console.log("selected type is "+type);
|
||||
var size = jQuery("#size");
|
||||
console.log("We select a new type = "+type);
|
||||
var size = jQuery("#size");
|
||||
var computed_value = jQuery("#computed_value");
|
||||
var langfile = jQuery("#langfile");
|
||||
var default_value = jQuery("#default_value");
|
||||
var unique = jQuery("#unique");
|
||||
var required = jQuery("#required");
|
||||
@ -51,7 +52,7 @@ $langs->load("modulebuilder");
|
||||
|
||||
if (GETPOST('type','alpha') == "separate")
|
||||
{
|
||||
print "jQuery('#size, #default_value').val('').prop('disabled', true);";
|
||||
print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);";
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
?>
|
||||
@ -93,7 +94,7 @@ $langs->load("modulebuilder");
|
||||
else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
|
||||
else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
||||
else if (type == 'separate') {
|
||||
size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
langfile.val('').prop('disabled',true);size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();
|
||||
}
|
||||
else { // type = string
|
||||
@ -104,12 +105,13 @@ $langs->load("modulebuilder");
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);
|
||||
jQuery('#list').val(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
default_value.removeAttr('disabled');
|
||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||
langfile.removeAttr('disabled');required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
init_typeoffields('<?php echo GETPOST('type','alpha'); ?>');
|
||||
@ -162,7 +164,7 @@ $langs->load("modulebuilder");
|
||||
<!-- Position -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOST('pos','int'); ?>"></td></tr>
|
||||
<!-- Language file -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" id="langfile" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
|
||||
<!-- Computed Value -->
|
||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('computed_value','none')?GETPOST('computed_value','none'):''); ?>"></td></tr>
|
||||
<!-- Default Value (at sql setup level) -->
|
||||
|
||||
@ -37,6 +37,7 @@ $langs->load("modulebuilder");
|
||||
console.log("select new type "+type);
|
||||
var size = jQuery("#size");
|
||||
var computed_value = jQuery("#computed_value");
|
||||
var langfile = jQuery("#langfile");
|
||||
var default_value = jQuery("#default_value");
|
||||
var unique = jQuery("#unique");
|
||||
var required = jQuery("#required");
|
||||
@ -50,7 +51,7 @@ $langs->load("modulebuilder");
|
||||
|
||||
if (GETPOST('type','alpha') == "separate")
|
||||
{
|
||||
print "jQuery('#size, #default_value').val('').prop('disabled', true);";
|
||||
print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);";
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
?>
|
||||
@ -99,7 +100,8 @@ $langs->load("modulebuilder");
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);
|
||||
jQuery('#list').val(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -83,7 +83,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
$b=new BlockedLog($this->db);
|
||||
$b->action = $action;
|
||||
$b->amounts= $amounts;
|
||||
$b->setObjectData($object); // Set field ref_object, fk_object, element, object_data
|
||||
$b->setObjectData($object); // Set field date_object, ref_object, fk_object, element, object_data
|
||||
|
||||
$res = $b->create($user);
|
||||
|
||||
|
||||
@ -1051,61 +1051,17 @@ class Cronjob extends CommonObject
|
||||
// Run a command line
|
||||
if ($this->jobtype=='command')
|
||||
{
|
||||
$command=escapeshellcmd($this->command);
|
||||
$command.=" 2>&1";
|
||||
dol_mkdir($conf->cronjob->dir_temp);
|
||||
$outputfile=$conf->cronjob->dir_temp.'/cronjob.'.$userlogin.'.out';
|
||||
$outputdir = $conf->cron->dir_temp;
|
||||
if (empty($outputdir)) $outputdir = $conf->cronjob->dir_temp;
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs system:".$command, LOG_DEBUG);
|
||||
$output_arr=array();
|
||||
|
||||
$execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2
|
||||
if ($execmethod == 1)
|
||||
if (! empty($outputdir))
|
||||
{
|
||||
exec($command, $output_arr, $retval);
|
||||
if ($retval != 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
dol_syslog(get_class($this)."::run_jobs retval=".$retval, LOG_ERR);
|
||||
$this->error = 'Error '.$retval;
|
||||
$this->lastoutput = ''; // Will be filled later
|
||||
$this->lastresult = $retval;
|
||||
$retval = $this->lastresult;
|
||||
$error++;
|
||||
}
|
||||
dol_mkdir($outputdir);
|
||||
$outputfile=$outputdir.'/cronjob.'.$userlogin.'.out'; // File used with popen method
|
||||
|
||||
// Execute a CLI
|
||||
$retval = $this->executeCLI($this->command, $outputfile);
|
||||
}
|
||||
if ($execmethod == 2)
|
||||
{
|
||||
$ok=0;
|
||||
$handle = fopen($outputfile, 'w');
|
||||
if ($handle)
|
||||
{
|
||||
dol_syslog("Run command ".$command);
|
||||
$handlein = popen($command, 'r');
|
||||
while (!feof($handlein))
|
||||
{
|
||||
$read = fgets($handlein);
|
||||
fwrite($handle,$read);
|
||||
$output_arr[]=$read;
|
||||
}
|
||||
pclose($handlein);
|
||||
fclose($handle);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
|
||||
// Update with result
|
||||
if (is_array($output_arr) && count($output_arr)>0)
|
||||
{
|
||||
foreach($output_arr as $val)
|
||||
{
|
||||
$this->lastoutput.=$val."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$this->lastresult=$retval;
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs now we update job to track it is finished (with success or error)");
|
||||
@ -1125,6 +1081,83 @@ class Cronjob extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execute a CLI command.
|
||||
* this->error, this->lastoutput, this->lastresult are also set.
|
||||
*
|
||||
* @param string $command Command line
|
||||
* @param string $outputfile Output file
|
||||
* @param int $execmethod 0=Use default method, 1=Use the PHP 'exec', 2=Use the 'popen' method
|
||||
* @return int Retval
|
||||
*/
|
||||
function executeCLI($command, $outputfile, $execmethod=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$retval = 0;
|
||||
|
||||
$command=escapeshellcmd($command);
|
||||
$command.=" 2>&1";
|
||||
|
||||
if (! empty($conf->global->MAIN_EXEC_USE_POPEN)) $execmethod=$conf->global->MAIN_EXEC_USE_POPEN;
|
||||
if (empty($execmethod)) $execmethod=1;
|
||||
//$execmethod=1;
|
||||
|
||||
dol_syslog(get_class($this)."::executeCLI execmethod=".$execmethod." system:".$command, LOG_DEBUG);
|
||||
$output_arr=array();
|
||||
|
||||
if ($execmethod == 1)
|
||||
{
|
||||
exec($command, $output_arr, $retval);
|
||||
if ($retval != 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
dol_syslog(get_class($this)."::executeCLI retval after exec=".$retval, LOG_ERR);
|
||||
$this->error = 'Error '.$retval;
|
||||
$this->lastoutput = ''; // Will be filled later from $output_arr
|
||||
$this->lastresult = $retval;
|
||||
$retval = $this->lastresult;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($execmethod == 2) // This method may create
|
||||
{
|
||||
$ok=0;
|
||||
$handle = fopen($outputfile, 'w+b');
|
||||
if ($handle)
|
||||
{
|
||||
dol_syslog(get_class($this)."::executeCLI run command ".$command);
|
||||
$handlein = popen($command, 'r');
|
||||
while (!feof($handlein))
|
||||
{
|
||||
$read = fgets($handlein);
|
||||
fwrite($handle,$read);
|
||||
$output_arr[]=$read;
|
||||
}
|
||||
pclose($handlein);
|
||||
fclose($handle);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
|
||||
// Update with result
|
||||
if (is_array($output_arr) && count($output_arr)>0)
|
||||
{
|
||||
foreach($output_arr as $val)
|
||||
{
|
||||
$this->lastoutput.=$val.($execmethod == 2 ? '' : "\n");
|
||||
}
|
||||
}
|
||||
|
||||
$this->lastresult=$retval;
|
||||
|
||||
dol_syslog(get_class($this)."::executeCLI output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
|
||||
|
||||
return $reval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reprogram a job
|
||||
*
|
||||
|
||||
@ -31,12 +31,18 @@
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
// Pour autre que bittorrent, on charge environnement + info issus de logon (comme le user)
|
||||
// For bittorent link, we don't need to load/check we are into a login session
|
||||
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'bittorrent' && ! defined("NOLOGIN"))
|
||||
{
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
}
|
||||
// For direct external download link, we don't need to load/check we are into a login session
|
||||
if (isset($_GET["hashp"]) && ! defined("NOLOGIN"))
|
||||
{
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
@ -111,21 +117,23 @@ if (! empty($hashp))
|
||||
$result = $ecmfile->fetch(0, '', '', '', $hashp);
|
||||
if ($result > 0)
|
||||
{
|
||||
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepatch is relative to document directory
|
||||
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory
|
||||
$moduleparttocheck = $tmp[0];
|
||||
if ($moduleparttocheck == $modulepart)
|
||||
{
|
||||
// We remove first level of directory
|
||||
$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir
|
||||
//var_dump($original_file); exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('Bad link. File owns to another module part.',0,0,1);
|
||||
accessforbidden('Bad link. File is from another module part.',0,0,1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('Bad link. File was not found or sharing attribute removed recently.',0,0,1);
|
||||
$langs->load("errors");
|
||||
accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"),0,0,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,30 +146,38 @@ $refname=basename(dirname($original_file)."/");
|
||||
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
|
||||
|
||||
// Basic protection (against external users only)
|
||||
if ($user->societe_id > 0)
|
||||
if (! empty($hashp))
|
||||
{
|
||||
if ($sqlprotectagainstexternals)
|
||||
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
|
||||
}
|
||||
else
|
||||
{
|
||||
// Basic protection (against external users only)
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$resql = $db->query($sqlprotectagainstexternals);
|
||||
if ($resql)
|
||||
if ($sqlprotectagainstexternals)
|
||||
{
|
||||
$num=$db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
$resql = $db->query($sqlprotectagainstexternals);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($user->societe_id != $obj->fk_soc)
|
||||
$num=$db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$accessallowed=0;
|
||||
break;
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($user->societe_id != $obj->fk_soc)
|
||||
{
|
||||
$accessallowed=0;
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,6 +112,7 @@ class EcmFiles //extends CommonObject
|
||||
}
|
||||
if (isset($this->filepath)) {
|
||||
$this->filepath = trim($this->filepath);
|
||||
$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /
|
||||
}
|
||||
if (isset($this->fullpath_orig)) {
|
||||
$this->fullpath_orig = trim($this->fullpath_orig);
|
||||
@ -164,6 +165,11 @@ class EcmFiles //extends CommonObject
|
||||
$maxposition=$maxposition+1;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->filename) || empty($this->filepath))
|
||||
{
|
||||
$this->errors[] = 'Bad property filename or filepath';
|
||||
return -1;
|
||||
}
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
@ -349,7 +355,7 @@ class EcmFiles //extends CommonObject
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="label";
|
||||
|
||||
$section=GETPOST("section");
|
||||
$section=GETPOST("section",'alpha');
|
||||
if (! $section)
|
||||
{
|
||||
dol_print_error('','Error, section parameter missing');
|
||||
@ -101,7 +101,7 @@ $filepathtodocument=$relativetodocument.$file->label;
|
||||
// Try to load object from index
|
||||
$object = new ECMFiles($db);
|
||||
$result=$object->fetch(0, '', $filepathtodocument);
|
||||
if (! ($result >= 0))
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
@ -109,7 +109,6 @@ if (! ($result >= 0))
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -124,7 +123,7 @@ if ($cancel)
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.$urlfile.'§ion='.$section);
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -140,13 +139,18 @@ if ($action == 'update')
|
||||
|
||||
//$db->begin();
|
||||
|
||||
$olddir=$ecmdir->getRelativePath(0);
|
||||
$olddir=$ecmdir->getRelativePath(0); // Relative to ecm
|
||||
$olddirrelativetodocument = 'ecm/'.$olddir; // Relative to document
|
||||
$newdirrelativetodocument = 'ecm/'.$olddir;
|
||||
$olddir=$conf->ecm->dir_output.'/'.$olddir;
|
||||
$newdir=$olddir;
|
||||
|
||||
$oldfile=$olddir.$oldlabel;
|
||||
$newfile=$newdir.$newlabel;
|
||||
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
|
||||
//print $oldfile.' - '.$newfile;
|
||||
if ($newlabel != $oldlabel)
|
||||
{
|
||||
@ -157,29 +161,52 @@ if ($action == 'update')
|
||||
setEventMessages($langs->trans('ErrorFailToRenameFile',$oldfile,$newfile), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
// Reload object after the move
|
||||
$result=$object->fetch(0, '', $newdirrelativetodocument.$newlabel);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (is_object($object))
|
||||
if ($shareenabled)
|
||||
{
|
||||
if ($shareenabled)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$object->share = getRandomPassword(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->share = '';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$object->share = getRandomPassword(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->share = '';
|
||||
}
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
// Call update to set the share key
|
||||
$result = $object->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Call create to insert record
|
||||
$object->entity = $conf->entity;
|
||||
$object->filepath = preg_replace('/[\\/]+$/', '', $newdirrelativetodocument);
|
||||
$object->filename = $newlabel;
|
||||
$object->label = md5_file(dol_osencode($newfile)); // hash of file content
|
||||
$object->fullpath_orig = '';
|
||||
$object->gen_or_uploaded = 'unknown';
|
||||
$object->description = ''; // indexed content
|
||||
$object->keyword = ''; // keyword content
|
||||
$result = $object->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +214,10 @@ if ($action == 'update')
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
$urlfile=$newlabel;
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -297,6 +327,7 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
// Link for internal download
|
||||
print '<tr><td>'.$langs->trans("DirectDownloadInternalLink").'</td><td>';
|
||||
$modulepart='ecm';
|
||||
$forcedownload=1;
|
||||
@ -308,9 +339,10 @@ $fulllink=$urlwithroot.$rellink;
|
||||
print img_picto('','object_globe.png').' ';
|
||||
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||
else print $fulllink;
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here.
|
||||
print '</td></tr>';
|
||||
|
||||
// Link for direct external download
|
||||
print '<tr><td>';
|
||||
if ($action != 'edit') print $langs->trans("DirectDownloadLink");
|
||||
else print $langs->trans("FileSharedViaALink");
|
||||
@ -332,7 +364,7 @@ if (! empty($object->share))
|
||||
print img_picto('','object_globe.png').' ';
|
||||
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||
else print $fulllink;
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -374,7 +406,7 @@ if ($action == 'edit')
|
||||
// Confirmation de la suppression d'une ligne categorie
|
||||
if ($action == 'delete_file')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($_GET["section"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
|
||||
}
|
||||
|
||||
@ -385,7 +417,7 @@ if ($action != 'edit')
|
||||
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
|
||||
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel§ion='.$section.'&urlfile='.urlencode($urlfile).'&backtopage='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014-2015 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2014-2017 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Yasser Carreón <yacasia@gmail.com>
|
||||
@ -69,6 +69,7 @@ $id = $origin_id;
|
||||
if (empty($origin_id)) $origin_id = GETPOST('origin_id','int'); // Id of order or propal
|
||||
if (empty($origin_id)) $origin_id = GETPOST('object_id','int'); // Id of order or propal
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$line_id = GETPOST('lineid','int')?GETPOST('lineid','int'):'';
|
||||
|
||||
// Security check
|
||||
$socid='';
|
||||
@ -598,6 +599,279 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* delete a line
|
||||
*/
|
||||
elseif ($action == 'deleteline' && ! empty($line_id))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$lines = $object->lines;
|
||||
$line = new ExpeditionLigne($db);
|
||||
|
||||
$num_prod = count($lines);
|
||||
for ($i = 0 ; $i < $num_prod ; $i++)
|
||||
{
|
||||
if ($lines[$i]->id == $line_id)
|
||||
{
|
||||
if (count($lines[$i]->details_entrepot) > 1)
|
||||
{
|
||||
// delete multi warehouse lines
|
||||
foreach ($lines[$i]->details_entrepot as $details_entrepot) {
|
||||
$line->id = $details_entrepot->line_id;
|
||||
if (! $error && $line->delete($user) < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// delete single warehouse line
|
||||
$line->id = $line_id;
|
||||
if (! $error && $line->delete($user) < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($_POST["lineid"]);
|
||||
}
|
||||
|
||||
if(! $error) {
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Update a line
|
||||
*/
|
||||
else if ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('save'))
|
||||
{
|
||||
// Clean parameters
|
||||
|
||||
$qty=0;
|
||||
$entrepot_id = 0;
|
||||
$batch_id = 0;
|
||||
|
||||
$lines = $object->lines;
|
||||
$num_prod = count($lines);
|
||||
for ($i = 0 ; $i < $num_prod ; $i++)
|
||||
{
|
||||
if ($lines[$i]->id == $line_id)
|
||||
{
|
||||
// line to update
|
||||
$line = new ExpeditionLigne($db);
|
||||
// Extrafields Lines
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$line->array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
// Unset extrafield POST Data
|
||||
if (is_array($extralabelsline)) {
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
$line->fk_product = $lines[$i]->fk_product;
|
||||
if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0)
|
||||
{
|
||||
// line with lot
|
||||
foreach ($lines[$i]->detail_batch as $detail_batch)
|
||||
{
|
||||
$lotStock = new Productbatch($db);
|
||||
$batch="batchl".$detail_batch->fk_expeditiondet."_".$detail_batch->fk_origin_stock;
|
||||
$qty = "qtyl".$detail_batch->fk_expeditiondet.'_'.$detail_batch->id;
|
||||
$batch_id = GETPOST($batch,'int');
|
||||
$batch_qty = GETPOST($qty, 'int');
|
||||
if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->dluo_qty))
|
||||
{
|
||||
if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) // $line is ExpeditionLine
|
||||
{
|
||||
if ($lines[$i]->entrepot_id != 0)
|
||||
{
|
||||
// allow update line entrepot_id if not multi warehouse shipping
|
||||
$line->entrepot_id = $lotStock->warehouseid;
|
||||
}
|
||||
|
||||
// detail_batch can be an object with keys, or an array of ExpeditionLineBatch
|
||||
if (empty($line->detail_batch)) $line->detail_batch=new stdClass();
|
||||
|
||||
$line->detail_batch->fk_origin_stock = $batch_id;
|
||||
$line->detail_batch->batch = $lotStock->batch;
|
||||
$line->detail_batch->id = $detail_batch->id;
|
||||
$line->detail_batch->entrepot_id = $lotStock->warehouseid;
|
||||
$line->detail_batch->dluo_qty = $batch_qty;
|
||||
if ($line->update($user) < 0) {
|
||||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($lotStock->error, $lotStock->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
unset($_POST[$batch]);
|
||||
unset($_POST[$qty]);
|
||||
}
|
||||
// add new batch
|
||||
$lotStock = new Productbatch($db);
|
||||
$batch="batchl".$line_id."_0";
|
||||
$qty = "qtyl".$line_id."_0";
|
||||
$batch_id = GETPOST($batch,'int');
|
||||
$batch_qty = GETPOST($qty, 'int');
|
||||
$lineIdToAddLot = 0;
|
||||
if ($batch_qty > 0 && ! empty($batch_id))
|
||||
{
|
||||
if ($lotStock->fetch($batch_id) > 0)
|
||||
{
|
||||
// check if lotStock warehouse id is same as line warehouse id
|
||||
if ($lines[$i]->entrepot_id > 0)
|
||||
{
|
||||
// single warehouse shipment line
|
||||
if ($lines[i]->entrepot_id == $lotStock->warehouseid)
|
||||
{
|
||||
$lineIdToAddLot = $line_id;
|
||||
}
|
||||
}
|
||||
else if (count($lines[$i]->details_entrepot) > 1)
|
||||
{
|
||||
// multi warehouse shipment lines
|
||||
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
|
||||
{
|
||||
if ($detail_entrepot->entrepot_id == $lotStock->warehouseid)
|
||||
{
|
||||
$lineIdToAddLot = $detail_entrepot->line_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($lineIdToAddLot)
|
||||
{
|
||||
// add lot to existing line
|
||||
if ($line->fetch($lineIdToAddLot) > 0)
|
||||
{
|
||||
$line->detail_batch->fk_origin_stock = $batch_id;
|
||||
$line->detail_batch->batch = $lotStock->batch;
|
||||
$line->detail_batch->entrepot_id = $lotStock->warehouseid;
|
||||
$line->detail_batch->dluo_qty = $batch_qty;
|
||||
if ($line->update($user) < 0) {
|
||||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// create new line with new lot
|
||||
$line->origin_line_id = $lines[$i]->origin_line_id;
|
||||
$line->entrepot_id = $lotStock->warehouseid;
|
||||
$line->detail_batch[0] = new ExpeditionLineBatch($db);
|
||||
$line->detail_batch[0]->fk_origin_stock = $batch_id;
|
||||
$line->detail_batch[0]->batch = $lotStock->batch;
|
||||
$line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
|
||||
$line->detail_batch[0]->dluo_qty = $batch_qty;
|
||||
if ($object->create_line_batch($line, $line->array_options) < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($lotStock->error, $lotStock->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// line without lot
|
||||
if ($lines[$i]->entrepot_id > 0)
|
||||
{
|
||||
// single warehouse shipment line
|
||||
$stockLocation="entl".$line_id;
|
||||
$qty = "qtyl".$line_id;
|
||||
$line->id = $line_id;
|
||||
$line->entrepot_id = GETPOST($stockLocation,'int');
|
||||
$line->qty = GETPOST($qty, 'int');
|
||||
if ($line->update($user) < 0) {
|
||||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
unset($_POST[$stockLocation]);
|
||||
unset($_POST[$qty]);
|
||||
}
|
||||
else if (count($lines[$i]->details_entrepot) > 1)
|
||||
{
|
||||
// multi warehouse shipment lines
|
||||
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
|
||||
{
|
||||
if (! $error) {
|
||||
$stockLocation="entl".$detail_entrepot->line_id;
|
||||
$qty = "qtyl".$detail_entrepot->line_id;
|
||||
$warehouse = GETPOST($stockLocation,'int');
|
||||
if (!empty ($warehouse))
|
||||
{
|
||||
$line->id = $detail_entrepot->line_id;
|
||||
$line->entrepot_id = $warehouse;
|
||||
$line->qty = GETPOST($qty, 'int');
|
||||
if ($line->update($user) < 0) {
|
||||
setEventMessages($line->error, $line->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
unset($_POST[$stockLocation]);
|
||||
unset($_POST[$qty]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($_POST["lineid"]);
|
||||
|
||||
if (! $error) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$ret = $object->fetch($object->id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||
exit();
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
@ -1242,6 +1516,7 @@ if ($action == 'create')
|
||||
|
||||
print '<!-- Show details of lot -->';
|
||||
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
|
||||
|
||||
//print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
|
||||
//print $line->fk_product.' - '.$dbatch->batch;
|
||||
print $langs->trans("Batch").': ';
|
||||
@ -1329,7 +1604,13 @@ if ($action == 'create')
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></div>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
|
||||
print ' ';
|
||||
print '<input type="'.($backtopage?"submit":"button").'" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage?'':' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -1732,6 +2013,15 @@ else if ($id || $ref)
|
||||
/*
|
||||
* Lines of products
|
||||
*/
|
||||
if ($action == 'editline')
|
||||
{
|
||||
print ' <form name="updateline" id="updateline" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $line_id . '" method="POST">
|
||||
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
|
||||
<input type="hidden" name="action" value="updateline">
|
||||
<input type="hidden" name="mode" value="">
|
||||
<input type="hidden" name="id" value="' . $object->id . '">
|
||||
';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -1743,34 +2033,62 @@ else if ($id || $ref)
|
||||
}
|
||||
print '<td>'.$langs->trans("Products").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
|
||||
if ($object->statut <= 1)
|
||||
if ($origin && $origin_id > 0)
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("QtyToShip").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyInOtherShipments").'</td>';
|
||||
}
|
||||
if ($action == 'editline')
|
||||
{
|
||||
$editColspan = 3;
|
||||
if (empty($conf->stock->enabled)) $editColspan--;
|
||||
if (empty($conf->productbatch->enabled)) $editColspan--;
|
||||
print '<td align="center" colspan="'. $editColspan . '">';
|
||||
if ($object->statut <= 1)
|
||||
{
|
||||
print $langs->trans("QtyToShip").' - ';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("QtyShipped").' - ';
|
||||
}
|
||||
if (! empty($conf->stock->enabled))
|
||||
{
|
||||
print $langs->trans("WarehouseSource").' - ';
|
||||
}
|
||||
if (! empty($conf->productbatch->enabled))
|
||||
{
|
||||
print $langs->trans("Batch");
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
||||
}
|
||||
if ($object->statut <= 1)
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("QtyToShip").'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
||||
}
|
||||
if (! empty($conf->stock->enabled))
|
||||
{
|
||||
print '<td align="left">'.$langs->trans("WarehouseSource").'</td>';
|
||||
}
|
||||
|
||||
if ($origin && $origin_id > 0)
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("QtyInOtherShipments").'</td>';
|
||||
if (! empty($conf->productbatch->enabled))
|
||||
{
|
||||
print '<td align="left">'.$langs->trans("Batch").'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">'.$langs->trans("CalculatedWeight").'</td>';
|
||||
print '<td align="center">'.$langs->trans("CalculatedVolume").'</td>';
|
||||
//print '<td align="center">'.$langs->trans("Size").'</td>';
|
||||
|
||||
if (! empty($conf->stock->enabled))
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
print '<td align="left">'.$langs->trans("WarehouseSource").'</td>';
|
||||
print '<td class="linecoledit"></td>';
|
||||
print '<td class="linecoldelete" width="10"></td>';
|
||||
}
|
||||
|
||||
if (! empty($conf->productbatch->enabled))
|
||||
{
|
||||
print '<td align="left">'.$langs->trans("Batch").'</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=false;
|
||||
@ -1894,9 +2212,6 @@ else if ($id || $ref)
|
||||
// Qty ordered
|
||||
print '<td align="center">'.$lines[$i]->qty_asked.'</td>';
|
||||
|
||||
// Qty to ship or shipped
|
||||
print '<td align="center">'.$lines[$i]->qty_shipped.'</td>';
|
||||
|
||||
// Qty in other shipments (with shipment and warehouse used)
|
||||
if ($origin && $origin_id > 0)
|
||||
{
|
||||
@ -1928,6 +2243,123 @@ else if ($id || $ref)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
||||
{
|
||||
// edit mode
|
||||
print '<td colspan="'.$editColspan.'"><table>';
|
||||
if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0)
|
||||
{
|
||||
$line = new ExpeditionLigne($db);
|
||||
foreach ($lines[$i]->detail_batch as $detail_batch)
|
||||
{
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
print '<td>' . '<input name="qtyl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->id.'" id="qtyl'.$line_id.'_'.$detail_batch->id.'" type="text" size="4" value="'.$detail_batch->dluo_qty.'">' . '</td>';
|
||||
// Batch number managment
|
||||
if ($lines[$i]->entrepot_id == 0)
|
||||
{
|
||||
// only show lot numbers from src warehouse when shipping from multiple warehouses
|
||||
$line->fetch($detail_batch->fk_expeditiondet);
|
||||
}
|
||||
print '<td>' . $formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $line->entrepot_id). '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// add a 0 qty lot row to be able to add a lot
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
print '<td>' . '<input name="qtyl'.$line_id.'_0" id="qtyl'.$line_id.'_0" type="text" size="4" value="0">' . '</td>';
|
||||
// Batch number managment
|
||||
print '<td>' . $formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product). '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else if (! empty($conf->stock->enabled))
|
||||
{
|
||||
if ($lines[$i]->entrepot_id > 0)
|
||||
{
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
print '<td>' . '<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">' . '</td>';
|
||||
// Warehouse source
|
||||
print '<td>' . $formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1). '</td>';
|
||||
// Batch number managment
|
||||
print '<td> - ' . $langs->trans("NA") . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else if (count($lines[$i]->details_entrepot) > 1)
|
||||
{
|
||||
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
|
||||
{
|
||||
print '<tr>';
|
||||
// Qty to ship or shipped
|
||||
print '<td>' . '<input name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'">' . '</td>';
|
||||
// Warehouse source
|
||||
print '<td>' . $formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1) . '</td>';
|
||||
// Batch number managment
|
||||
print '<td> - ' . $langs->trans("NA") . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</table></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Qty to ship or shipped
|
||||
print '<td align="center">'.$lines[$i]->qty_shipped.'</td>';
|
||||
|
||||
// Warehouse source
|
||||
if (! empty($conf->stock->enabled))
|
||||
{
|
||||
print '<td align="left">';
|
||||
if ($lines[$i]->entrepot_id > 0)
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($lines[$i]->entrepot_id);
|
||||
print $entrepot->getNomUrl(1);
|
||||
}
|
||||
else if (count($lines[$i]->details_entrepot) > 1)
|
||||
{
|
||||
$detail = '';
|
||||
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
|
||||
{
|
||||
if ($detail_entrepot->entrepot_id > 0)
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($detail_entrepot->entrepot_id);
|
||||
$detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'<br/>';
|
||||
}
|
||||
}
|
||||
print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"),$detail);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Batch number managment
|
||||
if (! empty($conf->productbatch->enabled))
|
||||
{
|
||||
if (isset($lines[$i]->detail_batch))
|
||||
{
|
||||
print '<td>';
|
||||
if ($lines[$i]->product_tobatch)
|
||||
{
|
||||
$detail = '';
|
||||
foreach ($lines[$i]->detail_batch as $dbatch)
|
||||
{
|
||||
$detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'<br/>';
|
||||
}
|
||||
print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Weight
|
||||
print '<td align="center">';
|
||||
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight");
|
||||
@ -1943,55 +2375,28 @@ else if ($id || $ref)
|
||||
// Size
|
||||
//print '<td align="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").'</td>';
|
||||
|
||||
// Warehouse source
|
||||
if (! empty($conf->stock->enabled))
|
||||
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
||||
{
|
||||
print '<td align="left">';
|
||||
if ($lines[$i]->entrepot_id > 0)
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($lines[$i]->entrepot_id);
|
||||
print $entrepot->getNomUrl(1);
|
||||
}
|
||||
else if (count($lines[$i]->details_entrepot) > 1)
|
||||
{
|
||||
$detail = '';
|
||||
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
|
||||
{
|
||||
if ($detail_entrepot->entrepot_id > 0)
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($detail_entrepot->entrepot_id);
|
||||
$detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'<br/>';
|
||||
}
|
||||
}
|
||||
print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"),$detail);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center" colspan="2" valign="middle">';
|
||||
print '<input type="submit" class="button" id="savelinebutton" name="save" value="' . $langs->trans("Save") . '"><br>';
|
||||
print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="' . $langs->trans("Cancel") . '"><br>';
|
||||
}
|
||||
|
||||
// Batch number managment
|
||||
if (! empty($conf->productbatch->enabled))
|
||||
else if ($object->statut == 0)
|
||||
{
|
||||
if (isset($lines[$i]->detail_batch))
|
||||
// edit-delete buttons
|
||||
print '<td class="linecoledit" align="center">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=editline&lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
|
||||
print '</td>';
|
||||
print '<td class="linecoldelete" width="10">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=deleteline&lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>';
|
||||
print '</td>';
|
||||
|
||||
// Display lines extrafields
|
||||
if (! empty($rowExtrafieldsStart))
|
||||
{
|
||||
print '<td>';
|
||||
if ($lines[$i]->product_tobatch)
|
||||
{
|
||||
$detail = '';
|
||||
foreach ($lines[$i]->detail_batch as $dbatch)
|
||||
{
|
||||
$detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'<br/>';
|
||||
}
|
||||
print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print $rowExtrafieldsStart;
|
||||
print $rowExtrafieldsView;
|
||||
print $rowEnd;
|
||||
}
|
||||
}
|
||||
print "</tr>";
|
||||
@ -2002,11 +2407,16 @@ else if ($id || $ref)
|
||||
$line = new ExpeditionLigne($db);
|
||||
$line->fetch_optionals($lines[$i]->id,$extralabelslines);
|
||||
print '<tr class="oddeven">';
|
||||
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
|
||||
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
||||
{
|
||||
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO Show also lines ordered but not delivered
|
||||
@ -2114,7 +2524,7 @@ else if ($id || $ref)
|
||||
* Documents generated
|
||||
*/
|
||||
|
||||
if ($action != 'presend')
|
||||
if ($action != 'presend' && $action != 'editline')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
@ -2161,136 +2571,6 @@ else if ($id || $ref)
|
||||
$trackid = 'shi'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
/*
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('sendings');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file))
|
||||
{
|
||||
$result = $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$object->error,$object->errors);
|
||||
exit;
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendShippingByEMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='shi'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'shi'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$outputlangs->trans('SendShippingRef','__SHIPPINGREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object, $outputlangs);
|
||||
$formmail->substit['__SHIPPINGREF__']=$object->ref;
|
||||
$formmail->substit['__SHIPPINGTRACKNUM__']=$object->tracking_number;
|
||||
$formmail->substit['__SHIPPINGTRACKNUMURL__']=$object->tracking_url;
|
||||
|
||||
//Find the good contact adress
|
||||
if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) {
|
||||
$objectsrc=new Commande($db);
|
||||
$objectsrc->fetch($object->$typeobject->id);
|
||||
}
|
||||
if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) {
|
||||
$objectsrc=new Propal($db);
|
||||
$objectsrc->fetch($object->$typeobject->id);
|
||||
}
|
||||
$custcontact='';
|
||||
$contactarr=array();
|
||||
if (is_object($objectsrc)) // For the case the shipment was created without orders
|
||||
{
|
||||
$contactarr=$objectsrc->liste_contact(-1,'external');
|
||||
}
|
||||
|
||||
if (is_array($contactarr) && count($contactarr)>0) {
|
||||
foreach($contactarr as $contact) {
|
||||
|
||||
if ($contact['libelle']==$langs->trans('TypeContact_commande_external_CUSTOMER')) {
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
|
||||
$contactstatic=new Contact($db);
|
||||
$contactstatic->fetch($contact['id']);
|
||||
$custcontact=$contactstatic->getFullName($langs,1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action']='send';
|
||||
$formmail->param['models']='shipping_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['shippingid']=$object->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode")=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||
}
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014-2015 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2014-2017 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
@ -373,48 +373,18 @@ class Expedition extends CommonObject
|
||||
*/
|
||||
function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$line_id = 0;
|
||||
$expeditionline = new ExpeditionLigne($this->db);
|
||||
$expeditionline->fk_expedition = $this->id;
|
||||
$expeditionline->entrepot_id = $entrepot_id;
|
||||
$expeditionline->fk_origin_line = $origin_line_id;
|
||||
$expeditionline->qty = $qty;
|
||||
$expeditionline->array_options = $array_options;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (";
|
||||
$sql.= "fk_expedition";
|
||||
$sql.= ", fk_entrepot";
|
||||
$sql.= ", fk_origin_line";
|
||||
$sql.= ", qty";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $this->id;
|
||||
$sql.= ", ".($entrepot_id?$entrepot_id:'null');
|
||||
$sql.= ", ".$origin_line_id;
|
||||
$sql.= ", ".$qty;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create_line", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
if (($lineId = $expeditionline->insert()) < 0)
|
||||
{
|
||||
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
||||
$this->error[]=$expeditionline->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$expeditionline = new ExpeditionLigne($this->db);
|
||||
$expeditionline->array_options=$array_options;
|
||||
$expeditionline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$expeditionline->table_element);
|
||||
$result=$expeditionline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error[]=$expeditionline->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) return $line_id;
|
||||
else return -1;
|
||||
return $lineId;
|
||||
}
|
||||
|
||||
|
||||
@ -1366,6 +1336,7 @@ class Expedition extends CommonObject
|
||||
$detail_entrepot = new stdClass;
|
||||
$detail_entrepot->entrepot_id = $obj->fk_entrepot;
|
||||
$detail_entrepot->qty_shipped = $obj->qty_shipped;
|
||||
$detail_entrepot->line_id = $obj->line_id;
|
||||
$line->details_entrepot[] = $detail_entrepot;
|
||||
|
||||
$line->line_id = $obj->line_id;
|
||||
@ -1533,11 +1504,11 @@ class Expedition extends CommonObject
|
||||
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='sending';
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$linkstart.$this->ref.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2238,6 +2209,17 @@ class Expedition extends CommonObject
|
||||
*/
|
||||
class ExpeditionLigne extends CommonObjectLine
|
||||
{
|
||||
public $element='expeditiondet';
|
||||
public $table_element='expeditiondet';
|
||||
|
||||
public $fk_origin_line;
|
||||
|
||||
/**
|
||||
* Id of shipment
|
||||
* @var int
|
||||
*/
|
||||
public $fk_expedition;
|
||||
|
||||
var $db;
|
||||
|
||||
// From llx_expeditiondet
|
||||
@ -2245,6 +2227,12 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
var $qty_shipped;
|
||||
var $fk_product;
|
||||
var $detail_batch;
|
||||
/**
|
||||
* Id of warehouse
|
||||
* @var int
|
||||
*/
|
||||
public $entrepot_id;
|
||||
|
||||
|
||||
// From llx_commandedet or llx_propaldet
|
||||
var $qty_asked;
|
||||
@ -2261,10 +2249,7 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
var $total_localtax1; // Total Local tax 1
|
||||
var $total_localtax2; // Total Local tax 2
|
||||
|
||||
public $element='expeditiondet';
|
||||
public $table_element='expeditiondet';
|
||||
|
||||
public $fk_origin_line;
|
||||
|
||||
// Deprecated
|
||||
/**
|
||||
@ -2283,15 +2268,403 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
*/
|
||||
var $libelle;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db=$db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load line expedition
|
||||
*
|
||||
* @param int $rowid Id line order
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = 'SELECT ed.rowid, ed.fk_expedition, ed.fk_entrepot, ed.fk_origin_line, ed.qty, ed.rang';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as ed';
|
||||
$sql.= ' WHERE ed.rowid = '.$rowid;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$this->id = $objp->rowid;
|
||||
$this->fk_expedition = $objp->fk_expedition;
|
||||
$this->entrepot_id = $objp->fk_entrepot;
|
||||
$this->fk_origin_line = $objp->fk_origin_line;
|
||||
$this->qty = $objp->qty;
|
||||
$this->rang = $objp->rang;
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert line into database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 1 = disable triggers
|
||||
* @return int <0 if KO, line id >0 if OK
|
||||
*/
|
||||
function insert($user=null, $notrigger=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->fk_expedition) || empty($this->fk_origin_line) || empty($this->qty))
|
||||
{
|
||||
$this->errors[] = 'ErrorMandatoryParametersNotProvided';
|
||||
return -1;
|
||||
}
|
||||
// Clean parameters
|
||||
if (empty($this->entrepot_id)) $this->entrepot_id='null';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (";
|
||||
$sql.= "fk_expedition";
|
||||
$sql.= ", fk_entrepot";
|
||||
$sql.= ", fk_origin_line";
|
||||
$sql.= ", qty";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $this->fk_expedition;
|
||||
$sql.= ", ".$this->entrepot_id;
|
||||
$sql.= ", ".$this->fk_origin_line;
|
||||
$sql.= ", ".$this->qty;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINESHIPPING_INSERT',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->errors[]=$this->error;
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete shipment line.
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function delete($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// delete batch expedition line
|
||||
if ($conf->productbatch->enabled)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_batch";
|
||||
$sql.= " WHERE fk_expeditiondet = ".$this->id;
|
||||
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->errors[]=$this->db->lasterror()." - sql=$sql";
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
if (! $error && $this->db->query($sql))
|
||||
{
|
||||
// Remove extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->errors[]=$this->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINESHIPPING_DELETE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->errors[]=$this->error;
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors[]=$this->db->lasterror()." - sql=$sql";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a line in database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 1 = disable triggers
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
dol_syslog(get_class($this)."::update id=$this->id, entrepot_id=$this->entrepot_id, product_id=$this->fk_product, qty=$this->qty");
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->qty)) $this->qty=0;
|
||||
$qty=price2num($this->qty);
|
||||
$remainingQty = 0;
|
||||
$batch = null;
|
||||
$batch_id = null;
|
||||
$expedition_batch_id = null;
|
||||
if (is_array($this->detail_batch)) // array of ExpeditionLineBatch
|
||||
{
|
||||
if (count($this->detail_batch) > 1)
|
||||
{
|
||||
dol_syslog(get_class($this).'::update only possible for one batch', LOG_ERR);
|
||||
$this->errors[]='ErrorBadParameters';
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$batch = $this->detail_batch[0]->batch;
|
||||
$batch_id = $this->detail_batch[0]->fk_origin_stock;
|
||||
$expedition_batch_id = $this->detail_batch[0]->id;
|
||||
if ($this->entrepot_id != $this->detail_batch[0]->entrepot_id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::update only possible for batch of same warehouse', LOG_ERR);
|
||||
$this->errors[]='ErrorBadParameters';
|
||||
$error++;
|
||||
}
|
||||
$qty = price2num($this->detail_batch[0]->dluo_qty);
|
||||
}
|
||||
}
|
||||
else if (! empty($this->detail_batch))
|
||||
{
|
||||
$batch = $this->detail_batch->batch;
|
||||
$batch_id = $this->detail_batch->fk_origin_stock;
|
||||
$expedition_batch_id = $this->detail_batch->id;
|
||||
if ($this->entrepot_id != $this->detail_batch->entrepot_id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::update only possible for batch of same warehouse', LOG_ERR);
|
||||
$this->errors[]='ErrorBadParameters';
|
||||
$error++;
|
||||
}
|
||||
$qty = price2num($this->detail_batch->dluo_qty);
|
||||
}
|
||||
|
||||
// check parameters
|
||||
if (! isset($this->id) || ! isset($this->entrepot_id))
|
||||
{
|
||||
dol_syslog(get_class($this).'::update missing line id and/or warehouse id', LOG_ERR);
|
||||
$this->errors[]='ErrorMandatoryParametersNotProvided';
|
||||
$error++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// update lot
|
||||
|
||||
if (! empty($batch) && $conf->productbatch->enabled)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update expedition batch id=$expedition_batch_id, batch_id=$batch_id, batch=$batch");
|
||||
|
||||
if (empty($batch_id) || empty($this->fk_product)) {
|
||||
dol_syslog(get_class($this).'::update missing fk_origin_stock (batch_id) and/or fk_product', LOG_ERR);
|
||||
$this->errors[]='ErrorMandatoryParametersNotProvided';
|
||||
$error++;
|
||||
}
|
||||
|
||||
// fetch remaining lot qty
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
|
||||
if (! $error && ($lotArray = ExpeditionLineBatch::fetchAll($this->db, $this->id)) < 0)
|
||||
{
|
||||
$this->errors[]=$this->db->lasterror()." - ExpeditionLineBatch::fetchAll";
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// caculate new total line qty
|
||||
foreach ($lotArray as $lot)
|
||||
{
|
||||
if ($expedition_batch_id != $lot->id)
|
||||
{
|
||||
$remainingQty += $lot->dluo_qty;
|
||||
}
|
||||
}
|
||||
$qty += $remainingQty;
|
||||
|
||||
//fetch lot details
|
||||
|
||||
// fetch from product_lot
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
$lot = new Productlot($this->db);
|
||||
if ($lot->fetch(0,$this->fk_product,$batch) < 0)
|
||||
{
|
||||
$this->errors[] = $lot->errors;
|
||||
$error++;
|
||||
}
|
||||
if (! $error && ! empty($expedition_batch_id))
|
||||
{
|
||||
// delete lot expedition line
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_batch";
|
||||
$sql.= " WHERE fk_expeditiondet = ".$this->id;
|
||||
$sql.= " AND rowid = ".$expedition_batch_id;
|
||||
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->errors[]=$this->db->lasterror()." - sql=$sql";
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (! $error && $this->detail_batch->dluo_qty > 0)
|
||||
{
|
||||
// create lot expedition line
|
||||
if (isset($lot->id))
|
||||
{
|
||||
$shipmentLot = new ExpeditionLineBatch($this->db);
|
||||
$shipmentLot->batch = $lot->batch;
|
||||
$shipmentLot->eatby = $lot->eatby;
|
||||
$shipmentLot->sellby = $lot->sellby;
|
||||
$shipmentLot->entrepot_id = $this->detail_batch->entrepot_id;
|
||||
$shipmentLot->dluo_qty = $this->detail_batch->dluo_qty;
|
||||
$shipmentLot->fk_origin_stock = $batch_id;
|
||||
if ($shipmentLot->create($this->id) < 0)
|
||||
{
|
||||
$this->errors[]=$shipmentLot->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
// update line
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql.= " fk_entrepot = ".$this->entrepot_id;
|
||||
$sql.= " , qty = ".$qty;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->errors[]=$this->db->lasterror()." - sql=$sql";
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->errors[]=$this->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINESHIPPING_UPDATE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->errors[]=$this->error;
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,13 +39,7 @@ if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/st
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$langs->load('orders');
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load('propal');
|
||||
$langs->load('deliveries');
|
||||
$langs->load('stocks');
|
||||
$langs->load("productbatch");
|
||||
$langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm'));
|
||||
|
||||
$id=GETPOST('id','int'); // id of order
|
||||
$ref= GETPOST('ref','alpha');
|
||||
@ -157,6 +151,15 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||
$object = new Commande($db);
|
||||
@ -528,7 +531,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
if ($user->rights->commande->creer) print '<a href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
|
||||
@ -1544,7 +1544,6 @@ class ExpenseReport extends CommonObject
|
||||
|
||||
if ($short) return $url;
|
||||
|
||||
$picto='trip';
|
||||
$label = '<u>' . $langs->trans("ShowExpenseReport") . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
@ -1583,8 +1582,11 @@ class ExpenseReport extends CommonObject
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend.' ');
|
||||
$result.=$linkstart.($max?dol_trunc($ref,$max):$ref).$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.=($max?dol_trunc($ref,$max):$ref);
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -123,7 +123,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -671,7 +671,6 @@ class Fichinter extends CommonObject
|
||||
if (! empty($this->ref))
|
||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
|
||||
|
||||
$picto='intervention';
|
||||
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
|
||||
|
||||
if ($option !== 'nolink')
|
||||
@ -698,9 +697,11 @@ class Fichinter extends CommonObject
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -393,7 +393,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre'.(($num == 0) ? ' nobottom':'').'">';
|
||||
print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td align="right">';
|
||||
print '<a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/product/list.php?fourn_id='.$object->id.'">'.$langs->trans("AllProductServicePrices").' <span class="badge">'.$object->nbOfProductRefs().'</span>';
|
||||
print '<a class="notasortlink" href="'.DOL_URL_ROOT.'/fourn/product/list.php?fourn_id='.$object->id.'">'.$langs->trans("AllProductReferencesOfSupplier").' <span class="badge">'.$object->nbOfProductRefs().'</span>';
|
||||
print '</a></td></tr>';
|
||||
|
||||
$return = array();
|
||||
|
||||
@ -1497,6 +1497,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
else
|
||||
{
|
||||
$this->error=$this->line->error;
|
||||
$this->errors=$this->line->errors;
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -1344,11 +1344,6 @@ if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
|
||||
llxHeader('',$langs->trans("Order"),$help_url);
|
||||
|
||||
/* *************************************************************************** */
|
||||
/* */
|
||||
/* Mode vue et edition */
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
$now=dol_now();
|
||||
if ($action=='create')
|
||||
|
||||
@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -828,7 +828,7 @@ class Holiday extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$picto='holiday';
|
||||
|
||||
$label=$langs->trans("Show").': '.$this->ref;
|
||||
|
||||
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;
|
||||
@ -844,9 +844,11 @@ class Holiday extends CommonObject
|
||||
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend;
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= $this->ref;
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
0
htdocs/includes/stripe/build.php
Normal file → Executable file
0
htdocs/includes/stripe/build.php
Normal file → Executable file
@ -353,6 +353,7 @@ ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
|
||||
|
||||
-- We fix value of 'list' from 0 to 1 for all extrafields created before this migration
|
||||
UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
|
||||
UPDATE llx_extrafields SET list = 3 WHERE type = 'separate' AND list != 3;
|
||||
|
||||
ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
|
||||
--VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET DEFAULT 1;
|
||||
@ -460,6 +461,26 @@ UPDATE llx_accounting_system SET fk_country =140 WHERE pcg_version = 'PCN-LUXEMB
|
||||
UPDATE llx_accounting_system SET fk_country = 12 WHERE pcg_version = 'PCG';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE llx_actioncomm_reminder(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
dateremind datetime NOT NULL,
|
||||
typeremind varchar(32) NOT NULL,
|
||||
fk_user integer NOT NULL,
|
||||
offsetvalue integer NOT NULL,
|
||||
offsetunit varchar(1) NOT NULL,
|
||||
status integer NOT NULL DEFAULT 0
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_rowid (rowid);
|
||||
ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_dateremind (dateremind);
|
||||
ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_fk_user (fk_user);
|
||||
|
||||
ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_unique(fk_user, typeremind, offsetvalue, offsetunit);
|
||||
|
||||
|
||||
-- VPGSQL8.2 CREATE SEQUENCE llx_supplier_proposal_rowid_seq;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_supplier_proposal ALTER COLUMN rowid SET DEFAULT nextval('llx_supplier_proposal_rowid_seq');
|
||||
-- VPGSQL8.2 ALTER TABLE llx_supplier_proposal ALTER COLUMN rowid SET NOT NULL;
|
||||
@ -476,3 +497,31 @@ ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);
|
||||
|
||||
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_intra varchar(32) AFTER accountancy_code_sell;
|
||||
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_export varchar(32) AFTER accountancy_code_sell_intra;
|
||||
|
||||
-- SPEC : use database type "double" to store monetary values
|
||||
ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8);
|
||||
ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8);
|
||||
ALTER TABLE llx_commande_fournisseur MODIFY COLUMN amount_ht double(24,8);
|
||||
ALTER TABLE llx_don MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_expensereport_rules MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_loan MODIFY COLUMN capital double(24,8);
|
||||
ALTER TABLE llx_loan MODIFY COLUMN capital_position double(24,8);
|
||||
ALTER TABLE llx_loan_schedule MODIFY COLUMN amount_capital double(24,8);
|
||||
ALTER TABLE llx_loan_schedule MODIFY COLUMN amount_insurance double(24,8);
|
||||
ALTER TABLE llx_loan_schedule MODIFY COLUMN amount_interest double(24,8);
|
||||
ALTER TABLE llx_paiementcharge MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_paiementfourn MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_payment_donation MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_payment_expensereport MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_payment_loan MODIFY COLUMN amount_capital double(24,8);
|
||||
ALTER TABLE llx_payment_loan MODIFY COLUMN amount_insurance double(24,8);
|
||||
ALTER TABLE llx_payment_loan MODIFY COLUMN amount_interest double(24,8);
|
||||
ALTER TABLE llx_payment_salary MODIFY COLUMN salary double(24,8);
|
||||
ALTER TABLE llx_payment_salary MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_prelevement_bons MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_prelevement_lignes MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_societe MODIFY COLUMN capital double(24,8);
|
||||
ALTER TABLE llx_tva MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_subscription MODIFY COLUMN subscription double(24,8);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
-- Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
@ -21,20 +21,20 @@
|
||||
|
||||
create table llx_accounting_account
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
fk_pcg_version varchar(32) NOT NULL,
|
||||
pcg_type varchar(20) NOT NULL,
|
||||
pcg_subtype varchar(20) NOT NULL,
|
||||
account_number varchar(32) NOT NULL,
|
||||
account_parent varchar(32) DEFAULT '0', -- Hierarchic parent TODO Move this as integer, it is a foreign key of llx_accounting_account.rowid
|
||||
label varchar(255) NOT NULL,
|
||||
fk_accounting_category integer DEFAULT 0,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_modif integer DEFAULT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
fk_pcg_version varchar(32) NOT NULL,
|
||||
pcg_type varchar(20) NOT NULL,
|
||||
pcg_subtype varchar(20) NOT NULL,
|
||||
account_number varchar(32) NOT NULL,
|
||||
account_parent varchar(32) DEFAULT '0', -- Hierarchic parent TODO Move this as integer, it is a foreign key of llx_accounting_account.rowid
|
||||
label varchar(255) NOT NULL,
|
||||
fk_accounting_category integer DEFAULT 0,
|
||||
fk_user_author integer DEFAULT NULL,
|
||||
fk_user_modif integer DEFAULT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL,
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255) -- for other parameters with json format
|
||||
extraparams varchar(255) -- for other parameters with json format
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -40,7 +40,7 @@ CREATE TABLE llx_accounting_bookkeeping
|
||||
multicurrency_code varchar(255), -- FEC:Idevise
|
||||
lettering_code varchar(255), -- FEC:EcritureLet
|
||||
date_lettering datetime, -- FEC:DateLet
|
||||
date_lim_reglement datetime DEFAULT NULL, -- | date limite de reglement
|
||||
date_lim_reglement datetime DEFAULT NULL, -- | date limite de reglement
|
||||
fk_user_author integer NOT NULL, -- | user creating
|
||||
fk_user_modif integer, -- | user making last change
|
||||
date_creation datetime, -- FEC:EcritureDate | creation date
|
||||
|
||||
@ -40,7 +40,7 @@ CREATE TABLE llx_accounting_bookkeeping_tmp
|
||||
multicurrency_code varchar(255), -- FEC:Idevise
|
||||
lettering_code varchar(255), -- FEC:EcritureLet
|
||||
date_lettering datetime, -- FEC:DateLet
|
||||
date_lim_reglement datetime, -- | date limite de reglement
|
||||
date_lim_reglement datetime, -- | date limite de reglement
|
||||
fk_user_author integer NOT NULL, -- | user creating
|
||||
fk_user_modif integer, -- | user making last change
|
||||
date_creation datetime, -- FEC:EcritureDate | creation date
|
||||
|
||||
25
htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql
Normal file
25
htdocs/install/mysql/tables/llx_actioncomm_reminder.key.sql
Normal file
@ -0,0 +1,25 @@
|
||||
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_rowid (rowid);
|
||||
ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_dateremind (dateremind);
|
||||
ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_fk_user (fk_user);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
|
||||
ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_unique(fk_user, typeremind, offsetvalue, offsetunit);
|
||||
|
||||
|
||||
27
htdocs/install/mysql/tables/llx_actioncomm_reminder.sql
Normal file
27
htdocs/install/mysql/tables/llx_actioncomm_reminder.sql
Normal file
@ -0,0 +1,27 @@
|
||||
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
CREATE TABLE llx_actioncomm_reminder(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
dateremind datetime NOT NULL,
|
||||
typeremind varchar(32) NOT NULL,
|
||||
fk_user integer NOT NULL,
|
||||
offsetvalue integer NOT NULL,
|
||||
offsetunit varchar(1) NOT NULL,
|
||||
status integer NOT NULL DEFAULT 0
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
@ -21,7 +21,7 @@ CREATE TABLE llx_blockedlog
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
action varchar(50),
|
||||
amounts real NOT NULL,
|
||||
amounts double(24,8) NOT NULL,
|
||||
signature varchar(100) NOT NULL,
|
||||
signature_line varchar(100) NOT NULL,
|
||||
element varchar(50),
|
||||
|
||||
@ -25,7 +25,7 @@ create table llx_bordereau_cheque
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(30) NOT NULL, -- ref
|
||||
ref_ext varchar(255), -- ref_ext
|
||||
ref_ext varchar(255), -- ref_ext
|
||||
datec datetime NOT NULL,
|
||||
date_bordereau date,
|
||||
amount double(24,8) NOT NULL,
|
||||
|
||||
@ -20,25 +20,25 @@
|
||||
|
||||
create table llx_chargesociales
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(16), -- 'TX....'
|
||||
date_ech datetime NOT NULL, -- date echeance
|
||||
libelle varchar(80) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
fk_type integer NOT NULL,
|
||||
fk_account integer, -- bank account
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
amount real default 0 NOT NULL,
|
||||
paye smallint default 0 NOT NULL,
|
||||
periode date,
|
||||
fk_projet integer DEFAULT NULL,
|
||||
import_key varchar(14)
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(16), -- 'TX....'
|
||||
date_ech datetime NOT NULL, -- date echeance
|
||||
libelle varchar(80) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
fk_type integer NOT NULL,
|
||||
fk_account integer, -- bank account
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
amount double(24,8) default 0 NOT NULL,
|
||||
paye smallint default 0 NOT NULL,
|
||||
periode date,
|
||||
fk_projet integer DEFAULT NULL,
|
||||
import_key varchar(14)
|
||||
)ENGINE=innodb;
|
||||
|
||||
--
|
||||
|
||||
@ -20,63 +20,63 @@
|
||||
|
||||
create table llx_commande
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(30) NOT NULL, -- order reference number
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
ref varchar(30) NOT NULL, -- order reference number
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
|
||||
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
|
||||
ref_int varchar(255), -- reference into an internal system (deprecated)
|
||||
ref_client varchar(255), -- reference for customer
|
||||
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
|
||||
ref_int varchar(255), -- reference into an internal system (deprecated)
|
||||
ref_client varchar(255), -- reference for customer
|
||||
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer DEFAULT NULL, -- projet auquel est rattache la commande
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer DEFAULT NULL, -- projet auquel est rattache la commande
|
||||
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_cloture datetime, -- date de cloture
|
||||
date_commande date, -- date de la commande
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
fk_user_cloture integer, -- user closing
|
||||
source smallint, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ?
|
||||
fk_statut smallint default 0,
|
||||
amount_ht real default 0,
|
||||
remise_percent real default 0,
|
||||
remise_absolue real default 0,
|
||||
remise real default 0,
|
||||
tva double(24,8) default 0,
|
||||
localtax1 double(24,8) default 0, -- total localtax1
|
||||
localtax2 double(24,8) default 0, -- total localtax2
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_cloture datetime, -- date de cloture
|
||||
date_commande date, -- date de la commande
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
fk_user_cloture integer, -- user closing
|
||||
source smallint, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ?
|
||||
fk_statut smallint default 0,
|
||||
amount_ht double(24,8) default 0,
|
||||
remise_percent real default 0,
|
||||
remise_absolue real default 0,
|
||||
remise real default 0,
|
||||
tva double(24,8) default 0,
|
||||
localtax1 double(24,8) default 0, -- total localtax1
|
||||
localtax2 double(24,8) default 0, -- total localtax2
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
facture tinyint default 0,
|
||||
fk_account integer, -- bank account
|
||||
fk_currency varchar(3), -- currency code
|
||||
fk_cond_reglement integer, -- condition de reglement
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
facture tinyint default 0,
|
||||
fk_account integer, -- bank account
|
||||
fk_currency varchar(3), -- currency code
|
||||
fk_cond_reglement integer, -- condition de reglement
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
|
||||
date_livraison date default NULL,
|
||||
fk_shipping_method integer, -- shipping method id
|
||||
fk_warehouse integer default NULL,
|
||||
fk_availability integer NULL,
|
||||
fk_input_reason integer, -- id coming from c_input_reason, '0' if no defined
|
||||
fk_delivery_address integer, -- delivery address (deprecated)
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255), -- for stock other parameters with json format
|
||||
date_livraison date default NULL,
|
||||
fk_shipping_method integer, -- shipping method id
|
||||
fk_warehouse integer default NULL,
|
||||
fk_availability integer NULL,
|
||||
fk_input_reason integer, -- id coming from c_input_reason, '0' if no defined
|
||||
fk_delivery_address integer, -- delivery address (deprecated)
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255), -- for stock other parameters with json format
|
||||
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_tx double(24,8) DEFAULT 1,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -21,58 +21,58 @@
|
||||
|
||||
create table llx_commande_fournisseur
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
|
||||
ref varchar(255) NOT NULL, -- order number
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
ref varchar(255) NOT NULL, -- order number
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
|
||||
ref_ext varchar(64), -- reference into an external system (not used by dolibarr)
|
||||
ref_supplier varchar(255),
|
||||
ref_ext varchar(64), -- reference into an external system (not used by dolibarr)
|
||||
ref_supplier varchar(255),
|
||||
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer DEFAULT 0, -- project id
|
||||
fk_soc integer NOT NULL,
|
||||
fk_projet integer DEFAULT 0, -- project id
|
||||
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_approve datetime, -- date de approve
|
||||
date_approve2 datetime, -- date de approve 2 (when double approving is accivated)
|
||||
date_commande date, -- date de la commande
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
fk_user_approve integer, -- user approving
|
||||
fk_user_approve2 integer, -- user approving 2 (when double approving is accivated)
|
||||
source smallint NOT NULL, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ?
|
||||
fk_statut smallint default 0,
|
||||
billed smallint default 0,
|
||||
amount_ht real default 0,
|
||||
remise_percent real default 0,
|
||||
remise real default 0,
|
||||
tva double(24,8) default 0,
|
||||
localtax1 double(24,8) default 0,
|
||||
localtax2 double(24,8) default 0,
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
tms timestamp,
|
||||
date_creation datetime, -- date de creation
|
||||
date_valid datetime, -- date de validation
|
||||
date_approve datetime, -- date de approve
|
||||
date_approve2 datetime, -- date de approve 2 (when double approving is accivated)
|
||||
date_commande date, -- date de la commande
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
fk_user_valid integer, -- user validating
|
||||
fk_user_approve integer, -- user approving
|
||||
fk_user_approve2 integer, -- user approving 2 (when double approving is accivated)
|
||||
source smallint NOT NULL, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ?
|
||||
fk_statut smallint default 0,
|
||||
billed smallint default 0,
|
||||
amount_ht double(24,8) default 0,
|
||||
remise_percent real default 0,
|
||||
remise real default 0,
|
||||
tva double(24,8) default 0,
|
||||
localtax1 double(24,8) default 0,
|
||||
localtax2 double(24,8) default 0,
|
||||
total_ht double(24,8) default 0,
|
||||
total_ttc double(24,8) default 0,
|
||||
note_private text,
|
||||
note_public text,
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
|
||||
|
||||
date_livraison datetime default NULL,
|
||||
fk_account integer, -- bank account
|
||||
fk_cond_reglement integer, -- condition de reglement
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
fk_input_method integer default 0, -- id coming from c_input_reason, '0' if no defined
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255), -- for stock other parameters with json format
|
||||
date_livraison datetime default NULL,
|
||||
fk_account integer, -- bank account
|
||||
fk_cond_reglement integer, -- condition de reglement
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
fk_input_method integer default 0, -- id coming from c_input_reason, '0' if no defined
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255), -- for incoterms
|
||||
import_key varchar(14),
|
||||
extraparams varchar(255), -- for stock other parameters with json format
|
||||
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_tx double(24,8) DEFAULT 1,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
-- Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
@ -23,39 +23,39 @@ create table llx_commande_fournisseurdet
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_commande integer NOT NULL,
|
||||
fk_parent_line integer NULL,
|
||||
fk_parent_line integer NULL,
|
||||
fk_product integer,
|
||||
ref varchar(50), -- supplier product ref
|
||||
label varchar(255), -- product label
|
||||
ref varchar(50), -- supplier product ref
|
||||
label varchar(255), -- product label
|
||||
description text,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
remise real DEFAULT 0, -- montant de la remise
|
||||
subprice double(24,8) DEFAULT 0, -- prix unitaire
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total Local Tax 1
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- Total Local Tax 2
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0,
|
||||
import_key varchar(14),
|
||||
fk_unit integer DEFAULT NULL,
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0,
|
||||
import_key varchar(14),
|
||||
fk_unit integer DEFAULT NULL,
|
||||
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_subprice double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_subprice double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -30,42 +30,42 @@ create table llx_commandedet
|
||||
description text,
|
||||
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
|
||||
tva_tx double(6,3), -- Vat rate
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
remise real DEFAULT 0, -- montant de la remise
|
||||
fk_remise_except integer NULL, -- Lien vers table des remises fixes
|
||||
price real, -- prix final
|
||||
subprice double(24,8) DEFAULT 0, -- P.U. HT (exemple 100)
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- Total LocalTax2
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
subprice double(24,8) DEFAULT 0, -- P.U. HT (exemple 100)
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1
|
||||
total_localtax2 double(24,8) DEFAULT 0, -- Total LocalTax2
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
|
||||
buy_price_ht double(24,8) DEFAULT 0, -- buying price
|
||||
buy_price_ht double(24,8) DEFAULT 0, -- buying price
|
||||
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
|
||||
|
||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0,
|
||||
fk_unit integer DEFAULT NULL, -- lien vers table des unités
|
||||
fk_unit integer DEFAULT NULL, -- lien vers table des unités
|
||||
import_key varchar(14),
|
||||
|
||||
fk_commandefourndet integer DEFAULT NULL, -- link to detail line of commande fourn (resplenish)
|
||||
|
||||
fk_multicurrency integer,
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_subprice double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ht double(24,8) DEFAULT 0,
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
multicurrency_total_tva double(24,8) DEFAULT 0,
|
||||
multicurrency_total_ttc double(24,8) DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
--
|
||||
|
||||
@ -28,7 +28,7 @@ create table llx_don
|
||||
tms timestamp,
|
||||
fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate
|
||||
datedon datetime, -- Date of the donation/promise
|
||||
amount real DEFAULT 0,
|
||||
amount double(24,8) DEFAULT 0,
|
||||
fk_payment integer,
|
||||
paid smallint default 0 NOT NULL,
|
||||
firstname varchar(50),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user