Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into 7.0_new_shipment_update

This commit is contained in:
fappels 2017-10-31 16:49:54 +01:00
commit 3f5112ff48
277 changed files with 33059 additions and 1627 deletions

View File

@ -79,7 +79,7 @@ matrix:
notifications:
email:
on_success: never # [always|never|change] default: change
on_failure: change # [always|never|change] default: always
on_failure: never # [always|never|change] default: always
irc:
channels:
- "chat.freenode.net#dolibarr"
@ -319,7 +319,7 @@ script:
php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE > $TRAVIS_BUILD_DIR/upgrade600700-2.log
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
cd -
set +e

View File

@ -36,7 +36,7 @@ Stripe 4.7.0 MIT licence Yes
JS libraries:
jQuery 3.1.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.4 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery Flot 0.8.3 MIT License Yes JS library to build graph

View File

@ -28,6 +28,33 @@ Following changes may create regressions for some external modules, but were nec
* Remove js library fileupload that was not used by core code.
***** ChangeLog for 6.0.3 compared to 6.0.2 *****
FIX: #7211 Update qty dispatched on qty change
FIX: #7458
FIX: #7593
FIX: #7616
FIX: #7619
FIX: #7626
FIX: #7648
FIX: #7675
FIX: Agenda events are not exported in the ICAL, VCAL if begin exactly with the same $datestart
FIX: API to get object does not return data of linked objects
FIX: Bad localtax apply
FIX: Bad ressource list in popup in gantt view
FIX: bankentries search conciliated if val 0
FIX: hook formObjectOptions() must use $expe and not $object which i…
FIX: hook formObjectOptions() must use $expe and not $object which is an order here
FIX: make of link to other object during creation
FIX: Missing function getLinesArray
FIX: old batch not shown in multi shipping
FIX: paid supplier invoices are shown as abandoned
FIX: selection of thirdparty was lost on stats page of invoices
FIX: sql syntax error because of old field accountancy_journal
FIX: Stats on invoices show nothing
FIX: substitution in ODT of thirdparties documents
FIX: wrong key in selectarray
FIX: wrong personnal project time spent
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
FIX: #7148
FIX: #7288

View File

@ -78,15 +78,17 @@ $sqls=array(
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
'DELETE FROM '.MAIN_DB_PREFIX.'propal',
),
'supplier_order'=>array(
'supplier_proposal'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
),
'supplier_order'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
),
'supplier_invoice'=>array(
'supplier_invoice'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
),
'delivery'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
@ -114,8 +116,10 @@ $sqls=array(
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
'DELETE FROM '.MAIN_DB_PREFIX.'product',
'DELETE FROM '.MAIN_DB_PREFIX.'product_batch',
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
'DELETE FROM '.MAIN_DB_PREFIX.'product_lot',
'DELETE FROM '.MAIN_DB_PREFIX.'product',
),
'project'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
@ -128,12 +132,13 @@ $sqls=array(
),
'thirdparty'=>array(
'@contact',
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL',
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib',
'DELETE FROM '.MAIN_DB_PREFIX.'societe',
)
);
@ -152,27 +157,37 @@ $mode = $argv[1];
$option = $argv[2];
if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
print "Usage: $script_file (test|confirm) (all|option)\n";
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',',array_keys($sqls))."\n";
exit(-1);
}
if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
print "Usage: $script_file (test|confirm) (all|option)\n";
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',',array_keys($sqls))."\n";
exit(-1);
}
// Replace database handler
if (! empty($argv[3]))
{
$db->close();
unset($db);
$db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]);
$user=new User($db);
}
//var_dump($user->db->database_name);
$ret=$user->fetch('','admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
print 'An admin user with login "admin" must exists to use this script.'."\n";
exit;
}
$user->getrights();
//$user->getrights();
print "Purge all data for this database:\n";
print "Server = ".$db->database_host."\n";
@ -190,14 +205,14 @@ if (! $confirmed)
/**
* Process sql requests of a family
*
*
* @param string $family Name of family key of array $sqls
* @return int -1 if KO, 1 if OK
*/
function processfamily($family)
{
global $db, $sqls;
$error=0;
foreach($sqls[$family] as $sql)
{
@ -207,7 +222,7 @@ function processfamily($family)
processfamily($newfamily);
continue;
}
print "Run sql: ".$sql."\n";
$resql=$db->query($sql);
if (! $resql)
@ -217,7 +232,7 @@ function processfamily($family)
$error++;
}
}
if ($error)
{
print $db->lasterror();
@ -225,7 +240,7 @@ function processfamily($family)
break;
}
}
if ($error) return -1;
else return 1;
}
@ -242,7 +257,7 @@ foreach($sqls as $family => $familysql)
$oldfamily = $family;
$result=processfamily($family);
if ($result < 0)
if ($result < 0)
{
$error++;
break;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -125,9 +125,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == AccountancyExport::$EXPORT_TYPE_CEGID) $sep = ";"; // For CEGID, we force separator.
$journal = 'bookkepping';
$journal = 'balance';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
@ -138,10 +137,11 @@ if ($action == 'export_csv') {
foreach ($object->lines as $line) {
print length_accountg($line->numero_compte) . $sep;
print $line->debit . $sep;
print $line->credit . $sep;
print $line->debit . $sep;
print $line->credit - $line->debit . $sep;
print $object->get_compte_desc($line->numero_compte) . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print price($line->debit) . $sep;
print price($line->credit - $line->debit) . $sep;
print "\n";
}
}

View File

@ -29,7 +29,7 @@ class AccountingJournal extends CommonObject
public $element='accounting_journal';
public $table_element='accounting_journal';
public $fk_element = '';
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $rowid;

View File

@ -37,7 +37,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -40,7 +40,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -43,7 +43,7 @@ class Adherent extends CommonObject
{
public $element='member';
public $table_element='adherent';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $mesgs;

View File

@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -44,7 +44,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -39,7 +39,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

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

View File

@ -539,7 +539,7 @@ print "<td>&nbsp;</td>\n";
print "</tr>\n";
$var=true;
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
@ -550,7 +550,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -573,7 +573,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext);
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
print '</td><td align="right">';

View File

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

View File

@ -193,20 +193,14 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{
// Button off, click to enable
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
//$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.$langs->trans("Disabled").'">';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableDefaultValues");
$enabledisablehtml.='</span>';
$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
$enabledisablehtml.= '</a>';
}
else
{
// Button on, click to disable
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
//$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.$langs->trans("Activated").'">';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableDefaultValues");
$enabledisablehtml.='</span>';
$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
$enabledisablehtml.= '</a>';
}

View File

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

View File

@ -47,7 +47,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
*
*
*
* 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
@ -47,7 +47,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

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

View File

@ -44,7 +44,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -711,7 +711,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
print "</td></tr>\n";
print '</form>';
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
@ -722,7 +722,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -744,7 +744,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext);
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td>';
print '<td><input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />';
print '</td><td align="right">';

View File

@ -534,7 +534,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
@ -544,7 +544,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='FICHINTER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -567,7 +567,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext).'<br>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.$conf->global->FICHINTER_DRAFT_WATERMARK.'">';
print '</td><td align="right">';

View File

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

View File

@ -47,7 +47,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
*
*
*
* 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
@ -47,7 +47,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -116,7 +116,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$action=GETPOST('action','aZ09');
$cancel=GETPOST('cancel','alpha');
$langs->load("companies");
$langs->load("products");
@ -62,22 +63,22 @@ error_reporting($err);
* Actions
*/
if ($action == 'update' && empty($_POST["cancel"]))
if ($action == 'update' && ! $cancel)
{
$_SESSION["mainmenu"]="home"; // Le gestionnaire de menu a pu changer
dolibarr_set_const($db, "MAIN_MENU_STANDARD", $_POST["MAIN_MENU_STANDARD"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENU_SMARTPHONE", $_POST["MAIN_MENU_SMARTPHONE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENU_STANDARD", GETPOST('MAIN_MENU_STANDARD','alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENU_SMARTPHONE", GETPOST('MAIN_MENU_SMARTPHONE','alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENUFRONT_STANDARD", $_POST["MAIN_MENUFRONT_STANDARD"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENUFRONT_SMARTPHONE",$_POST["MAIN_MENUFRONT_SMARTPHONE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENUFRONT_STANDARD", GETPOST('MAIN_MENUFRONT_STANDARD','alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MENUFRONT_SMARTPHONE", GETPOST('MAIN_MENUFRONT_SMARTPHONE','alpha'),'chaine',0,'',$conf->entity);
// Define list of menu handlers to initialize
$listofmenuhandler=array();
$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_STANDARD"])]=1;
$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_STANDARD"])]=1;
if (isset($_POST["MAIN_MENU_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENU_SMARTPHONE"])]=1;
if (isset($_POST["MAIN_MENUFRONT_SMARTPHONE"])) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',$_POST["MAIN_MENUFRONT_SMARTPHONE"])]=1;
$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENU_STANDARD','alpha'))]=1;
$listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENUFRONT_STANDARD','alpha'))]=1;
if (GETPOST('MAIN_MENU_SMARTPHONE','alpha')) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENU_SMARTPHONE','alpha'))]=1;
if (GETPOST('MAIN_MENUFRONT_SMARTPHONE','alpha')) $listofmenuhandler[preg_replace('/(_backoffice|_frontoffice|_menu)?\.php/i','',GETPOST('MAIN_MENUFRONT_SMARTPHONE','alpha'))]=1;
// Initialize menu handlers
foreach ($listofmenuhandler as $key => $val)
@ -179,7 +180,7 @@ if ($action == 'edit')
print '</tr>';
// Menu top
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMenuManager").'</td>';
print '<td>';
$formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled');
@ -190,7 +191,7 @@ if ($action == 'edit')
print '</tr>';
// Menu smartphone
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
print '<td>';
$formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard,$dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled');
@ -217,7 +218,7 @@ else
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMenuManager").'</td>';
print '<td>';
$filelib=preg_replace('/.php$/i','',(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED));
@ -229,7 +230,7 @@ else
print '</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
print '<td>';

View File

@ -421,9 +421,13 @@ if ($mode == 'feature')
$i=0;
foreach($objMod->tabs as $val)
{
$tmp=explode(':',$val,3);
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
$i++;
if (is_array($val)) $val=$val['data'];
if (is_string($val))
{
$tmp=explode(':',$val,3);
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
$i++;
}
}
}
else $text.=$langs->trans("No");
@ -508,10 +512,10 @@ if ($mode == 'feature')
$i=0;
foreach($objMod->module_parts['hooks'] as $key => $val)
{
if ($key == 'entity') continue;
if ($key === 'entity') continue;
// For special values
if ($key == 'data')
if ($key === 'data')
{
if (is_array($val))
{

View File

@ -44,7 +44,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -45,7 +45,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -110,10 +110,10 @@ $formother=new FormOther($db);
$formadmin=new FormAdmin($db);
$arraydetailsforpdffoot = array(
0 => $langs->trans('NoDetails'),
1 => $langs->trans('DisplayCompanyInfo'),
2 => $langs->trans('DisplayCompanyManagers'),
3 => $langs->trans('DisplayCompanyInfoAndManagers')
0 => $langs->transnoentitiesnoconv('NoDetails'),
1 => $langs->transnoentitiesnoconv('DisplayCompanyInfo'),
2 => $langs->transnoentitiesnoconv('DisplayCompanyManagers'),
3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
);
print load_fiche_titre($langs->trans("PDF"),'','title_setup');
@ -589,7 +589,7 @@ else // Show
print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print $arraydetailsforpdffoot[$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS];
print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)];
print '</td></tr>';
print '</table>';

View File

@ -545,7 +545,7 @@ print "</td></tr>\n";
print '</form>';
*/
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
@ -555,7 +555,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -577,7 +577,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'<br>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
print '</td><td align="right">';

View File

@ -43,7 +43,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

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

View File

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

View File

@ -500,7 +500,7 @@ print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
print "<td>&nbsp;</td>\n";
print "</tr>";
$substitutionarray=pdf_getSubstitutionArray($langs);
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
@ -511,7 +511,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -533,7 +533,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'<br>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input size="50" class="flat" type="text" name="SUPPLIER_PROPOSAL_DRAFT_WATERMARK" value="'.$conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK.'">';
print '</td><td align="right">';

View File

@ -48,7 +48,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -48,7 +48,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -44,7 +44,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -45,7 +45,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -210,7 +210,7 @@ llxHeader('',$langs->trans("Setup"),$wikihelp);
$param='&mode='.$mode;
$enabledisablehtml='';
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
$enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
{
// Button off, click to enable
@ -437,8 +437,8 @@ if ($mode == 'searchkey')
// Now search into translation array
foreach($newlang->tab_translate as $key => $val)
{
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/', $key)) continue;
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/', $val)) continue;
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/i', $key)) continue;
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/i', $val)) continue;
$recordtoshow[$key]=$val;
}
}

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
class Dictionary extends DolibarrApi
{
private $translations = null;
/**
* Constructor
*/
@ -52,11 +52,11 @@ class Dictionary extends DolibarrApi
* @param int $page Page number {@min 0}
* @param int $active Payment type is active or not {@min 0} {@max 1}
* @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
*
*
* @url GET payment/types
*
* @return array [List of payment types]
*
*
* @throws 400 RestException
* @throws 200 OK
*/
@ -104,7 +104,7 @@ class Dictionary extends DolibarrApi
return $list;
}
/**
* Get the list of countries.
*
@ -121,9 +121,9 @@ class Dictionary extends DolibarrApi
* @param string $lang Code of the language the label of the countries must be translated to
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of countries
*
*
* @url GET countries
*
*
* @throws RestException
*/
function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '')
@ -135,7 +135,7 @@ class Dictionary extends DolibarrApi
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."c_country as t";
$sql.=" WHERE 1 = 1";
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@ -144,7 +144,7 @@ class Dictionary extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $this->db->order($sortfield, $sortorder);
if ($limit) {
@ -152,7 +152,7 @@ class Dictionary extends DolibarrApi
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit, $offset);
}
@ -177,7 +177,7 @@ class Dictionary extends DolibarrApi
} else {
throw new RestException(503, 'Error when retrieving list of countries : '.$country->error);
}
return $list;
}
@ -187,9 +187,9 @@ class Dictionary extends DolibarrApi
* @param int $id ID of country
* @param string $lang Code of the language the name of the
* country must be translated to
*
*
* @url GET countries/{id}
*
*
* @throws RestException
*/
function getCountryByID($id, $lang = '')
@ -217,16 +217,16 @@ class Dictionary extends DolibarrApi
function _cleanObjectDatas($object)
{
$object = parent::_cleanObjectDatas($object);
unset($object->error);
unset($object->errors);
return $object;
}
/**
* Translate the name of the country to the given language.
*
*
* @param Ccountry $country Country
* @param string $lang Code of the language the name of the
* country must be translated to
@ -249,8 +249,8 @@ class Dictionary extends DolibarrApi
}
}
}
}
}
/**
* Get the list of events types.
*
@ -262,7 +262,7 @@ class Dictionary extends DolibarrApi
* @param string $module To filter on module events
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types
*
*
* @url GET events
*
* @throws RestException
@ -312,9 +312,9 @@ class Dictionary extends DolibarrApi
}
return $list;
}
}
/**
* Get the list of extra fields.
*
@ -323,7 +323,7 @@ class Dictionary extends DolibarrApi
* @param string $type Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...)
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'SO-%')"
* @return List of events types
*
*
* @url GET extrafields
*
* @throws RestException
@ -335,7 +335,7 @@ class Dictionary extends DolibarrApi
if ($type == 'thirdparty') $type='societe';
if ($type == 'contact') $type='socpeople';
$sql = "SELECT t.rowid, t.name, t.label, t.type, t.size, t.elementtype, t.fieldunique, t.fieldrequired, t.param, t.pos, t.alwayseditable, t.perms, t.list, t.ishidden, t.fielddefault, t.fieldcomputed";
$sql = "SELECT t.rowid, t.name, t.label, t.type, t.size, t.elementtype, t.fieldunique, t.fieldrequired, t.param, t.pos, t.alwayseditable, t.perms, t.list, t.fielddefault, t.fieldcomputed";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields as t";
$sql.= " WHERE t.entity IN (".getEntity('extrafields').")";
if (! empty($type)) $sql.= " AND t.elementtype = '".$this->db->escape($type)."'";
@ -373,7 +373,6 @@ class Dictionary extends DolibarrApi
$list[$tab->elementtype][$tab->name]['alwayseditable']=$tab->alwayseditable;
$list[$tab->elementtype][$tab->name]['perms']=$tab->perms;
$list[$tab->elementtype][$tab->name]['list']=$tab->list;
$list[$tab->elementtype][$tab->name]['ishidden']=$tab->ishidden;
}
}
}
@ -388,9 +387,9 @@ class Dictionary extends DolibarrApi
}
return $list;
}
}
/**
* Get the list of towns.
*
@ -402,9 +401,9 @@ class Dictionary extends DolibarrApi
* @param string $town To filter on city name
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of towns
*
*
* @url GET towns
*
*
* @throws RestException
*/
function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $sqlfilters = '')
@ -426,8 +425,8 @@ class Dictionary extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $this->db->order($sortfield, $sortorder);
if ($limit) {
@ -435,10 +434,10 @@ class Dictionary extends DolibarrApi
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit, $offset);
}
$result = $this->db->query($sql);
if ($result) {
@ -450,9 +449,9 @@ class Dictionary extends DolibarrApi
} else {
throw new RestException(503, 'Error when retrieving list of towns : '.$this->db->lasterror());
}
return $list;
}
}
/**
* Get the list of payments terms.

View File

@ -139,14 +139,14 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' |
{
$module = strtolower($regmod[1]);
$moduledirforclass = getModuleDirForApiClass($module);
$moduleforperm = $module;
if ($module == 'propale') { $moduleforperm='propal'; }
$modulenameforenabled = $module;
if ($module == 'propale') { $moduleforenabled='propal'; }
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
// Defined if module is enabled
$enabled=true;
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
if (empty($conf->$moduleforenabled->enabled)) $enabled=false;
if ($enabled)
{

View File

@ -96,7 +96,8 @@ class BlockedLog
/**
* try to retrieve logged object link
*/
public function getObjectLink() {
public function getObjectLink()
{
global $langs;
if($this->element === 'facture') {
@ -110,6 +111,17 @@ class BlockedLog
$this->error++;
}
}
if($this->element === 'invoice_supplier') {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$object = new FactureFournisseur($this->db);
if($object->fetch($this->fk_object)>0) {
return $object->getNomUrl(1);
}
else{
$this->error++;
}
}
else if($this->element === 'payment') {
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
@ -121,6 +133,17 @@ class BlockedLog
$this->error++;
}
}
else if($this->element === 'payment_supplier') {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
$object = new PaiementFourn($this->db);
if($object->fetch($this->fk_object)>0) {
return $object->getNomUrl(1);
}
else{
$this->error++;
}
}
return $langs->trans('ImpossibleToReloadObject', $this->element, $this->fk_object);
@ -129,7 +152,8 @@ class BlockedLog
/**
* try to retrieve user author
*/
public function getUser() {
public function getUser()
{
global $langs, $cachedUser;
if(empty($cachedUser))$cachedUser=array();
@ -149,16 +173,22 @@ class BlockedLog
}
/**
* populate log by object
* Populate properties of log from object data
*
* @param payment|facture $object object to store
* @param Object $object object to store
*/
public function setObjectData(&$object) {
if($object->element=='payment') {
public function setObjectData(&$object)
{
// Set date
if($object->element == 'payment' || $object->element == 'payment_supplier')
{
$this->date_object = $object->datepaye;
}
else{
if ($object->element=='payment_salary')
{
$this->date_object = $object->datev;
}
else {
$this->date_object = $object->date;
}
@ -168,7 +198,23 @@ class BlockedLog
$this->object_data=new stdClass();
if($this->element === 'facture') {
if ($this->element == 'facture')
{
if(empty($object->thirdparty))$object->fetch_thirdparty();
$this->object_data->thirdparty = new stdClass();
foreach($object->thirdparty as $key=>$value) {
if(!is_object($value)) $this->object_data->thirdparty->{$key} = $value;
}
$this->object_data->total_ht = (double) $object->total_ht;
$this->object_data->total_tva = (double) $object->total_tva;
$this->object_data->total_ttc = (double) $object->total_ttc;
$this->object_data->total_localtax1= (double) $object->total_localtax1;
$this->object_data->total_localtax2= (double) $object->total_localtax2;
$this->object_data->note_public = (double) $object->note_public;
}
if($this->element == 'invoice_supplier') {
if(empty($object->thirdparty))$object->fetch_thirdparty();
$this->object_data->thirdparty = new stdClass();
@ -185,10 +231,13 @@ class BlockedLog
$this->object_data->note_private= (double) $object->note_private;
}
elseif($this->element==='payment'){
elseif ($this->element == 'payment'|| $object->element == 'payment_supplier')
{
$this->object_data->amounts = $object->amounts;
}
elseif($this->element == 'payment_salary')
{
$this->object_data->amounts = array($object->amount);
}
}
@ -511,6 +560,15 @@ class BlockedLog
$this->amounts = (double) $obj->amount;
}
}
if($this->element === 'payment_supplier') {
$sql="SELECT amount FROM ".MAIN_DB_PREFIX."paiementfourn WHERE rowid=".$this->fk_object;
$res = $this->db->query($sql);
if($res && $obj = $this->db->fetch_object($res)) {
$this->amounts = (double) $obj->amount;
}
}
elseif($this->element === 'facture') {
$sql="SELECT total_ttc FROM ".MAIN_DB_PREFIX."facture WHERE rowid=".$this->fk_object;

View File

@ -30,7 +30,7 @@ class Bookmark extends CommonObject
{
public $element='bookmark';
public $table_element='bookmark';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'bookmark';
var $db;

View File

@ -37,7 +37,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -155,7 +155,7 @@ $form = new Form($db);
$help_url='';
llxHeader('', $langs->trans("WebsiteSetup"), $help_url, '', 0, '', '', '', '', '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">');
llxHeader('', $langs->trans("WebsiteSetup"), $help_url, '', 0, '', '', '', '', '', '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">');
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><div>';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -2,8 +2,8 @@
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ class ActionComm extends CommonObject
public $element='action';
public $table_element = 'actioncomm';
public $table_rowid = 'id';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='action';
/**
@ -928,7 +928,7 @@ class ActionComm extends CommonObject
$sql.= ")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " WHERE 1";
$sql.= " WHERE 1 = 1";
if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100";
$sql.= " AND a.entity IN (".getEntity('agenda').")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
@ -1341,6 +1341,7 @@ class ActionComm extends CommonObject
{
// Note: Output of sql request is encoded in $conf->file->character_set_client
// This assignment in condition is not a bug. It allows walking the results.
$diff = 0;
while ($obj=$this->db->fetch_object($resql))
{
$qualified=true;
@ -1377,6 +1378,7 @@ class ActionComm extends CommonObject
{
$eventarray[]=$event;
}
$diff++;
}
}
else

View File

@ -38,7 +38,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
@ -87,7 +87,7 @@ if ($action != 'create' && $action != 'edit')
/* ************************************************************************** */
/* */
/* Creation of an optional field */
/* Creation of an optional field */
/* */
/* ************************************************************************** */

View File

@ -45,7 +45,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -186,8 +186,12 @@ if (empty($reshook))
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields();
if ($result < 0) $error++;
$result = $object->insertExtraFields();
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error) $action = 'edit_extras';
}

View File

@ -1176,7 +1176,11 @@ if (empty($reshook))
if (! $error)
{
$result = $object->insertExtraFields();
if ($result < 0) $error++;
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error) $action = 'edit_extras';
}
@ -2191,7 +2195,7 @@ if ($action == 'create')
// Show object lines
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST">
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateligne') . '">
<input type="hidden" name="mode" value="">

View File

@ -48,7 +48,7 @@ class Propal extends CommonObject
public $table_element='propal';
public $table_element_line='propaldet';
public $fk_element='fk_propal';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='propal';
/**

View File

@ -158,7 +158,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -1226,7 +1226,9 @@ if (empty($reshook))
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
if ($result < 0) {
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
@ -2386,7 +2388,7 @@ if ($action == 'create' && $user->rights->commande->creer)
*/
$result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST">
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
<input type="hidden" name="mode" value="">

View File

@ -46,7 +46,7 @@ class Commande extends CommonOrder
public $table_element_line = 'commandedet';
public $class_element_line = 'OrderLine';
public $fk_element = 'fk_commande';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'order';
/**
@ -610,6 +610,7 @@ class Commande extends CommonOrder
return -1;
}
}
return 0;
}
/**

View File

@ -142,7 +142,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -151,7 +151,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -386,7 +386,7 @@ class Account extends CommonObject
* Add an entry into table ".MAIN_DB_PREFIX."bank
*
* @param int $date Date operation
* @param string $oper 1,2,3,4... (deprecated) or TYP,VIR,PRE,LIQ,VAD,CB,CHQ...
* @param string $oper 1,2,3,4... (deprecated) or 'TYP','VIR','PRE','LIQ','VAD','CB','CHQ'...
* @param string $label Descripton
* @param float $amount Amount
* @param string $num_chq Numero cheque ou virement

View File

@ -103,7 +103,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -35,7 +35,7 @@ class Deplacement extends CommonObject
public $table_element='deplacement';
public $table_element_line = '';
public $fk_element = '';
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $datec; // Creation date
var $dated;

View File

@ -39,7 +39,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -40,7 +40,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -40,7 +40,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -40,7 +40,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -2041,8 +2041,10 @@ if (empty($reshook))
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
if ($result < 0) {
$error ++;
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
} else if ($reshook < 0)
$error ++;
@ -4076,7 +4078,7 @@ else if ($id > 0 || ! empty($ref))
}
}
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST">
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateligne') . '">
<input type="hidden" name="mode" value="">

View File

@ -71,6 +71,12 @@ class Invoices extends DolibarrApi
throw new RestException(404, 'Invoice not found');
}
// Get payment details
$this->invoice->totalpaye = $this->invoice->getSommePaiement();
$this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@ -646,6 +652,133 @@ class Invoices extends DolibarrApi
}
/**
* Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount)
*
* @param int $id Id of invoice
* @param int $discountid Id of discount
*
* @url POST {id}/usediscount/{discountid}
*
* @return int
* @throws 400
* @throws 401
* @throws 404
* @throws 405
*/
function useDiscount($id, $discountid) {
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
if(empty($id)) {
throw new RestException(400, 'Invoice ID is mandatory');
}
if(empty($discountid)) {
throw new RestException(400, 'Discount ID is mandatory');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
$result = $this->invoice->insert_discount($discountid);
if( $result < 0) {
throw new RestException(405, $this->invoice->error);
}
return $result;
}
/**
* Add an available credit note discount to payments of an existing invoice (Consume the credit note)
*
* @param int $id Id of invoice
* @param int $discountid Id of a discount coming from a credit note
*
* @url POST {id}/usecreditnote/{discountid}
*
* @return int
* @throws 400
* @throws 401
* @throws 404
* @throws 405
*/
function useCreditNote($id, $discountid) {
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
if(empty($id)) {
throw new RestException(400, 'Invoice ID is mandatory');
}
if(empty($discountid)) {
throw new RestException(400, 'Credit ID is mandatory');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$discount = new DiscountAbsolute($this->db);
$result = $discount->fetch($discountid);
if( ! $result ) {
throw new RestException(404, 'Credit not found');
}
$result = $discount->link_to_invoice(0, $id);
if( $result < 0) {
throw new RestException(405, $discount->error);
}
return $result;
}
/**
* Get list of payments of a given invoice
*
* @param int $id Id of invoice
*
* @url GET {id}/getpayments
*
* @return array
* @throws 400
* @throws 401
* @throws 404
* @throws 405
*/
function getPayments($id) {
if(! DolibarrApiAccess::$user->rights->facture->lire) {
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);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
$result = $this->invoice->getListOfPayments();
if( $result < 0) {
throw new RestException(405, $this->invoice->error);
}
return $result;
}
/**
* Clean sensible object datas
*

View File

@ -52,7 +52,7 @@ class Facture extends CommonInvoice
public $table_element='facture';
public $table_element_line = 'facturedet';
public $fk_element = 'fk_facture';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='bill';
/**
@ -79,6 +79,8 @@ class Facture extends CommonInvoice
public $remise_percent;
public $total_ht=0;
public $total_tva=0;
public $total_localtax1=0;
public $total_localtax2=0;
public $total_ttc=0;
public $revenuestamp;
@ -977,6 +979,8 @@ class Facture extends CommonInvoice
$line->subprice = $object->lines[$i]->subprice;
$line->total_ht = $object->lines[$i]->total_ht;
$line->total_tva = $object->lines[$i]->total_tva;
$line->total_localtax1 = $object->lines[$i]->total_localtax1;
$line->total_localtax2 = $object->lines[$i]->total_localtax2;
$line->total_ttc = $object->lines[$i]->total_ttc;
$line->vat_src_code = $object->lines[$i]->vat_src_code;
$line->tva_tx = $object->lines[$i]->tva_tx;
@ -1128,6 +1132,10 @@ class Facture extends CommonInvoice
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('LT1') . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('LT2') . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
@ -1582,7 +1590,7 @@ class Facture extends CommonInvoice
/**
* Add a discount line into invoice using an existing absolute discount
* Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount)
*
* @param int $idremise Id of absolute discount
* @return int >0 if OK, <0 if KO
@ -1648,7 +1656,7 @@ class Facture extends CommonInvoice
$result=$this->update_price(1);
if ($result > 0)
{
// Create linke between discount and invoice line
// Create link between discount and invoice line
$result=$remise->link_to_invoice($lineid,0);
if ($result < 0)
{
@ -3505,11 +3513,12 @@ class Facture extends CommonInvoice
/**
* Renvoi liste des factures remplacables
* Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee
* Return list of invoices qualified to be replaced by another invoice.
* Invoices matching the following rules are returned:
* (Status validated or abandonned for a reason 'other') + not payed + no payment at all + not already replaced
*
* @param int $socid Id societe
* @return array Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
* @param int $socid Id thirdparty
* @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
*/
function list_replacable_invoices($socid=0)
{
@ -3552,12 +3561,12 @@ class Facture extends CommonInvoice
/**
* Renvoi liste des factures qualifiables pour correction par avoir
* Les factures qui respectent les regles suivantes sont retournees:
* (validee + paiement en cours) ou classee (payee completement ou payee partiellement) + pas deja remplacee + pas deja avoir
* Return list of invoices qualified to be corrected by a credit note.
* Invoices matching the following rules are returned:
* (validated + payment on process) or classified (payed completely or payed partiely) + not already replaced + not already a credit note
*
* @param int $socid Id societe
* @return array Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
* @param int $socid Id thirdparty
* @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
*/
function list_qualified_avoir_invoices($socid=0)
{

View File

@ -386,22 +386,16 @@ if (empty($reshook))
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0)
$error ++;
if ($ret < 0) $error++;
if (! $error) {
$result = $object->insertExtraFields();
if ($result < 0) {
$error ++;
}
} else if ($reshook < 0)
$error ++;
if ($error) {
$action = 'edit_extras';
setEventMessages($object->error, $object->errors, 'errors');
}
if (! $error) {
$result = $object->insertExtraFields();
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
}
// Add a new line

View File

@ -138,7 +138,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -174,7 +174,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -136,7 +136,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = "SELECT f.facnumber";
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc";
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client";
$sql.= ", f.type";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
@ -178,6 +178,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->ref_client=$obj->ref_client;
$facturestatic->type=$obj->type;
print $facturestatic->getNomUrl(1,'');
print '</td>';
@ -218,7 +219,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
*/
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
{
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type";
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_fournisseur";
@ -253,6 +254,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$facturesupplierstatic->total_ht=$obj->total_ht;
$facturesupplierstatic->total_tva=$obj->total_tva;
$facturesupplierstatic->total_ttc=$obj->total_ttc;
$facturesupplierstatic->ref_supplier=$obj->ref_supplier;
$facturesupplierstatic->type=$obj->type;
print $facturesupplierstatic->getNomUrl(1,'',16);
print '</td>';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Pierre-Henry Favre <support@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,6 +40,9 @@ $result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Societe($db);
if ($id > 0) $object->fetch($id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('recapcomptacard','globalcard'));
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
@ -60,6 +64,9 @@ $arrayfields=array(
/*
* Actions
*/
$parameters = array('socid' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// None
@ -139,13 +146,20 @@ if ($id > 0)
$userstatic->id=$objf->userid;
$userstatic->login=$objf->login;
$TData[] = array(
$values = array(
'fk_facture' => $objf->facid,
'date' => $fac->date,
'link' => $fac->getNomUrl(1),
'status' => $fac->getLibStatut(2,$totalpaye),
'amount' => $fac->total_ttc,
'author' => $userstatic->getLoginUrl(1)
);
$parameters = array('socid' => $id, 'values' => &$values, 'fac' => $fac, 'userstatic' => $userstatic);
$reshook = $hookmanager->executeHooks('facdao', $parameters, $object); // Note that $parameters['values'] and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$TData[] = $values;
$TDataSort[] = $fac->date;
// Paiements
@ -175,13 +189,20 @@ if ($id > 0)
$userstatic->id=$objp->userid;
$userstatic->login=$objp->login;
$TData[] = array(
$values = array(
'fk_paiement' => $objp->rowid,
'date' => $db->jdate($objp->dp),
'link' => $langs->trans("Payment") .' '. $paymentstatic->getNomUrl(1),
'status' => '',
'amount' => -$objp->amount,
'author' => $userstatic->getLoginUrl(1)
);
$parameters = array('socid' => $id, 'values' => &$values, 'fac' => $fac, 'userstatic' => $userstatic, 'paymentstatic' => $paymentstatic);
$reshook = $hookmanager->executeHooks('paydao', $parameters, $object); // Note that $parameters['values'] and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$TData[] = $values;
$TDataSort[] = $db->jdate($objp->dp);
$j++;
@ -224,7 +245,11 @@ if ($id > 0)
// Display array
foreach($TData as $data) {
print '<tr class="oddeven">';
$html_class = '';
if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
print '<tr class="oddeven '.$html_class.'">';
print "<td align=\"center\">".dol_print_date($data['date'],'day')."</td>\n";
print '<td>'.$data['link']."</td>\n";

View File

@ -73,6 +73,8 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
if (empty($datev)) $datev=$datep;
$type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement');
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
$object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0;
$object->datev=$datev;
@ -82,7 +84,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$object->datesp=$datesp;
$object->dateep=$dateep;
$object->note=GETPOST("note");
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
$object->type_payment=($type_payment > 0 ? $type_payment : 0);
$object->num_payment=GETPOST("num_payment");
$object->fk_user_author=$user->id;
@ -101,7 +103,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Employee")), null, 'errors');
$error++;
}
if (empty($object->type_payment) || $object->type_payment < 0)
if (empty($type_payment) || $type_payment < 0)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++;
@ -292,7 +294,7 @@ if ($action == 'create')
// Type payment
print '<tr><td>';
print fieldLabel('PaymentMode','selectpaymenttype',1).'</td><td>';
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype");
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2);
print '</td></tr>';
// Number

View File

@ -349,7 +349,7 @@ class PaymentSalary extends CommonObject
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", ".$this->amount;
$sql.= ", ".($this->salary > 0 ? $this->salary : "null");
$sql.= ", '".$this->db->escape($this->type_payment)."'";
$sql.= ", ".$this->db->escape($this->type_payment);
$sql.= ", '".$this->db->escape($this->num_payment)."'";
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->db->escape($this->label)."'";

View File

@ -114,7 +114,7 @@ $sql.= " AND s.entity = ".$conf->entity;
// Search criteria
if ($search_ref) $sql.=" AND s.rowid=".$search_ref;
if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $search_user);
if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
if ($search_label) $sql.=natural_search(array('s.label'), $search_label);
if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1);
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;

View File

@ -39,7 +39,7 @@ class Contact extends CommonObject
{
public $element='contact';
public $table_element='socpeople';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $civility_id; // In fact we store civility_code
public $civility_code;

View File

@ -160,7 +160,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}

View File

@ -41,7 +41,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -41,7 +41,7 @@ $form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');

View File

@ -326,13 +326,21 @@ if (empty($reshook))
{
$label = $lines[$i]->product_label;
}
$desc = ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
}
else {
$desc = dol_htmlentitiesbr($lines[$i]->desc);
}
// Extrafields
$array_options = array();
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
// trigger used
{
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options;
}
$txtva = $lines[$i]->vat_src_code ? $lines[$i]->tva_tx . ' (' . $lines[$i]->vat_src_code . ')' : $lines[$i]->tva_tx;
// View third's localtaxes for now
@ -355,7 +363,7 @@ if (empty($reshook))
$lines[$i]->info_bits,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
array(),
$array_options,
$lines[$i]->fk_unit
);
@ -821,21 +829,19 @@ if (empty($reshook))
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0)
$error ++;
if ($ret < 0) $error++;
if (! $error) {
$result = $object->insertExtraFields();
if ($result < 0) {
$error ++;
}
} else if ($reshook < 0)
$error ++;
$result = $object->insertExtraFields();
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
if ($error) {
$action = 'edit_extras';
setEventMessages($object->error, $object->errors, 'errors');
}
}
elseif ($action=='setref_supplier')

View File

@ -40,7 +40,7 @@ class Contracts extends DolibarrApi
);
/**
* @var Contract $contract {@type Contrat}
* @var Contrat $contract {@type Contrat}
*/
public $contract;
@ -156,6 +156,7 @@ class Contracts extends DolibarrApi
{
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
$i=0;
while ($i < $min)
{
$obj = $db->fetch_object($result);
@ -269,8 +270,8 @@ class Contracts extends DolibarrApi
$request_data->localtax2_tx,
$request_data->fk_product,
$request_data->remise_percent,
$request_data->date_start, // date ouverture = date_start_real
$request_data->date_end, // date_cloture = date_end_real
$request_data->date_start, // date_start = date planned start, date ouverture = date_start_real
$request_data->date_end, // date_end = date planned end, date_cloture = date_end_real
$request_data->HT,
$request_data->subprice_excl_tax,
$request_data->info_bits,
@ -450,7 +451,6 @@ class Contracts extends DolibarrApi
* Validate an contract
*
* @param int $id Contract ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
* @url POST {id}/validate
@ -460,12 +460,10 @@ class Contracts extends DolibarrApi
* Error message: "Forbidden: Content type `text/plain` is not supported."
* Workaround: send this in the body
* {
* "idwarehouse": 0,
* "notrigger": 0
* }
*/
/*
function validate($id, $idwarehouse=0, $notrigger=0)
function validate($id, $notrigger=0)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401);
@ -479,7 +477,7 @@ class Contracts extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->contract->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
$result = $this->contract->validate(DolibarrApiAccess::$user, '', $notrigger);
if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated');
}
@ -494,7 +492,54 @@ class Contracts extends DolibarrApi
)
);
}
*/
/**
* Close all services of a contract
*
* @param int $id Contract ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
* @url POST {id}/close
*
* @return array
* FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
* Workaround: send this in the body
* {
* "notrigger": 0
* }
*/
function close($id, $notrigger=0)
{
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
throw new RestException(401);
}
$result = $this->contract->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Contract not found');
}
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->contract->closeAll(DolibarrApiAccess::$user, $notrigger);
if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already close');
}
if ($result < 0) {
throw new RestException(500, 'Error when closing Contract: '.$this->contract->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Contract closed (Ref='.$this->contract->ref.'). All services were closed.'
)
);
}
/**
* Clean sensible object datas
@ -508,6 +553,16 @@ class Contracts extends DolibarrApi
unset($object->address);
unset($object->date_ouverture_prevue);
unset($object->date_ouverture);
unset($object->date_fin_validite);
unset($object->date_cloture);
unset($object->date_debut_prevue);
unset($object->date_debut_reel);
unset($object->date_fin_prevue);
unset($object->date_fin_reel);
unset($object->civility_id);
return $object;
}

View File

@ -44,7 +44,7 @@ class Contrat extends CommonObject
public $table_element='contrat';
public $table_element_line='contratdet';
public $fk_element='fk_contrat';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='contract';
/**
@ -298,12 +298,13 @@ class Contrat extends CommonObject
}
/**
* Close all lines of a contract
* Close all lines of a contract
*
* @param User $user Object User making action
* @return int <0 if KO, >0 if OK
* @param User $user Object User making action
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function closeAll($user)
function closeAll(User $user, $notrigger=0)
{
$this->db->begin();
@ -330,7 +331,7 @@ class Contrat extends CommonObject
if ($this->statut == 0)
{
$result=$this->validate($user);
$result=$this->validate($user, '', $notrigger);
if ($result < 0) $ok=false;
}
@ -355,7 +356,7 @@ class Contrat extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
function validate($user, $force_number='', $notrigger=0)
function validate(User $user, $force_number='', $notrigger=0)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $langs, $conf;
@ -741,12 +742,12 @@ class Contrat extends CommonObject
$line->fk_unit = $objp->fk_unit;
$line->ref = $objp->product_ref; // deprecated
if (empty($objp->fk_product))
if (empty($objp->fk_product))
{
$line->label = ''; // deprecated
$line->libelle = $objp->description; // deprecated
}
else
else
{
$line->label = $objp->product_label; // deprecated
$line->libelle = $objp->product_label; // deprecated
@ -757,11 +758,15 @@ class Contrat extends CommonObject
$line->description = $objp->description;
$line->date_start = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_start_real = $this->db->jdate($objp->date_ouverture);
$line->date_end = $this->db->jdate($objp->date_fin_validite);
$line->date_end_real = $this->db->jdate($objp->date_cloture);
// For backward compatibility
$line->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_ouverture = $this->db->jdate($objp->date_ouverture);
$line->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
$line->date_cloture = $this->db->jdate($objp->date_cloture);
// For backward compatibility
$line->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
$line->date_debut_reel = $this->db->jdate($objp->date_ouverture);
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
@ -2084,10 +2089,10 @@ class Contrat extends CommonObject
if ($mode == 'inactives') {
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
$label = $langs->trans("BoardNotActivatedServices");
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=0';
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=0';
} else {
$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");
}
@ -2242,10 +2247,10 @@ class Contrat extends CommonObject
$line->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64;
$line->date_ouverture = dol_now() - 200000;
$line->date_ouverture_prevue = dol_now() - 500000;
$line->date_fin_validite = dol_now() + 500000;
$line->date_cloture = dol_now() - 100000;
$line->date_start = dol_now() - 500000;
$line->date_start_real = dol_now() - 200000;
$line->date_end = dol_now() + 500000;
$line->date_end_real = dol_now() - 100000;
if ($num_prods > 0)
{
$prodid = mt_rand(1, $num_prods);
@ -2256,17 +2261,18 @@ class Contrat extends CommonObject
}
}
/**
/**
* Create an array of order lines
*
* @return int >0 if OK, <0 if KO
*/
function getLinesArray()
{
return $this->fetch_lines();
}
*/
function getLinesArray()
{
return $this->fetch_lines();
}
/**
/**
* Create a document onto disk according to template module.
*
* @param string $modele Force model to use ('' to not force)
@ -2458,6 +2464,12 @@ class ContratLigne extends CommonObjectLine
var $product_label;
var $date_commande;
var $date_start; // date start planned
var $date_start_real; // date start real
var $date_end; // date end planned
var $date_end_real; // date end real
// For backward compatibility
var $date_ouverture_prevue; // date start planned
var $date_ouverture; // date start real
var $date_fin_validite; // date end planned
@ -2693,10 +2705,17 @@ class ContratLigne extends CommonObjectLine
$this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line
$this->description = $obj->description;
$this->date_commande = $this->db->jdate($obj->date_commande);
$this->date_start = $this->db->jdate($obj->date_ouverture_prevue);
$this->date_start_real = $this->db->jdate($obj->date_ouverture);
$this->date_end = $this->db->jdate($obj->date_fin_validite);
$this->date_end_real = $this->db->jdate($obj->date_cloture);
// For backward compatibility
$this->date_ouverture_prevue = $this->db->jdate($obj->date_ouverture_prevue);
$this->date_ouverture = $this->db->jdate($obj->date_ouverture);
$this->date_fin_validite = $this->db->jdate($obj->date_fin_validite);
$this->date_cloture = $this->db->jdate($obj->date_cloture);
$this->tva_tx = $obj->tva_tx;
$this->vat_src_code = $obj->vat_src_code;
$this->localtax1_tx = $obj->localtax1_tx;
@ -2784,6 +2803,12 @@ class ContratLigne extends CommonObjectLine
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
if (empty($this->remise_percent)) $this->remise_percent = 0;
// For backward compatibility
if (empty($this->date_start)) $this->date_start=$this->date_ouverture_prevue;
if (empty($this->date_start_real)) $this->date_start=$this->date_ouverture;
if (empty($this->date_end)) $this->date_start=$this->date_fin_validite;
if (empty($this->date_end_real)) $this->date_start=$this->date_cloture;
// Check parameters
// Put here code to add control on parameters values

View File

@ -190,7 +190,7 @@ foreach($listofstatus as $status)
print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
print "</tr>\n";
}
if ($status==4 && ! $bool) $bool=true;
@ -210,7 +210,7 @@ foreach($listofstatus as $status)
{
print '<tr class="oddeven">';
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
if ($status==4 && ! $bool) $bool=true;
else $bool=false;
print "</tr>\n";
@ -468,7 +468,7 @@ if ($resql)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
print "</tr>\n";
while ($i < $num)
@ -548,7 +548,7 @@ if ($resql)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=4&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";
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)
{
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
* \brief Page to list services in contracts
*/
@ -134,7 +134,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
}
}
@ -272,7 +272,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql .= $db->plimit($limit + 1, $offset);
//print $sql;
dol_syslog("contrat/services.php", LOG_DEBUG);
dol_syslog("contrat/services_list.php", LOG_DEBUG);
$resql=$db->query($sql);
if (! $resql)
{

View File

@ -0,0 +1,141 @@
<?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/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/actions_addupdatedelete.inc.php
* \brief Code for common actions cancel / add / update / delete
*/
// $action or $cancel must be defined
// $object must be defined
// $permissiontoadd must be defined
// $permissiontodelete must be defined
// $backurlforlist must be defined
// $backtopage may be defined
if ($cancel)
{
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
$action='';
}
// Action to add record
if ($action == 'add' && ! empty($permissiontoadd))
{
foreach ($object->fields as $key => $val)
{
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
$value = GETPOST($key,'alpha');
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
$object->$key=$value;
if ($val['notnull'] > 0 && $object->$key == '')
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
}
if (! $error)
{
$result=$object->createCommon($user);
if ($result > 0)
{
// Creation OK
$urltogo=$backtopage?$backtopage:$backurlforlist;
header("Location: ".$urltogo);
exit;
}
else
{
// Creation KO
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
$action='create';
}
}
else
{
$action='create';
}
}
// Action to update record
if ($action == 'update' && ! empty($permissiontoadd))
{
foreach ($object->fields as $key => $val)
{
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
$value = GETPOST($key,'alpha');
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field
if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field
$object->$key=$value;
if ($val['notnull'] > 0 && $object->$key == '')
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
}
if (! $error)
{
$result=$object->updateCommon($user);
if ($result > 0)
{
$action='view';
}
else
{
// Creation KO
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
$action='edit';
}
}
else
{
$action='edit';
}
}
// Action to delete
if ($action == 'confirm_delete' && ! empty($permissiontodelete))
{
$result=$object->deleteCommon($user);
if ($result > 0)
{
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');
header("Location: ".$backurlforlist);
exit;
}
else
{
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
}
}

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(
GETPOST('attrname', 'alpha'),
GETPOST('label', 'alpha'),
@ -173,8 +177,8 @@ if ($action == 'add')
$params,
(GETPOST('alwayseditable', 'alpha')?1:0),
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
(GETPOST('ishidden', 'alpha')?1:0),
$visibility,
0,
GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:''),
GETPOST('langfile', 'alpha')
@ -323,6 +327,10 @@ if ($action == 'update')
}
}
// Visibility: -1=not visible by default in list, 1=visible, 0=hidden
$visibility = GETPOST('list', 'alpha');
if ($type == 'separate') $visibility=3;
$result=$extrafields->update(
GETPOST('attrname', 'alpha'),
GETPOST('label', 'alpha'),
@ -335,8 +343,8 @@ if ($action == 'update')
$params,
(GETPOST('alwayseditable', 'alpha')?1:0),
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
(GETPOST('ishidden', 'alpha')?1:0),
$visibility,
0,
GETPOST('default_value','alpha'),
GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:''),

View File

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

View File

@ -0,0 +1,86 @@
<?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 htdocs/core/ajax/selectobject.php
* \brief File to return Ajax response on a selection list request
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
require '../../main.inc.php';
$objectdesc=GETPOST('objectdesc', 'alpha');
$htmlname=GETPOST('htmlname', 'aZ09');
$sqlfilter=GETPOST('sqlfilter', 'alpha');
$outjson=(GETPOST('outjson', 'int') ? GETPOST('outjson', 'int') : 0);
$action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int');
/*
* View
*/
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
dol_syslog(join(',', $_GET));
//print_r($_GET);
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($db);
//$langs->load("companies");
top_httphead();
if (empty($htmlname)) return;
$InfoFieldList = explode(":", $objectdesc);
$classname=$InfoFieldList[0];
$classpath=$InfoFieldList[1];
if (! empty($classpath))
{
dol_include_once($classpath);
if ($classname && class_exists($classname))
{
$objecttmp = new $classname($db);
}
}
if (! is_object($objecttmp))
{
dol_syslog('Error bad param objectdesc', LOG_WARNING);
print 'Error bad param objectdesc';
}
// When used from jQuery, the search term is added as GET param "term".
$searchkey=(($id && GETPOST($id, 'alpha'))?GETPOST($id, 'alpha'):(($htmlname && GETPOST($htmlname, 'alpha'))?GETPOST($htmlname, 'alpha'):''));
// TODO Add a security test to avoid to get content of all tables
$arrayresult=$form->selectForFormsList($objecttmp, $htmlname, '', 0, $searchkey, '', '', '', 0, 1);
$db->close();
if ($outjson) print json_encode($arrayresult);

View File

@ -269,7 +269,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
$out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone cursormove"');
$out.= img_picto($langs->trans("CloseBox",$this->box_id),'close_title','class="boxclose cursorpointer" rel="x:y" id="imgclose'.$this->box_id.'"');
$label=$head['text'];
if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')';
//if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')';
if (! empty($head['graph'])) $label.=' <span class="fa fa-bar-chart"></span>';
$out.= '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">';
$out.= '</td></tr></table>';
}

File diff suppressed because it is too large Load Diff

View File

@ -81,14 +81,16 @@ class DolGraph
/**
* Constructor
*
* @param string $library 'jflot' (default) or 'artichow' (no more supported)
*/
function __construct()
function __construct($library='jflot')
{
global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
// To use old feature
if (isset($conf->global->MAIN_GRAPH_LIBRARY) && $conf->global->MAIN_GRAPH_LIBRARY == 'artichow')
if ($library == 'artichow')
{
$this->_library='artichow';
@ -586,7 +588,7 @@ class DolGraph
}
/**
* Build a graph onto disk using correct library
* Build a graph into memory using correct library (may also be wrote on disk, depending on library used)
*
* @param string $file Image file name to use to save onto disk (also used as javascript unique id)
* @param string $fileurl Url path to show image if saved onto disk

View File

@ -46,7 +46,7 @@ class EmailSenderProfile extends CommonObject
/**
* @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
protected $ismultientitymanaged = 1;
public $ismultientitymanaged = 1;
/**
* @var string String with name of icon for emailsenderprofile
*/

View File

@ -140,8 +140,8 @@ class ExtraFields
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default (-1, 0 or 1)
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param int $list Visibilty
* @param int $ishidden Deprecated. Us visibility instead.
* @param string $computed Computed value
* @param string $entity Entity of extrafields
* @param string $langfile Language file
@ -279,8 +279,8 @@ class ExtraFields
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default (-1, 0 or 1)
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param int $list Visibily
* @param int $ishidden Deprecated. Use visibility instead.
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
* @param string $entity Entity of extrafields
@ -328,7 +328,6 @@ class ExtraFields
$sql.= " perms,";
$sql.= " langs,";
$sql.= " list,";
$sql.= " ishidden,";
$sql.= " fielddefault,";
$sql.= " fieldcomputed,";
$sql.= " fk_user_author,";
@ -349,7 +348,6 @@ class ExtraFields
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
$sql.= " ".$list.",";
$sql.= " ".$ishidden.",";
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").",";
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
$sql .= " " . $user->id . ",";
@ -483,8 +481,8 @@ class ExtraFields
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param int $list Visibility
* @param int $ishidden Deprecated. Use visiblity instead.
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
* @param string $entity Entity of extrafields
@ -589,8 +587,8 @@ class ExtraFields
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param int $list Visiblity
* @param int $ishidden Deprecated. Use visility instead.
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
* @param string $entity Entity of extrafields
@ -639,7 +637,6 @@ class ExtraFields
$sql.= " alwayseditable,";
$sql.= " param,";
$sql.= " list,";
$sql.= " ishidden,";
$sql.= " fielddefault,";
$sql.= " fieldcomputed,";
$sql.= " fk_user_author,";
@ -660,7 +657,6 @@ class ExtraFields
$sql.= " '".$alwayseditable."',";
$sql.= " '".$param."',";
$sql.= " ".$list.", ";
$sql.= " ".$ishidden.", ";
$sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").",";
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
$sql .= " " . $user->id . ",";
@ -714,7 +710,7 @@ class ExtraFields
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,ishidden,fielddefault,fieldcomputed";
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed";
$sql .= ",entity";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
@ -749,7 +745,6 @@ class ExtraFields
$this->attribute_perms[$tab->name]=$tab->perms;
$this->attribute_langfile[$tab->name]=$tab->langs;
$this->attribute_list[$tab->name]=$tab->list;
$this->attribute_hidden[$tab->name]=$tab->ishidden;
$this->attribute_entityid[$tab->name]=$tab->entity;
// New usage
@ -767,7 +762,6 @@ class ExtraFields
$this->attributes[$tab->elementtype]['perms'][$tab->name]=$tab->perms;
$this->attributes[$tab->elementtype]['langfile'][$tab->name]=$tab->langs;
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden;
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
if (!empty($conf->multicompany->enabled))
@ -802,24 +796,33 @@ class ExtraFields
/**
* Return HTML string to put an input field into a page
* Code very similar with showInputField of common object
*
* @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string $moreparam To add more parametes on html input tag
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Prefix string to add after name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Suffix string to add before name and id of field (can be used to avoid duplicate names)
* @param mixed $showsize Value for css to define size. May also be a numeric.
* @param int $objectid Current object id
* @return string
*/
function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0, $objectid=0)
{
global $conf,$langs;
global $conf,$langs,$form;
if (! is_object($form))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form=new Form($this->db);
}
$keyprefix = $keyprefix.'options_'; // Because we work on extrafields
$label=$this->attribute_label[$key];
$type =$this->attribute_type[$key];
$size =$this->attribute_size[$key];
$elementtype=$this->attribute_elementtype[$key];
$elementtype=$this->attribute_elementtype[$key]; // Seems not used
$default=$this->attribute_default[$key];
$computed=$this->attribute_computed[$key];
$unique=$this->attribute_unique[$key];
@ -831,7 +834,7 @@ class ExtraFields
if ($computed)
{
if ($keyprefix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
if (! preg_match('/^search_/', $keyprefix)) return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
else return '';
}
@ -847,7 +850,7 @@ class ExtraFields
//$showsize=19;
$showsize = 'minwidth200imp';
}
elseif (in_array($type,array('int','double','price')))
elseif (in_array($type,array('int','integer','double','price')))
{
//$showsize=10;
$showsize = 'maxwidth75';
@ -888,31 +891,27 @@ class ExtraFields
// Do not show current date when field not required (see select_date() method)
if (!$required && $value == '') $value = '-1';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
global $form;
if (! is_object($form)) $form=new Form($this->db);
// TODO Must also support $moreparam
$out = $form->select_date($value, $keyprefix.'options_'.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
$out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
}
elseif (in_array($type,array('int')))
elseif (in_array($type,array('int','integer')))
{
$tmp=explode(',',$size);
$newsize=$tmp[0];
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'varchar')
elseif (preg_match('/varchar/', $type))
{
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
}
elseif (in_array($type, array('mail', 'phone', 'url')))
{
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'text')
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($keyprefix.'options_'.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
$out=$doleditor->Create(1);
}
elseif ($type == 'boolean')
@ -923,21 +922,21 @@ class ExtraFields
} else {
$checked=' value="1" ';
}
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'price')
{
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value);
}
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
}
elseif ($type == 'select')
{
@ -945,10 +944,10 @@ class ExtraFields
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
$out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
}
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
$out.='<option value="0">&nbsp;</option>';
foreach ($param['options'] as $key => $val)
{
@ -967,14 +966,15 @@ class ExtraFields
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
$out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
}
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
if (is_array($param['options']))
{
$param_list=array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
$parentName='';
// 0 : tableName
// 1 : label field name
// 2 : key fields name (if differ of rowid)
@ -1059,8 +1059,9 @@ class ExtraFields
$obj = $this->db->fetch_object($resql);
// Several field into label (eq table:code|libelle:rowid)
$notrans = false;
$fields_label = explode('|',$InfoFieldList[1]);
if(is_array($fields_label))
if (is_array($fields_label))
{
$notrans = true;
foreach ($fields_label as $field_toshow)
@ -1074,7 +1075,7 @@ class ExtraFields
}
$labeltoshow=dol_trunc($labeltoshow,45);
if ($value==$obj->rowid)
if ($value == $obj->rowid)
{
foreach ($fields_label as $field_toshow)
{
@ -1089,7 +1090,7 @@ class ExtraFields
}
else
{
if(!$notrans)
if (! $notrans)
{
$translabel=$langs->trans($obj->{$InfoFieldList[1]});
if ($translabel!=$obj->{$InfoFieldList[1]}) {
@ -1128,23 +1129,19 @@ class ExtraFields
}
elseif ($type == 'checkbox')
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($db);
$value_arr=explode(',',$value);
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
$out=$form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
}
elseif ($type == 'radio')
{
$out='';
foreach ($param['options'] as $keyopt => $val)
{
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
$out.=' value="'.$keyopt.'"';
$out.=' id="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'"';
$out.=' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"';
$out.= ($value==$keyopt?'checked':'');
$out.='/><label for="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
$out.='/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
}
}
elseif ($type == 'chkbxlst')
@ -1283,10 +1280,7 @@ class ExtraFields
}
$this->db->free($resql);
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($db);
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
$out=$form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
} else {
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
@ -1296,41 +1290,17 @@ class ExtraFields
}
elseif ($type == 'link')
{
$out='';
$param_list=array_keys($param['options']);
// 0 : ObjectName
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$valuetoshow=$value;
if (!empty($value))
{
$object = new $InfoFieldList[0]($this->db);
$resfetch=$object->fetch($value);
if ($resfetch > 0)
{
$valuetoshow=$object->ref;
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
}
}
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$valuetoshow.'" >';
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
$out.='Error bad setup of extrafield';
}
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
$showempty=(($val['notnull'] == 1 && $val['default'] != '')?0:1);
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty);
}
elseif ($type == 'password')
{
// If prefix is 'search_', field is used as a filter, we use a common text field.
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
}
if (!empty($hidden)) {
$out='<input type="hidden" value="'.$value.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'"/>';
$out='<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>';
}
/* Add comments
if ($type == 'date') $out.=' (YYYY-MM-DD)';
@ -1352,7 +1322,7 @@ class ExtraFields
{
global $conf,$langs;
$elementtype=$this->attribute_elementtype[$key];
$elementtype=$this->attribute_elementtype[$key]; // seems not used
$label=$this->attribute_label[$key];
$type=$this->attribute_type[$key];
$size=$this->attribute_size[$key];
@ -1360,11 +1330,13 @@ class ExtraFields
$computed=$this->attribute_computed[$key];
$unique=$this->attribute_unique[$key];
$required=$this->attribute_required[$key];
$params=$this->attribute_param[$key];
$param=$this->attribute_param[$key];
$perms=$this->attribute_perms[$key];
$langfile=$this->attribute_langfile[$key];
$list=$this->attribute_list[$key];
$hidden=$this->attribute_hidden[$key]; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
$hidden=(abs($list)!=1 ? 1 : 0);
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
// If field is a computed field, value must become result of compute
if ($computed)
@ -1421,11 +1393,11 @@ class ExtraFields
}
elseif ($type == 'select')
{
$value=$params['options'][$value];
$value=$param['options'][$value];
}
elseif ($type == 'sellist')
{
$param_list=array_keys($params['options']);
$param_list=array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
$selectkey="rowid";
@ -1502,7 +1474,7 @@ class ExtraFields
}
elseif ($type == 'radio')
{
$value=$params['options'][$value];
$value=$param['options'][$value];
}
elseif ($type == 'checkbox')
{
@ -1511,7 +1483,7 @@ class ExtraFields
if (is_array($value_arr))
{
foreach ($value_arr as $keyval=>$valueval) {
$toprint[]='<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$params['options'][$valueval].'</li>';
$toprint[]='<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$param['options'][$valueval].'</li>';
}
}
$value='<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
@ -1520,7 +1492,7 @@ class ExtraFields
{
$value_arr = explode(',', $value);
$param_list = array_keys($params['options']);
$param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
$selectkey = "rowid";
@ -1592,22 +1564,26 @@ class ExtraFields
// only if something to display (perf)
if ($value)
{
$param_list=array_keys($params['options']);
// 0 : ObjectName
// 1 : classPath
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$value=$object->getNomUrl(3);
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
$out.='Error bad setup of extrafield';
}
$classname=$InfoFieldList[0];
$classpath=$InfoFieldList[1];
if (! empty($classpath))
{
dol_include_once($InfoFieldList[1]);
if ($classname && class_exists($classname))
{
$object = new $classname($this->db);
$object->fetch($value);
$value=$object->getNomUrl(3);
}
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
return 'Error bad setup of extrafield';
}
}
}
elseif ($type == 'text')
@ -1627,10 +1603,6 @@ class ExtraFields
//print $type.'-'.$size;
$out=$value;
if (!empty($hidden)) {
$out='';
}
return $out;
}

View File

@ -32,7 +32,7 @@ class Fiscalyear extends CommonObject
public $table_element='accounting_fiscalyear';
public $table_element_line = '';
public $fk_element = '';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $rowid;

View File

@ -504,7 +504,7 @@ class Form
global $conf, $langs;
$alt = '';
if ($tooltiptrigger) $alt=$langs->trans("ClickToShowHelp");
if ($tooltiptrigger) $alt=$langs->transnoentitiesnoconv("ClickToShowHelp");
//For backwards compatibility
if ($type == '0') $type = 'info';
@ -727,7 +727,7 @@ class Form
* @param string $page Defined the form action
* @param string $htmlname Name of html select object
* @param string $htmloption Options html on select object
* @param int $forcecombo Force to use standard combo box (no ajax use)
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @return string HTML string with select and input
*/
@ -959,7 +959,7 @@ class Form
* @param int $filter Filter on thirdparty
* @param int $limit Limit on number of returned lines
* @param array $ajaxoptions Options for ajax_autocompleter
* @param int $forcecombo Force to use combo box
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @return string Return select box for thirdparty.
* @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0)
*/
@ -976,7 +976,7 @@ class Form
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)')
* @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty')
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param int $limit Maximum number of elements
* @param string $morecss Add more css styles to the SELECT component
@ -1007,11 +1007,7 @@ class Form
// mode 1
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype?'&showtype='.$showtype:'');
$out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$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").' : ';
else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
@ -1020,7 +1016,7 @@ class Form
$out.= img_picto($langs->trans("Search"), 'search');
}
}
$out.= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
$out.= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
if ($hidelabel == 3) {
$out.= img_picto($langs->trans("Search"), 'search');
}
@ -1043,7 +1039,7 @@ class Form
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)')
* @param string $showempty Add an empty field (Can be '1' or text to use on empty line like 'SelectThirdParty')
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box
* @param int $forcecombo Force to use standard HTML select component without beautification
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param string $filterkey Filter on key value
* @param int $outputmode 0=HTML select string, 1=Array
@ -1152,17 +1148,23 @@ class Form
if ($obj->fournisseur) $label.=($obj->client?', ':'').$langs->trans("Supplier");
if ($obj->client || $obj->fournisseur) $label.=')';
}
if ($selected > 0 && $selected == $obj->rowid)
if (empty($outputmode))
{
$out.= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
if ($selected > 0 && $selected == $obj->rowid)
{
$out.= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
}
else
{
$out.= '<option value="'.$obj->rowid.'">'.$label.'</option>';
}
}
else
{
$out.= '<option value="'.$obj->rowid.'">'.$label.'</option>';
array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label));
}
array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label));
$i++;
if (($i % 10) == 0) $out.="\n";
}
@ -4749,6 +4751,12 @@ class Form
$smin = dol_print_date($set_time, "%M");
$ssec = dol_print_date($set_time, "%S");
}
else
{
$shour = '';
$smin = '';
$ssec = '';
}
}
else
{
@ -5121,6 +5129,202 @@ class Form
}
/**
* Generic method to select a component from a combo list.
* This is the generic method that will replace all specific existing methods.
*
* @param string $objectdesc Objectclassname:Objectclasspath
* @param string $htmlname Name of HTML select component
* @param int $preselectedvalue Preselected value (ID of element)
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
* @param string $searchkey Search criteria
* @param string $placeholder Place holder
* @param string $morecss More CSS
* @param string $moreparams More params provided to ajax call
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @return string Return HTML string
* @see selectForFormsList select_thirdparty
*/
function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty='', $searchkey='', $placeholder='', $morecss='', $moreparams='', $forcecombo=0)
{
global $conf, $user;
$objecttmp = null;
$InfoFieldList = explode(":", $objectdesc);
$classname=$InfoFieldList[0];
$classpath=$InfoFieldList[1];
if (! empty($classpath))
{
dol_include_once($classpath);
if ($classname && class_exists($classname))
{
$objecttmp = new $classname($this->db);
}
}
if (! is_object($objecttmp))
{
dol_syslog('Error bad setup of type for field '.$InfoFieldList, LOG_WARNING);
return 'Error bad setup of type for field '.join(',', $InfoFieldList);
}
$prefixforautocompletemode=$objecttmp->element;
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
dol_syslog(get_class($this)."::selectForForms", LOG_DEBUG);
$out='';
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->$confkeyforautocompletemode) && ! $forcecombo)
{
$objectdesc=$classname.':'.$classpath;
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
//if ($objecttmp->element == 'societe') $urlforajaxcall = DOL_URL_ROOT.'/societe/ajax/company.php';
// No immediate load of all database
$urloption='htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.($moreparams?$moreparams:'');
// Activate the auto complete using ajax call.
$out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
$out.= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
if ($placeholder) $placeholder=' placeholder="'.$placeholder.'"';
$out.= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
}
else
{
// Immediate load of all database
$out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo);
}
return $out;
}
/**
* Output html form to select an object.
* Note, this function is called by selectForForms or by ajax selectobject.php
*
* @param Object $objecttmp Object
* @param string $htmlname Name of HTML select component
* @param int $preselectedvalue Preselected value (ID of element)
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
* @param string $searchkey Search value
* @param string $placeholder Place holder
* @param string $morecss More CSS
* @param string $moreparams More params provided to ajax call
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param int $outputmode 0=HTML select string, 1=Array
* @return string Return HTML string
* @see selectForForms
*/
function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty='', $searchkey='', $placeholder='', $morecss='', $moreparams='', $forcecombo=0, $outputmode=0)
{
global $conf, $langs, $user;
$prefixforautocompletemode=$objecttmp->element;
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
$fieldstoshow='t.ref';
if (! empty($objecttmp->fields))
{
$tmpfieldstoshow='';
foreach($objecttmp->fields as $key => $val)
{
if ($val['showoncombobox']) $tmpfieldstoshow.=($tmpfieldstoshow?',':'').'t.'.$key;
}
if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow;
}
$out='';
$outarray=array();
$num=0;
// Search data
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t";
if ($objecttmp->ismultientitymanaged == 2)
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE t.entity IN (".getEntity($objecttmp->table_element).")";
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->societe_id)) $sql.= " AND t.fk_soc = ".$user->societe_id;
if ($searchkey != '') $sql.=natural_search(explode(',',$fieldstoshow), $searchkey);
if ($objecttmp->ismultientitymanaged == 2)
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND t.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.=$this->db->order($fieldstoshow,"ASC");
//$sql.=$this->db->plimit($limit, 0);
// Build output string
$resql=$this->db->query($sql);
if ($resql)
{
if ($conf->use_javascript_ajax && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement =ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode);
$out.= $comboenhancement;
}
// Construct $out and $outarray
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparams?' '.$moreparams:'').' name="'.$htmlname.'">'."\n";
// Warning: Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
$textifempty='&nbsp;';
//if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
if (! empty($conf->global->$confkeyforautocompletemode))
{
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
else $textifempty.=$langs->trans("All");
}
if ($showempty) $out.= '<option value="-1">'.$textifempty.'</option>'."\n";
$num = $this->db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$label='';
$tmparray=explode(',', $fieldstoshow);
foreach($tmparray as $key => $val)
{
$val = preg_replace('/t\./','',$val);
$label .= (($label && $obj->$val)?' - ':'').$obj->$val;
}
if (empty($outputmode))
{
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid)
{
$out.= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
}
else
{
$out.= '<option value="'.$obj->rowid.'">'.$label.'</option>';
}
}
else
{
array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label));
}
$i++;
if (($i % 10) == 0) $out.="\n";
}
}
$out.= '</select>'."\n";
}
else
{
dol_print_error($this->db);
}
$this->result=array('nbofelement'=>$num);
if ($outputmode) return $outarray;
return $out;
}
/**
* Return a HTML select string, built from an array of key+value.
* Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
@ -5172,7 +5376,9 @@ class Form
}
}
$out.='<select id="'.preg_replace('/^\./','',$htmlname).'" '.($disabled?'disabled ':'').'class="flat '.(preg_replace('/^\./','',$htmlname)).($morecss?' '.$morecss:'').'" name="'.preg_replace('/^\./','',$htmlname).'" '.($moreparam?$moreparam:'').'>';
$out.='<select id="'.preg_replace('/^\./','',$htmlname).'" '.($disabled?'disabled ':'').'class="flat '.(preg_replace('/^\./','',$htmlname)).($morecss?' '.$morecss:'').'"';
$out.=' name="'.preg_replace('/^\./','',$htmlname).'" '.($moreparam?$moreparam:'');
$out.='>';
if ($show_empty)
{
@ -5209,10 +5415,6 @@ class Form
$style=' class="warning"';
}
}
$out.='<option value="'.$key.'"';
$out.=$style.$disabled;
if ($id != '' && $id == $key && ! $disabled) $out.=' selected'; // To preselect a value
$out.='>';
if ($key_in_label)
{
@ -5225,6 +5427,12 @@ class Form
else $selectOptionValue = $maxlen?dol_trunc($value,$maxlen):$value;
if ($value == '' || $value == '-') $selectOptionValue='&nbsp;';
}
$out.='<option value="'.$key.'"';
$out.=$style.$disabled;
if ($id != '' && $id == $key && ! $disabled) $out.=' selected'; // To preselect a value
if ($nohtmlescape) $out.=' html="'.dol_escape_htmltag($selectOptionValue).'"';
$out.='>';
//var_dump($selectOptionValue);
$out.=$selectOptionValue;
$out.="</option>\n";
@ -5300,7 +5508,7 @@ class Form
cache: true
},
language: select2arrayoflanguage,
/* dropdownCssClass: "css-'.$htmlname.'", */
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
placeholder: "'.dol_escape_js($placeholder).'",
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: '.$minimumInputLength.',
@ -5312,12 +5520,13 @@ class Form
'.($callurlonselect ? '
/* Code to execute a GET when we select a value */
$(".'.$htmlname.'").change(function() {
var selected = $(".'.$htmlname.'").select2("val");
$(".'.$htmlname.'").select2("val",""); /* reset visible combo value */
var selected = $(".'.$htmlname.'").val();
console.log("We select "+selected)
$(".'.$htmlname.'").val(""); /* reset visible combo value */
$.each( saveRemoteData, function( key, value ) {
if (key == selected)
{
console.log("Do a redirect into selectArrayAjax to "+value.url)
console.log("selectArrayAjax - Do a redirect to "+value.url)
location.assign(value.url);
}
});
@ -5433,11 +5642,11 @@ class Form
/**
* Show a multiselect form from an array.
* Show a multiselect dropbox from an array.
*
* @param string $htmlname Name of select
* @param string $htmlname Name of HTML field
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
* @param string $varpage Id of context for page. Can be set 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
* @see selectarray
*/

View File

@ -249,16 +249,16 @@ class FormActions
print $action->type;
print '</td>';
print '<td>'.$label.'</td>';
print '<td align="center">'.dol_print_date($action->datep,'dayhour');
print '<td align="center">'.dol_print_date($action->datep, 'dayhour', 'tzuserrel');
if ($action->datef)
{
$tmpa=dol_getdate($action->datep);
$tmpb=dol_getdate($action->datef);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year'])
{
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($action->datef,'hour');
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($action->datef, 'hour', 'tzuserrel');
}
else print '-'.dol_print_date($action->datef,'dayhour');
else print '-'.dol_print_date($action->datef, 'dayhour', 'tzuserrel');
}
print '</td>';
print '<td align="right">';

View File

@ -51,7 +51,7 @@ class FormAdmin
* @param string $htmlname Name of HTML select
* @param int $showauto Show 'auto' choice
* @param array $filter Array of keys to exclude in list
* @param string $showempty 1=Add empty value or string to show
* @param string $showempty '1'=Add empty value or string to show
* @param int $showwarning Show a warning if language is not complete
* @param int $disabled Disable edit of select
* @param string $morecss Add more css styles

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