Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop
This commit is contained in:
Laurent Destailleur 2022-11-11 01:04:59 +01:00
commit d2c101ef52
60 changed files with 1891 additions and 1347 deletions

View File

@ -247,6 +247,20 @@ if ($action == 'setdisablebindingonexpensereports') {
}
}
if ($action == 'setenablelettering') {
$setenablelettering = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
* View
@ -466,6 +480,27 @@ print '</tr>';
print '</table>';
// Lettering params
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>';
print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
print '</form>';

View File

@ -611,12 +611,6 @@ if ($id) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'RECEP') {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'EF0') {
$iserasable = 0;
$canbedisabled = 0;
}
}

View File

@ -700,6 +700,17 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
// Export files then exit
$accountancyexport = new AccountancyExport($db);
$notexportlettering = GETPOST('notexportlettering', 'alpha');
if (!empty($notexportlettering)) {
if (is_array($object->lines)) {
foreach ($object->lines as $k => $movement) {
unset($object->lines[$k]->lettering_code);
unset($object->lines[$k]->date_lettering);
}
}
}
$mimetype = $accountancyexport->getMimeType($formatexportset);
top_httphead($mimetype, 1);
@ -802,6 +813,19 @@ $formconfirm = '';
if ($action == 'export_file') {
$form_question = array();
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
// If 1, we check by default.
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
$form_question['notexportlettering'] = array(
'name' => 'notexportlettering',
'type' => 'checkbox',
'label' => $langs->trans('NotExportLettering'),
'value' => $checked,
);
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
}
// If 1 or not set, we check by default.
$checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
$form_question['notifiedexportdate'] = array(
@ -811,7 +835,7 @@ if ($action == 'export_file') {
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
);
$form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
// If 0 or not set, we NOT check by default.
@ -823,10 +847,10 @@ if ($action == 'export_file') {
'value' => $checked,
);
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600);
}
//if ($action == 'delbookkeepingyear') {

View File

@ -231,7 +231,7 @@ class AccountingJournal extends CommonObject
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $withlabel 0=No label, 1=Include label of journal
* @param int $withlabel 0=No label, 1=Include label of journal, 2=Include nature of journal
* @param int $nourl 1=Disable url
* @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip
@ -281,9 +281,14 @@ class AccountingJournal extends CommonObject
}
$label_link = $this->code;
if ($withlabel && !empty($this->label)) {
if ($withlabel != 2 && !empty($this->label)) {
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : '');
}
if ($withlabel == 2 && !empty($this->nature)) {
$key = $langs->trans("AccountingJournalType".strtoupper($this->nature));
$transferlabel = ($this->nature && $key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label);
$label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$transferlabel.($nourl ? '</span>' : '');
}
$result .= $linkstart;
if ($withpicto) {

View File

@ -592,7 +592,7 @@ class Lettering extends BookKeeping
$sql .= " WHERE bpn.entity IN (" . getEntity('accountancy') . ")";
$sql .= " AND bpn.doc_type = 'bank'";
$sql .= " AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
$sql .= " AND bpn ON bpn.piece_num = ab.piece_num";
$sql .= " AND bpn.piece_num = ab.piece_num";
$sql .= " ) OR ";
}
$sql .= " EXISTS (";

View File

@ -1032,9 +1032,11 @@ if (empty($action) || $action == 'view') {
$salarystatic = new Salary($db);
$variousstatic = new PaymentVarious($db);
llxHeader('', $langs->trans("FinanceJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$builddate = dol_now();
//$description = $langs->trans("DescFinanceJournal") . '<br>';
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
@ -1052,6 +1054,7 @@ if (empty($action) || $action == 'view') {
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
$desc = '';
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0";
@ -1074,7 +1077,7 @@ if (empty($action) || $action == 'view') {
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
print $desc;
@ -1125,8 +1128,8 @@ if (empty($action) || $action == 'view') {
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print "<td>".$langs->trans("Date")."</td>";
print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")</td>";
print "<td>".$langs->trans("AccountAccounting")."</td>";

View File

@ -496,14 +496,16 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
}
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("ExpenseReportsJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("ExpenseReportsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = dol_now();
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);

View File

@ -756,9 +756,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
}
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("PurchasesJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("PurchasesJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';

View File

@ -699,9 +699,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("SellsJournal"));
$title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1);
$nom = $langs->trans("SellsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';

View File

@ -165,22 +165,18 @@ if ($reload) {
$form = new Form($db);
if ($object->nature == 2) {
$title = $langs->trans("SellsJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
} elseif ($object->nature == 3) {
$title = $langs->trans("PurchasesJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
} elseif ($object->nature == 4) {
$title = $langs->trans("FinanceJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
} elseif ($object->nature == 5) {
$title = $langs->trans("ExpenseReportsJournal");
$some_mandatory_steps_of_setup_were_not_done = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
$account_accounting_not_defined = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
} else {
@ -189,8 +185,11 @@ if ($object->nature == 2) {
$account_accounting_not_defined = false;
}
$title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 2, 1, '', 1);
$nom = $title . ' | ' . $object->getNomUrl(0, 1, 1, '', 1);
llxHeader('', dol_string_nohtmltag($title));
$nom = $title;
$nomlink = '';
$periodlink = '';
$exportlink = '';
@ -213,8 +212,6 @@ $period .= ' - ' . $langs->trans("JournalizationInLedgerStatus") . ' ' . $form-
$varlink = 'id_journal=' . $id_journal;
llxHeader('', $title);
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
if ($object->nature == 4) { // Bank journal

View File

@ -1725,10 +1725,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Type
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td>';
print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
print '<tr><td>'.$langs->trans("MemberNature").'</td>';
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
print '</tr>';
// Company

View File

@ -520,7 +520,7 @@ class Adherent extends CommonObject
* Return translated label by the nature of a adherent (physical or moral)
*
* @param string $morphy Nature of the adherent (physical or moral)
* @param int $addbadge Add badge (1=Full label, 2=First letter only)
* @param int $addbadge Add badge (1=Full label, 2=First letters only)
* @return string Label
*/
public function getmorphylib($morphy = '', $addbadge = 0)
@ -534,21 +534,27 @@ class Adherent extends CommonObject
if ($addbadge) {
$s = '';
$labeltoshowm = $langs->trans("Moral");
$labeltoshowp = $langs->trans("Physical");
if ($morphy == 'phy') {
$labeltoshow = $labeltoshowp;
if ($addbadge == 2) {
$labeltoshow = dol_substr($langs->trans("Physical"), 0, 1);
} else {
$labeltoshow = $langs->trans("Physical");
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp));
if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowm))) {
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp, 2));
}
}
$s .= '<span class="customer-back paddingleftimp paddingrightimp" title="'.$langs->trans("Physical").'">'.$labeltoshow.'</span>';
$s .= '<span class="member-individual-back paddingleftimp paddingrightimp" title="'.$langs->trans("Physical").'">'.$labeltoshow.'</span>';
}
if ($morphy == 'mor') {
$labeltoshow = $labeltoshowm;
if ($addbadge == 2) {
$labeltoshow = dol_substr($langs->trans("Moral"), 0, 1);
} else {
$labeltoshow = $langs->trans("Moral");
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm));
if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowp))) {
$labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm, 2));
}
}
$s .= '<span class="vendor-back paddingleftimp paddingrightimp" title="'.$langs->trans("Moral").'">'.$labeltoshow.'</span>';
$s .= '<span class="member-company-back paddingleftimp paddingrightimp" title="'.$langs->trans("Moral").'">'.$labeltoshow.'</span>';
}
} else {
if ($morphy == 'phy') {

View File

@ -158,13 +158,12 @@ if ($id > 0) {
}
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
print '<tr><td>'.$langs->trans("Type").'</td>';
print '<td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$object);
print '</td>';*/
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td>';
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
print '</tr>';
// Company

View File

@ -133,13 +133,12 @@ if ($id) {
}
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
print '<tr><td>'.$langs->trans("Type").'</td>';
print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$member);
print '</td>';*/
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td>';
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
print '</tr>';
// Company

View File

@ -506,10 +506,12 @@ if ($rowid > 0) {
}
// Type
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td>';
print '<td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '<tr><td>'.$langs->trans("MemberNature").'</td>';
print '<td class="valeur" >'.$object->getmorphylib('', 1).'</td>';
print '</tr>';
// Company

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@
/**
* \file htdocs/admin/taxes.php
* \ingroup tax
* \brief Page de configuration du module tax
* \brief Page to setup module tax
*/
// Load Dolibarr environment
@ -116,6 +116,8 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_INFO_VAT_RETURN", GETPOST("MAIN_INFO_VAT_RETURN", 'alpha'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVA_DAY_DEADLINE_SUBMISSION", GETPOST("deadline_day_vat", 'int'), 'chaine', 0, '', $conf->entity);
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@ -179,6 +181,10 @@ if (empty($mysoc->tva_assuj)) {
}
print '</tr>';
print '<tr class="oddeven"><td><label for="deadline_day_vat">'.$langs->trans("DeadlineDayVATSubmission").'</label></td><td>';
print '<input placeholder="'.$langs->trans("Example").':21" name="deadline_day_vat" id="deadline_day_vat" class="minwidth200" value="'.(!empty($conf->global->MAIN_INFO_TVA_DAY_DEADLINE_SUBMISSION) ? $conf->global->MAIN_INFO_TVA_DAY_DEADLINE_SUBMISSION : '').'">';
print '</td></tr>';
print '</table>';
print '<br>';

View File

@ -430,7 +430,36 @@ if (empty($reshook) && $action == 'add') {
if (!$error) {
$db->begin();
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
$selectedrecurrulebyday = '';
$object->recurrule = GETPOSTISSET('recurrulefreq') ? "FREQ=".GETPOST('recurrulefreq', 'alpha') : "";
$object->recurrule .= (GETPOST('recurrulefreq', 'alpha') == 'MONTHLY' && GETPOSTISSET('BYMONTHDAY')) ? "_BYMONTHDAY".GETPOST('BYMONTHDAY', 'alpha') : "";
$object->recurrule .= (GETPOST('recurrulefreq', 'alpha') == 'WEEKLY' && GETPOSTISSET('BYDAY')) ? "_BYDAY".GETPOST('BYDAY', 'alpha') : "";
$reg1 = array(); $reg2 = array(); $reg3 = array();
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) {
$selectedrecurrulefreq = $reg1[1];
}
if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) {
$selectedrecurrulebymonthday = $reg2[1];
}
if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) {
$selectedrecurrulebyday = $reg3[1];
}
// Is event recurrent ?
$eventisrecurring = 0;
$userepeatevent = (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 2 ? 1 : 0);
if ($userepeatevent && !empty($selectedrecurrulefreq) && $selectedrecurrulefreq != 'no') {
$eventisrecurring = 1;
$object->recurid = dol_print_date(dol_now('gmt'), 'dayhourlog', 'gmt');
$object->recurdateend = dol_mktime(0, 0, 0, GETPOST('limitmonth', 'int'), GETPOST('limitday', 'int'), GETPOST('limityear', 'int'));
} else {
unset($object->recurid);
unset($object->recurrule);
unset($object->recurdateend);
}
// Creation of action/event
$idaction = $object->create($user);
@ -517,26 +546,7 @@ if (empty($reshook) && $action == 'add') {
$action = 'create'; $donotclearsession = 1;
}
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
$selectedrecurrulebyday = '';
$object->recurrule = GETPOSTISSET('recurrulefreq') ? "FREQ=".GETPOST('recurrulefreq', 'alpha') : "";
$object->recurrule .= GETPOSTISSET('BYMONTHDAY') ? "_BYMONTHDAY".GETPOST('BYMONTHDAY', 'alpha') : "";
$object->recurrule .= GETPOSTISSET('BYDAY') ? "_BYDAY".GETPOST('BYDAY', 'alpha') : "";
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) {
$selectedrecurrulefreq = $reg1[1];
}
if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) {
$selectedrecurrulebymonthday = $reg2[1];
}
if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) {
$selectedrecurrulebyday = $reg3[1];
}
// If event is recurrent
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent && !empty($selectedrecurrulefreq) && $selectedrecurrulefreq != 'no') {
if ($eventisrecurring) {
// We set first date of recurrence and offsets
if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) {
$firstdatearray = dol_get_first_day_week(GETPOST("apday", 'int'), GETPOST("apmonth", 'int'), GETPOST("apyear", 'int'));
@ -944,9 +954,7 @@ if (empty($reshook) && $action == 'update') {
}
}
/*
* delete event
*/
// Delete event
if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes') {
$object->fetch($id);
$object->fetch_optionals();
@ -2205,11 +2213,18 @@ if ($id > 0) {
}
// Private
if ($object->elementtype == 'ticket') print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
if ($object->elementtype == 'ticket') {
print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
}
// Full day event
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
// Event into a serie
if ($object->recurid) {
print '<tr><td class="titlefield">'.$langs->trans("EventIntoASerie").'</td><td>'.dol_escape_htmltag($object->recurid).'</td></tr>';
}
$rowspan = 4;
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
$rowspan++;

View File

@ -269,6 +269,7 @@ class ActionComm extends CommonObject
*/
public $contact_id;
/**
* @var Societe|null Company linked to action (optional)
* @deprecated
@ -376,9 +377,9 @@ class ActionComm extends CommonObject
/**
* Properties to manage the recurring events
*/
public $recurid;
public $recurrule;
public $recurdateend;
public $recurid; /* A string YYYYMMDDHHMMSS shared by allevent of same serie */
public $recurrule; /* Rule of recurring */
public $recurdateend; /* Repeat until this date */
public $calling_duration;
@ -549,6 +550,9 @@ class ActionComm extends CommonObject
$sql .= "email_tobcc,";
$sql .= "email_subject,";
$sql .= "errors_to,";
$sql .= "recurid,";
$sql .= "recurrule,";
$sql .= "recurdateend,";
$sql .= "num_vote,";
$sql .= "event_paid,";
$sql .= "status";
@ -587,6 +591,9 @@ class ActionComm extends CommonObject
$sql .= (!empty($this->email_tobcc) ? "'".$this->db->escape($this->email_tobcc)."'" : "null").", ";
$sql .= (!empty($this->email_subject) ? "'".$this->db->escape($this->email_subject)."'" : "null").", ";
$sql .= (!empty($this->errors_to) ? "'".$this->db->escape($this->errors_to)."'" : "null").", ";
$sql .= (!empty($this->recurid) ? "'".$this->db->escape($this->recurid)."'" : "null").", ";
$sql .= (!empty($this->recurrule) ? "'".$this->db->escape($this->recurrule)."'" : "null").", ";
$sql .= (!empty($this->recurdateend) ? "'".$this->db->idate($this->recurdateend)."'" : "null").", ";
$sql .= (!empty($this->num_vote) ? (int) $this->num_vote : "null").", ";
$sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", ";
$sql .= (!empty($this->status) ? (int) $this->status : "0");
@ -716,6 +723,9 @@ class ActionComm extends CommonObject
$this->fetchResources();
$this->id = 0;
$this->recurid = '';
$this->recurrule = '';
$this->recurdateend = '';
// Create clone
$this->context['createfromclone'] = 'createfromclone';
@ -1306,8 +1316,17 @@ class ActionComm extends CommonObject
dol_syslog(get_class()."::getActions", LOG_DEBUG);
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('agendadao'));
$sql = "SELECT a.id";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
// Fields from hook
$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
$reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
if (!empty($socid)) {
$sql .= " AND a.fk_soc = ".((int) $socid);
@ -1326,6 +1345,10 @@ class ActionComm extends CommonObject
if (!empty($filter)) {
$sql .= $filter;
}
// Fields where hook
$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
$reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
if ($sortorder && $sortfield) {
$sql .= $this->db->order($sortfield, $sortorder);
}

View File

@ -3347,7 +3347,7 @@ class Propal extends CommonObject
public function LibStatut($status, $mode = 1)
{
// phpcs:enable
global $conf;
global $conf, $hookmanager;
// Init/load array of translation of status
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
@ -3378,6 +3378,14 @@ class Propal extends CommonObject
$statusType = 'status6';
}
$parameters = array('status' => $status, 'mode' => $mode);
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}

View File

@ -3626,7 +3626,7 @@ class Commande extends CommonOrder
public function LibStatut($status, $billed, $mode, $donotshowbilled = 0)
{
// phpcs:enable
global $langs, $conf;
global $langs, $conf, $hookmanager;
$billedtext = '';
if (empty($donotshowbilled)) {
@ -3674,6 +3674,19 @@ class Commande extends CommonOrder
$mode = 0;
}
$parameters = array(
'status' => $status,
'mode' => $mode,
'billed' => $billed,
'donotshowbilled' => $donotshowbilled
);
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip));
}

View File

@ -143,6 +143,13 @@ if (empty($reshook)) {
$result = $object->makeStripeSepaRequest($user, GETPOST('did', 'int'), 'direct-debit', 'facture');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// We refresh object data
$ret = $object->fetch($id, $ref);
$isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0);
if ($ret > 0) {
$object->fetch_thirdparty();
}
}
}

View File

@ -1010,7 +1010,7 @@ if (!empty($arrayfields['p.tms']['checked'])) {
// Status
if (!empty($arrayfields['p.statut']['checked'])) {
print '<td class="liste_titre center">';
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75');
print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75 onrightofpage');
print '</td>';
}
if (!empty($arrayfields['p.import_key']['checked'])) {

View File

@ -1323,6 +1323,60 @@ if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiont
}
}
if (!$error && ($action == 'affectuser' && $confirm == 'yes') && $permissiontoadd) {
$db->begin();
$usertoaffect=GETPOST('usertoaffect');
$projectrole=GETPOST('projectrole');
$tasksrole=GETPOST('tasksrole');
if (!empty($usertoaffect)) {
foreach ($toselect as $toselectid) {
$result = $object->fetch($toselectid);
//var_dump($contcats);exit;
if ($result > 0) {
$res = $object->add_contact($usertoaffect, $projectrole, 'internal');
if ($res >= 0) {
$taskstatic = new Task($db);
$task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0);
foreach ($task_array as $task) {
$tasksToAffect = new Task($db);
$result = $tasksToAffect->fetch($task->id);
if ($result > 0) {
$res = $tasksToAffect->add_contact($usertoaffect, $tasksrole, 'internal');
if ($res < 0) {
setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors');
}
}
}
$nbok++;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
break;
}
}
} else {
setEventMessage('UserNotFound', 'errors');
$error++;
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null);
}
$db->commit();
$toselect=array();
} else {
$db->rollback();
}
}
if (!$error && ($massaction == 'enable' || ($action == 'enable' && $confirm == 'yes')) && $permissiontoadd) {
$db->begin();

View File

@ -128,7 +128,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
$sql .= ' WHERE a.code <> "AC_OTH_AUTO"';
$sql .= ' AND (';
$sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity;
$sql .= " ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity;
$sql .= ' )';
} else {
$sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);

View File

@ -584,7 +584,7 @@ abstract class CommonInvoice extends CommonObject
public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
{
// phpcs:enable
global $langs;
global $langs, $hookmanager;
$langs->load('bills');
if ($type == -1) {
@ -634,6 +634,22 @@ abstract class CommonInvoice extends CommonObject
}
}
$parameters = array(
'status' => $status,
'mode' => $mode,
'paye' => $paye,
'alreadypaid' => $alreadypaid,
'type' => $type
);
$reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook
if ($reshook > 0) {
return $hookmanager->resPrint;
}
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
}
@ -1572,7 +1588,7 @@ abstract class CommonInvoice extends CommonObject
$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
}
$sql = "INSERT INTO '.MAIN_DB_PREFIX.'prelevement_demande(";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_demande(";
$sql .= "fk_facture, ";
$sql .= " amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)";
$sql .= " VALUES (".$this->id;

View File

@ -8097,7 +8097,7 @@ class Form
if ($addjscombo && $jsbeautify) {
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', $show_empty < 0 ? (string) $show_empty : '-1');
$out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($show_empty < 0 ? (string) $show_empty : '-1'), $morecss);
}
return $out;

View File

@ -1270,7 +1270,7 @@ class FormTicket
// Define output language
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->param['langsmodels'])) {
$newlang = $this->param['langsmodels'];
}
if (!empty($newlang)) {
@ -1281,7 +1281,7 @@ class FormTicket
// Get message template for $this->param["models"] into c_email_templates
$arraydefaultmessage = -1;
if ($this->param['models'] != 'none') {
if (isset($this->param['models']) && $this->param['models'] != 'none') {
$model_id = 0;
if (array_key_exists('models_id', $this->param)) {
$model_id = (int) $this->param["models_id"];
@ -1323,7 +1323,7 @@ class FormTicket
// Define output language
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && isset($this->param['langsmodels'])) {
$newlang = $this->param['langsmodels'];
}
if (!empty($newlang)) {
@ -1380,7 +1380,12 @@ class FormTicket
print '<input type="hidden" name="action" value="'.$this->action.'">';
print '<input type="hidden" name="actionbis" value="add_message">';
print '<input type="hidden" name="backtopage" value="'.$this->backtopage.'">';
print '<input type="hidden" name="trackid" value="'.$this->trackid.'">';
if (!empty($this->trackid)) {
print '<input type="hidden" name="trackid" value="'.$this->trackid.'">';
} else {
print '<input type="hidden" name="trackid" value="'.(empty($this->track_id) ? '' : $this->track_id).'">';
$keytoavoidconflict = empty($this->track_id) ? '' : '-'.$this->track_id; // track_id instead of trackid
}
foreach ($this->param as $key => $value) {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
}
@ -1392,7 +1397,7 @@ class FormTicket
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
}
$result = $formmail->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
$result = $formmail->fetchAllEMailTemplate(!empty($this->param["models"]) ? $this->param["models"] : "", $user, $outputlangs);
if ($result < 0) {
setEventMessages($this->error, $this->errors, 'errors');
}
@ -1404,7 +1409,7 @@ class FormTicket
print '<table class="border" width="'.$width.'">';
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
if ($user->hasRight("ticket", "write") && !$user->socid) {
$ticketstat = new Ticket($this->db);
$res = $ticketstat->fetch('', '', $this->track_id);
@ -1556,7 +1561,7 @@ class FormTicket
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) {
$this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']);
} elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) {
} elseif (!dol_textishtml($defaultmessage) && isset($this->substit['__USER_SIGNATURE__']) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) {
$defaultmessage = dol_nl2br($defaultmessage);
}
if (GETPOSTISSET("message") && !GETPOST('modelselected')) {
@ -1569,7 +1574,7 @@ class FormTicket
}
print '<tr><td colspan="2"><label for="message"><span class="fieldrequired">'.$langs->trans("Message").'</span>';
if ($user->rights->ticket->write && !$user->socid) {
if ($user->hasRight("ticket", "write") && !$user->socid) {
$texttooltip = $langs->trans("TicketMessageHelp");
if (getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO') || getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE')) {
$texttooltip .= '<br><br>'.$langs->trans("ForEmailMessageWillBeCompletedWith").'...';

View File

@ -434,10 +434,11 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
* @param int $forcefocus Force focus on field
* @param string $widthTypeOfAutocomplete 'resolve' or 'off'
* @param string $idforemptyvalue '-1'
* @param string $morecss More css
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
* @see selectArrayAjax() of html.form.class
*/
function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve', $idforemptyvalue = '-1')
function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve', $idforemptyvalue = '-1', $morecss = '')
{
global $conf;
@ -463,14 +464,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
$minLengthToAutocomplete = 0;
}
$moreselect2theme = ($morecss ? dol_escape_js(' '.$morecss) : '');
$moreselect2theme = preg_replace('/widthcentpercentminus[^\s]*/', '', $moreselect2theme);
$tmpplugin = 'select2';
$msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
<script>
$(document).ready(function () {
$(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
dir: \'ltr\',
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
minimumInputLength: '.$minLengthToAutocomplete.',
width: \''.dol_escape_js($widthTypeOfAutocomplete).'\', /* off or resolve */
minimumInputLength: '.((int) $minLengthToAutocomplete).',
language: select2arrayoflanguage,
matcher: function (params, data) {
if ($.trim(params.term) === "") {
@ -484,6 +488,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
}
return data;
},
theme: \'default'.$moreselect2theme.'\', /* to add css on generated html components */
containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
selectionCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
templateResult: function (data, container) { /* Format visible output into combo list */

View File

@ -1489,6 +1489,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql = '';
if (isModEnabled('agenda')) {
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('agendadao'));
// Recherche histo sur actioncomm
if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,";
@ -1528,6 +1533,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
}
// Fields from hook
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
$reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
@ -1539,6 +1549,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id);
}
// Fields from hook
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
$reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
@ -1639,6 +1654,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
addOtherFilterSQL($sql, $donetodo, $now, $filters);
// Fields from hook
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module);
$reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook
if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
if (is_array($actioncode)) {
foreach ($actioncode as $code) {
$sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj);

View File

@ -641,6 +641,12 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask
return 0;
}
$srcexists = dol_is_file($srcfile);
if (!$srcexists) {
dol_syslog("files.lib.php::dolReplaceInFile failed to read src file", LOG_WARNING);
return -3;
}
$tmpdestfile = $destfile.'.tmp';
$newpathofsrcfile = dol_osencode($srcfile);

View File

@ -3844,6 +3844,27 @@ function isValidPhone($phone)
}
/**
* Return first letters of a strings.
* Example with nbofchar=1: 'ghi' will return 'g' but 'abc def' will return 'ad'
* Example with nbofchar=2: 'ghi' will return 'gh' but 'abc def' will return 'abde'
*
* @param string $s String to truncate
* @param int $nbofchar Nb of characters to keep
* @return string Return first chars.
*/
function dolGetFirstLetters($s, $nbofchar = 1)
{
$ret = '';
$tmparray = explode(' ', $s);
foreach ($tmparray as $tmps) {
$ret .= dol_substr($tmps, 0, $nbofchar);
}
return $ret;
}
/**
* Make a strlen call. Works even if mbstring module not enabled
*
@ -5726,7 +5747,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
if ((string) $forcerounding != '-1') {
if ($forcerounding == 'MU') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT;
} else if ($forcerounding == 'MT') {
} elseif ($forcerounding == 'MT') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT;
} elseif ($forcerounding >= 0) {
$nbdecimal = $forcerounding;

View File

@ -1727,9 +1727,13 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
if ($nature) {
$langs->load('accountancy');
$journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ...
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
$key = $langs->trans("AccountingJournalType".strtoupper($objp->nature));
$transferlabel = ($objp->nature && $key != "AccountingJournalType".strtoupper($langs->trans($objp->nature)) ? $key : $objp->label);
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $transferlabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire'));
}
$i++;
$i++;
}
} else {
// Should not happend. Entries are added

View File

@ -1176,6 +1176,18 @@ class pdf_crabe extends ModelePDFFactures
$posy = $pdf->GetY();
}
// Show if Option VAT debit option is on also if transmitter is french
// Decret n°2099-1299 2022-10-07
// French mention : "Option pour le paiement de la taxe d'après les débits"
if ($this->emetteur->country_code == 'FR') {
if ($conf->global->TAX_MODE == 1) {
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
$posy = $pdf->GetY() + 1;
}
}
// Show online payment link
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0;

View File

@ -1259,7 +1259,7 @@ class pdf_sponge extends ModelePDFFactures
$posy = $pdf->GetY() + 1;
}
// Show payment mode
// Show payment mode
if (!empty($object->mode_reglement_code)
&& $object->mode_reglement_code != 'CHQ'
&& $object->mode_reglement_code != 'VIR') {
@ -1286,7 +1286,19 @@ class pdf_sponge extends ModelePDFFactures
$posy = $pdf->GetY();
}
// Show online payment link
// Show if Option VAT debit option is on also if transmitter is french
// Decret n°2099-1299 2022-10-07
// French mention : "Option pour le paiement de la taxe d'après les débits"
if ($this->emetteur->country_code == 'FR') {
if ($conf->global->TAX_MODE == 1) {
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities("MentionVATDebitOptionIsOn"), 0, 1);
$posy = $pdf->GetY() + 1;
}
}
// Show online payment link
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') {
$useonlinepayment = 0;
if (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) {

View File

@ -102,7 +102,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$texte .= '<input type="hidden" name="param2" value="COMPANY_DIGITARIA_MASK_CUSTOMER">';
$texte .= '<input type="hidden" name="param3" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER">';
$texte .= '<input type="hidden" name="param4" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER">';
$texte .= '<table class="nobordernopadding" width="100%">';
$texte .= '<input type="hidden" name="param5" value="COMPANY_DIGITARIA_CLEAN_WORDS">';
$texte .= '<table class="nobordernopadding centpercent">';
$s1 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value1" value="'.$conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER.'">', $tooltip, 1, 1);
$s2 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value2" value="'.$conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER.'">', $tooltip, 1, 1);
$s3 = $form->textwithpicto('<input type="text" class="flat" size="2" name="value3" value="'.$conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER.'">', $tooltip, 1, 1);
@ -127,7 +128,23 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
}
$texte .= '</td>';
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"></td>';
$texte .= '</tr>';
$texte .= '<tr><td>';
$texte .= "<br>\n";
$texthelp = $langs->trans("RemoveSpecialWordsHelp");
$texttitle = $langs->trans("RemoveSpecialWords");
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= "<br>\n";
$texte .= '<textarea class="flat" cols="60" name="value5">';
if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_WORDS)) {
$texte .= $conf->global->COMPANY_DIGITARIA_CLEAN_WORDS;
}
$texte .= '</textarea>';
$texte .= '</tr></table>';
$texte .= '</form>';
return $texte;
@ -192,6 +209,11 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
return -1;
}
// Clean declared words
if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_WORDS)) {
$cleanWords = explode(";", $conf->global->COMPANY_DIGITARIA_CLEAN_WORDS);
$codetouse = str_replace($cleanWords, "", $codetouse);
}
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default)
if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) {
$codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse);
@ -202,7 +224,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
}
$this->code = $prefix.strtoupper(substr($codetouse, 0, $width));
dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code);
dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code, LOG_DEBUG);
// Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default)
if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) {
@ -279,6 +301,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$sql = "SELECT " . $typethirdparty . " FROM " . MAIN_DB_PREFIX . "societe";
$sql .= " WHERE " . $typethirdparty . " = '" . $db->escape($code) . "'";
}
$sql .= " AND entity IN (".getEntity('societe').")";
$resql = $db->query($sql);
if ($resql) {

View File

@ -113,6 +113,44 @@ if ($massaction == 'presetsupervisor') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmSetSupervisor"), $langs->trans("ConfirmSetSupervisorQuestion", count($toselect)), "setsupervisor", $formquestion, 1, 0, 200, 500, 1);
}
if ($massaction == 'preaffectuser') {
$formquestion = array();
$valuefielduser = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
$valuefielduser .= img_picto('', 'user').' ';
$valuefielduser .= $form->select_dolusers('', 'usertoaffect', 1, $arrayofselected, 0, '', 0, $object->entity, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
$valuefielduser .= '</div>';
$valuefieldprojrole = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
$valuefieldprojrole .= $formcompany->selectTypeContact($object, '', 'projectrole', 'internal', 'position', 0, 'widthcentpercentminusx maxwidth300', 0);
$valuefieldprojrole .= '</div>';
$valuefieldtasksrole = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
$valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic, '', 'tasksrole', 'internal', 'position', 0, 'widthcentpercentminusx maxwidth300', 0);
$valuefieldtasksrole .= '</div>';
$formquestion[] = array(
'type' => 'other',
'name' => 'usertoaffect',
'label' => $langs->trans("User"),
'value' => $valuefielduser
);
$formquestion[] = array(
'type' => 'other',
'name' => 'projectrole',
'label' => $langs->trans("ProjectRole"),
'value' => $valuefieldprojrole
);
$formquestion[] = array(
'type' => 'other',
'name' => 'tasksrole',
'label' => $langs->trans("TasksRole"),
'value' => $valuefieldtasksrole
);
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAffectUser"), $langs->trans("ConfirmAffectUserQuestion", count($toselect)), "affectuser", $formquestion, 1, 0, 200, 500, 1);
}
if ($massaction == 'presend') {
$langs->load("mails");

View File

@ -751,7 +751,13 @@ class EcmFiles extends CommonObject
}
// If you need to delete child tables to, you can insert them here
if (!$error) {
$result = $this->deleteExtraFields();
if (!$result) {
dol_syslog(get_class($this)."::delete error ".$this->error, LOG_ERR);
$error++;
}
}
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' WHERE rowid='.((int) $this->id);

View File

@ -668,7 +668,7 @@ if (empty($reshook)) {
// If status pending validation and validator = user
if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) {
$object->date_refuse = dol_print_date('dayhour', dol_now());
$object->date_refuse = dol_now();
$object->fk_user_refuse = $user->id;
$object->statut = Holiday::STATUS_REFUSED;
$object->status = Holiday::STATUS_REFUSED;

View File

@ -48,12 +48,11 @@
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'ACCOUNTING_SELL_JOURNAL', 2, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'ACCOUNTING_PURCHASE_JOURNAL', 3, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'ACCOUNTING_BANK_JOURNAL', 4, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ACCOUNTING_EXPENSEREPORT_JOURNAL', 5, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'FinanceJournal', 4, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', 1, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 0, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'ACCOUNTING_INVENTORY_JOURNAL', 8, 0, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ExpenseReportsJournal', 5, 1, 1);
INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'InventoryJournal', 8, 1, 1);
-- Accounting Charts / Plans (Templates) for Countries

View File

@ -325,9 +325,10 @@ AccountingJournalType1=Miscellaneous operations
AccountingJournalType2=Sales
AccountingJournalType3=Purchases
AccountingJournalType4=Bank
AccountingJournalType5=Expenses report
AccountingJournalType5=Expense reports
AccountingJournalType8=Inventory
AccountingJournalType9=Has-new
GenerationOfAccountingEntries=Generation of accounting entries
ErrorAccountingJournalIsAlreadyUse=This journal is already use
AccountingAccountForSalesTaxAreDefinedInto=Note: Accounting account for Sales tax are defined into menu <b>%s</b> - <b>%s</b>
NumberOfAccountancyEntries=Number of entries
@ -335,8 +336,10 @@ NumberOfAccountancyMovements=Number of movements
ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding & transfer in accountancy on sales (customer invoices will not be taken into account in accounting)
ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountancy on purchases (vendor invoices will not be taken into account in accounting)
ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting)
ACCOUNTING_ENABLE_LETTERING=Enable the lettering function in the accounting
## Export
NotExportLettering=Do not export the lettering when generating the file
NotifiedExportDate=Flag exported lines as Exported <span class="warning">(to modify a line, you will need to delete the whole transaction and re-transfert it into accounting)</span>
NotifiedValidationDate=Validate and Lock the exported entries <span class="warning">(same effect than the "%s" feature, modification and deletion of the lines will DEFINITELY not be possible)</span>
DateValidationAndLock=Date validation and lock

View File

@ -2059,6 +2059,8 @@ RemoveSpecialChars=Remove special characters
COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX)
COMPANY_DIGITARIA_CLEAN_REGEX=Regex filter to clean value (COMPANY_DIGITARIA_CLEAN_REGEX)
COMPANY_DIGITARIA_UNIQUE_CODE=Duplicate not allowed
RemoveSpecialWords=Clean certain words when generating sub-accounts for customers or suppliers
RemoveSpecialWordsHelp=Specify the words to be cleaned before calculating the customer or supplier account. Use a ";" between each word
GDPRContact=Data Protection Officer (DPO, Data Privacy or GDPR contact)
GDPRContactDesc=If you store personal data in your Information System, you can name the contact who is responsible for the General Data Protection Regulation here
HelpOnTooltip=Help text to show on tooltip
@ -2335,4 +2337,5 @@ LimitsAndMitigation=Access limits and mitigation
DesktopsOnly=Desktops only
DesktopsAndSmartphones=Desktops et smartphones
AllowOnlineSign=Allow online signing
AllowExternalDownload=Allow external download (without login, using a shared link)
AllowExternalDownload=Allow external download (without login, using a shared link)
DeadlineDayVATSubmission=Deadline day for vat submission on the next month

View File

@ -625,3 +625,4 @@ PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to pa
SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices
MakePaymentAndClassifyPayed=Record payment
BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status)
MentionVATDebitOptionIsOn=Option to pay tax based on debits

View File

@ -1146,12 +1146,17 @@ UpdateForAllLines=Update for all lines
OnHold=On hold
Civility=Civility
AffectTag=Affect Tag
AffectUser=Affect User
SetSupervisor=Set Supervisor
CreateExternalUser=Create external user
ConfirmAffectTag=Bulk Tag Affect
ConfirmAffectUser=Bulk User Affect
ProjectRole=Role assigned on each project
TasksRole=Role assigned on each task of each project
ConfirmSetSupervisor=Bulk Supervisor Set
ConfirmUpdatePrice=Choose a increase/decrease price rate
ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)?
ConfirmAffectUserQuestion=Are you sure you want to affect users to the %s selected record(s)?
ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)?
ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)?
CategTypeNotFound=No tag type found for type of records

View File

@ -1146,13 +1146,18 @@ UpdateForAllLines=Mise à jour de toutes les lignes
OnHold=En attente
Civility=Civilité
AffectTag=Affecter un tag/catégorie
AffectUser=Affecter un utilisateur
SetSupervisor=Choisir un superviseur
CreateExternalUser=Créer utilisateur externe
ConfirmAffectTag=Affecter les tags en masse
ConfirmSetSupervisor=Choisir un superviseur en masse
ConfirmAffectUser=Affecter les utilisateurs en masse
ProjectRole=Role attribué pour chaque projet
TasksRole=Role attribué pour chaque tâche de chaque projet
ConfirmUpdatePrice=Choisir un pourcentage de hausse/baisse des prix
ConfirmAffectTagQuestion=Êtes-vous sur de vouloir affecter ces catégories aux %s lignes sélectionnées ?
ConfirmSetSupervisorQuestion=Êtes-vous sur de vouloir affecter ce superviseur aux %s lignes sélectionnées ?
ConfirmAffectUserQuestion=Êtes-vous sur de vouloir affecter cet utilisateur aux %s lignes sélectionnées ?
ConfirmUpdatePriceQuestion=Êtes-vous sur de vouloir mettre à jour les prix des %s lignes sélectionnées ?
CategTypeNotFound=Aucun type de tag trouvé pour ce type d'enregistrements
Rate=Taux

File diff suppressed because it is too large Load Diff

View File

@ -556,7 +556,7 @@ if (empty($reshook)) {
// Ajout / mise à jour
if ($rowid > 0) {
$sql = "UPDATE ".MAIN_DB_PREFIX."product_price_by_qty SET";
$sql .= " price=".((float) $price)."',";
$sql .= " price=".((float) $price).",";
$sql .= " unitprice=".((float) $unitPrice).",";
$sql .= " quantity=".((float) $quantity).",";
$sql .= " remise_percent=".((float) $remise_percent).",";

View File

@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
if (isModEnabled('categorie')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
@ -355,8 +357,10 @@ if (empty($reshook)) {
*/
$form = new Form($db);
$formcompany = new FormCompany($db);
$companystatic = new Societe($db);
$taskstatic = new Task($db);
$formother = new FormOther($db);
$formproject = new FormProjets($db);
@ -802,6 +806,7 @@ $arrayofmassactions = array(
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->projet->creer) {
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Close");
$arrayofmassactions['preaffectuser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AffectUser");
}
if ($user->rights->projet->supprimer) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
@ -809,7 +814,7 @@ if ($user->rights->projet->supprimer) {
if (isModEnabled('category') && $user->rights->projet->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preaffectuser'))) {
$arrayofmassactions = array();
}

View File

@ -310,11 +310,11 @@ if (empty($reshook)) {
}
}
if (is_array($searched_companies)) {
if (!empty($searched_companies) && is_array($searched_companies)) {
$object->fk_soc = $searched_companies[0]->id;
}
if (is_array($contacts) and count($contacts) > 0) {
if (is_array($contacts) && count($contacts) > 0) {
$object->fk_soc = $contacts[0]->socid;
$usertoassign = $contacts[0]->id;
}
@ -329,7 +329,7 @@ if (empty($reshook)) {
if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
$error++;
$errors = array($langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
array_push($object->errors, array($langs->trans("AlreadyTooMuchPostOnThisIPAdress")));
array_push($object->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
$action = 'create_ticket';
}

View File

@ -62,6 +62,8 @@ $cancel = GETPOST('cancel', 'aZ09');
$track_id = GETPOST('track_id', 'alpha');
$email = strtolower(GETPOST('email', 'alpha'));
$suffix = "";
$moreforfilter = "";
if (GETPOST('btn_view_ticket_list')) {
unset($_SESSION['track_id_customer']);
@ -364,7 +366,7 @@ if ($action == "view_ticketlist") {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id = t.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact = tc.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople = sp.rowid";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)";
}
$sql .= " WHERE t.entity IN (".getEntity('ticket').")";
@ -736,7 +738,7 @@ if ($action == "view_ticketlist") {
print '</p>';
print '<p><label for="email" style="display: inline-block; width: 30%; "><span class="fieldrequired">'.$langs->trans('Email').'</span></label>';
print '<input size="30" id="email" name="email" value="'.(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $_SESSION['customer_email']).'" />';
print '<input size="30" id="email" name="email" value="'.(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : (!empty($_SESSION['customer_email']) ? $_SESSION['customer_email'] : "")).'" />';
print '</p>';
print '<p style="text-align: center; margin-top: 1.5em;">';

View File

@ -63,6 +63,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$track_id = GETPOST('track_id', 'alpha');
$email = GETPOST('email', 'email');
$suffix = "";
if (GETPOST('btn_view_ticket')) {
unset($_SESSION['email_customer']);
@ -205,7 +206,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
$triggersendname = 'TICKET_SENTBYMAIL';
$paramname = 'id';
$autocopy = 'MAIN_MAIL_AUTOCOPY_TICKET_TO'; // used to know the automatic BCC to add
$trackid = 'tic'.$object->id;
if (!empty($object->id)) $trackid = 'tic'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
@ -401,7 +402,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
print '</p>';
print '<p><label for="email" style="display: inline-block; width: 30%; "><span class="fieldrequired">'.$langs->trans('Email').'</span></label>';
print '<input size="30" id="email" name="email" value="'.(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : $_SESSION['customer_email']).'" />';
print '<input size="30" id="email" name="email" value="'.(GETPOST('email', 'alpha') ? GETPOST('email', 'alpha') : (!empty($_SESSION['customer_email']) ? $_SESSION['customer_email'] : "")).'" />';
print '</p>';
print '<p style="text-align: center; margin-top: 1.5em;">';

View File

@ -52,6 +52,22 @@ $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'int');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int');
$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int');
$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int');
$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int');
$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int');
$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int');
$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver
$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
$search_date_create_startday = GETPOST('search_date_create_startday', 'int');
$search_date_create_startmonth = GETPOST('search_date_create_startmonth', 'int');
$search_date_create_startyear = GETPOST('search_date_create_startyear', 'int');
$search_date_create_endday = GETPOST('search_date_create_endday', 'int');
$search_date_create_endmonth = GETPOST('search_date_create_endmonth', 'int');
$search_date_create_endyear = GETPOST('search_date_create_endyear', 'int');
$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver
$search_date_create_end = dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear);
$search_billed = GETPOST("search_billed", 'int');
$sall = GETPOST('sall', 'alphanohtml');
$optioncss = GETPOST('optioncss', 'alpha');
@ -161,6 +177,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_state = "";
$search_country = '';
$search_type_thirdparty = '';
$search_date_delivery_startday = '';
$search_date_delivery_startmonth = '';
$search_date_delivery_startyear = '';
$search_date_delivery_endday = '';
$search_date_delivery_endmonth = '';
$search_date_delivery_endyear = '';
$search_date_delivery_start = '';
$search_date_delivery_end = '';
$search_date_create_startday = '';
$search_date_create_startmonth = '';
$search_date_create_startyear = '';
$search_date_create_endday = '';
$search_date_create_endmonth = '';
$search_date_create_endyear = '';
$search_date_create_start = '';
$search_date_create_end = '';
$search_billed = '';
$search_status = '';
$search_array_options = array();
@ -545,6 +577,18 @@ if ($search_country) {
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
}
if ($search_date_delivery_start) {
$sql .= " AND e.date_delivery >= '".$db->idate($search_date_delivery_start)."'";
}
if ($search_date_delivery_end) {
$sql .= " AND e.date_delivery <= '".$db->idate($search_date_delivery_end)."'";
}
if ($search_date_create_start) {
$sql .= " AND e.date_creation >= '".$db->idate($search_date_create_start)."'";
}
if ($search_date_create_end) {
$sql .= " AND e.date_creation <= '".$db->idate($search_date_create_end)."'";
}
if ($search_ref_rcp) {
$sql .= natural_search('e.ref', $search_ref_rcp);
}
@ -633,6 +677,42 @@ if ($search_country) {
if ($search_type_thirdparty) {
$param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
}
if ($search_date_delivery_startday) {
$param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
}
if ($search_date_delivery_startmonth) {
$param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
}
if ($search_date_delivery_startyear) {
$param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
}
if ($search_date_delivery_endday) {
$param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
}
if ($search_date_delivery_endmonth) {
$param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
}
if ($search_date_delivery_endyear) {
$param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
}
if ($search_date_create_startday) {
$param .= '&search_date_create_startday='.urlencode($search_date_create_startday);
}
if ($search_date_create_startmonth) {
$param .= '&search_date_create_startmonth='.urlencode($search_date_create_startmonth);
}
if ($search_date_create_startyear) {
$param .= '&search_date_create_startyear='.urlencode($search_date_create_startyear);
}
if ($search_date_create_endday) {
$param .= '&search_date_create_endday='.urlencode($search_date_create_endday);
}
if ($search_date_create_endmonth) {
$param .= '&search_date_create_endmonth='.urlencode($search_date_create_endmonth);
}
if ($search_date_create_endyear) {
$param .= '&search_date_create_endyear='.urlencode($search_date_create_endyear);
}
if ($search_ref_supplier) {
$param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
}
@ -815,7 +895,14 @@ if (!empty($arrayfields['typent.code']['checked'])) {
}
// Date delivery planned
if (!empty($arrayfields['e.date_delivery']['checked'])) {
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
}
if (!empty($arrayfields['l.ref']['checked'])) {
// Delivery ref
@ -836,7 +923,13 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['e.datec']['checked'])) {
print '<td class="liste_titre">';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_create_start ? $search_date_create_start : -1, 'search_date_create_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_create_end ? $search_date_create_end : -1, 'search_date_create_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
}
// Date modification

View File

@ -15,7 +15,7 @@
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2019-2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2022 ButterflyOfFire <butterflyoffire+dolibarr@protonmail.com>
*
@ -1710,13 +1710,13 @@ class Societe extends CommonObject
$sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif';
$sql .= ', s.phone, s.fax, s.email';
$sql .= ', s.socialnetworks';
$sql .= ', s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur';
$sql .= ', s.url, s.zip, s.town, s.note_private, s.note_public, s.client, s.fournisseur';
$sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6';
$sql .= ', s.capital, s.tva_intra';
$sql .= ', s.fk_typent as typent_id';
$sql .= ', s.fk_effectif as effectif_id';
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
$sql .= ', s.webservices_url, s.webservices_key, s.model_pdf';
$sql .= ', s.webservices_url, s.webservices_key, s.model_pdf, s.last_main_doc';
if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= ', s.code_compta, s.code_compta_fournisseur, s.accountancy_code_buy, s.accountancy_code_sell';
} else {
@ -1947,7 +1947,10 @@ class Societe extends CommonObject
// multicurrency
$this->fk_multicurrency = $obj->fk_multicurrency;
$this->multicurrency_code = $obj->multicurrency_code;
// pdf
$this->model_pdf = $obj->model_pdf;
$this->last_main_doc = $obj->last_main_doc;
$result = 1;

View File

@ -6460,6 +6460,9 @@ ul.select2-results__options li {
.select2-container.select2-container--open .select2-dropdown--below {
min-width: 220px !important;
}
.onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--below {
min-width: 140px !important;
}
.select2-container--open .select2-dropdown--below {
border-top: 1px solid var(--inputbordercolor);

View File

@ -295,7 +295,20 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
margin: 2px;
border-radius: 3px;
}
.member-company-back {
padding: 2px 7px 2px 7px;
background-color: #e4e4e4;
color: #666;
border-radius: 10px;
white-space: nowrap;
}
.member-individual-back {
padding: 2px 7px 2px 7px;
background-color: #e4e4e4;
color: #666;
border-radius: 10px;
white-space: nowrap;
}
.bg-infobox-project{

View File

@ -48,7 +48,20 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
margin: 2px;
border-radius: 3px;
}
.member-company-back {
padding: 2px 7px 2px 7px;
background-color: #e4e4e4;
color: #666;
border-radius: 10px;
white-space: nowrap;
}
.member-individual-back {
padding: 2px 7px 2px 7px;
background-color: #e4e4e4;
color: #666;
border-radius: 10px;
white-space: nowrap;
}
.bg-infobox-project{
<?php echo $prefix; ?>color: #6c6aa8 !important;

View File

@ -6225,6 +6225,9 @@ ul.select2-results__options li {
.select2-container.select2-container--open .select2-dropdown--below {
min-width: 220px !important;
}
.onrightofpage span.select2-dropdown.ui-dialog.select2-dropdown--below {
min-width: 140px !important;
}
.select2-container--open .select2-dropdown--below {
border-top: 1px solid var(--inputbordercolor);

View File

@ -199,7 +199,7 @@ class ActionsTicket
print '<tr class="liste_titre trforfield"><td class="nowrap titlefield">';
print $langs->trans("InitialMessage");
print '</td><td>';
if ($user->rights->ticket->manage) {
if ($user->hasRight("ticket", "manage")) {
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=edit_message_init&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a>';
}
print '</td></tr>';

View File

@ -1666,7 +1666,7 @@ class Ticket extends CommonObject
*/
public function loadCacheMsgsTicket()
{
if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) {
if (!empty($this->cache_msgs_ticket) && is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) {
return 0;
}

View File

@ -214,6 +214,9 @@ if ($action == 'create') {
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>';
print dol_get_fiche_end();

View File

@ -1003,10 +1003,14 @@ class Website extends CommonObject
// Make some replacement into some files
$cssindestdir = $conf->website->dir_temp.'/'.$website->ref.'/containers/styles.css.php';
dolReplaceInFile($cssindestdir, $arrayreplacementincss);
if (dol_is_file($cssindestdir)) {
dolReplaceInFile($cssindestdir, $arrayreplacementincss);
}
$htmldeaderindestdir = $conf->website->dir_temp.'/'.$website->ref.'/containers/htmlheader.html';
dolReplaceInFile($htmldeaderindestdir, $arrayreplacementincss);
if (dol_is_file($htmldeaderindestdir)) {
dolReplaceInFile($htmldeaderindestdir, $arrayreplacementincss);
}
// Build sql file
$filesql = $conf->website->dir_temp.'/'.$website->ref.'/website_pages.sql';