Merge remote-tracking branch 'uptream/develop' into 7.0-general_ledger
This commit is contained in:
commit
7c0ff3a32f
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
27
ChangeLog
27
ChangeLog
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ $langs->load("agenda");
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
|
||||
$search_event = GETPOST('search_event', 'alpha');
|
||||
|
||||
// Get list of triggers available
|
||||
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
|
||||
@ -70,6 +71,12 @@ else
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_event = '';
|
||||
}
|
||||
|
||||
if ($action == "save" && empty($cancel))
|
||||
{
|
||||
$i=0;
|
||||
@ -78,10 +85,13 @@ if ($action == "save" && empty($cancel))
|
||||
|
||||
foreach ($triggers as $trigger)
|
||||
{
|
||||
$param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$keyparam='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
//print "param=".$param." - ".$_POST[$param];
|
||||
$res = dolibarr_set_const($db,$param,(GETPOST($param,'alpha')?GETPOST($param,'alpha'):''),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $keyparam))
|
||||
{
|
||||
$res = dolibarr_set_const($db,$keyparam,(GETPOST($keyparam,'alpha')?GETPOST($keyparam,'alpha'):''),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -140,6 +150,8 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="save">';
|
||||
|
||||
$param = '';
|
||||
$param.= '&search_event='.urlencode($search_event);
|
||||
|
||||
$head=agenda_prepare_head();
|
||||
|
||||
@ -151,8 +163,19 @@ print "<br>\n";
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>';
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="liste_titre">'.$langs->trans("ActionsEvents").'</th>';
|
||||
print '<th class="liste_titre"></th>';
|
||||
print '<th class="liste_titre"><a href="'.$_SERVER["PHP_SELF"].'?action=selectall'.($param?$param:'').'">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone'.($param?$param:'').'">'.$langs->trans("None").'</a></th>';
|
||||
print '</tr>'."\n";
|
||||
// Show each trigger (list is in c_action_trigger)
|
||||
if (! empty($triggers))
|
||||
@ -173,15 +196,17 @@ if (! empty($triggers))
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$trigger['code'].'</td>';
|
||||
print '<td>'.$trigger['label'].'</td>';
|
||||
print '<td align="right" width="40">';
|
||||
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$value=$conf->global->$key;
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
|
||||
print '</td></tr>'."\n";
|
||||
if ($search_event === '' || preg_match('/'.preg_quote($search_event,'/').'/i', $trigger['code']))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$trigger['code'].'</td>';
|
||||
print '<td>'.$trigger['label'].'</td>';
|
||||
print '<td align="right" width="40">';
|
||||
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$value=$conf->global->$key;
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,6 +352,15 @@ else
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
|
||||
@ -381,15 +390,6 @@ print '<td align="right">'."\n";
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -258,14 +258,14 @@ $var=true;
|
||||
|
||||
$var=! $var;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -539,7 +539,7 @@ print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -550,7 +550,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='ORDER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -573,7 +573,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext);
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input class="flat minwidth200" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -474,7 +474,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'));
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -482,8 +482,7 @@ $htmltext.='</i>';
|
||||
|
||||
$var=! $var;
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
//print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2);
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print '<br>';
|
||||
$variablename='CONTRACT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
@ -501,8 +500,7 @@ print '</td></tr>'."\n";
|
||||
//Use draft Watermark
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
//print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2);
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
@ -193,20 +193,14 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
|
||||
//$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.$langs->trans("Disabled").'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableDefaultValues");
|
||||
$enabledisablehtml.='</span>';
|
||||
$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$enabledisablehtml.= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
|
||||
//$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.$langs->trans("Activated").'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableDefaultValues");
|
||||
$enabledisablehtml.='</span>';
|
||||
$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
||||
$enabledisablehtml.= '</a>';
|
||||
}
|
||||
|
||||
|
||||
@ -477,14 +477,14 @@ print "<tr class=\"liste_titre\">";
|
||||
print "<td>".$langs->trans("Parameter")."</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SHIPPING_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -499,7 +499,7 @@ else
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.$conf->global->SHIPPING_DRAFT_WATERMARK.'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
@ -482,7 +482,7 @@ print '<td align="center" width="60"></td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -490,7 +490,7 @@ $htmltext.='</i>';
|
||||
|
||||
$var=! $var;
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='EXPENSEREPORT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -507,7 +507,7 @@ print '</td></tr>'."\n";
|
||||
//Use draft Watermark
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
|
||||
@ -711,7 +711,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -722,7 +722,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='INVOICE_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -744,7 +744,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext);
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td>';
|
||||
print '<td><input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -534,7 +534,7 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -544,7 +544,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='FICHINTER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -567,7 +567,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.$conf->global->FICHINTER_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -454,7 +454,7 @@ print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -465,7 +465,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='DELIVERY_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -116,7 +116,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -545,7 +545,7 @@ print "</td></tr>\n";
|
||||
print '</form>';
|
||||
*/
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -555,7 +555,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='PROPOSAL_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -577,7 +577,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input class="flat minwidth200" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -471,14 +471,14 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_INVOICE_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -537,14 +537,14 @@ else
|
||||
}
|
||||
*/
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_ORDER_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
|
||||
@ -500,7 +500,7 @@ print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
|
||||
print "<td> </td>\n";
|
||||
print "</tr>";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs);
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
@ -511,7 +511,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
@ -533,7 +533,7 @@ print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'<br>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="SUPPLIER_PROPOSAL_DRAFT_WATERMARK" value="'.$conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
|
||||
@ -210,7 +210,7 @@ llxHeader('',$langs->trans("Setup"),$wikihelp);
|
||||
$param='&mode='.$mode;
|
||||
|
||||
$enabledisablehtml='';
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
|
||||
$enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
|
||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
// Button off, click to enable
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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,18 +173,18 @@ 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) {
|
||||
|
||||
public function setObjectData(&$object)
|
||||
{
|
||||
// Set date
|
||||
if ($object->element=='payment')
|
||||
if ($object->element == 'payment' || $object->element == 'payment_supplier')
|
||||
{
|
||||
$this->date_object = $object->datepaye;
|
||||
}
|
||||
if ($object->element=='payment_salary')
|
||||
elseif ($object->element=='payment_salary')
|
||||
{
|
||||
$this->date_object = $object->datev;
|
||||
}
|
||||
@ -174,7 +198,7 @@ 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();
|
||||
@ -190,15 +214,31 @@ class BlockedLog
|
||||
$this->object_data->total_localtax2= (double) $object->total_localtax2;
|
||||
$this->object_data->note_public = (double) $object->note_public;
|
||||
}
|
||||
elseif($this->element === 'payment')
|
||||
if($this->element == 'invoice_supplier') {
|
||||
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;
|
||||
$this->object_data->note_private= (double) $object->note_private;
|
||||
|
||||
}
|
||||
elseif ($this->element == 'payment'|| $object->element == 'payment_supplier')
|
||||
{
|
||||
$this->object_data->amounts = $object->amounts;
|
||||
}
|
||||
elseif($this->element === 'payment_salary')
|
||||
elseif($this->element == 'payment_salary')
|
||||
{
|
||||
$this->object_data->amounts = array($object->amount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -520,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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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'].'">';
|
||||
|
||||
@ -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
|
||||
@ -1528,10 +1530,18 @@ class ActionComm extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
// TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done
|
||||
|
||||
|
||||
|
||||
// Delete also very old past events (we do not keep more than 1 month record in past)
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->jdate($now - (3600 * 24 * 32))."'";
|
||||
$this->db->query($sql);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
229
htdocs/comm/action/class/actioncommreminder.class.php
Normal file
229
htdocs/comm/action/class/actioncommreminder.class.php
Normal file
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file class/actioncommreminder.class.php
|
||||
* \ingroup agenda
|
||||
* \brief This file is a CRUD class file for ActionCommReminder (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class for ActionCommReminder
|
||||
*/
|
||||
class ActionCommReminder extends CommonObject
|
||||
{
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
public $element = 'actioncomm_reminder';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'actioncomm_reminder';
|
||||
/**
|
||||
* @var array Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
public $ismultientitymanaged = 0;
|
||||
/**
|
||||
* @var string String with name of icon for actioncommreminder. Must be the part after the 'object_' into object_actioncommreminder.png
|
||||
*/
|
||||
public $picto = 'generic';
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format.
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
* 'showoncombobox' if field must be shown into the label of combobox
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'dateremind' => array('type'=>'datetime', 'label'=>'DateRemind', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>1, 'index'=>1,),
|
||||
'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",),
|
||||
'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,),
|
||||
'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,),
|
||||
'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')),
|
||||
);
|
||||
public $rowid;
|
||||
public $dateremind;
|
||||
public $typeremind;
|
||||
public $fk_user;
|
||||
public $offsetvalue;
|
||||
public $offsetunit;
|
||||
public $status;
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible']=0;
|
||||
if (empty($conf->multicompany->enabled)) $this->fields['entity']['enabled']=0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->createCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
$result = $this->fetchCommon($id, $ref);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->updateCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
return $this->deleteCommon($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le libelle du status d'un user (actif, inactif)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status
|
||||
*
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
static function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($status == 1) return $langs->trans('Done');
|
||||
if ($status == 0) return $langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Done');
|
||||
if ($status == 0) return $langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
|
||||
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Done'),'statut4');
|
||||
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
|
||||
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
|
||||
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
|
||||
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->initAsSpecimenCommon();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1364,7 +1364,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print '>';
|
||||
print '<table class="centpercent cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
|
||||
print 'background: #'.$color.';';
|
||||
print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($color, 0).'), to(#'.dol_color_minus($color, 1).'));';
|
||||
print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($color, -4).'), to(#'.dol_color_minus($color, -3).'));';
|
||||
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
|
||||
//print ' -moz-border-radius:4px;"';
|
||||
@ -1572,7 +1572,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
* Change color with a delta
|
||||
*
|
||||
* @param string $color Color
|
||||
* @param int $minus Delta (1 = 16 unit)
|
||||
* @param int $minus Delta (1 = 16 unit). Positive value = darker color, Negative value = brighter color.
|
||||
* @param int $minusunit Minus unit
|
||||
* @return string New color
|
||||
*/
|
||||
|
||||
@ -2195,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="">
|
||||
|
||||
@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2388,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="">
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -142,7 +142,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -4078,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="">
|
||||
|
||||
@ -77,21 +77,6 @@ class Invoices extends DolibarrApi
|
||||
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
|
||||
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
|
||||
|
||||
// get available discounts of customer
|
||||
/* TODO Move this into thirdparty API
|
||||
$soc = new Societe($this->db);
|
||||
if ($this->invoice->socid > 0)
|
||||
$res = $soc->fetch($this->invoice->socid);
|
||||
if($res) {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%'))";
|
||||
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
|
||||
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
|
||||
$absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
|
||||
$this->invoice->absolute_discount = price2num($absolute_discount, 'MT');
|
||||
$this->invoice->absolute_creditnote = price2num($absolute_creditnote, 'MT');
|
||||
}
|
||||
*/
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
@ -667,8 +652,96 @@ 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 a payment list of a given invoice
|
||||
* Get list of payments of a given invoice
|
||||
*
|
||||
* @param int $id Id of invoice
|
||||
*
|
||||
@ -706,8 +779,6 @@ class Invoices extends DolibarrApi
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -138,7 +138,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -160,7 +160,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -326,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
|
||||
);
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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&leftmenu=contracts&mode=0';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0';
|
||||
} else {
|
||||
$warning_delay = $conf->contrat->services->expires->warning_delay;
|
||||
$url = DOL_URL_ROOT.'/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired';
|
||||
$label = $langs->trans("BoardRunningServices");
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -190,7 +190,7 @@ foreach($listofstatus as $status)
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
@ -210,7 +210,7 @@ foreach($listofstatus as $status)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
print '<td align="right"><a href="services_list.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
if ($status==4 && ! $bool) $bool=true;
|
||||
else $bool=false;
|
||||
print "</tr>\n";
|
||||
@ -468,7 +468,7 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("NotActivatedServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=0"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
@ -548,7 +548,7 @@ if ($resql)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print '<tr class="liste_titre"><th colspan="4">'.$langs->trans("ListOfExpiredServices").' <a href="'.DOL_URL_ROOT.'/contrat/services_list.php?mode=4&filter=expired"><span class="badge">'.$num.'</span></a></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < $num)
|
||||
|
||||
@ -137,7 +137,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contrat/services.php
|
||||
* \file htdocs/contrat/services_list.php
|
||||
* \ingroup contrat
|
||||
* \brief Page to list services in contracts
|
||||
*/
|
||||
@ -134,7 +134,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
//print $sql;
|
||||
dol_syslog("contrat/services.php", LOG_DEBUG);
|
||||
dol_syslog("contrat/services_list.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -46,7 +46,11 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
||||
{
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
|
||||
$object->$key=GETPOST($key,'alpha');
|
||||
$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++;
|
||||
@ -85,7 +89,11 @@ if ($action == 'update' && ! empty($permissiontoadd))
|
||||
{
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
|
||||
$object->$key=GETPOST($key,'alpha');
|
||||
$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++;
|
||||
|
||||
@ -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:''),
|
||||
|
||||
@ -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;
|
||||
|
||||
86
htdocs/core/ajax/selectobject.php
Normal file
86
htdocs/core/ajax/selectobject.php
Normal 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);
|
||||
@ -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
@ -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
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -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"> </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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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 ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
|
||||
$textifempty=' ';
|
||||
|
||||
//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=' ';
|
||||
}
|
||||
|
||||
$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
|
||||
*/
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1001,8 +1001,8 @@ class FormOther
|
||||
{
|
||||
if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user
|
||||
$label=$langs->transnoentitiesnoconv($box->boxlabel);
|
||||
if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')';
|
||||
//$label = '<span class="fa fa-home fa-fw" aria-hidden="true"></span>'.$label; KO with select2. No html rendering.
|
||||
//if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')';
|
||||
if (preg_match('/graph/',$box->class)) $label=$label.' <span class="fa fa-bar-chart"></span>';
|
||||
$arrayboxtoactivatelabel[$box->id]=$label; // We keep only boxes not shown for user, to show into combo list
|
||||
}
|
||||
foreach($boxidactivatedforuser as $boxid)
|
||||
@ -1014,6 +1014,7 @@ class FormOther
|
||||
//var_dump($boxidactivatedforuser);
|
||||
|
||||
// Class Form must have been already loaded
|
||||
$selectboxlist.='<!-- Form with select box list -->'."\n";
|
||||
$selectboxlist.='<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$selectboxlist.='<input type="hidden" name="addbox" value="addbox">';
|
||||
$selectboxlist.='<input type="hidden" name="userid" value="'.$user->id.'">';
|
||||
@ -1086,6 +1087,7 @@ class FormOther
|
||||
var self = this; // because JQuery can modify this
|
||||
var boxid=self.id.substring(8);
|
||||
var label=jQuery(\'#boxlabelentry\'+boxid).val();
|
||||
console.log("We close box "+boxid);
|
||||
jQuery(\'#boxto_\'+boxid).remove();
|
||||
if (boxid > 0) jQuery(\'#boxcombo\').append(new Option(label, boxid));
|
||||
updateBoxOrder(1); /* 1 to avoid message after a remove */
|
||||
|
||||
@ -624,7 +624,7 @@ class Translate
|
||||
$str=str_replace(array('<','>','"',),array('__lt__','__gt__','__quot__'),$str);
|
||||
|
||||
// Crypt string into HTML
|
||||
$str=htmlentities($str,ENT_QUOTES,$this->charset_output);
|
||||
$str=htmlentities($str, ENT_COMPAT, $this->charset_output); // Do not convert simple quotes in translation (strings in html are enmbraced by "). Use dol_escape_htmltag around text in HTML content
|
||||
|
||||
// Restore HTML tags
|
||||
$str=str_replace(array('__lt__','__gt__','__quot__'),array('<','>','"',),$str);
|
||||
|
||||
@ -274,7 +274,15 @@ class DoliDBPgsql extends DoliDB
|
||||
$line.= "ALTER TABLE ".$reg[1]." ADD PRIMARY KEY (".$reg[3];
|
||||
}
|
||||
|
||||
// Translate order to drop foreign keys
|
||||
// Translate order to drop primary keys
|
||||
// ALTER TABLE llx_dolibarr_modules DROP PRIMARY KEY pk_xxx
|
||||
if (preg_match('/ALTER\s+TABLE\s*(.*)\s*DROP\s+PRIMARY\s+KEY\s*([^;]+)$/i',$line,$reg))
|
||||
{
|
||||
$line = "-- ".$line." replaced by --\n";
|
||||
$line.= "ALTER TABLE ".$reg[1]." DROP CONSTRAINT ".$reg[2];
|
||||
}
|
||||
|
||||
// Translate order to drop foreign keys
|
||||
// ALTER TABLE llx_dolibarr_modules DROP FOREIGN KEY fk_xxx
|
||||
if (preg_match('/ALTER\s+TABLE\s*(.*)\s*DROP\s+FOREIGN\s+KEY\s*(.*)$/i',$line,$reg))
|
||||
{
|
||||
|
||||
@ -160,8 +160,8 @@ var select2arrayoflanguage = {
|
||||
noResults: function () { return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2NotFound")); ?>"; },
|
||||
inputTooShort: function (input) {
|
||||
var n = input.minimum;
|
||||
console.log(input);
|
||||
console.log(input.minimum);
|
||||
/*console.log(input);
|
||||
console.log(input.minimum);*/
|
||||
if (n > 1) return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2MoreCharacters")); ?>";
|
||||
else return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2MoreCharacter")); ?>"
|
||||
},
|
||||
@ -427,6 +427,28 @@ function urlencode(s) {
|
||||
return news;
|
||||
}
|
||||
|
||||
/*
|
||||
* =================================================================
|
||||
* Purpose: Clean string to have it url encoded
|
||||
* Input: s
|
||||
* Author: Laurent Destailleur
|
||||
* Licence: GPL
|
||||
* ==================================================================
|
||||
*/
|
||||
function htmlEntityDecodeJs(inp){
|
||||
var replacements = {'<':'<','>':'>','/':'/','"':'"',''':'\'','&':'&',' ':' '};
|
||||
if (inp)
|
||||
{
|
||||
for(var r in replacements){
|
||||
inp = inp.replace(new RegExp(r,'g'),replacements[r]);
|
||||
}
|
||||
return inp.replace(/&#(\d+);/g, function(match, dec) {
|
||||
return String.fromCharCode(dec);
|
||||
});
|
||||
}
|
||||
else { return ''; }
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* =================================================================
|
||||
|
||||
@ -27,9 +27,9 @@
|
||||
/**
|
||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php).
|
||||
* The HTML field must be an input text with id=search_$htmlname.
|
||||
* This use the jQuery "autocomplete" function.
|
||||
* This use the jQuery "autocomplete" function. If we want to use the select2, we must also convert the input into select on funcntions that call this method.
|
||||
*
|
||||
* @param string $selected Preselecte value
|
||||
* @param string $selected Preselected value
|
||||
* @param string $htmlname HTML name of input field
|
||||
* @param string $url Url for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
|
||||
* @param string $urloption More parameters on URL request
|
||||
@ -411,17 +411,23 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
||||
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
||||
minimumInputLength: '.$minLengthToAutocomplete.',
|
||||
language: select2arrayoflanguage,
|
||||
containerCssClass: \':all:\', /* Line to add class or origin SELECT propagated to the new <span class="select2-selection...> tag */
|
||||
templateResult: function (data, container) { /* Format visible output into combo list */
|
||||
/* Code to add class of origin option propagated to the new select2 li tag */
|
||||
/* Code to add class of origin OPTION propagated to the new select2 <li> tag */
|
||||
if (data.element) {
|
||||
$(container).addClass($(data.element).attr("class"));
|
||||
}
|
||||
|
||||
//console.log(data.html);
|
||||
if ($(data.element).attr("html") != undefined) return htmlEntityDecodeJs($(data.element).attr("html")); // If property html set, we decode html entities and use this
|
||||
return data.text;
|
||||
},
|
||||
templateSelection: function (selection) { /* Format visible output of selected value */
|
||||
return selection.text;
|
||||
},
|
||||
escapeMarkup: function(markup) {
|
||||
return markup;
|
||||
}
|
||||
})';
|
||||
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
||||
$msg.= ';'."\n";
|
||||
|
||||
@ -321,56 +321,27 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
|
||||
}
|
||||
}
|
||||
// Else, retreive default values if we are not doing a sort
|
||||
elseif (! isset($_GET['sortfield']) && ! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set
|
||||
elseif (! isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set
|
||||
{
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||
// Search default value from $object->field
|
||||
global $object;
|
||||
if (is_object($object) && isset($object->fields[$paramname]['default']))
|
||||
{
|
||||
if (isset($user->default_values[$relativepathstring]['createform']))
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['createform'] as $defkey => $defval)
|
||||
{
|
||||
$qualified = 0;
|
||||
if ($defkey != '_noquery_')
|
||||
{
|
||||
$tmpqueryarraytohave=explode('&', $defkey);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
$foundintru=0;
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||
}
|
||||
if (! $foundintru) $qualified=1;
|
||||
//var_dump($defkey.'-'.$qualified);
|
||||
}
|
||||
else $qualified = 1;
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring][$defkey]['createform']);
|
||||
if (isset($user->default_values[$relativepathstring]['createform'][$defkey][$paramname]))
|
||||
{
|
||||
$out = $user->default_values[$relativepathstring]['createform'][$defkey][$paramname];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$out = $object->fields[$paramname]['default'];
|
||||
}
|
||||
}
|
||||
// Management of default search_filters and sort order
|
||||
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
if (! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring]);
|
||||
if ($paramname == 'sortfield' || $paramname == 'sortorder') // Sorted on which fields ? ASC or DESC ?
|
||||
// Now search in setup to overwrite default values
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||
{
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
|
||||
if (isset($user->default_values[$relativepathstring]['createform']))
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $defkey => $defval)
|
||||
foreach($user->default_values[$relativepathstring]['createform'] as $defkey => $defval)
|
||||
{
|
||||
$qualified = 0;
|
||||
if ($defkey != '_noquery_')
|
||||
@ -389,67 +360,108 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val)
|
||||
//var_dump($user->default_values[$relativepathstring][$defkey]['createform']);
|
||||
if (isset($user->default_values[$relativepathstring]['createform'][$defkey][$paramname]))
|
||||
{
|
||||
if ($out) $out.=', ';
|
||||
if ($paramname == 'sortfield')
|
||||
{
|
||||
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
|
||||
}
|
||||
if ($paramname == 'sortorder')
|
||||
{
|
||||
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
|
||||
}
|
||||
$out = $user->default_values[$relativepathstring]['createform'][$defkey][$paramname];
|
||||
break;
|
||||
}
|
||||
//break; // No break for sortfield and sortorder so we can cumulate fields (is it realy usefull ?)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($user->default_values[$relativepathstring]['filters']))
|
||||
}
|
||||
// Management of default search_filters and sort order
|
||||
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['filters'] as $defkey => $defval)
|
||||
//var_dump($user->default_values[$relativepathstring]);
|
||||
if ($paramname == 'sortfield' || $paramname == 'sortorder') // Sorted on which fields ? ASC or DESC ?
|
||||
{
|
||||
$qualified = 0;
|
||||
if ($defkey != '_noquery_')
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
|
||||
{
|
||||
$tmpqueryarraytohave=explode('&', $defkey);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
$foundintru=0;
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'] as $defkey => $defval)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||
}
|
||||
if (! $foundintru) $qualified=1;
|
||||
//var_dump($defkey.'-'.$qualified);
|
||||
}
|
||||
else $qualified = 1;
|
||||
$qualified = 0;
|
||||
if ($defkey != '_noquery_')
|
||||
{
|
||||
$tmpqueryarraytohave=explode('&', $defkey);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
$foundintru=0;
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||
}
|
||||
if (! $foundintru) $qualified=1;
|
||||
//var_dump($defkey.'-'.$qualified);
|
||||
}
|
||||
else $qualified = 1;
|
||||
|
||||
if ($qualified)
|
||||
if ($qualified)
|
||||
{
|
||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||
foreach($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val)
|
||||
{
|
||||
if ($out) $out.=', ';
|
||||
if ($paramname == 'sortfield')
|
||||
{
|
||||
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
|
||||
}
|
||||
if ($paramname == 'sortorder')
|
||||
{
|
||||
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
|
||||
}
|
||||
}
|
||||
//break; // No break for sortfield and sortorder so we can cumulate fields (is it realy usefull ?)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($user->default_values[$relativepathstring]['filters']))
|
||||
{
|
||||
foreach($user->default_values[$relativepathstring]['filters'] as $defkey => $defval)
|
||||
{
|
||||
if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
|
||||
$qualified = 0;
|
||||
if ($defkey != '_noquery_')
|
||||
{
|
||||
// We made a search from quick search menu, do we still use default filter ?
|
||||
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
|
||||
$tmpqueryarraytohave=explode('&', $defkey);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
$foundintru=0;
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||
}
|
||||
if (! $foundintru) $qualified=1;
|
||||
//var_dump($defkey.'-'.$qualified);
|
||||
}
|
||||
else $qualified = 1;
|
||||
|
||||
if ($qualified)
|
||||
{
|
||||
if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
|
||||
{
|
||||
// We made a search from quick search menu, do we still use default filter ?
|
||||
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
|
||||
{
|
||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
|
||||
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
|
||||
@ -908,7 +920,7 @@ function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
|
||||
*
|
||||
* @param string $stringtoescape String to escape
|
||||
* @param int $keepb 1=Preserve b tags (otherwise, remove them)
|
||||
* @param int $keepn 1=Preserve \r\n strings (otherwise, remove them)
|
||||
* @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value)
|
||||
* @return string Escaped string
|
||||
* @see dol_string_nohtmltag
|
||||
*/
|
||||
@ -1598,7 +1610,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false)
|
||||
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
|
||||
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
|
||||
* false or 'tzserver' => output string is for local PHP server TZ usage
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst)
|
||||
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
|
||||
* 'tzuserrel' => output string is for user TZ (current browser TZ with dst or not, depending on date position) (TODO not implemented yet)
|
||||
* @param Translate $outputlangs Object lang that contains language for text translation.
|
||||
* @param boolean $encodetooutput false=no convert into output pagecode
|
||||
@ -1629,8 +1641,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
{
|
||||
$to_gmt=true;
|
||||
$offsettzstring=(empty($_SESSION['dol_tz_string'])?'UTC':$_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
|
||||
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
|
||||
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60;
|
||||
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60; // Will not be used anymore
|
||||
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60; // Will not be used anymore
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1687,8 +1699,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$time,$reg)
|
||||
|| preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i',$time,$reg)) // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
||||
{
|
||||
// This part of code should not be used. TODO Remove this.
|
||||
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
||||
// TODO Remove this.
|
||||
// This part of code should not be used.
|
||||
dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR);
|
||||
// Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
|
||||
$syear = (! empty($reg[1]) ? $reg[1] : '');
|
||||
$smonth = (! empty($reg[2]) ? $reg[2] : '');
|
||||
@ -1698,22 +1711,26 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
$ssec = (! empty($reg[6]) ? $reg[6] : '');
|
||||
|
||||
$time=dol_mktime($shour,$smin,$ssec,$smonth,$sday,$syear,true);
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Date is a timestamps
|
||||
if ($time < 100000000000) // Protection against bad date values
|
||||
{
|
||||
$ret=adodb_strftime($format, $time+$offsettz+$offsetdst, $to_gmt); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$ret=adodb_strftime($format, $timetouse, $to_gmt);
|
||||
}
|
||||
else $ret='Bad value '.$time.' for date';
|
||||
}
|
||||
|
||||
if (preg_match('/__b__/i',$format))
|
||||
{
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||
$month=adodb_strftime('%m', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$month=adodb_strftime('%m', $timetouse);
|
||||
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||
if ($encodetooutput)
|
||||
{
|
||||
@ -1733,7 +1750,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
}
|
||||
if (preg_match('/__a__/i',$format))
|
||||
{
|
||||
$w=adodb_strftime('%w', $time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$timetouse = $time+$offsettz+$offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
|
||||
$w=adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w);
|
||||
$ret=str_replace('__A__',$dayweek,$ret);
|
||||
$ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret);
|
||||
@ -2229,17 +2248,9 @@ function dol_print_ip($ip,$mode=0)
|
||||
|
||||
if (empty($mode)) $ret.=$ip;
|
||||
|
||||
if (! empty($conf->geoipmaxmind->enabled) && $mode != 2)
|
||||
if ($mode != 2)
|
||||
{
|
||||
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
|
||||
//$ip='24.24.24.24';
|
||||
//$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages)
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
$geoip=new DolGeoIP('country',$datafile);
|
||||
//print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n";
|
||||
//print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n";
|
||||
$countrycode=$geoip->getCountryCodeFromIP($ip);
|
||||
$countrycode=dolGetCountryCodeFromIp($ip);
|
||||
if ($countrycode) // If success, countrycode is us, fr, ...
|
||||
{
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/common/flags/'.$countrycode.'.png'))
|
||||
@ -2253,6 +2264,35 @@ function dol_print_ip($ip,$mode=0)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a country code from IP. Empty string if not found.
|
||||
*
|
||||
* @param string $ip IP
|
||||
* @return string Country code ('us', 'fr', ...)
|
||||
*/
|
||||
function dolGetCountryCodeFromIp($ip)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$countrycode='';
|
||||
|
||||
if (! empty($conf->geoipmaxmind->enabled))
|
||||
{
|
||||
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
|
||||
//$ip='24.24.24.24';
|
||||
//$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages)
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
|
||||
$geoip=new DolGeoIP('country',$datafile);
|
||||
//print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n";
|
||||
//print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n";
|
||||
$countrycode=$geoip->getCountryCodeFromIP($ip);
|
||||
}
|
||||
|
||||
return $countrycode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return country code for current user.
|
||||
* If software is used inside a local network, detection may fails (we need a public ip)
|
||||
@ -2681,19 +2721,17 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($picto == 'switch_off')
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
{
|
||||
$fakey = $picto; $facolor=''; $fasize='';
|
||||
if ($picto == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; }
|
||||
if ($picto == 'switch_on') { $fakey = 'fa-toggle-on'; $facolor='#227722'; $fasize='2em'; }
|
||||
if ($picto == 'off') { $fakey = 'fa-square-o'; $fasize='1.3em'; }
|
||||
if ($picto == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; }
|
||||
$enabledisablehtml='';
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation");
|
||||
$enabledisablehtml.='</span>';
|
||||
return $enabledisablehtml;
|
||||
}
|
||||
if ($picto == 'switch_on')
|
||||
{
|
||||
$enabledisablehtml='';
|
||||
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation");
|
||||
$enabledisablehtml.='<span class="fa '.$fakey.' valignmiddle" style="'.($fasize?('font-size: '.$fasize.';'):'').($facolor?(' color: '.$facolor.';'):'').'" alt="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'">';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$titlealt;
|
||||
$enabledisablehtml.='</span>';
|
||||
return $enabledisablehtml;
|
||||
}
|
||||
@ -5432,6 +5470,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:'';
|
||||
$substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object)?$object->total_ht:'';
|
||||
$substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
|
||||
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object)?($object->total_localtax1?$object->total_localtax1:$object->total_localtax1):'';
|
||||
if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3__'] = is_object($object)?($object->total_localtax2?$object->total_localtax2:$object->total_localtax2):'';
|
||||
|
||||
/* TODO Add key for multicurrency
|
||||
$substitutionarray['__AMOUNT_FORMATED__'] = is_object($object)?price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency_code):'';
|
||||
$substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object)?price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code):'';
|
||||
@ -5734,26 +5775,27 @@ function setEventMessages($mesg, $mesgs, $style='mesgs')
|
||||
* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function, so there is
|
||||
* no need to call it explicitely.
|
||||
*
|
||||
* @param int $disabledoutputofmessages Clear all messages stored into session without diplaying them
|
||||
* @return void
|
||||
* @see dol_htmloutput_mesg
|
||||
* @see dol_htmloutput_mesg
|
||||
*/
|
||||
function dol_htmloutput_events()
|
||||
function dol_htmloutput_events($disabledoutputofmessages=0)
|
||||
{
|
||||
// Show mesgs
|
||||
if (isset($_SESSION['dol_events']['mesgs'])) {
|
||||
dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']);
|
||||
if (empty($disabledoutputofmessages)) dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']);
|
||||
unset($_SESSION['dol_events']['mesgs']);
|
||||
}
|
||||
|
||||
// Show errors
|
||||
if (isset($_SESSION['dol_events']['errors'])) {
|
||||
dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error');
|
||||
if (empty($disabledoutputofmessages)) dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error');
|
||||
unset($_SESSION['dol_events']['errors']);
|
||||
}
|
||||
|
||||
// Show warnings
|
||||
if (isset($_SESSION['dol_events']['warnings'])) {
|
||||
dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning');
|
||||
if (empty($disabledoutputofmessages)) dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning');
|
||||
unset($_SESSION['dol_events']['warnings']);
|
||||
}
|
||||
}
|
||||
@ -6341,21 +6383,18 @@ function printCommonFooter($zone='private')
|
||||
// Google Analytics (need Google module)
|
||||
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
||||
{
|
||||
if (($conf->dol_use_jmobile != 4))
|
||||
{
|
||||
print "\n";
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print ' var _gaq = _gaq || [];'."\n";
|
||||
print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
|
||||
print ' _gaq.push([\'_trackPageview\']);'."\n";
|
||||
print ''."\n";
|
||||
print ' (function() {'."\n";
|
||||
print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
|
||||
print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
|
||||
print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
|
||||
print ' })();'."\n";
|
||||
print '</script>'."\n";
|
||||
}
|
||||
print "\n";
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print ' var _gaq = _gaq || [];'."\n";
|
||||
print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
|
||||
print ' _gaq.push([\'_trackPageview\']);'."\n";
|
||||
print ''."\n";
|
||||
print ' (function() {'."\n";
|
||||
print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
|
||||
print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
|
||||
print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
|
||||
print ' })();'."\n";
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
// End of tuning
|
||||
|
||||
@ -132,9 +132,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; // addslashes is escape for PHP
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>'".$val['help']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; // addslashes is escape for PHP
|
||||
if ($val['arrayofkeyval'])
|
||||
{
|
||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||
@ -215,8 +215,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
$pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php';
|
||||
|
||||
// Edit .sql file
|
||||
$pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($objectname).'.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
|
||||
$pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
|
||||
if (! dol_is_file($pathoffiletoeditsrc))
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -251,7 +251,11 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
$texttoinsert.= "\t".$key." ".$val['type'];
|
||||
|
||||
$type = $val['type'];
|
||||
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
|
||||
|
||||
$texttoinsert.= "\t".$key." ".$type;
|
||||
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||
else
|
||||
@ -283,8 +287,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
}
|
||||
|
||||
// Edit .key.sql file
|
||||
$pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
|
||||
$pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
|
||||
$pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
|
||||
|
||||
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
|
||||
|
||||
@ -297,7 +301,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
$i++;
|
||||
if ($val['index'])
|
||||
{
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($objectname)." ADD INDEX idx_".strtolower($objectname)."_".$key." (".$key.");";
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
|
||||
$texttoinsert.= "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -590,16 +590,17 @@ function pdf_pagehead(&$pdf,$outputlangs,$page_height)
|
||||
|
||||
|
||||
/**
|
||||
* Return array of possible substitutions for PDF content (without external module substitutions).
|
||||
* Return array of possible substitutions for PDF content (without external module substitutions).
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
||||
* @param Object $object Object
|
||||
* @return array Array of substitutions
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
||||
* @param Object $object Object
|
||||
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip)
|
||||
* @return array Array of substitutions
|
||||
*/
|
||||
function pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null)
|
||||
function pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykeys=0)
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $exclude, $object);
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, $onlykeys, $exclude, $object);
|
||||
$substitutionarray['__FROM_NAME__']='__FROM_NAME__';
|
||||
$substitutionarray['__FROM_EMAIL__']='__FROM_EMAIL__';
|
||||
return $substitutionarray;
|
||||
@ -1822,7 +1823,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
|
||||
{
|
||||
if (empty($hookmanager)) global $hookmanager;
|
||||
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||
|
||||
@ -611,7 +611,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
}
|
||||
}
|
||||
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 to start break , -1 no break
|
||||
|
||||
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
@ -871,7 +871,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
|
||||
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_BREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
||||
$oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break
|
||||
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
|
||||
@ -22,8 +22,40 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content.
|
||||
* Used to ouput the page on the Preview.
|
||||
*
|
||||
* @param Website $website Web site object
|
||||
* @param string $content Content to replace
|
||||
* @return boolean True if OK
|
||||
*/
|
||||
function dolWebsiteReplacementOfLinks($website, $content)
|
||||
{
|
||||
// Replace php code. Note $content may come from database and does not contains body tags.
|
||||
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $content);
|
||||
|
||||
// Replace relative link / with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||
// Replace relative link /xxx.php with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
|
||||
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
// <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
|
||||
$content = preg_replace('/(<img[^>]*src=")(?!(http|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
|
||||
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render a string of an HTML content and output it.
|
||||
* Used to ouput the page when viewed from server (Dolibarr or Apache).
|
||||
*
|
||||
* @param string $content Content string
|
||||
* @return void
|
||||
@ -43,7 +75,27 @@ function dolWebsiteOutput($content)
|
||||
|
||||
// Note: This seems never called when page is output inside the website editor (search 'REPLACEMENT OF LINKS When page called by website editor')
|
||||
|
||||
if (! defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from virtual host
|
||||
if (defined('USEDOLIBARRSERVER')) // REPLACEMENT OF LINKS When page called from Dolibarr server
|
||||
{
|
||||
global $website;
|
||||
|
||||
// Replace relative link / with dolibarr URL: ...href="/"...
|
||||
$content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||
// Replace relative link /xxx.php with dolibarr URL: ...href="....php"
|
||||
$content=preg_replace('/(href=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
|
||||
$content=preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
// action="newpage.php" => action="dolibarr/website/index.php?website=...&pageref=newpage
|
||||
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
}
|
||||
else // REPLACEMENT OF LINKS When page called from virtual host
|
||||
{
|
||||
$symlinktomediaexists=1;
|
||||
|
||||
@ -63,23 +115,6 @@ function dolWebsiteOutput($content)
|
||||
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1medias/\4\5', $content, -1, $nbrep);
|
||||
}
|
||||
}
|
||||
else // REPLACEMENT OF LINKS When page called from dolibarr server
|
||||
{
|
||||
global $website;
|
||||
|
||||
// Replace relative link / with dolibarr URL: ...href="/"...
|
||||
$content=preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||
// Replace relative link /xxx.php with dolibarr URL: ...href="....php"
|
||||
$content=preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1'.DOL_URL_ROOT.'\2\3"', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link into medias with correct URL after the DOL_URL_ROOT: ../url("medias/
|
||||
$content=preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
}
|
||||
|
||||
dol_syslog("dolWebsiteOutput end");
|
||||
|
||||
@ -87,33 +122,6 @@ function dolWebsiteOutput($content)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a page content to have correct links into a new html content.
|
||||
* Used to ouput the page on the Preview.
|
||||
*
|
||||
* @param Website $website Web site object
|
||||
* @param string $content Content to replace
|
||||
* @return boolean True if OK
|
||||
*/
|
||||
function dolWebsiteReplacementOfLinks($website, $content)
|
||||
{
|
||||
// Replace php code. Note $content may come from database and does not contains body tags.
|
||||
$content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '<span style="background: #ddd; border: 1px solid #ccc; border-radius: 4px;">...php...</span>', $content);
|
||||
|
||||
// Replace relative link / with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||
// Replace relative link /xxx.php with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
|
||||
$content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
// <img src="image.png... => <img src="dolibarr/viewimage.php/modulepart=medias&file=image.png...
|
||||
$content = preg_replace('/(<img[^>]*src=")(?!(http|'.preg_quote(DOL_URL_ROOT,'/').'\/viewimage))/', '\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format img tags to introduce viewimage on img src.
|
||||
*
|
||||
@ -155,7 +163,7 @@ function dolIncludeHtmlContent($contentfile)
|
||||
|
||||
$MAXLEVEL=20;
|
||||
|
||||
$fullpathfile=DOL_DATA_ROOT.'/websites/'.$contentfile;
|
||||
$fullpathfile=DOL_DATA_ROOT.'/website/'.$contentfile;
|
||||
|
||||
if (empty($includehtmlcontentopened)) $includehtmlcontentopened=0;
|
||||
$includehtmlcontentopened++;
|
||||
@ -188,29 +196,29 @@ function dolIncludeHtmlContent($contentfile)
|
||||
* Generate a zip with all data of web site.
|
||||
*
|
||||
* @param Website $website Object website
|
||||
* @return void
|
||||
* @return string Path to file with zip
|
||||
*/
|
||||
function exportWebSite($website)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
dol_mkdir($conf->websites->dir_temp);
|
||||
$srcdir = $conf->websites->dir_output.'/'.$website->ref;
|
||||
$destdir = $conf->websites->dir_temp.'/'.$website->ref;
|
||||
dol_mkdir($conf->website->dir_temp);
|
||||
$srcdir = $conf->website->dir_output.'/'.$website->ref;
|
||||
$destdir = $conf->website->dir_temp.'/'.$website->ref;
|
||||
|
||||
$arrayreplacement=array();
|
||||
|
||||
dolCopyDir($srcdir, $destdir, 0, 1, $arrayreplacement);
|
||||
|
||||
$srcdir = DOL_DATA_ROOT.'/medias/images/'.$website->ref;
|
||||
$destdir = $conf->websites->dir_temp.'/'.$website->ref.'/medias/images/'.$website->ref;
|
||||
$destdir = $conf->website->dir_temp.'/'.$website->ref.'/medias/images/'.$website->ref;
|
||||
|
||||
dolCopyDir($srcdir, $destdir, 0, 1, $arrayreplacement);
|
||||
|
||||
// Build sql file
|
||||
dol_mkdir($conf->websites->dir_temp.'/'.$website->ref.'/export');
|
||||
dol_mkdir($conf->website->dir_temp.'/'.$website->ref.'/export');
|
||||
|
||||
$filesql = $conf->websites->dir_temp.'/'.$website->ref.'/export/pages.sql';
|
||||
$filesql = $conf->website->dir_temp.'/'.$website->ref.'/export/pages.sql';
|
||||
$fp = fopen($filesql,"w");
|
||||
|
||||
$objectpages = new WebsitePage($db);
|
||||
@ -267,9 +275,9 @@ function exportWebSite($website)
|
||||
@chmod($filesql, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
// Build zip file
|
||||
$filedir = $conf->websites->dir_temp.'/'.$website->ref;
|
||||
$fileglob = $conf->websites->dir_temp.'/'.$website->ref.'/export/'.$website->ref.'_export_*.zip';
|
||||
$filename = $conf->websites->dir_temp.'/'.$website->ref.'/export/'.$website->ref.'_export_'.dol_print_date(dol_now(),'dayhourlog').'.zip';
|
||||
$filedir = $conf->website->dir_temp.'/'.$website->ref;
|
||||
$fileglob = $conf->website->dir_temp.'/'.$website->ref.'/export/website_'.$website->ref.'-*.zip';
|
||||
$filename = $conf->website->dir_temp.'/'.$website->ref.'/export/website_'.$website->ref.'-'.dol_print_date(dol_now(),'dayhourlog').'.zip';
|
||||
|
||||
dol_delete_file($fileglob, 0);
|
||||
dol_compress_file($filedir, $filename, 'zip');
|
||||
@ -278,6 +286,33 @@ function exportWebSite($website)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open a zip with all data of web site and load it into database.
|
||||
*
|
||||
* @param string $pathtofile Path of zip file
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function importWebSite($pathtofile)
|
||||
{
|
||||
$result = 0;
|
||||
|
||||
$filename = basename($pathtofile);
|
||||
if (! preg_match('/^website_(.*)-(.*)$/', $filename, $reg))
|
||||
{
|
||||
$this->errors[]='Bad format for filename '.$filename.'. Must be website_XXX-VERSION.';
|
||||
return -1;
|
||||
}
|
||||
|
||||
$websitecode = $reg[1];
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."website(ref, entity, description, status) values('".$websitecode."', ".$conf->entity.", 'Portal to sell your SaaS. Do not remove this entry.', 1)";
|
||||
$resql = $db->query($sql);
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download all images found into page content $tmp.
|
||||
* If $modifylinks is set, links to images will be replace with a link to viewimage wrapper.
|
||||
|
||||
@ -154,11 +154,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1402__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/list.php?leftmenu=contracts', 'List', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1403__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts', 'MenuServices', 1, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1404__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=0', 'MenuInactiveServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?leftmenu=contracts&mode=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
|
||||
-- Commercial - Interventions
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
|
||||
|
||||
@ -768,11 +768,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000);
|
||||
$newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer);
|
||||
$newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire);
|
||||
$newmenu->add("/contrat/services.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
|
||||
$newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu=="contracts") $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire);
|
||||
}
|
||||
|
||||
// Interventions
|
||||
|
||||
@ -553,10 +553,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($langs->trans("Module".$this->numero."Name") != ("Module".$this->numero."Name"))
|
||||
if ($langs->transnoentitiesnoconv("Module".$this->numero."Name") != ("Module".$this->numero."Name"))
|
||||
{
|
||||
// If module name translation exists
|
||||
return $langs->trans("Module".$this->numero."Name");
|
||||
return $langs->transnoentitiesnoconv("Module".$this->numero."Name");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -572,11 +572,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if ($langs->trans("Module".$this->name."Name") != ("Module".$this->name."Name"))
|
||||
{
|
||||
// If module name translation exists
|
||||
return $langs->trans("Module".$this->name."Name");
|
||||
return $langs->transnoentitiesnoconv("Module".$this->name."Name");
|
||||
}
|
||||
|
||||
// Last change with simple product label
|
||||
return $langs->trans($this->name);
|
||||
// Last chance with simple label
|
||||
return $langs->transnoentitiesnoconv($this->name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,10 +591,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($langs->trans("Module".$this->numero."Desc") != ("Module".$this->numero."Desc"))
|
||||
if ($langs->transnoentitiesnoconv("Module".$this->numero."Desc") != ("Module".$this->numero."Desc"))
|
||||
{
|
||||
// If module description translation exists
|
||||
return $langs->trans("Module".$this->numero."Desc");
|
||||
return $langs->transnoentitiesnoconv("Module".$this->numero."Desc");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -606,6 +606,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if ($val) $langs->load($val);
|
||||
}
|
||||
}
|
||||
|
||||
if ($langs->transnoentitiesnoconv("Module".$this->name."Desc") != ("Module".$this->name."Desc"))
|
||||
{
|
||||
// If module name translation exists
|
||||
return $langs->trans("Module".$this->name."Desc");
|
||||
}
|
||||
|
||||
// Last chance with simple label
|
||||
return $langs->trans($this->description);
|
||||
}
|
||||
}
|
||||
@ -657,7 +665,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
}
|
||||
}
|
||||
|
||||
$content = $langs->trans($this->descriptionlong);
|
||||
$content = $langs->transnoentitiesnoconv($this->descriptionlong);
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,16 +679,27 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
*/
|
||||
function getDescLongReadmeFound()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$filefound= false;
|
||||
|
||||
// Define path to file README.md.
|
||||
// First check README-la_LA.md then README.md
|
||||
// First check README-la_LA.md then README-la.md then README.md
|
||||
$pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$langs->defaultlang.'.md', 0);
|
||||
if (dol_is_file($pathoffile))
|
||||
{
|
||||
$filefound = true;
|
||||
}
|
||||
if (! $filefound)
|
||||
{
|
||||
$tmp=explode('_', $langs->defaultlang);
|
||||
$pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$tmp[0].'.md', 0);
|
||||
if (dol_is_file($pathoffile))
|
||||
{
|
||||
$filefound = true;
|
||||
}
|
||||
}
|
||||
if (! $filefound)
|
||||
{
|
||||
$pathoffile = dol_buildpath(strtolower($this->name).'/README.md', 0);
|
||||
if (dol_is_file($pathoffile))
|
||||
@ -778,13 +797,13 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$ret='';
|
||||
|
||||
$newversion=preg_replace('/_deprecated/','',$this->version);
|
||||
if ($newversion == 'experimental') $ret=($translated?$langs->trans("VersionExperimental"):$newversion);
|
||||
elseif ($newversion == 'development') $ret=($translated?$langs->trans("VersionDevelopment"):$newversion);
|
||||
if ($newversion == 'experimental') $ret=($translated?$langs->transnoentitiesnoconv("VersionExperimental"):$newversion);
|
||||
elseif ($newversion == 'development') $ret=($translated?$langs->transnoentitiesnoconv("VersionDevelopment"):$newversion);
|
||||
elseif ($newversion == 'dolibarr') $ret=DOL_VERSION;
|
||||
elseif ($newversion) $ret=$newversion;
|
||||
else $ret=($translated?$langs->trans("VersionUnknown"):'unknown');
|
||||
else $ret=($translated?$langs->transnoentitiesnoconv("VersionUnknown"):'unknown');
|
||||
|
||||
if (preg_match('/_deprecated/',$this->version)) $ret.=($translated?' ('.$langs->trans("Deprecated").')':$this->version);
|
||||
if (preg_match('/_deprecated/',$this->version)) $ret.=($translated?' ('.$langs->transnoentitiesnoconv("Deprecated").')':$this->version);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -855,12 +874,12 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if ($langs->trans($langstring) == $langstring)
|
||||
{
|
||||
// Translation not found
|
||||
return $langs->trans($this->import_label[$r]);
|
||||
return $langs->transnoentitiesnoconv($this->import_label[$r]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Translation found
|
||||
return $langs->trans($langstring);
|
||||
return $langs->transnoentitiesnoconv($langstring);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,9 +35,10 @@ $langs->load("modulebuilder");
|
||||
jQuery(document).ready(function() {
|
||||
function init_typeoffields(type)
|
||||
{
|
||||
console.log("selected type is "+type);
|
||||
var size = jQuery("#size");
|
||||
console.log("We select a new type = "+type);
|
||||
var size = jQuery("#size");
|
||||
var computed_value = jQuery("#computed_value");
|
||||
var langfile = jQuery("#langfile");
|
||||
var default_value = jQuery("#default_value");
|
||||
var unique = jQuery("#unique");
|
||||
var required = jQuery("#required");
|
||||
@ -51,7 +52,7 @@ $langs->load("modulebuilder");
|
||||
|
||||
if (GETPOST('type','alpha') == "separate")
|
||||
{
|
||||
print "jQuery('#size, #default_value').val('').prop('disabled', true);";
|
||||
print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);";
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
?>
|
||||
@ -67,15 +68,15 @@ $langs->load("modulebuilder");
|
||||
{
|
||||
console.log("We enter a computed formula");
|
||||
jQuery("#default_value").val('');
|
||||
/* jQuery("#unique, #required, #alwayseditable, #ishidden, #list").removeAttr('checked'); */
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', true);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").hide();
|
||||
/* jQuery("#unique, #required, #alwayseditable, #list").removeAttr('checked'); */
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #list").attr('disabled', true);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_list").hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("No computed formula");
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #list").attr('disabled', false);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_list").show();
|
||||
}
|
||||
|
||||
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
||||
@ -93,7 +94,7 @@ $langs->load("modulebuilder");
|
||||
else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
|
||||
else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
|
||||
else if (type == 'separate') {
|
||||
size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
langfile.val('').prop('disabled',true);size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true);
|
||||
jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();
|
||||
}
|
||||
else { // type = string
|
||||
@ -104,12 +105,13 @@ $langs->load("modulebuilder");
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);
|
||||
jQuery('#list').val(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
default_value.removeAttr('disabled');
|
||||
required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||
langfile.removeAttr('disabled');required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
init_typeoffields('<?php echo GETPOST('type','alpha'); ?>');
|
||||
@ -162,7 +164,7 @@ $langs->load("modulebuilder");
|
||||
<!-- Position -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOST('pos','int'); ?>"></td></tr>
|
||||
<!-- Language file -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" id="langfile" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
|
||||
<!-- Computed Value -->
|
||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('computed_value','none')?GETPOST('computed_value','none'):''); ?>"></td></tr>
|
||||
<!-- Default Value (at sql setup level) -->
|
||||
@ -173,15 +175,11 @@ $langs->load("modulebuilder");
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo (GETPOST('required','alpha')?' checked':''); ?>></td></tr>
|
||||
<!-- Always editable -->
|
||||
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ((GETPOST('alwayseditable','alpha') || ! GETPOST('button','alpha'))?' checked':''); ?>></td></tr>
|
||||
<!-- Is visible or not -->
|
||||
<?php if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?>
|
||||
<tr class="extra_ishidden"><td><?php echo $langs->trans("Hidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden"<?php echo (GETPOST('ishidden','alpha') ?' checked' : ''); ?>></td></tr>
|
||||
<?php } ?>
|
||||
<?php if ($conf->multicompany->enabled) { ?>
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall','alpha') ? '':' checked'); ?>></td></tr>
|
||||
<?php } ?>
|
||||
<!-- By default visible into list -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("ByDefaultInList"), $langs->trans("VisibleDesc")); ?>
|
||||
<!-- Visibility -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
|
||||
</td><td class="valeur"><input id="list" size="1" type="text" name="list" value="<?php echo GETPOST('list','int')!='' ? GETPOST('list','int') : '1'; ?>"></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ $langs->load("modulebuilder");
|
||||
console.log("select new type "+type);
|
||||
var size = jQuery("#size");
|
||||
var computed_value = jQuery("#computed_value");
|
||||
var langfile = jQuery("#langfile");
|
||||
var default_value = jQuery("#default_value");
|
||||
var unique = jQuery("#unique");
|
||||
var required = jQuery("#required");
|
||||
@ -50,7 +51,7 @@ $langs->load("modulebuilder");
|
||||
|
||||
if (GETPOST('type','alpha') == "separate")
|
||||
{
|
||||
print "jQuery('#size, #default_value').val('').prop('disabled', true);";
|
||||
print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);";
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
?>
|
||||
@ -65,15 +66,15 @@ $langs->load("modulebuilder");
|
||||
{
|
||||
console.log("We enter a computed formula");
|
||||
jQuery("#default_value").val('');
|
||||
/* jQuery("#unique, #required, #alwayseditable, #ishidden, #list").removeAttr('checked'); */
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', true);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").hide();
|
||||
/* jQuery("#unique, #required, #alwayseditable, #list").removeAttr('checked'); */
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #list").attr('disabled', true);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_list").hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("No computed formula");
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #ishidden, #list").attr('disabled', false);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_ishidden, tr.extra_list").show();
|
||||
jQuery("#default_value, #unique, #required, #alwayseditable, #list").attr('disabled', false);
|
||||
jQuery("tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_list").show();
|
||||
}
|
||||
|
||||
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
|
||||
@ -99,7 +100,8 @@ $langs->load("modulebuilder");
|
||||
if (type == 'separate')
|
||||
{
|
||||
required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
|
||||
jQuery('#size, #default_value').val('').prop('disabled', true);
|
||||
jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);
|
||||
jQuery('#list').val(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -143,7 +145,6 @@ $param=$extrafields->attributes[$elementtype]['param'][$attrname];
|
||||
$perms=$extrafields->attributes[$elementtype]['perms'][$attrname];
|
||||
$langfile=$extrafields->attributes[$elementtype]['langfile'][$attrname];
|
||||
$list=$extrafields->attributes[$elementtype]['list'][$attrname];
|
||||
$ishidden=$extrafields->attributes[$elementtype]['hidden'][$attrname];
|
||||
$entitycurrentorall=$extrafields->attributes[$elementtype]['entityid'][$attrname];
|
||||
|
||||
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
|
||||
@ -210,10 +211,10 @@ else
|
||||
<tr><td>
|
||||
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo dol_htmlcleanlastbr($param_chain); ?></textarea>
|
||||
</td><td>
|
||||
<span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></span>
|
||||
<span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
|
||||
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span>
|
||||
<span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0)?></span>
|
||||
<span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0,'', 0, 2, 'helpvalue1')?></span>
|
||||
<span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?></span>
|
||||
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?></span>
|
||||
<span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?></span>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
@ -232,15 +233,11 @@ else
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required?' checked':''); ?>></td></tr>
|
||||
<!-- Always editable -->
|
||||
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable?' checked':''); ?>></td></tr>
|
||||
<!-- Is visible or not -->
|
||||
<?php if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?>
|
||||
<tr><td><?php echo $langs->trans("Hidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden"<?php echo ($ishidden ?' checked':''); ?>></td></tr>
|
||||
<?php } ?>
|
||||
<?php if ($conf->multicompany->enabled) { ?>
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ?' checked':''); ?>></td></tr>
|
||||
<?php } ?>
|
||||
<!-- By default visible into list -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("ByDefaultInList"), $langs->trans("VisibleDesc")); ?>
|
||||
<!-- Visibility -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
|
||||
</td><td class="valeur"><input id="list" size="1" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -81,7 +81,6 @@ if (count($extrafields->attributes[$elementtype]['type']))
|
||||
print '<td align="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
|
||||
print '<td align="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
|
||||
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attributes[$elementtype]['ishidden'][$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
print '<td align="center">'.($extrafields->attributes[$elementtype]['entityid'][$key]==0?$langs->trans("All"):$extrafields->attributes[$elementtype]['entitylabel'][$key]).'</td>';
|
||||
}
|
||||
|
||||
@ -34,8 +34,10 @@ if ($action == 'presend')
|
||||
|
||||
$object->fetch_projet();
|
||||
|
||||
if (! in_array($object->element, array('societe', 'user')))
|
||||
if (! in_array($object->element, array('societe', 'user', 'member')))
|
||||
{
|
||||
// TODO get also the main_lastdoc field of $object. If not found, try to guess with following code
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
@ -75,19 +77,17 @@ if ($action == 'presend')
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! in_array($object->element, array('societe', 'user')))
|
||||
if (! in_array($object->element, array('societe', 'user', 'member')))
|
||||
{
|
||||
if (! $file || ! is_readable($file)) {
|
||||
if ($object->element != 'member')
|
||||
{
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
if ((! $file || ! is_readable($file)) && method_exists($object, 'generateDocument'))
|
||||
{
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
51
htdocs/core/tpl/commonfields_add.tpl.php
Normal file
51
htdocs/core/tpl/commonfields_add.tpl.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?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/>.
|
||||
*
|
||||
* Need to have following variables defined:
|
||||
* $object (invoice, order, ...)
|
||||
* $action
|
||||
* $conf
|
||||
* $langs
|
||||
*/
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE commonfields_add.tpl.php -->
|
||||
<?php
|
||||
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (abs($val['visible']) != 1) continue; // Discard such field from form
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
|
||||
|
||||
print '<tr id="field_'.$key.'">';
|
||||
print '<td';
|
||||
print ' class="titlefieldcreate';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
if ($val['type'] == 'text') print ' tdtop';
|
||||
print '"';
|
||||
print '>';
|
||||
print $langs->trans($val['label']);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
|
||||
elseif ($val['type'] == 'text') $value = GETPOST($key, 'none');
|
||||
else $value = GETPOST($key, 'alpha');
|
||||
print $object->showInputField($val, $key, $value, '', '', '', 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- END PHP TEMPLATE commonfields_add.tpl.php -->
|
||||
48
htdocs/core/tpl/commonfields_edit.tpl.php
Normal file
48
htdocs/core/tpl/commonfields_edit.tpl.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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/>.
|
||||
*
|
||||
* Need to have following variables defined:
|
||||
* $object (invoice, order, ...)
|
||||
* $action
|
||||
* $conf
|
||||
* $langs
|
||||
*/
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE commonfields_edit.tpl.php -->
|
||||
<?php
|
||||
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (abs($val['visible']) != 1) continue; // Discard such field from form
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
|
||||
|
||||
print '<tr><td';
|
||||
print ' class="titlefieldcreate';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
if ($val['type'] == 'text') print ' tdtop';
|
||||
print '"';
|
||||
print '>'.$langs->trans($val['label']).'</td>';
|
||||
print '<td>';
|
||||
if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
|
||||
elseif ($val['type'] == 'text') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
|
||||
else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key;
|
||||
print $object->showInputField($val, $key, $value, '', '', '', 0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- END PHP TEMPLATE commonfields_edit.tpl.php -->
|
||||
84
htdocs/core/tpl/commonfields_view.tpl.php
Normal file
84
htdocs/core/tpl/commonfields_view.tpl.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?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/>.
|
||||
*
|
||||
* Need to have following variables defined:
|
||||
* $object (invoice, order, ...)
|
||||
* $action
|
||||
* $conf
|
||||
* $langs
|
||||
*/
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE commonfields_view.tpl.php -->
|
||||
<?php
|
||||
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (abs($val['visible']) != 1) continue; // Discard such field from form
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
|
||||
if ($key == 'status') continue; // Status is alreadt in dol_banner
|
||||
|
||||
$value=$object->$key;
|
||||
|
||||
print '<tr><td';
|
||||
print ' class="titlefield';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
print '"';
|
||||
print '>'.$langs->trans($val['label']).'</td>';
|
||||
print '<td>';
|
||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||
//print dol_escape_htmltag($object->$key, 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
//if ($key == 'targetsrcfile3') break; // key used for break on second column
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$alreadyoutput = 1;
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if ($alreadyoutput)
|
||||
{
|
||||
//if ($key == 'targetsrcfile3') $alreadyoutput = 0; // key used for break on second column
|
||||
continue;
|
||||
}
|
||||
|
||||
if (abs($val['visible']) != 1) continue; // Discard such field from form
|
||||
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
|
||||
if ($key == 'status') continue; // Status is alreadt in dol_banner
|
||||
|
||||
$value=$object->$key;
|
||||
|
||||
print '<tr><td';
|
||||
print ' class="titlefield';
|
||||
if ($val['notnull'] > 0) print ' fieldrequired';
|
||||
print '"';
|
||||
print '>'.$langs->trans($val['label']).'</td>';
|
||||
print '<td>';
|
||||
print $object->showOutputField($val, $key, $value, '', '', '', 0);
|
||||
//print dol_escape_htmltag($object->$key, 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- END PHP TEMPLATE commonfields_view.tpl.php -->
|
||||
@ -42,6 +42,9 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
// Discard if extrafield is a hidden field
|
||||
if (abs($extrafields->attributes[$object->table_element]['list'][$key]) != 1) continue;
|
||||
|
||||
// Load language if required
|
||||
if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||
|
||||
@ -59,8 +62,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($extrafields->attributes[$object->table_element]['ishidden'][$key])) print '<tr class="hideobject"><td>';
|
||||
else print '<tr><td>';
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr>';
|
||||
print '<td';
|
||||
@ -112,7 +114,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">';
|
||||
|
||||
print $extrafields->showInputField($key, $value,'','','',0,$object->id);
|
||||
print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id);
|
||||
|
||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
|
||||
<?php if ($main_home)
|
||||
{
|
||||
?>
|
||||
<div class="center login_main_home" style="max-width: 70%">
|
||||
<div class="center login_main_home paddingtopbottom <?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' backgroundsemitransparent'; ?>" style="max-width: 70%">
|
||||
<?php echo $main_home; ?>
|
||||
</div><br>
|
||||
<?php
|
||||
|
||||
@ -160,11 +160,11 @@ if (! empty($morelogincontent)) {
|
||||
</form>
|
||||
|
||||
|
||||
<div class="center login_main_home" style="max-width: 70%">
|
||||
<div class="center login_main_home paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' backgroundsemitransparent'; ?>" style="max-width: 70%">
|
||||
<?php if ($mode == 'dolibarr' || ! $disabled) { ?>
|
||||
<font style="font-size: 12px;">
|
||||
<span class="passwordmessagedesc">
|
||||
<?php echo $langs->trans('SendNewPasswordDesc'); ?>
|
||||
</font>
|
||||
</span>
|
||||
<?php }else{ ?>
|
||||
<div class="warning" align="center">
|
||||
<?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?>
|
||||
|
||||
@ -50,19 +50,27 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
if($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
|
||||
|| $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW') {
|
||||
|
||||
// Test if event/record is qualified
|
||||
$listofqualifiedelement = array('payment', 'facture');
|
||||
if (! in_array($object->element, $listofqualifiedelement)) return 1;
|
||||
|
||||
|
||||
// Event/record is qualified
|
||||
if ($action==='BILL_VALIDATE' || $action === 'BILL_PAYED' || $action==='BILL_UNPAYED'
|
||||
|| $action === 'BILL_SENTBYMAIL' || $action === 'DOC_DOWNLOAD' || $action === 'DOC_PREVIEW'
|
||||
|| $action === 'BILL_SUPPLIER_PAYED')
|
||||
{
|
||||
$amounts= (double) $object->total_ttc;
|
||||
}
|
||||
else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK') {
|
||||
else if($action === 'PAYMENT_CUSTOMER_CREATE' || $action === 'PAYMENT_ADD_TO_BANK' || $action === 'PAYMENT_SUPPLIER_CREATE')
|
||||
{
|
||||
$amounts = 0;
|
||||
if(!empty($object->amounts)) {
|
||||
foreach($object->amounts as $amount) {
|
||||
$amounts+= price2num($amount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if(strpos($action,'PAYMENT')!==false) {
|
||||
$amounts= (double) $object->amount;
|
||||
@ -71,24 +79,23 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
|
||||
return 0; // not implemented action log
|
||||
}
|
||||
|
||||
|
||||
$b=new BlockedLog($this->db);
|
||||
$b->action = $action;
|
||||
$b->amounts= $amounts;
|
||||
$b->setObjectData($object); // Set field ref_object, fk_object, element, object_data
|
||||
$b->setObjectData($object); // Set field date_object, ref_object, fk_object, element, object_data
|
||||
|
||||
$res = $b->create($user);
|
||||
|
||||
if($res<0) {
|
||||
if ($res<0)
|
||||
{
|
||||
setEventMessage($b->error,'errors');
|
||||
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -31,12 +31,18 @@
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
// Pour autre que bittorrent, on charge environnement + info issus de logon (comme le user)
|
||||
// For bittorent link, we don't need to load/check we are into a login session
|
||||
if (isset($_GET["modulepart"]) && $_GET["modulepart"] == 'bittorrent' && ! defined("NOLOGIN"))
|
||||
{
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
}
|
||||
// For direct external download link, we don't need to load/check we are into a login session
|
||||
if (isset($_GET["hashp"]) && ! defined("NOLOGIN"))
|
||||
{
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
}
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
@ -111,21 +117,23 @@ if (! empty($hashp))
|
||||
$result = $ecmfile->fetch(0, '', '', '', $hashp);
|
||||
if ($result > 0)
|
||||
{
|
||||
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepatch is relative to document directory
|
||||
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory
|
||||
$moduleparttocheck = $tmp[0];
|
||||
if ($moduleparttocheck == $modulepart)
|
||||
{
|
||||
// We remove first level of directory
|
||||
$original_file = (($tmp[1]?$tmp[1].'/':'').$ecmfile->filename); // this is relative to module dir
|
||||
//var_dump($original_file); exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('Bad link. File owns to another module part.',0,0,1);
|
||||
accessforbidden('Bad link. File is from another module part.',0,0,1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('Bad link. File was not found or sharing attribute removed recently.',0,0,1);
|
||||
$langs->load("errors");
|
||||
accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"),0,0,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,30 +146,38 @@ $refname=basename(dirname($original_file)."/");
|
||||
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
|
||||
|
||||
// Basic protection (against external users only)
|
||||
if ($user->societe_id > 0)
|
||||
if (! empty($hashp))
|
||||
{
|
||||
if ($sqlprotectagainstexternals)
|
||||
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
|
||||
}
|
||||
else
|
||||
{
|
||||
// Basic protection (against external users only)
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$resql = $db->query($sqlprotectagainstexternals);
|
||||
if ($resql)
|
||||
if ($sqlprotectagainstexternals)
|
||||
{
|
||||
$num=$db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
$resql = $db->query($sqlprotectagainstexternals);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($user->societe_id != $obj->fk_soc)
|
||||
$num=$db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$accessallowed=0;
|
||||
break;
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($user->societe_id != $obj->fk_soc)
|
||||
{
|
||||
$accessallowed=0;
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ class Don extends CommonObject
|
||||
public $element='don'; // Id that identify managed objects
|
||||
public $table_element='don'; // Name of table without prefix where object is stored
|
||||
public $fk_element = 'fk_donation';
|
||||
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 $picto = 'generic';
|
||||
|
||||
var $date;
|
||||
|
||||
@ -112,6 +112,7 @@ class EcmFiles //extends CommonObject
|
||||
}
|
||||
if (isset($this->filepath)) {
|
||||
$this->filepath = trim($this->filepath);
|
||||
$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /
|
||||
}
|
||||
if (isset($this->fullpath_orig)) {
|
||||
$this->fullpath_orig = trim($this->fullpath_orig);
|
||||
@ -164,6 +165,11 @@ class EcmFiles //extends CommonObject
|
||||
$maxposition=$maxposition+1;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->filename) || empty($this->filepath))
|
||||
{
|
||||
$this->errors[] = 'Bad property filename or filepath';
|
||||
return -1;
|
||||
}
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
@ -349,7 +355,7 @@ class EcmFiles //extends CommonObject
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="label";
|
||||
|
||||
$section=GETPOST("section");
|
||||
$section=GETPOST("section",'alpha');
|
||||
if (! $section)
|
||||
{
|
||||
dol_print_error('','Error, section parameter missing');
|
||||
@ -101,7 +101,7 @@ $filepathtodocument=$relativetodocument.$file->label;
|
||||
// Try to load object from index
|
||||
$object = new ECMFiles($db);
|
||||
$result=$object->fetch(0, '', $filepathtodocument);
|
||||
if (! ($result >= 0))
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
@ -109,7 +109,6 @@ if (! ($result >= 0))
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -124,7 +123,7 @@ if ($cancel)
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.$urlfile.'§ion='.$section);
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -140,13 +139,18 @@ if ($action == 'update')
|
||||
|
||||
//$db->begin();
|
||||
|
||||
$olddir=$ecmdir->getRelativePath(0);
|
||||
$olddir=$ecmdir->getRelativePath(0); // Relative to ecm
|
||||
$olddirrelativetodocument = 'ecm/'.$olddir; // Relative to document
|
||||
$newdirrelativetodocument = 'ecm/'.$olddir;
|
||||
$olddir=$conf->ecm->dir_output.'/'.$olddir;
|
||||
$newdir=$olddir;
|
||||
|
||||
$oldfile=$olddir.$oldlabel;
|
||||
$newfile=$newdir.$newlabel;
|
||||
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
|
||||
//print $oldfile.' - '.$newfile;
|
||||
if ($newlabel != $oldlabel)
|
||||
{
|
||||
@ -157,29 +161,52 @@ if ($action == 'update')
|
||||
setEventMessages($langs->trans('ErrorFailToRenameFile',$oldfile,$newfile), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
// Reload object after the move
|
||||
$result=$object->fetch(0, '', $newdirrelativetodocument.$newlabel);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (is_object($object))
|
||||
if ($shareenabled)
|
||||
{
|
||||
if ($shareenabled)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$object->share = getRandomPassword(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->share = '';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$object->share = getRandomPassword(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->share = '';
|
||||
}
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
// Call update to set the share key
|
||||
$result = $object->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Call create to insert record
|
||||
$object->entity = $conf->entity;
|
||||
$object->filepath = preg_replace('/[\\/]+$/', '', $newdirrelativetodocument);
|
||||
$object->filename = $newlabel;
|
||||
$object->label = md5_file(dol_osencode($newfile)); // hash of file content
|
||||
$object->fullpath_orig = '';
|
||||
$object->gen_or_uploaded = 'unknown';
|
||||
$object->description = ''; // indexed content
|
||||
$object->keyword = ''; // keyword content
|
||||
$result = $object->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,7 +214,10 @@ if ($action == 'update')
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
$urlfile=$newlabel;
|
||||
header("Location: ".DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -297,6 +327,7 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
// Link for internal download
|
||||
print '<tr><td>'.$langs->trans("DirectDownloadInternalLink").'</td><td>';
|
||||
$modulepart='ecm';
|
||||
$forcedownload=1;
|
||||
@ -308,9 +339,10 @@ $fulllink=$urlwithroot.$rellink;
|
||||
print img_picto('','object_globe.png').' ';
|
||||
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadinternallink" name="downloadinternellink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||
else print $fulllink;
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here.
|
||||
print '</td></tr>';
|
||||
|
||||
// Link for direct external download
|
||||
print '<tr><td>';
|
||||
if ($action != 'edit') print $langs->trans("DirectDownloadLink");
|
||||
else print $langs->trans("FileSharedViaALink");
|
||||
@ -332,7 +364,7 @@ if (! empty($object->share))
|
||||
print img_picto('','object_globe.png').' ';
|
||||
if ($action != 'edit') print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
|
||||
else print $fulllink;
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>';
|
||||
if ($action != 'edit') print ' <a href="'.$fulllink.'">'.$langs->trans("Download").'</a>'; // No target here
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -374,7 +406,7 @@ if ($action == 'edit')
|
||||
// Confirmation de la suppression d'une ligne categorie
|
||||
if ($action == 'delete_file')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($_GET["section"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
|
||||
}
|
||||
|
||||
@ -385,7 +417,7 @@ if ($action != 'edit')
|
||||
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
|
||||
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel§ion='.$section.'&urlfile='.urlencode($urlfile).'&backtopage='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
|
||||
}
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
<?php
|
||||
if (empty($module)) $module='ecm';
|
||||
|
||||
print 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working2.gif".'\';'."\n";
|
||||
|
||||
$openeddir='/';
|
||||
?>
|
||||
|
||||
|
||||
@ -214,8 +214,8 @@ if (empty($reshook))
|
||||
$objectsrc->fetch($object->origin_id);
|
||||
|
||||
$object->socid = $objectsrc->socid;
|
||||
$object->ref_customer = ''; // We don't use $objectsrc->ref_client, this is ref or order not shipment
|
||||
$object->model_pdf = GETPOST('model','alpha');
|
||||
$object->ref_customer = GETPOST('ref_customer','alpha');
|
||||
$object->model_pdf = GETPOST('model');
|
||||
$object->date_delivery = $date_delivery; // Date delivery planed
|
||||
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id','int');
|
||||
@ -693,7 +693,7 @@ if ($action == 'create')
|
||||
else if ($origin == 'propal') print $langs->trans('RefCustomerOrder');
|
||||
else print $langs->trans('RefCustomer');
|
||||
print '</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '<input type="text" name="ref_customer" value="'.$object->ref_client.'" />';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -779,7 +779,7 @@ if ($action == 'create')
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
||||
@ -1242,6 +1242,7 @@ if ($action == 'create')
|
||||
|
||||
print '<!-- Show details of lot -->';
|
||||
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
|
||||
|
||||
//print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
|
||||
//print $line->fk_product.' - '.$dbatch->batch;
|
||||
print $langs->trans("Batch").': ';
|
||||
|
||||
@ -47,7 +47,7 @@ class Expedition extends CommonObject
|
||||
public $fk_element="fk_expedition";
|
||||
public $table_element="expedition";
|
||||
public $table_element_line="expeditiondet";
|
||||
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 = 'sending';
|
||||
|
||||
var $socid;
|
||||
|
||||
@ -111,7 +111,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user