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:
Alexandre SPANGARO 2017-11-03 06:18:27 +01:00
commit 2d17e4094c
883 changed files with 5819 additions and 2828 deletions

View File

@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 7.0.0 compared to 6.0.* ***** ***** ChangeLog for 7.0.0 compared to 6.0.* *****
For users:
For developers: For developers:
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page 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. * 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 ***** ***** ChangeLog for 6.0.2 compared to 6.0.1 *****
FIX: #7148 FIX: #7148
FIX: #7288 FIX: #7288

View File

@ -571,6 +571,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`; $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/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; $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/php-iban/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/.gitattributes`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Classes/license.md`; $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/Examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`; $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/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/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`; $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/fonts/utils`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $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/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
print "Remove subdir of custom dir\n"; print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n"; print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";

View File

@ -77,6 +77,10 @@ $sqls=array(
'proposal'=>array( 'proposal'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet', 'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
'DELETE FROM '.MAIN_DB_PREFIX.'propal', 'DELETE FROM '.MAIN_DB_PREFIX.'propal',
),
'supplier_proposal'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
), ),
'supplier_order'=>array( 'supplier_order'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet', 'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
@ -85,8 +89,6 @@ $sqls=array(
'supplier_invoice'=>array( 'supplier_invoice'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det', 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn', 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
), ),
'delivery'=>array( 'delivery'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet', 'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
@ -114,7 +116,9 @@ $sqls=array(
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang', 'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
'DELETE FROM '.MAIN_DB_PREFIX.'product_price', 'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price', 'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
'DELETE FROM '.MAIN_DB_PREFIX.'product_batch',
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock', 'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
'DELETE FROM '.MAIN_DB_PREFIX.'product_lot',
'DELETE FROM '.MAIN_DB_PREFIX.'product', 'DELETE FROM '.MAIN_DB_PREFIX.'product',
), ),
'project'=>array( 'project'=>array(
@ -133,6 +137,7 @@ $sqls=array(
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur', 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe', 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except', 'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib',
'DELETE FROM '.MAIN_DB_PREFIX.'societe', 'DELETE FROM '.MAIN_DB_PREFIX.'societe',
) )
); );
@ -152,27 +157,37 @@ $mode = $argv[1];
$option = $argv[2]; $option = $argv[2];
if (empty($mode) || ! in_array($mode,array('test','confirm'))) { 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 "\n";
print "option can be ".implode(',',array_keys($sqls))."\n"; print "option can be ".implode(',',array_keys($sqls))."\n";
exit(-1); exit(-1);
} }
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) { 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 "\n";
print "option can be ".implode(',',array_keys($sqls))."\n"; print "option can be ".implode(',',array_keys($sqls))."\n";
exit(-1); 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'); $ret=$user->fetch('','admin');
if (! $ret > 0) 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; exit;
} }
$user->getrights(); //$user->getrights();
print "Purge all data for this database:\n"; print "Purge all data for this database:\n";
print "Server = ".$db->database_host."\n"; print "Server = ".$db->database_host."\n";

View File

@ -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_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_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_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")) { if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear'; $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 = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) { if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = ''; $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 = GETPOST("search_accountancy_aux_code");
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha'); $search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
if ($search_accountancy_aux_code_start == - 1) { if ($search_accountancy_aux_code_start == - 1) {
$search_accountancy_aux_code_start = ''; $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')); $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('cancel','alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $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 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 = ''; $search_mvt_num = '';
@ -128,6 +145,10 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_ledger_code = ''; $search_ledger_code = '';
$search_date_start = ''; $search_date_start = '';
$search_date_end = ''; $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. // 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; $filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_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') { if ($action == 'delbookkeeping') {
@ -370,94 +411,164 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
print '</div>'; print '</div>';
print '<div class="div-table-responsive">'; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
print '<table class="noborder" width="100%">'; $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 '<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>'; // Movement number
print '<td class="liste_titre center">'; if (! empty($arrayfields['t.piece_num']['checked']))
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))
{ {
print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="' . dol_escape_htmltag($search_mvt_num) . '"></td>';
}
// Date document
if (! empty($arrayfields['t.doc_date']['checked']))
{
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>';
}
// Ref document
if (! empty($arrayfields['t.doc_ref']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="' . dol_escape_htmltag($search_doc_ref) . '"></td>';
}
// Accountancy account
if (! empty($arrayfields['t.numero_compte']['checked']))
{
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>';
}
// 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); print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
} }
else else
{ {
print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">'; print '<input type="text" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
} }
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('to').' '; 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 // 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. // use setup of keypress to select thirdparty and this hang browser on large database.
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{ {
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
} }
else else
{ {
print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">'; print '<input type="text" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
}
print '</div>';
print '</td>';
} }
print '</div>'; // Label operation
print '</td>'; 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 class="liste_titre">';
print '</td>'; print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
print '<td class="liste_titre center">&nbsp;</td>'; print '</td>';
print '<td class="liste_titre center">&nbsp;</td>'; }
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>'; // Debit
if (! empty($arrayfields['t.debit']['checked']))
{
print '<td class="liste_titre center">&nbsp;</td>';
}
// Credit
if (! empty($arrayfields['t.credit']['checked']))
{
print '<td class="liste_titre center">&nbsp;</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">'; print '<td class="liste_titre center">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.piece_num']['checked'])) 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); if (! empty($arrayfields['t.doc_date']['checked'])) 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); if (! empty($arrayfields['t.doc_ref']['checked'])) 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); if (! empty($arrayfields['t.numero_compte']['checked'])) 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); if (! empty($arrayfields['t.subledger_account']['checked'])) 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); if (! empty($arrayfields['t.label_operation']['checked'])) 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); if (! empty($arrayfields['t.debit']['checked'])) 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); if (! empty($arrayfields['t.credit']['checked'])) 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); if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
$checkpicto=''; if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); 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($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$total_debit = 0; if ($num > 0)
$total_credit = 0;
$i=0;
while ($i < min($num, $limit))
{ {
$i=0;
$totalarray=array();
while ($i < min($num, $limit))
{
$line = $object->lines[$i]; $line = $object->lines[$i];
$total_debit += $line->debit; $total_debit += $line->debit;
@ -465,41 +576,122 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// 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>'; 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>'; if (! $i) $totalarray['nbfield']++;
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>';
// 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']++;
}
// Document ref
if (! empty($arrayfields['t.doc_ref']['checked']))
{
print '<td class="nowrap">' . $line->doc_ref . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// 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); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('',$line->code_journal); $result = $accountingjournal->fetch('',$line->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal); $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0,0,0,'',0) : $line->code_journal);
print '<td align="center">' . $journaltoshow . '</td>'; 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 '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;'; print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>'; print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
print '<tr class="liste_total">'; // Show total line
if ($num < $limit) print '<td align="left" colspan="7">'.$langs->trans("Total").'</td>'; if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
else print '<td align="left" colspan="7">'.$langs->trans("Totalforthispage").'</td>'; {
print '</td>'; $i=0;
print '<td align="right">'; while ($i < $totalarray['nbfield'])
print price($total_debit); {
print '</td>'; $i++;
print '<td align="right">'; if ($i == 1)
print price($total_credit); {
print '</td>'; if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
print '<td colspan="2"></td>'; else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
print '</tr>'; }
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 "</table>"; print "</table>";
print '</div>'; print '</div>';

View File

@ -564,7 +564,8 @@ class BookKeeping extends CommonObject
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,"; $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 .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.$mode. ' as t';
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
$sql .= " AND entity IN (" . getEntity('accountancy') . ")"; $sql .= " AND entity IN (" . getEntity('accountancy') . ")";
@ -603,6 +604,7 @@ class BookKeeping extends CommonObject
$this->code_journal = $obj->code_journal; $this->code_journal = $obj->code_journal;
$this->journal_label = $obj->journal_label; $this->journal_label = $obj->journal_label;
$this->piece_num = $obj->piece_num; $this->piece_num = $obj->piece_num;
$this->date_creation = $this->db->jdate($obj->date_creation);
} }
$this->db->free($resql); $this->db->free($resql);
@ -658,7 +660,8 @@ class BookKeeping extends CommonObject
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,"; $sql .= " t.journal_label,";
$sql .= " t.piece_num"; $sql .= " t.piece_num,";
$sql .= " t.date_creation";
// Manage filter // Manage filter
$sqlwhere = array (); $sqlwhere = array ();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -675,6 +678,8 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} elseif ($key == 't.label_operation') { } elseif ($key == 't.label_operation') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} else { } else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
} }
@ -725,6 +730,7 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label; $line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;
$this->lines[] = $line; $this->lines[] = $line;
} }
@ -777,7 +783,8 @@ class BookKeeping extends CommonObject
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,"; $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'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter // Manage filter
$sqlwhere = array (); $sqlwhere = array ();
@ -793,6 +800,10 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key . '=' . $value; $sqlwhere[] = $key . '=' . $value;
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\''; $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 { } else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
} }
@ -841,6 +852,7 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label; $line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;
$this->lines[] = $line; $this->lines[] = $line;
} }
@ -1336,6 +1348,7 @@ class BookKeeping extends CommonObject
$this->code_journal = 'VT'; $this->code_journal = 'VT';
$this->journal_label = 'Journal de vente'; $this->journal_label = 'Journal de vente';
$this->piece_num = ''; $this->piece_num = '';
$this->date_creation = $now;
} }
/** /**
@ -1348,7 +1361,7 @@ class BookKeeping extends CommonObject
public function fetchPerMvt($piecenum, $mode='') { public function fetchPerMvt($piecenum, $mode='') {
global $conf; 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 .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")"; $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_date = $this->db->jdate($obj->doc_date);
$this->doc_ref = $obj->doc_ref; $this->doc_ref = $obj->doc_ref;
$this->doc_type = $obj->doc_type; $this->doc_type = $obj->doc_type;
$this->date_creation = $obj->date_creation;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR); 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 = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
$sql .= " numero_compte, label_compte, label_operation, debit, credit,"; $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 .= " FROM " . MAIN_DB_PREFIX . $this->table_element.$mode;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")"; $sql .= " AND entity IN (" . getEntity('accountancy') . ")";
@ -1447,6 +1461,7 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label; $line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;
$this->linesmvt[] = $line; $this->linesmvt[] = $line;
} }
@ -1785,4 +1800,5 @@ class BookKeepingLine
public $code_journal; public $code_journal;
public $journal_label; public $journal_label;
public $piece_num; public $piece_num;
public $date_creation;
} }

View File

@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -38,6 +38,7 @@ $langs->load("agenda");
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha'); $cancel = GETPOST('cancel','alpha');
$search_event = GETPOST('search_event', 'alpha');
// Get list of triggers available // Get list of triggers available
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype"; $sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
@ -70,6 +71,12 @@ else
* Actions * 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)) if ($action == "save" && empty($cancel))
{ {
$i=0; $i=0;
@ -78,11 +85,14 @@ if ($action == "save" && empty($cancel))
foreach ($triggers as $trigger) foreach ($triggers as $trigger)
{ {
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; $keyparam='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
//print "param=".$param." - ".$_POST[$param]; //print "param=".$param." - ".$_POST[$param];
$res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity); 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 (! $res > 0) $error++;
} }
}
if (! $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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="save">'; print '<input type="hidden" name="action" value="save">';
$param = '';
$param.= '&search_event='.urlencode($search_event);
$head=agenda_prepare_head(); $head=agenda_prepare_head();
@ -151,8 +163,19 @@ print "<br>\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>'; print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></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"></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"; print '</tr>'."\n";
// Show each trigger (list is in c_action_trigger) // Show each trigger (list is in c_action_trigger)
if (! empty($triggers)) if (! empty($triggers))
@ -173,7 +196,8 @@ if (! empty($triggers))
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue; 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; if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $trigger['code']))
{
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$trigger['code'].'</td>'; print '<td>'.$trigger['code'].'</td>';
print '<td>'.$trigger['label'].'</td>'; print '<td>'.$trigger['label'].'</td>';
@ -184,6 +208,7 @@ if (! empty($triggers))
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
} }
}
} }
print '</table>'; print '</table>';

View File

@ -352,6 +352,15 @@ else
} }
print '</td></tr>'."\n"; 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">&nbsp;</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)) 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'); $formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
print '</td></tr>'."\n"; 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">&nbsp;</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>'; print '</table>';
dol_fiche_end(); dol_fiche_end();

View File

@ -258,14 +258,14 @@ $var=true;
$var=! $var; $var=! $var;
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>'; $htmltext.='</i>';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {

View File

@ -539,7 +539,7 @@ print "<td>&nbsp;</td>\n";
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">'; print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_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="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">"; print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>'; 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 '</td><td>';
print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">'; print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
print '</td><td align="right">'; print '</td><td align="right">';

View File

@ -474,7 +474,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount')); $substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
@ -482,8 +482,7 @@ $htmltext.='</i>';
$var=! $var; $var=! $var;
print '<tr class="oddeven"><td colspan="2">'; 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, 'tooltiphelp');
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2);
print '<br>'; print '<br>';
$variablename='CONTRACT_FREE_TEXT'; $variablename='CONTRACT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
@ -501,8 +500,7 @@ print '</td></tr>'."\n";
//Use draft Watermark //Use draft Watermark
print '<tr class="oddeven"><td>'; 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, 'watermarktooltip').'<br>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2);
print '</td><td>'; print '</td><td>';
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">'; print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -193,20 +193,14 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{ {
// Button off, click to enable // Button off, click to enable
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">'; $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.= 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.= '</a>'; $enabledisablehtml.= '</a>';
} }
else else
{ {
// Button on, click to disable // Button on, click to disable
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">'; $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.= 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.= '</a>'; $enabledisablehtml.= '</a>';
} }

View File

@ -477,14 +477,14 @@ print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>\n"; print "<td>".$langs->trans("Parameter")."</td>\n";
print "</tr>"; print "</tr>";
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>'; $htmltext.='</i>';
print '<tr><td>'; 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'; $variablename='SHIPPING_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
@ -499,7 +499,7 @@ else
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td>'; 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 '<input size="50" class="flat" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.$conf->global->SHIPPING_DRAFT_WATERMARK.'">';
print "</td></tr>\n"; print "</td></tr>\n";

View File

@ -482,7 +482,7 @@ print '<td align="center" width="60"></td>';
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
@ -490,7 +490,7 @@ $htmltext.='</i>';
$var=! $var; $var=! $var;
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='EXPENSEREPORT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
@ -507,7 +507,7 @@ print '</td></tr>'."\n";
//Use draft Watermark //Use draft Watermark
print '<tr class="oddeven"><td colspan="2">'; 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 '<input size="50" class="flat" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -711,7 +711,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<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="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />'; print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_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="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />'; print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
print '<tr class="oddeven"><td>'; 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>';
print '<td><input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />'; print '<td><input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />';
print '</td><td align="right">'; print '</td><td align="right">';

View File

@ -534,7 +534,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n"; print "<td>&nbsp;</td>\n";
print "</tr>\n"; print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">'; print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='FICHINTER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_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="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">"; print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>'; 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 '</td><td>';
print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.$conf->global->FICHINTER_DRAFT_WATERMARK.'">'; print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.$conf->global->FICHINTER_DRAFT_WATERMARK.'">';
print '</td><td align="right">'; print '</td><td align="right">';

View File

@ -454,7 +454,7 @@ print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">'; print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='DELIVERY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {

View File

@ -116,7 +116,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -545,7 +545,7 @@ print "</td></tr>\n";
print '</form>'; print '</form>';
*/ */
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">'; print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_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="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">"; print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>'; 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 '</td><td>';
print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">'; print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
print '</td><td align="right">'; print '</td><td align="right">';

View File

@ -471,14 +471,14 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>'; $htmltext.='</i>';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='SUPPLIER_INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {

View File

@ -537,14 +537,14 @@ else
} }
*/ */
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>'; $htmltext.='</i>';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='SUPPLIER_ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {

View File

@ -500,7 +500,7 @@ print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
print "<td>&nbsp;</td>\n"; print "<td>&nbsp;</td>\n";
print "</tr>"; print "</tr>";
$substitutionarray=pdf_getSubstitutionArray($langs); $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<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="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">'; print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">'; 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'; $variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_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="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">"; print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>'; 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 '</td><td>';
print '<input size="50" class="flat" type="text" name="SUPPLIER_PROPOSAL_DRAFT_WATERMARK" value="'.$conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK.'">'; 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">'; print '</td><td align="right">';

View File

@ -210,7 +210,7 @@ llxHeader('',$langs->trans("Setup"),$wikihelp);
$param='&mode='.$mode; $param='&mode='.$mode;
$enabledisablehtml=''; $enabledisablehtml='';
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' '; $enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
{ {
// Button off, click to enable // 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 $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
print '</td>'."\n"; print '</td>'."\n";
print '<td>'; 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 '</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>'; print '</td>';
// Limit to superadmin // Limit to superadmin
/*if (! empty($conf->multicompany->enabled) && !$user->entity) /*if (! empty($conf->multicompany->enabled) && !$user->entity)
@ -403,6 +403,9 @@ if ($mode == 'searchkey')
$recordtoshow=array(); $recordtoshow=array();
// Search modules dirs
$modulesdir = dolGetModulesDirs();
$nbempty=0; $nbempty=0;
/*var_dump($langcode); /*var_dump($langcode);
var_dump($transkey); var_dump($transkey);
@ -416,15 +419,16 @@ if ($mode == 'searchkey')
} }
else else
{ {
// Load all translations keys // Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
foreach($conf->file->dol_document_root as $keydir => $searchdir) foreach($modulesdir as $keydir => $tmpsearchdir)
{ {
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
// Directory of translation files // Directory of translation files
$dir_lang = $searchdir."/langs/".$langcode; $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); $dir_lang_osencoded=dol_osencode($dir_lang);
$filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1); $filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
foreach($filearray as $file) foreach($filearray as $file)
{ {
$tmpfile=preg_replace('/.lang/i', '', basename($file['name'])); $tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
@ -437,8 +441,8 @@ if ($mode == 'searchkey')
// Now search into translation array // Now search into translation array
foreach($newlang->tab_translate as $key => $val) foreach($newlang->tab_translate as $key => $val)
{ {
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/', $key)) continue; if ($transkey && ! preg_match('/'.preg_quote($transkey).'/i', $key)) continue;
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/', $val)) continue; if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/i', $val)) continue;
$recordtoshow[$key]=$val; $recordtoshow[$key]=$val;
} }
} }
@ -566,6 +570,10 @@ dol_fiche_end();
print "</form>\n"; print "</form>\n";
if (! empty($langcode))
{
dol_set_focus('#transvalue');
}
llxFooter(); llxFooter();

View File

@ -128,7 +128,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir)
{ {
// Search available module // 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)); $handle=@opendir(dol_osencode($dir));
if (is_resource($handle)) if (is_resource($handle))
@ -139,14 +139,14 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
{ {
$module = strtolower($regmod[1]); $module = strtolower($regmod[1]);
$moduledirforclass = getModuleDirForApiClass($module); $moduledirforclass = getModuleDirForApiClass($module);
$moduleforperm = $module; $modulenameforenabled = $module;
if ($module == 'propale') { $moduleforperm='propal'; } 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 // Defined if module is enabled
$enabled=true; $enabled=true;
if (empty($conf->$moduleforperm->enabled)) $enabled=false; if (empty($conf->$modulenameforenabled->enabled)) $enabled=false;
if ($enabled) if ($enabled)
{ {
@ -235,7 +235,13 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
if ($module == 'order') { $classname='Commande'; } if ($module == 'order') { $classname='Commande'; }
//var_dump($classfile);var_dump($classname);exit; //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', '/'); if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/');
} }
else 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'); $dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
$classname=ucwords($module); $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); if (class_exists($classname)) $api->r->addAPIClass($classname);
} }
} }

View File

@ -180,11 +180,11 @@ class BlockedLog
public function setObjectData(&$object) public function setObjectData(&$object)
{ {
// Set date // Set date
if($object->element == 'payment' || $object->element == 'payment_supplier') if ($object->element == 'payment' || $object->element == 'payment_supplier')
{ {
$this->date_object = $object->datepaye; $this->date_object = $object->datepaye;
} }
if ($object->element=='payment_salary') elseif ($object->element=='payment_salary')
{ {
$this->date_object = $object->datev; $this->date_object = $object->datev;
} }

View File

@ -35,6 +35,10 @@ function printBookmarksList($aDb, $aLangs)
$db = $aDb; $db = $aDb;
$langs = $aLangs; $langs = $aLangs;
$ret.= '<div class="menu_top"></div>'."\n";
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'; 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; if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
@ -74,7 +78,7 @@ function printBookmarksList($aDb, $aLangs)
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>'; $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>'; $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 // Url to go on create new bookmark page
if ($user->rights->bookmark->creer) if (! empty($user->rights->bookmark->creer))
{ {
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url); //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url); $urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
@ -95,7 +99,7 @@ function printBookmarksList($aDb, $aLangs)
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'">'; $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.='<span class="fa fa-print">aa</span>';
$ret.=img_picto('','object_bookmark').' '; $ret.=img_picto('','object_bookmark').' ';
$ret.=$obj->title; $ret.=dol_escape_htmltag($obj->title);
$ret.='</option>'; $ret.='</option>';
$i++; $i++;
} }
@ -139,7 +143,9 @@ function printBookmarksList($aDb, $aLangs)
} }
});'; });';
$ret.='})</script>'; $ret.='})</script>';
$ret .= '<div class="menu_end"></div>'; }
$ret.= '<div class="menu_end"></div>'."\n";
return $ret; return $ret;
} }

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -1135,7 +1135,6 @@ class ActionComm extends CommonObject
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL'); if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
} }
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>'; $tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $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).')':''); $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; return $result;
} }
@ -1341,6 +1343,7 @@ class ActionComm extends CommonObject
{ {
// Note: Output of sql request is encoded in $conf->file->character_set_client // 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. // This assignment in condition is not a bug. It allows walking the results.
$diff = 0;
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$qualified=true; $qualified=true;
@ -1377,6 +1380,7 @@ class ActionComm extends CommonObject
{ {
$eventarray[]=$event; $eventarray[]=$event;
} }
$diff++;
} }
} }
else else
@ -1528,10 +1532,18 @@ class ActionComm extends CommonObject
return 0; return 0;
} }
$now = dol_now();
dol_syslog(__METHOD__, LOG_DEBUG); 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; return 0;
} }

View 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();
}
}

View File

@ -1364,7 +1364,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '>'; print '>';
print '<table class="centpercent cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h; print '<table class="centpercent cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
print 'background: #'.$color.';'; 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).'));'; //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;'; //else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
//print ' -moz-border-radius:4px;"'; //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 * Change color with a delta
* *
* @param string $color Color * @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 * @param int $minusunit Minus unit
* @return string New color * @return string New color
*/ */

View File

@ -3357,11 +3357,11 @@ class Propal extends CommonObject
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result .= $linkstart;
$result.=($linkstart.img_object(($notooltip?'':$label), $this->picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); 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 && $withpicto != 2) if ($withpicto != 2) $result.= $this->ref;
$result.=' '; $result .= $linkend;
$result.=$linkstart.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -1906,6 +1906,40 @@ class Commande extends CommonOrder
return $nb; 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 * 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 * 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; //print $sql;
dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG); dol_syslog(get_class($this)."::loadExpeditions", LOG_DEBUG);
$result = $this->db->query($sql); $resql = $this->db->query($sql);
if ($result) if ($resql)
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($resql);
$this->expeditions[$obj->rowid] = $obj->qty; $this->expeditions[$obj->rowid] = $obj->qty;
$i++; $i++;
} }
$this->db->free(); $this->db->free($resql);
return $num; return $num;
} }
else else
@ -1951,7 +1985,6 @@ class Commande extends CommonOrder
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
/** /**
@ -2002,18 +2035,18 @@ class Commande extends CommonOrder
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
$sql.= " WHERE ps.fk_product IN (".join(',',$array_of_product).")"; $sql.= " WHERE ps.fk_product IN (".join(',',$array_of_product).")";
$sql.= ' GROUP BY fk_product '; $sql.= ' GROUP BY fk_product ';
$result = $this->db->query($sql); $resql = $this->db->query($sql);
if ($result) if ($resql)
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($resql);
$this->stocks[$obj->fk_product] = $obj->total; $this->stocks[$obj->fk_product] = $obj->total;
$i++; $i++;
} }
$this->db->free(); $this->db->free($resql);
} }
} }
return 0; return 0;
@ -3368,7 +3401,6 @@ class Commande extends CommonOrder
if ($short) return $url; if ($short) return $url;
$picto = 'order';
$label = ''; $label = '';
if ($user->rights->commande->lire) { if ($user->rights->commande->lire) {
@ -3402,9 +3434,11 @@ class Commande extends CommonOrder
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); $result .= $linkstart;
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
$result.=$linkstart.$this->ref.$linkend; if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
return $result; return $result;
} }

View File

@ -142,7 +142,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -151,7 +151,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -1324,11 +1324,14 @@ class Account extends CommonObject
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
} }
$link = '<a href="'.$url.$linkclose; $linkstart = '<a href="'.$url.$linkclose;
$linkend='</a>'; $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; return $result;
} }

View File

@ -103,7 +103,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -745,7 +745,7 @@ class Invoices extends DolibarrApi
* *
* @param int $id Id of invoice * @param int $id Id of invoice
* *
* @url GET {id}/getpayments * @url GET {id}/payments
* *
* @return array * @return array
* @throws 400 * @throws 400
@ -779,6 +779,120 @@ class Invoices extends DolibarrApi
return $result; 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 * Clean sensible object datas
* *

View File

@ -79,6 +79,8 @@ class Facture extends CommonInvoice
public $remise_percent; public $remise_percent;
public $total_ht=0; public $total_ht=0;
public $total_tva=0; public $total_tva=0;
public $total_localtax1=0;
public $total_localtax2=0;
public $total_ttc=0; public $total_ttc=0;
public $revenuestamp; public $revenuestamp;
@ -977,6 +979,8 @@ class Facture extends CommonInvoice
$line->subprice = $object->lines[$i]->subprice; $line->subprice = $object->lines[$i]->subprice;
$line->total_ht = $object->lines[$i]->total_ht; $line->total_ht = $object->lines[$i]->total_ht;
$line->total_tva = $object->lines[$i]->total_tva; $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->total_ttc = $object->lines[$i]->total_ttc;
$line->vat_src_code = $object->lines[$i]->vat_src_code; $line->vat_src_code = $object->lines[$i]->vat_src_code;
$line->tva_tx = $object->lines[$i]->tva_tx; $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); $label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva)) if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $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)) if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $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; if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
@ -1153,9 +1161,10 @@ class Facture extends CommonInvoice
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); $result .= $linkstart;
if ($withpicto && $withpicto != 2) $result.=' '; 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.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend; if ($withpicto != 2) $result.= ($max?dol_trunc($this->ref,$max):$this->ref);
$result .= $linkend;
if ($addlinktonotes) if ($addlinktonotes)
{ {

View File

@ -138,7 +138,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -174,7 +174,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -40,6 +40,7 @@ class Contact extends CommonObject
public $element='contact'; public $element='contact';
public $table_element='socpeople'; public $table_element='socpeople';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'contact';
public $civility_id; // In fact we store civility_code public $civility_id; // In fact we store civility_code
public $civility_code; public $civility_code;
@ -1053,8 +1054,12 @@ class Contact extends CommonObject
$linkend='</a>'; $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; return $result;
} }

View File

@ -160,7 +160,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -326,7 +326,6 @@ if (empty($reshook))
{ {
$label = $lines[$i]->product_label; $label = $lines[$i]->product_label;
} }
$desc = ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):''; $desc = ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
} }
else { else {

View File

@ -1878,7 +1878,6 @@ class Contrat extends CommonObject
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
//} //}
$picto = 'contract';
$label = ''; $label = '';
if ($user->rights->contrat->lire) { if ($user->rights->contrat->lire) {
@ -1913,9 +1912,11 @@ class Contrat extends CommonObject
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); $result .= $linkstart;
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
$result.=$linkstart.$this->ref.$linkend; if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
return $result; return $result;
} }
@ -2089,10 +2090,10 @@ class Contrat extends CommonObject
if ($mode == 'inactives') { if ($mode == 'inactives') {
$warning_delay = $conf->contrat->services->inactifs->warning_delay; $warning_delay = $conf->contrat->services->inactifs->warning_delay;
$label = $langs->trans("BoardNotActivatedServices"); $label = $langs->trans("BoardNotActivatedServices");
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=0'; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=0';
} else { } else {
$warning_delay = $conf->contrat->services->expires->warning_delay; $warning_delay = $conf->contrat->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=4&amp;filter=expired'; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=4&amp;filter=expired';
$label = $langs->trans("BoardRunningServices"); $label = $langs->trans("BoardRunningServices");
} }

View File

@ -190,7 +190,7 @@ foreach($listofstatus as $status)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>'; 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"; print "</tr>\n";
} }
if ($status==4 && ! $bool) $bool=true; if ($status==4 && ! $bool) $bool=true;
@ -210,7 +210,7 @@ foreach($listofstatus as $status)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>'; 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; if ($status==4 && ! $bool) $bool=true;
else $bool=false; else $bool=false;
print "</tr>\n"; print "</tr>\n";
@ -468,7 +468,7 @@ if ($resql)
print '<table class="noborder" width="100%">'; 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"; print "</tr>\n";
while ($i < $num) while ($i < $num)
@ -548,7 +548,7 @@ if ($resql)
print '<table class="noborder" width="100%">'; 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&amp;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&amp;filter=expired"><span class="badge">'.$num.'</span></a></th>';
print "</tr>\n"; print "</tr>\n";
while ($i < $num) while ($i < $num)

View File

@ -137,7 +137,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -19,7 +19,7 @@
*/ */
/** /**
* \file htdocs/contrat/services.php * \file htdocs/contrat/services_list.php
* \ingroup contrat * \ingroup contrat
* \brief Page to list services in contracts * \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) 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); $sql .= $db->plimit($limit + 1, $offset);
//print $sql; //print $sql;
dol_syslog("contrat/services.php", LOG_DEBUG); dol_syslog("contrat/services_list.php", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);
if (! $resql) if (! $resql)
{ {

View File

@ -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( $result=$extrafields->addExtraField(
GETPOST('attrname', 'alpha'), GETPOST('attrname', 'alpha'),
GETPOST('label', 'alpha'), GETPOST('label', 'alpha'),
@ -173,7 +177,7 @@ if ($action == 'add')
$params, $params,
(GETPOST('alwayseditable', 'alpha')?1:0), (GETPOST('alwayseditable', 'alpha')?1:0),
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''), (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, 0,
GETPOST('computed_value','alpha'), GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:''), (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( $result=$extrafields->update(
GETPOST('attrname', 'alpha'), GETPOST('attrname', 'alpha'),
GETPOST('label', 'alpha'), GETPOST('label', 'alpha'),
@ -335,7 +343,7 @@ if ($action == 'update')
$params, $params,
(GETPOST('alwayseditable', 'alpha')?1:0), (GETPOST('alwayseditable', 'alpha')?1:0),
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''), (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, 0,
GETPOST('default_value','alpha'), GETPOST('default_value','alpha'),
GETPOST('computed_value','alpha'), GETPOST('computed_value','alpha'),

View File

@ -567,7 +567,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
$input_files.=' '.escapeshellarg($f); $input_files.=' '.escapeshellarg($f);
} }
$cmd = 'pdftk '.$input_files.' cat output '.escapeshellarg($file); $cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file);
exec($cmd); exec($cmd);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))

View File

@ -89,9 +89,7 @@ else // For no ajax call
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
// Load traductions files // Load traductions files
$langs->load("ecm"); $langs->loadLangs(array("ecm","companies","other"));
$langs->load("companies");
$langs->load("other");
// Security check // Security check
if ($user->societe_id > 0) $socid = $user->societe_id; if ($user->societe_id > 0) $socid = $user->societe_id;

View File

@ -75,7 +75,7 @@ class box_ficheinter extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastFicheInter",$max)); $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 = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut,";
$sql.= " f.datec,"; $sql.= " f.datec,";

View File

@ -340,16 +340,6 @@ abstract class CommonObject
// No constructor as it is an abstract class // 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 * 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 * 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 $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 * 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) if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{ {
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : '')); $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").'"'; $placeholder=' placeholder="'.$langs->trans("Label").'"';
else $placeholder=' title="'.$langs->trans("Label").'"';
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
@ -4091,7 +4164,12 @@ abstract class CommonObject
$ecmfile=new EcmFiles($this->db); $ecmfile=new EcmFiles($this->db);
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename); $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 if (empty($ecmfile->share)) // Because object not found or share not set yet
{ {
@ -4115,6 +4193,7 @@ abstract class CommonObject
} }
else else
{ {
$ecmfile->entity = $conf->entity;
$ecmfile->filepath = $rel_dir; $ecmfile->filepath = $rel_dir;
$ecmfile->filename = $filename; $ecmfile->filename = $filename;
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content $ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content

View File

@ -1010,8 +1010,7 @@ class Form
$out.='<style type="text/css">.ui-autocomplete { z-index: 250; }</style>'; $out.='<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : '; if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) { else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"'; $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) { if ($hidelabel == 2) {
$out.= img_picto($langs->trans("Search"), 'search'); $out.= img_picto($langs->trans("Search"), 'search');
} }
@ -1818,8 +1817,7 @@ class Form
} }
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : '; if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) { else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"'; $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) { if ($hidelabel == 2) {
print img_picto($langs->trans("Search"), 'search'); print img_picto($langs->trans("Search"), 'search');
} }
@ -2566,6 +2564,8 @@ class Form
$this->db->free($result); $this->db->free($result);
$out.=ajax_combobox($htmlname);
if (empty($outputmode)) return $out; if (empty($outputmode)) return $out;
return $outarray; 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 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); * @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 * @return string HTML multiselect string

View File

@ -249,16 +249,16 @@ class FormActions
print $action->type; print $action->type;
print '</td>'; print '</td>';
print '<td>'.$label.'</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) if ($action->datef)
{ {
$tmpa=dol_getdate($action->datep); $tmpa=dol_getdate($action->datep);
$tmpb=dol_getdate($action->datef); $tmpb=dol_getdate($action->datef);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) 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>';
print '<td align="right">'; print '<td align="right">';

View File

@ -517,22 +517,31 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
if (preg_match('/[^0-9,]+/i',$out)) $out=''; if (preg_match('/[^0-9,]+/i',$out)) $out='';
break; break;
case 'alpha': case 'alpha':
if (! is_array($out))
{
$out=trim($out); $out=trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
if (preg_match('/"/',$out)) $out=''; if (preg_match('/"/',$out)) $out='';
else if (preg_match('/\.\.\//',$out)) $out=''; else if (preg_match('/\.\.\//',$out)) $out='';
}
break; break;
case 'san_alpha': case 'san_alpha':
$out=filter_var($out,FILTER_SANITIZE_STRING); $out=filter_var($out,FILTER_SANITIZE_STRING);
break; break;
case 'aZ': case 'aZ':
if (! is_array($out))
{
$out=trim($out); $out=trim($out);
if (preg_match('/[^a-z]+/i',$out)) $out=''; if (preg_match('/[^a-z]+/i',$out)) $out='';
}
break; break;
case 'aZ09': case 'aZ09':
if (! is_array($out))
{
$out=trim($out); $out=trim($out);
if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out=''; if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
}
break; break;
case 'array': case 'array':
if (! is_array($out) || empty($out)) $out=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); $out=dol_string_nohtmltag($out);
break; break;
case 'alphanohtml': // Recommended for search params case 'alphanohtml': // Recommended for search params
if (! is_array($out))
{
$out=trim($out); $out=trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
if (preg_match('/"/',$out)) $out=''; if (preg_match('/"/',$out)) $out='';
else if (preg_match('/\.\.\//',$out)) $out=''; else if (preg_match('/\.\.\//',$out)) $out='';
$out=dol_string_nohtmltag($out); $out=dol_string_nohtmltag($out);
}
break; break;
case 'custom': case 'custom':
if (empty($filter)) return 'BadFourthParameterForGETPOST'; 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) function dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
{ {
// escape quotes and backslashes, newlines, etc. // 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 (! $keepb) $tmp=strtr($tmp, array("<b>"=>'','</b>'=>''));
if (! $keepn) $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n')); 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" * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
* @param string $tzoutput true or 'gmt' => string is for Greenwich location * @param string $tzoutput true or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage * 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) * '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 Translate $outputlangs Object lang that contains language for text translation.
* @param boolean $encodetooutput false=no convert into output pagecode * @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; $to_gmt=true;
$offsettzstring=(empty($_SESSION['dol_tz_string'])?'UTC':$_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' $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; $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; $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) 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 || 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. // TODO Remove this.
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING); // 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' // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
$syear = (! empty($reg[1]) ? $reg[1] : ''); $syear = (! empty($reg[1]) ? $reg[1] : '');
$smonth = (! empty($reg[2]) ? $reg[2] : ''); $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] : ''); $ssec = (! empty($reg[6]) ? $reg[6] : '');
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true); $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 else
{ {
// Date is a timestamps // Date is a timestamps
if ($time < 100000000000) // Protection against bad date values 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'; else $ret='Bad value '.$time.' for date';
} }
if (preg_match('/__b__/i',$format)) 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. // 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'. $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) if ($encodetooutput)
{ {
@ -1745,7 +1762,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
} }
if (preg_match('/__a__/i',$format)) 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); $dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w);
$ret=str_replace('__A__',$dayweek,$ret); $ret=str_replace('__A__',$dayweek,$ret);
$ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret); $ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret);
@ -2714,19 +2733,17 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
} }
else 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='';
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.dol_escape_htmltag($titlealt).'">'; $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.=$langs->trans("EnableOverwriteTranslation"); if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$titlealt;
$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>'; $enabledisablehtml.='</span>';
return $enabledisablehtml; return $enabledisablehtml;
} }
@ -5465,6 +5482,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:''; $substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:'';
$substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object)?$object->total_ht:''; $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):''; $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 /* 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_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):''; $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object)?price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code):'';

View File

@ -132,9 +132,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).","; $texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].","; if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].","; 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['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']) if ($val['arrayofkeyval'])
{ {
$texttoinsert.= " 'arrayofkeyval'=>array("; $texttoinsert.= " 'arrayofkeyval'=>array(";
@ -215,8 +215,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
$pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; $pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php';
// Edit .sql file // Edit .sql file
$pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($objectname).'.sql'; $pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
if (! dol_is_file($pathoffiletoeditsrc)) if (! dol_is_file($pathoffiletoeditsrc))
{ {
$langs->load("errors"); $langs->load("errors");
@ -287,8 +287,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
} }
// Edit .key.sql file // Edit .key.sql file
$pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'; $pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
@ -301,7 +301,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
$i++; $i++;
if ($val['index']) 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"; $texttoinsert.= "\n";
} }
} }

View File

@ -61,10 +61,13 @@ function commande_prepare_head(Commande $object)
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->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; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipments"); 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->expedition_bon->enabled && $conf->livraison_bon->enabled) $text.='/';
if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings"); if ($conf->livraison_bon->enabled) $text.=$langs->trans("Receivings");
if ($nbReceiption > 0) $text.= ' <span class="badge">'.$nbReceiption.'</span>';
$head[$h][1] = $text; $head[$h][1] = $text;
$head[$h][2] = 'shipping'; $head[$h][2] = 'shipping';
$h++; $h++;

View File

@ -595,11 +595,12 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
* @param Translate $outputlangs Output language * @param Translate $outputlangs Output language
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...) * @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
* @param Object $object Object * @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 * @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_NAME__']='__FROM_NAME__';
$substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__'; $substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__';
return $substitutionarray; return $substitutionarray;

View File

@ -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 $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @param int $preselectedday Preselected day * @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 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 * @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 $conf, $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; 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)); //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++) for ($i = 0 ; $i < $numlines ; $i++)
@ -818,8 +822,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$level++; $level++;
if ($lines[$i]->id > 0) if ($lines[$i]->id > 0)
{ {
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $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); else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak);
} }
$level--; $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 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 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 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 * @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 $conf, $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; 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)); //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++) for ($i = 0 ; $i < $numlines ; $i++)
{ {
@ -1065,8 +1073,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$level++; $level++;
if ($lines[$i]->id > 0) if ($lines[$i]->id > 0)
{ {
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $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); else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak);
} }
$level--; $level--;
} }

View File

@ -294,6 +294,8 @@ function exportWebSite($website)
*/ */
function importWebSite($pathtofile) function importWebSite($pathtofile)
{ {
global $db;
$result = 0; $result = 0;
$filename = basename($pathtofile); $filename = basename($pathtofile);

View File

@ -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', 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&amp;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', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?&action=create&amp;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', 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', __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.php?leftmenu=contracts&amp;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', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&amp;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&amp;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', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&amp;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&amp;mode=4&amp;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', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&amp;mode=4&amp;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&amp;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 && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&amp;mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
-- Commercial - Interventions -- 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', 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&amp;leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->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->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&amp;leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);

View File

@ -182,7 +182,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='accountancy'; $idsel='accountancy';
$menu->add('/accountancy/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("Accountancy"), 0, $showmode, $atarget, "accountancy", '', 52, $id, $idsel, $classname); $menu->add('/accountancy/index.php?mainmenu=accountancy&amp;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/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000);
$newmenu->add("/contrat/card.php?action=create&amp;leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer); $newmenu->add("/contrat/card.php?action=create&amp;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/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); $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.php?leftmenu=contracts&amp;mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&amp;mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&amp;mode=4&amp;filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=4&amp;filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&amp;mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
} }
// Interventions // Interventions

View File

@ -553,10 +553,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
global $langs; global $langs;
$langs->load("admin"); $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 // If module name translation exists
return $langs->trans("Module".$this->numero."Name"); return $langs->transnoentitiesnoconv("Module".$this->numero."Name");
} }
else 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 ($langs->trans("Module".$this->name."Name") != ("Module".$this->name."Name"))
{ {
// If module name translation exists // If module name translation exists
return $langs->trans("Module".$this->name."Name"); return $langs->transnoentitiesnoconv("Module".$this->name."Name");
} }
// Last chance with simple label // 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; global $langs;
$langs->load("admin"); $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 // If module description translation exists
return $langs->trans("Module".$this->numero."Desc"); return $langs->transnoentitiesnoconv("Module".$this->numero."Desc");
} }
else 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 // If module name translation exists
return $langs->trans("Module".$this->name."Desc"); 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=''; $ret='';
$newversion=preg_replace('/_deprecated/','',$this->version); $newversion=preg_replace('/_deprecated/','',$this->version);
if ($newversion == 'experimental') $ret=($translated?$langs->trans("VersionExperimental"):$newversion); if ($newversion == 'experimental') $ret=($translated?$langs->transnoentitiesnoconv("VersionExperimental"):$newversion);
elseif ($newversion == 'development') $ret=($translated?$langs->trans("VersionDevelopment"):$newversion); elseif ($newversion == 'development') $ret=($translated?$langs->transnoentitiesnoconv("VersionDevelopment"):$newversion);
elseif ($newversion == 'dolibarr') $ret=DOL_VERSION; elseif ($newversion == 'dolibarr') $ret=DOL_VERSION;
elseif ($newversion) $ret=$newversion; 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; return $ret;
} }
@ -874,12 +874,12 @@ class DolibarrModules // Can not be abstract, because we need to insta
if ($langs->trans($langstring) == $langstring) if ($langs->trans($langstring) == $langstring)
{ {
// Translation not found // Translation not found
return $langs->trans($this->import_label[$r]); return $langs->transnoentitiesnoconv($this->import_label[$r]);
} }
else else
{ {
// Translation found // Translation found
return $langs->trans($langstring); return $langs->transnoentitiesnoconv($langstring);
} }
} }

View File

@ -77,9 +77,6 @@ if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
} }
else else
{ {
$conf->global->MAIN_HTML5_PLACEHOLDER = 1;
$usedbyinclude = 1; // Used into next include $usedbyinclude = 1; // Used into next include
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';

View File

@ -35,9 +35,10 @@ $langs->load("modulebuilder");
jQuery(document).ready(function() { jQuery(document).ready(function() {
function init_typeoffields(type) function init_typeoffields(type)
{ {
console.log("selected type is "+type); console.log("We select a new type = "+type);
var size = jQuery("#size"); var size = jQuery("#size");
var computed_value = jQuery("#computed_value"); var computed_value = jQuery("#computed_value");
var langfile = jQuery("#langfile");
var default_value = jQuery("#default_value"); var default_value = jQuery("#default_value");
var unique = jQuery("#unique"); var unique = jQuery("#unique");
var required = jQuery("#required"); var required = jQuery("#required");
@ -51,7 +52,7 @@ $langs->load("modulebuilder");
if (GETPOST('type','alpha') == "separate") 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();'; 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 == '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 == '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') { 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(); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();
} }
else { // type = string else { // type = string
@ -104,12 +105,13 @@ $langs->load("modulebuilder");
if (type == 'separate') if (type == 'separate')
{ {
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true); 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 else
{ {
default_value.removeAttr('disabled'); 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'); ?>'); init_typeoffields('<?php echo GETPOST('type','alpha'); ?>');
@ -162,7 +164,7 @@ $langs->load("modulebuilder");
<!-- Position --> <!-- 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> <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 --> <!-- 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 --> <!-- 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> <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) --> <!-- Default Value (at sql setup level) -->

View File

@ -37,6 +37,7 @@ $langs->load("modulebuilder");
console.log("select new type "+type); console.log("select new type "+type);
var size = jQuery("#size"); var size = jQuery("#size");
var computed_value = jQuery("#computed_value"); var computed_value = jQuery("#computed_value");
var langfile = jQuery("#langfile");
var default_value = jQuery("#default_value"); var default_value = jQuery("#default_value");
var unique = jQuery("#unique"); var unique = jQuery("#unique");
var required = jQuery("#required"); var required = jQuery("#required");
@ -50,7 +51,7 @@ $langs->load("modulebuilder");
if (GETPOST('type','alpha') == "separate") 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();'; print 'jQuery("#value_choice").hide();';
} }
?> ?>
@ -99,7 +100,8 @@ $langs->load("modulebuilder");
if (type == 'separate') if (type == 'separate')
{ {
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true); 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 else
{ {

View File

@ -83,7 +83,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
$b=new BlockedLog($this->db); $b=new BlockedLog($this->db);
$b->action = $action; $b->action = $action;
$b->amounts= $amounts; $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); $res = $b->create($user);

View File

@ -1051,62 +1051,18 @@ class Cronjob extends CommonObject
// Run a command line // Run a command line
if ($this->jobtype=='command') if ($this->jobtype=='command')
{ {
$command=escapeshellcmd($this->command); $outputdir = $conf->cron->dir_temp;
$command.=" 2>&1"; if (empty($outputdir)) $outputdir = $conf->cronjob->dir_temp;
dol_mkdir($conf->cronjob->dir_temp);
$outputfile=$conf->cronjob->dir_temp.'/cronjob.'.$userlogin.'.out';
dol_syslog(get_class($this)."::run_jobs system:".$command, LOG_DEBUG); if (! empty($outputdir))
$output_arr=array(); {
dol_mkdir($outputdir);
$outputfile=$outputdir.'/cronjob.'.$userlogin.'.out'; // File used with popen method
$execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2); // 1 or 2 // Execute a CLI
if ($execmethod == 1) $retval = $this->executeCLI($this->command, $outputfile);
{
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++;
} }
} }
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)"); 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 * Reprogram a job
* *

View File

@ -31,12 +31,18 @@
*/ */
define('NOTOKENRENEWAL',1); // Disables token renewal 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")) if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'bittorrent' && ! defined("NOLOGIN"))
{ {
define("NOLOGIN",1); define("NOLOGIN",1);
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. 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('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
@ -111,21 +117,23 @@ if (! empty($hashp))
$result = $ecmfile->fetch(0, '', '', '', $hashp); $result = $ecmfile->fetch(0, '', '', '', $hashp);
if ($result > 0) 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]; $moduleparttocheck = $tmp[0];
if ($moduleparttocheck == $modulepart) if ($moduleparttocheck == $modulepart)
{ {
// We remove first level of directory
$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir $original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir
//var_dump($original_file); exit; //var_dump($original_file); exit;
} }
else 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 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,14 +146,21 @@ $refname=basename(dirname($original_file)."/");
// Security check // Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart'); if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed']; $accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
// Basic protection (against external users only) if (! empty($hashp))
if ($user->societe_id > 0)
{ {
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
}
else
{
// Basic protection (against external users only)
if ($user->societe_id > 0)
{
if ($sqlprotectagainstexternals) if ($sqlprotectagainstexternals)
{ {
$resql = $db->query($sqlprotectagainstexternals); $resql = $db->query($sqlprotectagainstexternals);
@ -165,6 +180,7 @@ if ($user->societe_id > 0)
} }
} }
} }
}
} }
// Security: // Security:

View File

@ -112,6 +112,7 @@ class EcmFiles //extends CommonObject
} }
if (isset($this->filepath)) { if (isset($this->filepath)) {
$this->filepath = trim($this->filepath); $this->filepath = trim($this->filepath);
$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /
} }
if (isset($this->fullpath_orig)) { if (isset($this->fullpath_orig)) {
$this->fullpath_orig = trim($this->fullpath_orig); $this->fullpath_orig = trim($this->fullpath_orig);
@ -164,6 +165,11 @@ class EcmFiles //extends CommonObject
$maxposition=$maxposition+1; $maxposition=$maxposition+1;
// Check parameters // 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 // Put here code to add control on parameters values
// Insert request // Insert request
@ -349,7 +355,7 @@ class EcmFiles //extends CommonObject
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
return - 1; return -1;
} }
} }

View File

@ -64,7 +64,7 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="label"; if (! $sortfield) $sortfield="label";
$section=GETPOST("section"); $section=GETPOST("section",'alpha');
if (! $section) if (! $section)
{ {
dol_print_error('','Error, section parameter missing'); dol_print_error('','Error, section parameter missing');
@ -101,7 +101,7 @@ $filepathtodocument=$relativetodocument.$file->label;
// Try to load object from index // Try to load object from index
$object = new ECMFiles($db); $object = new ECMFiles($db);
$result=$object->fetch(0, '', $filepathtodocument); $result=$object->fetch(0, '', $filepathtodocument);
if (! ($result >= 0)) if ($result < 0)
{ {
dol_print_error($db, $object->error, $object->errors); dol_print_error($db, $object->error, $object->errors);
exit; exit;
@ -109,7 +109,6 @@ if (! ($result >= 0))
/* /*
* Actions * Actions
*/ */
@ -124,7 +123,7 @@ if ($cancel)
} }
else else
{ {
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.$urlfile.'&section='.$section); header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'&section='.urlencode($section));
exit; exit;
} }
} }
@ -140,13 +139,18 @@ if ($action == 'update')
//$db->begin(); //$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; $olddir=$conf->ecm->dir_output.'/'.$olddir;
$newdir=$olddir; $newdir=$olddir;
$oldfile=$olddir.$oldlabel; $oldfile=$olddir.$oldlabel;
$newfile=$newdir.$newlabel; $newfile=$newdir.$newlabel;
// Now we update index of file
$db->begin();
//print $oldfile.' - '.$newfile; //print $oldfile.' - '.$newfile;
if ($newlabel != $oldlabel) if ($newlabel != $oldlabel)
{ {
@ -157,14 +161,17 @@ if ($action == 'update')
setEventMessages($langs->trans('ErrorFailToRenameFile',$oldfile,$newfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToRenameFile',$oldfile,$newfile), null, 'errors');
$error++; $error++;
} }
// Reload object after the move
$result=$object->fetch(0, '', $newdirrelativetodocument.$newlabel);
if ($result < 0)
{
dol_print_error($db, $object->error, $object->errors);
exit;
}
} }
// Now we update index of file
$db->begin();
if (! $error) if (! $error)
{
if (is_object($object))
{ {
if ($shareenabled) if ($shareenabled)
{ {
@ -175,11 +182,31 @@ if ($action == 'update')
{ {
$object->share = ''; $object->share = '';
} }
if ($object->id > 0)
{
// Call update to set the share key
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) if ($result < 0)
{ {
$error++; setEventMessages($object->error, $object->errors, 'warnings');
setEventMessages($object->error, $object->errors, 'errors'); }
}
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) if (!$error)
{ {
$db->commit(); $db->commit();
$urlfile=$newlabel; $urlfile=$newlabel;
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'&section='.urlencode($section));
exit;
} }
else 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=$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 //$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>'; print '<tr><td>'.$langs->trans("DirectDownloadInternalLink").'</td><td>';
$modulepart='ecm'; $modulepart='ecm';
$forcedownload=1; $forcedownload=1;
@ -308,9 +339,10 @@ $fulllink=$urlwithroot.$rellink;
print img_picto('','object_globe.png').' '; print img_picto('','object_globe.png').' ';
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">'; if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">';
else print $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>'; print '</td></tr>';
// Link for direct external download
print '<tr><td>'; print '<tr><td>';
if ($action != 'edit') print $langs->trans("DirectDownloadLink"); if ($action != 'edit') print $langs->trans("DirectDownloadLink");
else print $langs->trans("FileSharedViaALink"); else print $langs->trans("FileSharedViaALink");
@ -332,7 +364,7 @@ if (! empty($object->share))
print img_picto('','object_globe.png').' '; print img_picto('','object_globe.png').' ';
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">'; if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
else print $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 else
{ {
@ -374,7 +406,7 @@ if ($action == 'edit')
// Confirmation de la suppression d'une ligne categorie // Confirmation de la suppression d'une ligne categorie
if ($action == 'delete_file') 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) if ($user->rights->ecm->setup)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&section='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&section='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel&section='.$section.'&urlfile='.urlencode($urlfile).'&backtopage='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>'; //print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel&section='.$section.'&urlfile='.urlencode($urlfile).'&backtopage='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
} }

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * 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) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Yasser Carreón <yacasia@gmail.com> * 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('origin_id','int'); // Id of order or propal
if (empty($origin_id)) $origin_id = GETPOST('object_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'); $ref=GETPOST('ref','alpha');
$line_id = GETPOST('lineid','int')?GETPOST('lineid','int'):'';
// Security check // Security check
$socid=''; $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'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails // Actions to send emails
@ -1242,6 +1516,7 @@ if ($action == 'create')
print '<!-- Show details of lot -->'; print '<!-- Show details of lot -->';
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">'; 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 $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 $line->fk_product.' - '.$dbatch->batch;
print $langs->trans("Batch").': '; print $langs->trans("Batch").': ';
@ -1329,7 +1604,13 @@ if ($action == 'create')
print "</table>"; 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 '&nbsp; ';
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>'; print '</form>';
@ -1732,6 +2013,15 @@ else if ($id || $ref)
/* /*
* Lines of products * Lines of products
*/ */
if ($action == 'editline')
{
print ' <form name="updateline" id="updateline" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;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 '<br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -1743,6 +2033,36 @@ else if ($id || $ref)
} }
print '<td>'.$langs->trans("Products").'</td>'; print '<td>'.$langs->trans("Products").'</td>';
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>'; print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
if ($origin && $origin_id > 0)
{
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
{
if ($object->statut <= 1) if ($object->statut <= 1)
{ {
print '<td align="center">'.$langs->trans("QtyToShip").'</td>'; print '<td align="center">'.$langs->trans("QtyToShip").'</td>';
@ -1751,16 +2071,6 @@ else if ($id || $ref)
{ {
print '<td align="center">'.$langs->trans("QtyShipped").'</td>'; print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
} }
if ($origin && $origin_id > 0)
{
print '<td align="center">'.$langs->trans("QtyInOtherShipments").'</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 (! empty($conf->stock->enabled))
{ {
print '<td align="left">'.$langs->trans("WarehouseSource").'</td>'; print '<td align="left">'.$langs->trans("WarehouseSource").'</td>';
@ -1770,7 +2080,15 @@ else if ($id || $ref)
{ {
print '<td align="left">'.$langs->trans("Batch").'</td>'; 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 ($object->statut == 0)
{
print '<td class="linecoledit"></td>';
print '<td class="linecoldelete" width="10"></td>';
}
print "</tr>\n"; print "</tr>\n";
$var=false; $var=false;
@ -1894,9 +2212,6 @@ else if ($id || $ref)
// Qty ordered // Qty ordered
print '<td align="center">'.$lines[$i]->qty_asked.'</td>'; 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) // Qty in other shipments (with shipment and warehouse used)
if ($origin && $origin_id > 0) if ($origin && $origin_id > 0)
{ {
@ -1928,20 +2243,69 @@ else if ($id || $ref)
} }
print '</td>'; print '</td>';
// Weight if ($action == 'editline' && $lines[$i]->id == $line_id)
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"); // edit mode
else print '&nbsp;'; print '<td colspan="'.$editColspan.'"><table>';
print '</td>'; if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0)
{
// Volume $line = new ExpeditionLigne($db);
print '<td align="center">'; foreach ($lines[$i]->detail_batch as $detail_batch)
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume"); {
else print '&nbsp;'; print '<tr>';
print '</td>'; // 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>';
// Size // Batch number managment
//print '<td align="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").'</td>'; 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 // Warehouse source
if (! empty($conf->stock->enabled)) if (! empty($conf->stock->enabled))
@ -1994,6 +2358,47 @@ else if ($id || $ref)
print '<td></td>'; 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");
else print '&nbsp;';
print '</td>';
// Volume
print '<td align="center">';
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume");
else print '&nbsp;';
print '</td>';
// Size
//print '<td align="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").'</td>';
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
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>';
}
else if ($object->statut == 0)
{
// edit-delete buttons
print '<td class="linecoledit" align="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
print '</td>';
print '<td class="linecoldelete" width="10">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=deleteline&amp;lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>';
print '</td>';
// Display lines extrafields
if (! empty($rowExtrafieldsStart))
{
print $rowExtrafieldsStart;
print $rowExtrafieldsView;
print $rowEnd;
}
}
print "</tr>"; print "</tr>";
// Display lines extrafields // Display lines extrafields
@ -2002,11 +2407,16 @@ else if ($id || $ref)
$line = new ExpeditionLigne($db); $line = new ExpeditionLigne($db);
$line->fetch_optionals($lines[$i]->id,$extralabelslines); $line->fetch_optionals($lines[$i]->id,$extralabelslines);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
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 $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
}
print '</tr>'; print '</tr>';
} }
} }
// TODO Show also lines ordered but not delivered // TODO Show also lines ordered but not delivered
@ -2114,7 +2524,7 @@ else if ($id || $ref)
* Documents generated * Documents generated
*/ */
if ($action != 'presend') if ($action != 'presend' && $action != 'editline')
{ {
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
@ -2161,136 +2571,6 @@ else if ($id || $ref)
$trackid = 'shi'.$object->id; $trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; 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();
}*/
} }

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * 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) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
@ -372,49 +372,19 @@ class Expedition extends CommonObject
* @return int <0 if KO, line_id if OK * @return int <0 if KO, line_id if OK
*/ */
function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0)
{
global $conf;
$error = 0;
$line_id = 0;
$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)
{
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
}
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 = new ExpeditionLigne($this->db);
$expeditionline->array_options=$array_options; $expeditionline->fk_expedition = $this->id;
$expeditionline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$expeditionline->table_element); $expeditionline->entrepot_id = $entrepot_id;
$result=$expeditionline->insertExtraFields(); $expeditionline->fk_origin_line = $origin_line_id;
if ($result < 0) $expeditionline->qty = $qty;
$expeditionline->array_options = $array_options;
if (($lineId = $expeditionline->insert()) < 0)
{ {
$this->error[]=$expeditionline->error; $this->error[]=$expeditionline->error;
$error++;
} }
} return $lineId;
if (! $error) return $line_id;
else return -1;
} }
@ -1366,6 +1336,7 @@ class Expedition extends CommonObject
$detail_entrepot = new stdClass; $detail_entrepot = new stdClass;
$detail_entrepot->entrepot_id = $obj->fk_entrepot; $detail_entrepot->entrepot_id = $obj->fk_entrepot;
$detail_entrepot->qty_shipped = $obj->qty_shipped; $detail_entrepot->qty_shipped = $obj->qty_shipped;
$detail_entrepot->line_id = $obj->line_id;
$line->details_entrepot[] = $detail_entrepot; $line->details_entrepot[] = $detail_entrepot;
$line->line_id = $obj->line_id; $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">'; $linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $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; return $result;
} }
@ -2238,6 +2209,17 @@ class Expedition extends CommonObject
*/ */
class ExpeditionLigne extends CommonObjectLine 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; var $db;
// From llx_expeditiondet // From llx_expeditiondet
@ -2245,6 +2227,12 @@ class ExpeditionLigne extends CommonObjectLine
var $qty_shipped; var $qty_shipped;
var $fk_product; var $fk_product;
var $detail_batch; var $detail_batch;
/**
* Id of warehouse
* @var int
*/
public $entrepot_id;
// From llx_commandedet or llx_propaldet // From llx_commandedet or llx_propaldet
var $qty_asked; var $qty_asked;
@ -2261,10 +2249,7 @@ class ExpeditionLigne extends CommonObjectLine
var $total_localtax1; // Total Local tax 1 var $total_localtax1; // Total Local tax 1
var $total_localtax2; // Total Local tax 2 var $total_localtax2; // Total Local tax 2
public $element='expeditiondet';
public $table_element='expeditiondet';
public $fk_origin_line;
// Deprecated // Deprecated
/** /**
@ -2293,5 +2278,393 @@ class ExpeditionLigne extends CommonObjectLine
$this->db=$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;
}
}
} }

View File

@ -111,7 +111,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -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->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'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$langs->load('orders'); $langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm'));
$langs->load("companies");
$langs->load("bills");
$langs->load('propal');
$langs->load('deliveries');
$langs->load('stocks');
$langs->load("productbatch");
$id=GETPOST('id','int'); // id of order $id=GETPOST('id','int'); // id of order
$ref= GETPOST('ref','alpha'); $ref= GETPOST('ref','alpha');
@ -157,6 +151,15 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); 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 // shipping method
if ($action == 'setshippingmethod' && $user->rights->commande->creer) { if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
$object = new Commande($db); $object = new Commande($db);
@ -528,7 +531,7 @@ if ($id > 0 || ! empty($ref))
print '<table width="100%" class="nobordernopadding"><tr><td>'; print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel'); print $langs->trans('IncotermLabel');
print '<td><td align="right">'; 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 '&nbsp;'; else print '&nbsp;';
print '</td></tr></table>'; print '</td></tr></table>';
print '</td>'; print '</td>';

View File

@ -1544,7 +1544,6 @@ class ExpenseReport extends CommonObject
if ($short) return $url; if ($short) return $url;
$picto='trip';
$label = '<u>' . $langs->trans("ShowExpenseReport") . '</u>'; $label = '<u>' . $langs->trans("ShowExpenseReport") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
@ -1583,8 +1582,11 @@ class ExpenseReport extends CommonObject
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend.' '); $result .= $linkstart;
$result.=$linkstart.($max?dol_trunc($ref,$max):$ref).$linkend; 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; return $result;
} }

View File

@ -123,7 +123,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -671,7 +671,6 @@ class Fichinter extends CommonObject
if (! empty($this->ref)) if (! empty($this->ref))
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref; $label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
$picto='intervention';
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
if ($option !== 'nolink') if ($option !== 'nolink')
@ -698,9 +697,11 @@ class Fichinter extends CommonObject
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); $result .= $linkstart;
if ($withpicto && $withpicto != 2) $result.=' '; 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.=$linkstart.$this->ref.$linkend; if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
return $result; return $result;
} }

View File

@ -119,7 +119,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -393,7 +393,7 @@ if ($object->id > 0)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre'.(($num == 0) ? ' nobottom':'').'">'; print '<tr class="liste_titre'.(($num == 0) ? ' nobottom':'').'">';
print '<td colspan="3">'.$langs->trans("ProductsAndServices").'</td><td align="right">'; 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>'; print '</a></td></tr>';
$return = array(); $return = array();

View File

@ -1497,6 +1497,7 @@ class FactureFournisseur extends CommonInvoice
else else
{ {
$this->error=$this->line->error; $this->error=$this->line->error;
$this->errors=$this->line->errors;
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }

View File

@ -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'; $help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('',$langs->trans("Order"),$help_url); llxHeader('',$langs->trans("Order"),$help_url);
/* *************************************************************************** */
/* */
/* Mode vue et edition */
/* */
/* *************************************************************************** */
$now=dol_now(); $now=dol_now();
if ($action=='create') if ($action=='create')

View File

@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -175,7 +175,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{ {
foreach($extrafields->attribute_label as $key => $val) 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]));
} }
} }

View File

@ -828,7 +828,7 @@ class Holiday extends CommonObject
global $langs; global $langs;
$result=''; $result='';
$picto='holiday';
$label=$langs->trans("Show").': '.$this->ref; $label=$langs->trans("Show").': '.$this->ref;
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id; $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">'; $linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend); $result .= $linkstart;
if ($withpicto && $withpicto != 2) $result.=' '; 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.=$linkstart.$this->ref.$linkend; if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
return $result; return $result;
} }

0
htdocs/includes/stripe/build.php Normal file → Executable file
View File

View 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 -- 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 = 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; ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
--VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET 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'; 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 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 DEFAULT nextval('llx_supplier_proposal_rowid_seq');
-- VPGSQL8.2 ALTER TABLE llx_supplier_proposal ALTER COLUMN rowid SET NOT NULL; -- 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_intra varchar(32) AFTER accountancy_code_sell;
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_export varchar(32) AFTER accountancy_code_sell_intra; 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);

View 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);

View 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;

View File

@ -21,7 +21,7 @@ CREATE TABLE llx_blockedlog
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, tms timestamp,
action varchar(50), action varchar(50),
amounts real NOT NULL, amounts double(24,8) NOT NULL,
signature varchar(100) NOT NULL, signature varchar(100) NOT NULL,
signature_line varchar(100) NOT NULL, signature_line varchar(100) NOT NULL,
element varchar(50), element varchar(50),

View File

@ -34,7 +34,7 @@ create table llx_chargesociales
fk_type integer NOT NULL, fk_type integer NOT NULL,
fk_account integer, -- bank account fk_account integer, -- bank account
fk_mode_reglement integer, -- mode de reglement fk_mode_reglement integer, -- mode de reglement
amount real default 0 NOT NULL, amount double(24,8) default 0 NOT NULL,
paye smallint default 0 NOT NULL, paye smallint default 0 NOT NULL,
periode date, periode date,
fk_projet integer DEFAULT NULL, fk_projet integer DEFAULT NULL,

View File

@ -42,7 +42,7 @@ create table llx_commande
fk_user_cloture integer, -- user closing 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 ? 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, fk_statut smallint default 0,
amount_ht real default 0, amount_ht double(24,8) default 0,
remise_percent real default 0, remise_percent real default 0,
remise_absolue real default 0, remise_absolue real default 0,
remise real default 0, remise real default 0,

View File

@ -46,7 +46,7 @@ create table llx_commande_fournisseur
source smallint NOT NULL, -- not used, except by setting this to 42 for orders coming for replenishment and 0 in other case ? 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, fk_statut smallint default 0,
billed smallint default 0, billed smallint default 0,
amount_ht real default 0, amount_ht double(24,8) default 0,
remise_percent real default 0, remise_percent real default 0,
remise real default 0, remise real default 0,
tva double(24,8) default 0, tva double(24,8) default 0,

View File

@ -28,7 +28,7 @@ create table llx_don
tms timestamp, tms timestamp,
fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate fk_statut smallint NOT NULL DEFAULT 0, -- Status of donation promise or validate
datedon datetime, -- Date of the donation/promise datedon datetime, -- Date of the donation/promise
amount real DEFAULT 0, amount double(24,8) DEFAULT 0,
fk_payment integer, fk_payment integer,
paid smallint default 0 NOT NULL, paid smallint default 0 NOT NULL,
firstname varchar(50), firstname varchar(50),

View File

@ -23,7 +23,7 @@ CREATE TABLE llx_expensereport_rules (
tms timestamp, tms timestamp,
dates datetime NOT NULL, dates datetime NOT NULL,
datee datetime NOT NULL, datee datetime NOT NULL,
amount numeric(24,8) NOT NULL, amount double(24,8) NOT NULL,
restrictive tinyint NOT NULL, restrictive tinyint NOT NULL,
fk_user integer DEFAULT NULL, fk_user integer DEFAULT NULL,
fk_usergroup integer DEFAULT NULL, fk_usergroup integer DEFAULT NULL,

View File

@ -27,7 +27,7 @@ create table llx_loan
label varchar(80) NOT NULL, label varchar(80) NOT NULL,
fk_bank integer, fk_bank integer,
capital real default 0 NOT NULL, capital double(24,8) default 0 NOT NULL,
datestart date, datestart date,
dateend date, dateend date,
nbterm real, nbterm real,
@ -36,7 +36,7 @@ create table llx_loan
note_private text, note_private text,
note_public text, note_public text,
capital_position real default 0, -- If not a new loan, just have the position of capital capital_position double(24,8) default 0, -- If not a new loan, just have the position of capital
date_position date, date_position date,
paid smallint default 0 NOT NULL, paid smallint default 0 NOT NULL,

View File

@ -24,9 +24,9 @@ create table llx_loan_schedule
datec datetime, -- creation date datec datetime, -- creation date
tms timestamp, tms timestamp,
datep datetime, -- payment date datep datetime, -- payment date
amount_capital real DEFAULT 0, amount_capital double(24,8) DEFAULT 0,
amount_insurance real DEFAULT 0, amount_insurance double(24,8) DEFAULT 0,
amount_interest real DEFAULT 0, amount_interest double(24,8) DEFAULT 0,
fk_typepayment integer NOT NULL, fk_typepayment integer NOT NULL,
num_payment varchar(50), num_payment varchar(50),
note_private text, note_private text,

View File

@ -23,7 +23,7 @@ create table llx_paiementcharge
datec datetime, -- date de creation datec datetime, -- date de creation
tms timestamp, tms timestamp,
datep datetime, -- payment date datep datetime, -- payment date
amount real DEFAULT 0, amount double(24,8) DEFAULT 0,
fk_typepaiement integer NOT NULL, fk_typepaiement integer NOT NULL,
num_paiement varchar(50), num_paiement varchar(50),
note text, note text,

View File

@ -25,7 +25,7 @@ create table llx_paiementfourn
tms timestamp, tms timestamp,
datec datetime, -- date de creation de l'enregistrement datec datetime, -- date de creation de l'enregistrement
datep datetime, -- date de paiement datep datetime, -- date de paiement
amount real DEFAULT 0, -- montant amount double(24,8) DEFAULT 0, -- montant
multicurrency_amount double(24,8) DEFAULT 0, -- multicurrency amount multicurrency_amount double(24,8) DEFAULT 0, -- multicurrency amount
fk_user_author integer, -- auteur fk_user_author integer, -- auteur
fk_paiement integer NOT NULL, -- moyen de paiement fk_paiement integer NOT NULL, -- moyen de paiement

View File

@ -23,7 +23,7 @@ create table llx_payment_donation
datec datetime, -- date de creation datec datetime, -- date de creation
tms timestamp, tms timestamp,
datep datetime, -- payment date datep datetime, -- payment date
amount real DEFAULT 0, amount double(24,8) DEFAULT 0,
fk_typepayment integer NOT NULL, fk_typepayment integer NOT NULL,
num_payment varchar(50), num_payment varchar(50),
note text, note text,

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