Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW/add_real_payments_on_salaries

This commit is contained in:
Gauthier PC portable 024 2021-02-17 16:56:50 +01:00
commit 134d7e00ec
268 changed files with 3811 additions and 1247 deletions

View File

@ -18,9 +18,65 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup.
* API /setup/shipment_methods has been replaced with API /setup/shipping_methods
***** ChangeLog for 13.0.1 compared to 13.0.0 *****
FIX: 10.0 before crediting a withdrawal receipt, check whether it has been credited already.
FIX: 11.0 when a mandatory extrafield of type sellist contains '0' it should be considered empty and trigger an error message upon insertion
FIX: 11.0 when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized
FIX: create MO, Column 'tms' cannot be null
FIX: #14290 #15900
FIX: #16076
FIX: #16077
FIX: #16079
FIX: #16080
FIX: 16084
FIX: #16107
FIX: #16118 Timezone problem on some fields
FIX: #16131
FIX: #16135
FIX: #16143
FIX: #16156
FIX: #16160
FIX: #16185
FIX: #16189, fix download/see check deposit PDF
FIX: #16215
FIX: Accountancy - label_operation is used instead of label_compte
FIX: Add critical price patch
FIX: Assignement of actors on tasks
FIX: Bad dates on info tabs
FIX: cash fence for takepos with multientity
FIX: CSRF errors on margin forms
FIX: encoding status in graph of vendor proposals
FIX: Fix detect dispached product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES)
FIX: Hide/Unhide external ICSS calendars
FIX: link to create event when task is in a project with a thirdparty
FIX: Localtax must be converted with price2num
FIX: manage price min for PRODUIT_CUSTOMER_PRICES
FIX: Missing language ico
FIX: Must not be able to edit vat of all lines if not draft
FIX: Bad "htdocs" found into a path
FIX: removed no more used proc update_modified_column_date_m on pgsql (its presence triggered errors)
FIX: Vulnerability report by Ricardo Matias
FIX: select default mail template
FIX: Select transport mode function when creating a supplier invoice and add unique key to the table llx_c_transport_mode in migrate sql
FIX: Merge of thirdparties : "unknow column fk_soc" + "Delivery" label
FIX: SQL Error in group by with postgres or mysql strict mode
FIX: takepos : load date function
FIX: Timeout during import
FIX: Trigger on expense report was not fired
FIX: User creation of expense report not visible
FIX: warning when adding a line if $remise_percent is an empty string
FIX: status late on purchase orders
FIX: ODT generation very slow
FIX: amount in summary of report
FIX: vat value when code contains number
FIX: payment term label on PDF
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:

View File

@ -359,9 +359,9 @@ class AccountancyExport
print length_accountg($line->numero_compte).$separator;
print length_accounta($line->subledger_account).$separator;
print $line->sens.$separator;
print price($line->montant).$separator;
print $line->label_operation.$separator;
print $line->doc_ref;
print price2fec(abs($line->montant)).$separator;
print dol_string_unaccent($line->label_operation).$separator;
print dol_string_unaccent($line->doc_ref);
print $end_line;
}
}

View File

@ -81,6 +81,9 @@ if (!empty($canvas)) {
$objcanvas->getCanvas('adherent', 'membercard', $canvas);
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('membercard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
@ -107,9 +110,6 @@ if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('membercard', 'globalcard'));
/*
@ -796,7 +796,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$adht = new AdherentType($db);
print load_fiche_titre($langs->trans("NewMember"), '', 'members');
print load_fiche_titre($langs->trans("NewMember"), '', $object->picto);
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';

View File

@ -236,7 +236,7 @@ $form = new Form($db);
llxHeader('', $langs->trans("MembersCards"));
print load_fiche_titre($langs->trans("LinkToGeneratedPages"), '', 'members');
print load_fiche_titre($langs->trans("LinkToGeneratedPages"), '', $adherentstatic->picto);
print '<span class="opacitymedium">'.$langs->trans("LinkToGeneratedPagesDesc").'</span><br>';
print '<br>';

View File

@ -1749,7 +1749,7 @@ class Adherent extends CommonObject
if (!$error) {
// Set invoice as paid
$invoice->set_paid($user);
$invoice->setPaid($user);
}
}

View File

@ -46,7 +46,7 @@ class AdherentType extends CommonObject
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'group';
public $picto = 'members';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe

View File

@ -52,7 +52,7 @@ $staticmember = new Adherent($db);
$statictype = new AdherentType($db);
$subscriptionstatic = new Subscription($db);
print load_fiche_titre($langs->trans("MembersArea"), '', 'members');
print load_fiche_titre($langs->trans("MembersArea"), '', 'member');
$Adherents = array();
$AdherentsAValider = array();

View File

@ -425,7 +425,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information";
$modelmail = "member";
@ -443,8 +443,7 @@ $moreforfilter = '';
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Categories').': ';
$moreforfilter .= $formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1);
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1);
$moreforfilter .= '</div>';
}
$parameters = array();

View File

@ -57,7 +57,7 @@ llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, arra
$title = $langs->trans("MembersStatisticsByProperties");
print load_fiche_titre($title, '', 'object_group');
print load_fiche_titre($title, '', $memberstatic->picto);
dol_mkdir($dir);
@ -128,7 +128,7 @@ if ($resql) {
$head = member_stats_prepare_head($adh);
print dol_get_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'user');
print dol_get_fiche_head($head, 'statsbyproperties', '', -1, '');
// Print title

View File

@ -25,6 +25,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$graphwidth = DolGraph::getDefaultGraphSizeForStats('width', 700);
$mapratio = 0.5;
@ -52,6 +53,8 @@ $langs->loadLangs(array("companies", "members", "banks"));
* View
*/
$memberstatic = new Adherent($db);
$arrayjs = array('https://www.google.com/jsapi');
if (!empty($conf->dol_use_jmobile)) $arrayjs = array();
@ -63,7 +66,7 @@ if ($mode == 'memberbyregion') $title = $langs->trans("MembersStatisticsByRegion
llxHeader('', $title, '', '', 0, 0, $arrayjs);
print load_fiche_titre($title, '', 'object_group');
print load_fiche_titre($title, '', $memberstatic->picto);
dol_mkdir($dir);
@ -196,7 +199,7 @@ if ($mode) {
$head = member_stats_prepare_head($adh);
print dol_get_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
print dol_get_fiche_head($head, $tab, '', -1, '');
// Print title
@ -268,7 +271,6 @@ if (count($arrayjs) && $mode == 'memberbycountry') {
// print the div tag that will contain the map
print '<div class="center" id="'.$mode.'"></div>'."\n";
print '<br>';
}
if ($mode) {

View File

@ -24,6 +24,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
@ -53,12 +54,13 @@ $langs->loadLangs(array("companies", "members"));
* View
*/
$memberstatic = new Adherent($db);
$form = new Form($db);
$title = $langs->trans("SubscriptionsStatistics");
llxHeader('', $title);
print load_fiche_titre($title, '', 'members');
print load_fiche_titre($title, '', $memberstatic->picto);
$dir = $conf->adherent->dir_temp;
@ -133,7 +135,7 @@ if (!$mesg) {
$head = member_stats_prepare_head($adh);
print dol_get_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), -1, 'user');
print dol_get_fiche_head($head, 'statssubscription', '', -1, '');
print '<div class="fichecenter"><div class="fichethirdleft">';

View File

@ -55,6 +55,11 @@ $permissionnote = $user->rights->adherent->cotisation->creer; // Used by the inc
$permissiondellink = $user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php
$permissiontoedit = $user->rights->adherent->cotisation->creer; // Used by the include of actions_lineupdonw.inc.php
$hookmanager->initHooks(array('subscriptioncard', 'globalcard'));
// Security check
$result = restrictedArea($user, 'subscription', 0); // TODO Check on object id
/*
* Actions
@ -148,8 +153,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent-
$form = new Form($db);
llxHeader('', $langs->trans("SubscriptionCard"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("SubscriptionCard"), $help_url);
dol_htmloutput_errors($errmsg);

View File

@ -209,7 +209,8 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit;
}
llxHeader('', $langs->trans("ListOfSubscriptions"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("ListOfSubscriptions"), $help_url);
$i = 0;
@ -253,7 +254,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information";
$modelmail = "subscription";

View File

@ -203,7 +203,8 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer) {
$form = new Form($db);
$formproduct = new FormProduct($db);
llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("MembersTypeSetup"), $help_url);
// List of members type
if (!$rowid && $action != 'create' && $action != 'edit') {

View File

@ -184,7 +184,7 @@ print '</tr>'."\n";
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
print '<td class="right nowraponall">'."\n";
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) {
if (!isHTTPS()) {
@ -232,7 +232,7 @@ if (!empty($conf->cron->enabled)) {
}
print '</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
print '<td class="right nowraponall">'."\n";
if (empty($conf->cron->enabled)) {
print '<span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module2300Name")).'</span>';

View File

@ -319,7 +319,7 @@ print '<tr class="liste_titre">';
print '<td width="300">'.$langs->trans("Box").'</td>';
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("SourceFile").'</td>';
print '<td width="160" class="center">'.$langs->trans("ActivateOn").'</td>';
print '<td width="160" class="center">'.$langs->trans("ActivatableOn").'</td>';
print "</tr>\n";
foreach ($boxtoadd as $box) {
@ -377,7 +377,7 @@ print '<table class="tagtable liste">'."\n";
print '<tr class="liste_titre">';
print '<td width="300">'.$langs->trans("Box").'</td>';
print '<td>'.$langs->trans("Note").'/'.$langs->trans("Parameters").'</td>';
print '<td class="center" width="160">'.$langs->trans("ActiveOn").'</td>';
print '<td class="center" width="160">'.$langs->trans("ActivatableOn").'</td>';
print '<td class="center" width="60" colspan="2">'.$langs->trans("PositionByDefault").'</td>';
print '<td class="center" width="80">'.$langs->trans("Disable").'</td>';
print '</tr>'."\n";

View File

@ -73,7 +73,7 @@ print '<br>';
$head = ecm_admin_prepare_head();
print dol_get_fiche_head($head, 'ecm', $langs->trans("ECM"), -1, 'ecm');
print dol_get_fiche_head($head, 'ecm', '', -1, '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';

View File

@ -80,7 +80,7 @@ print "<br>\n";
$head = ecm_admin_prepare_head();
print dol_get_fiche_head($head, 'attributes_ecm_directories', $langs->trans("ECM"), -1, 'ecm');
print dol_get_fiche_head($head, 'attributes_ecm_directories', '', -1, '');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -80,7 +80,7 @@ print "<br>\n";
$head = ecm_admin_prepare_head();
print dol_get_fiche_head($head, 'attributes_ecm_files', $langs->trans("ECM"), -1, 'ecm');
print dol_get_fiche_head($head, 'attributes_ecm_files', '', -1, '');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -0,0 +1,600 @@
<?php
/* Copyright (C) 2021 Florian Henry <florian.henry@scopen.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
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/setup.php
* \ingroup eventorganization
* \brief EventOrganization setup page.
*/
// Load Dolibarr environment
require '../main.inc.php';
global $langs, $user;
// Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Translations
$langs->loadLangs(array("admin", "eventorganization"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject';
$arrayofparameters = array(
'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
);
$error = 0;
$setupnotempty = 0;
/*
* Actions
*/
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha');
$maskorder = GETPOST('maskorder', 'alpha');
if ($maskconstorder) {
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object');
$tmpobject = new $tmpobjectkey($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/eventorganization/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
require_once $file;
$module = new $classname($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}
} elseif ($action == 'set') {
// Activate a model
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->$constforval = $value;
}
// We disable/enable the document template (into llx_document_model table)
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
/*
* View
*/
$form = new Form($db);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$page_name = "EventOrganizationSetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'eventorganization');
// Configuration header
$head = eventorganizationAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, 'eventorganization');
// Setup page goes here
echo '<span class="opacitymedium">'.$langs->trans("EventOrganizationSetupPage").'</span><br><br>';
if ($action == 'edit') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
print '</td><td>';
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print "</textarea>\n";
} elseif ($val['type']== 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
//$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
$arrayofmessagename = array();
if (is_array($formmail->lines_model)) {
foreach ($formmail->lines_model as $modelmail) {
//var_dump($modelmail);
$moreonlabel = '';
if (!empty($arrayofmessagename[$modelmail->label])) {
$moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
}
// The 'label' is the key that is unique if we exclude the language
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($db);
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
}
print '</td></tr>';
}
}
print '</table>';
print '<br><div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br>';
} else {
if (!empty($arrayofparameters)) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
print '</td><td>';
if ($val['type'] == 'textarea') {
print dol_nl2br($conf->global->{$constname});
} elseif ($val['type']== 'html') {
print $conf->global->{$constname};
} elseif ($val['type'] == 'yesno') {
print ajax_constantonoff($constname);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
if (!empty($conf->global->{$constname})) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
if ($template < 0) {
setEventMessages(null, $formmail->errors, 'errors');
}
print $langs->trans($template->label);
}
} elseif (preg_match('/category:/', $val['type'])) {
if (!empty($conf->global->{$constname})) {
$c = new Categorie($db);
$result = $c->fetch($conf->global->{$constname});
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
}
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
}
} else {
print $conf->global->{$constname};
}
print '</td></tr>';
}
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
} else {
print '<br>'.$langs->trans("NothingToSetup");
}
}
$moduledir = 'eventorganization';
$myTmpObjects = array();
$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'MyObject') {
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
/*
* Orders Numbering model
*/
$setupnotempty++;
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.'/'.$file.'.php';
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
continue;
}
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
continue;
}
if ($module->isEnabled()) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
} else {
print $tmp;
}
print '</td>'."\n";
print '<td class="center">';
$constforvar = 'EVENTORGANIZATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
$mytmpinstance = new $myTmpObjectKey($db);
$mytmpinstance->initAsSpecimen();
// Info
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mytmpinstance);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval);
}
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
}
}
print "</table><br>\n";
}
if ($myTmpObjectArray['includedocgeneration']) {
/*
* Document templates generators
*/
$setupnotempty++;
$type = strtolower($myTmpObjectKey);
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$realpath = $reldir."core/modules/".$moduledir.$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
$modulequalified = 0;
}
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
$modulequalified = 0;
}
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
} else {
print $module->description;
}
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.urlencode($module->scandir).'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
$constforvar = 'EVENTORGANIZATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.urlencode($module->scandir).'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
}
}
if (empty($setupnotempty)) {
print '<br>'.$langs->trans("NothingToSetup");
}
// Page end
print dol_get_fiche_end();
llxFooter();
$db->close();

View File

@ -0,0 +1,108 @@
<?php
/* Copyright (C) 2021 Florian Henry <florian.henry@scopen.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
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/eventorganization_extrafields.php
* \ingroup bom
* \brief Page to setup extra fields of EventOrganization
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array('eventorganization', 'admin'));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'actioncomm';
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
llxHeader('', $langs->trans("EventOrganizationSetup"), $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("EventOrganizationSetup"), $linkback, 'eventorganization');
$head = eventorganizationAdminPrepareHead();
print dol_get_fiche_head($head, 'eventorganization_extrafields', $langs->trans("ExtraFields"), -1, 'eventorganization');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
/*
* Creation of an optional field
*/
if ($action == 'create')
{
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/*
* Edition of an optional field
*/
if ($action == 'edit' && !empty($attrname))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page
llxFooter();
$db->close();

View File

@ -43,7 +43,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("errors", "admin", "mails", "languages"));
$langsArray=array("errors", "admin", "mails", "languages");
if ($conf->adherent->enabled) {
$langsArray[]='members';
}
if ($conf->eventorganization->enabled) {
$langsArray[]='eventorganization';
}
$langs->loadLangs($langsArray);
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
@ -210,6 +219,9 @@ if ($conf->ticket->enabled && $user->rights->ticket->read) {
if ($conf->agenda->enabled) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
}
if ($conf->eventorganization->enabled && $user->rights->eventorganization->read) {
$elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
}
$parameters = array('elementList'=>$elementList);
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks
@ -878,10 +890,14 @@ if ($resql)
$class = "tddict";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'label' || $value == 'topic') {
if ($langs->trans($valuetoshow) != $valuetoshow) {
$valuetoshow = $langs->trans($valuetoshow);
}
$valuetoshow = dol_escape_htmltag($valuetoshow);
}
if ($value == 'label') {
$class .= ' tdoverflowmax100';
$valuetoshow = '<span title="'.$valuetoshow.'">'.$valuetoshow.'</span>';
}
/*if ($value == 'topic') {
$class .= ' tdoverflowmax300';

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('errors', 'admin', 'modulebuilder'));
$langs->loadLangs(array('errors', 'admin', 'modulebuilder', 'exports'));
$mode = GETPOST('mode', 'alpha');
$action = GETPOST('action', 'aZ09');

View File

@ -525,7 +525,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacitymedium"').'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth100" value="'.dol_escape_htmltag($search_keyword).'" placeholder="'.dol_escape_htmltag($langs->trans('Keyword')).'">';
$moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacitymedium"').'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth125" value="'.dol_escape_htmltag($search_keyword).'" placeholder="'.dol_escape_htmltag($langs->trans('Keyword')).'">';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield paddingtop">';
$moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1);
@ -1073,9 +1073,9 @@ if ($mode == 'deploy') {
} else {
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
print $langs->trans("FindPackageFromWebSite", $fullurl).'<br>';
print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite", '{s1}')).'<br>';
print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite", $fullurl).'<br>';
print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s1}')).'<br>';
print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
}

View File

@ -64,9 +64,10 @@ if ($action == 'getlastversion')
$form = new Form($db);
$help_url = '';
$title = $langs->trans("InfoDolibarr");
llxHeader('', $title);
llxHeader('', $title, $help_url);
print load_fiche_titre($title, '', 'title_setup');

View File

@ -110,7 +110,12 @@ if ($action == 'update') {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
// Set boolean (on/off) constants
elseif (preg_match('/^(set|del)_?([A-Z_]+)$/', $action, $reg)) {
if (!dolibarr_set_const($db, $reg[2], ($reg[1] === 'set' ? '1' : '0'), 'chaine', 0, '', $conf->entity) > 0) {
dol_print_error($db);
}
}
/*
@ -248,11 +253,26 @@ print "<br>\n";
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="button">';
print '<br/><br/>';
print '</div>';
print '</form>';
// Options
echo '<div>';
echo '<table class="noborder centpercent">';
echo '<thead>';
echo '<tr class="liste_titre"><th>' . $langs->trans('Parameter') . '</th><th>' . $langs->trans('Value') . '</th></tr>';
echo '</thead>';
echo '<tbody>';
$key = 'CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT';
echo '<tr><td>', $langs->trans($key), '</td><td>', ajax_constantonoff($key), '</td></tr>';
echo '</tbody>';
echo '</table>';
echo '</div>';
if (!empty($conf->accounting->enabled))

View File

@ -166,7 +166,8 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
* View
*/
llxHeader('', $langs->trans("Audit"));
$title = $langs->trans("Audit");
llxHeader('', $title);
$form = new Form($db);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
*
* This program is free software; you can redistribute it and/or modify
@ -70,7 +70,7 @@ $workflowcodes = array(
'picto'=>'bill'
),
'separator1'=>array('family'=>'separator', 'position'=>25),
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''),
// Automatic classification of proposal
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array(
@ -183,6 +183,7 @@ foreach ($workflowcodes as $key => $params) {
if ($params['family'] == 'separator') {
print '</table>';
print '<br>';
print '<table class="noborder centpercent">';
continue;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Thibault FOUCART <support@ptibogxiv.net>
*
*
@ -624,63 +624,6 @@ class Setup extends DolibarrApi
}
}
/**
* Get the list of shipment methods.
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
*
* @return array List of shipment methods
*
* @url GET dictionary/shipment_methods
*
* @throws RestException
*/
public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT t.rowid, t.code, t.libelle as label, t.description, t.tracking";
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql .= " WHERE t.active = ".$active;
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit, $offset);
}
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
for ($i = 0; $i < $min; $i++) {
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(503, 'Error when retrieving list of shipment methods : '.$this->db->lasterror());
}
return $list;
}
/**
* Get the list of events types.

View File

@ -773,7 +773,6 @@ class BlockedLog
*/
public function create($user, $forcesignature = '')
{
global $conf, $langs, $hookmanager;
$langs->load('blockedlog');
@ -814,6 +813,8 @@ class BlockedLog
$keyforsignature = $this->buildKeyForSignature();
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
$this->signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
$this->signature = dol_hash($previoushash.$keyforsignature, '5');
if ($forcesignature) $this->signature = $forcesignature;

View File

@ -319,7 +319,7 @@ switch ($action)
&& $obj_facturation->getSetPaymentMode() != 'DIFF')
{
// We set status to paid
$result = $invoice->set_paid($user);
$result = $invoice->setPaid($user);
//print 'set paid';exit;
}
}

View File

@ -365,6 +365,8 @@ class Categorie extends CommonObject
}
} else {
dol_print_error($this->db);
$this->error=$this->db->lasterror;
$this->errors[]=$this->db->lasterror;
return -1;
}
}

View File

@ -1363,6 +1363,7 @@ if ($id > 0)
$now = dol_now();
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
// Confirmation suppression action
if ($action == 'delete')
{
@ -1418,9 +1419,11 @@ if ($id > 0)
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
if ($object->type_code != 'AC_OTH_AUTO')
{
$formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ?GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto");
print $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ? GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto", 0, 0, 0, 1);
} else {
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'.$langs->trans("Action".$object->type_code);
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
print $object->getTypePicto();
print $langs->trans("Action".$object->type_code);
}
print '</td></tr>';
}
@ -1430,7 +1433,7 @@ if ($id > 0)
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
print dol_print_date($object->datep, 'dayhour', 'gmt');
// Date start - end
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
if (GETPOST("afaire") == 1) {
@ -1510,7 +1513,7 @@ if ($id > 0)
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
{
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="soixantepercent" value="'.$object->location.'"></td></tr>';
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
}
// Assigned to
@ -1786,7 +1789,6 @@ if ($id > 0)
} else {
print dol_get_fiche_head($head, 'card', $langs->trans("Action"), -1, 'action');
// Clone event
if ($action == 'clone')
{
@ -1873,7 +1875,9 @@ if ($id > 0)
// Type
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>'.$langs->trans($object->type).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
print $object->getTypePicto();
print $langs->trans($object->type).'</td></tr>';
}
// Full day event

View File

@ -1508,6 +1508,39 @@ class ActionComm extends CommonObject
return $result;
}
/**
* Return Picto of type of event
*
* @return string HTML String
*/
public function getTypePicto()
{
global $conf;
$imgpicto = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($this->type_picto) {
$imgpicto = img_picto('', $this->type_picto, 'class="paddingright"');
} else {
if ($this->type_code == 'AC_RDV') $imgpicto = img_picto('', 'meeting', '', false, 0, 0, '', 'paddingright');
elseif ($this->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
elseif ($this->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
elseif ($this->type_code == 'AC_EMAIL' || $this->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
elseif ($this->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright');
elseif ($this->type_code == 'AC_OTH' && $this->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright');
elseif (!preg_match('/_AUTO/', $this->type_code)) $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright');
else $imgpicto = img_picto('', 'cog', '', false, 0, 0, '', 'paddingright');
}
} else {
// 2 picto: 1 for auto, 1 for manual
if (!preg_match('/_AUTO/', $this->type_code)) $imgpicto = img_picto('', 'user-cog', '', false, 0, 0, '', 'paddingright');
else $imgpicto = img_picto('', 'cog', '', false, 0, 0, '', 'paddingright');
}
return $imgpicto;
}
/**
* Sets object to supplied categories.
*

View File

@ -688,28 +688,10 @@ if ($resql)
if (!empty($arrayfields['c.libelle']['checked']))
{
print '<td class="nowraponall">';
$actioncomm = $actionstatic;
// TODO Code common with code into showactions
$imgpicto = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($actioncomm->type_picto) {
$imgpicto = img_picto('', $actioncomm->type_picto);
} else {
if ($actioncomm->type_code == 'AC_RDV') $imgpicto = img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_EMAIL' || $actioncomm->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright').' ';
elseif (!preg_match('/_AUTO/', $actioncomm->type_code)) $imgpicto = img_picto('', 'object_other', '', false, 0, 0, '', 'paddingright').' ';
}
}
print $imgpicto;
print $actionstatic->getTypePicto();
$labeltype = $obj->type_code;
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) $labeltype = 'AC_OTH';
if ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') {
if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
$labeltype = $langs->trans("Message");
} else {
if (!empty($arraylist[$labeltype])) $labeltype = $arraylist[$labeltype];

View File

@ -12,7 +12,7 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
@ -1557,12 +1557,11 @@ if ($action == 'create')
}
print '</tr>'."\n";
if ($socid > 0)
{
if ($socid > 0) {
// Contacts (ask contact only if thirdparty already defined).
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
print img_picto('', 'contact');
$form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
print '</td></tr>';
// Third party discounts info line
@ -1612,8 +1611,9 @@ if ($action == 'create')
// Delivery delay
print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod');
if (!empty($conf->commande->enabled))
if (!empty($conf->commande->enabled)) {
print ' ('.$langs->trans('AfterOrder').')';
}
print '</td><td>';
print img_picto('', 'clock').'&ensp;';
$form->selectAvailabilityDelay('', 'availability_id', '', 1);

View File

@ -485,6 +485,7 @@ class Propal extends CommonObject
}
} else {
$this->error = $line->error;
$this->errors = $line->errors;
$this->db->rollback();
return -2;
}
@ -711,8 +712,8 @@ class Propal extends CommonObject
// Mise a jour informations denormalisees au niveau de la propale meme
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
if ($result > 0)
{
if ($result > 0) {
$this->db->commit();
return $this->line->id;
} else {
@ -722,6 +723,7 @@ class Propal extends CommonObject
}
} else {
$this->error = $this->line->error;
$this->errors = $this->line->errors;
$this->db->rollback();
return -2;
}
@ -914,7 +916,7 @@ class Propal extends CommonObject
return $result;
} else {
$this->error = $this->line->error;
$this->errors = $this->line->errors;
$this->db->rollback();
return -1;
}
@ -1630,7 +1632,7 @@ class Propal extends CommonObject
$sql .= " fk_input_reason=".(isset($this->demand_reason_id) ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
$sql .= " WHERE rowid=".$this->id;

View File

@ -116,6 +116,11 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'p.ref';
if (!$sortorder) $sortorder = 'DESC';
$permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->write;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
// Security check
$module = 'propal';
$dbtable = '';
@ -260,13 +265,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
if ($object_statut != '') $search_status = $object_statut;
if (empty($reshook))
{
$objectclass = 'Propal';
$objectlabel = 'Proposals';
$permissiontoread = $user->rights->propal->lire;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
$uploaddir = $conf->propal->multidir_output[$conf->entity];
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -1381,7 +1384,7 @@ if ($resql)
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) {
print ' ';
@ -1492,7 +1495,7 @@ if ($resql)
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
} else {
dol_print_error($db);
dol_print_error($db);
}
// End of page

View File

@ -61,7 +61,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
* View
*/
llxHeader('', $langs->trans('Proposal'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $langs->trans('Proposal'), $help_url);
$form = new Form($db);

View File

@ -12,7 +12,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.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
@ -238,7 +238,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate)
{
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$selectedLines = GETPOST('toselect', 'array');
if ($datecommande == '') {
@ -271,8 +271,8 @@ if (empty($reshook))
$object->fk_account = GETPOST('fk_account', 'int');
$object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison; // deprecated
$object->delivery_date = $datelivraison;
$object->date_livraison = $date_delivery; // deprecated
$object->delivery_date = $date_delivery;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');
@ -501,7 +501,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'setremise' && $usercancreate) {
$result = $object->set_remise($user, GETPOST('remise'));
$result = $object->setDiscount($user, GETPOST('remise'));
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -607,7 +607,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
@ -1603,7 +1603,7 @@ if ($action == 'create' && $usercancreate)
// Contacts (ask contact only if thirdparty already defined).
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
print img_picto('', 'contact');
$form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1);
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1);
print '</td></tr>';
// Ligne info remises tiers
@ -1628,7 +1628,7 @@ if ($action == 'create' && $usercancreate)
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">';
$date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
print "</td>\n";
print '</tr>';
@ -1644,8 +1644,7 @@ if ($action == 'create' && $usercancreate)
print '</td></tr>';
// Bank Account
if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && !empty($conf->banque->enabled))
{
if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && !empty($conf->banque->enabled)) {
print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
print img_picto('', 'bank_account');
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);

View File

@ -11,6 +11,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.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
@ -126,6 +127,10 @@ class Commande extends CommonOrder
* @var int Draft Status of the order
*/
public $brouillon;
/**
* @var string Condition payment code
*/
public $cond_reglement_code;
/**
@ -166,8 +171,16 @@ class Commande extends CommonOrder
*/
public $availability;
public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...)
/**
* @var int Source demand reason Id
*/
public $demand_reason_id;
/**
* @var string Source reason code. Why we receive order (after a phone campaign, ...)
*/
public $demand_reason_code;
/**
* @var int Date of order
*/
@ -182,11 +195,15 @@ class Commande extends CommonOrder
/**
* @var int Date expected for delivery
* @see delivery_date
* @deprecated
*/
public $date_livraison; // deprecated; Use delivery_date instead.
public $date_livraison;
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
/**
* @var int Date expected of shipment (date starting shipment, not the reception that occurs some days after)
*/
public $delivery_date;
/**
* @var int ID
@ -200,6 +217,9 @@ class Commande extends CommonOrder
public $special_code;
public $source; // Order mode. How we received order (by phone, by email, ...)
/**
* @var int Warehouse Id
*/
public $warehouse_id;
public $extraparams = array();
@ -227,6 +247,9 @@ class Commande extends CommonOrder
*/
public $fk_multicurrency;
/**
* @var string multicurrency code
*/
public $multicurrency_code;
public $multicurrency_tx;
public $multicurrency_total_ht;
@ -739,11 +762,11 @@ class Commande extends CommonOrder
if ($usercanclose)
{
$this->db->begin();
if ($this->statut == self::STATUS_CLOSED)
{
return 0;
}
$this->db->begin();
$now = dol_now();
@ -1973,6 +1996,7 @@ class Commande extends CommonOrder
}
} else {
$this->error = $line->error;
$this->errors = $line->errors;
$this->db->rollback();
return -2;
}
@ -2359,6 +2383,8 @@ class Commande extends CommonOrder
/**
* Applique une remise relative
*
* @deprecated
* @see setDiscount()
* @param User $user User qui positionne la remise
* @param float $remise Discount (percent)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
@ -2367,6 +2393,20 @@ class Commande extends CommonOrder
public function set_remise($user, $remise, $notrigger = 0)
{
// phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
return $this->setDiscount($user, $remise, $notrigger);
}
/**
* Applique une remise relative
*
* @param User $user User qui positionne la remise
* @param float $remise Discount (percent)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
public function setDiscount($user, $remise, $notrigger = 0)
{
$remise = trim($remise) ?trim($remise) : 0;
if ($user->rights->commande->creer)
@ -3243,6 +3283,7 @@ class Commande extends CommonOrder
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf);
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
$delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
// Check parameters
// Put here code to add control on parameters values
@ -3267,11 +3308,13 @@ class Commande extends CommonOrder
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
$sql .= " date_livraison=".(strval($this->delivery_date) != '' ? "'".$this->db->idate($this->delivery_date)."'" : 'null').",";
$sql .= " fk_shipping_method=".(isset($this->shipping_method_id) ? $this->shipping_method_id : "null").",";
$sql .= " fk_account=".($this->fk_account > 0 ? $this->fk_account : "null").",";
$sql .= " fk_input_reason=".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
$sql .= " WHERE rowid=".$this->id;
@ -3921,7 +3964,7 @@ class Commande extends CommonOrder
if (!empty($this->model_pdf)) {
$modele = $this->model_pdf;
} elseif (!empty($this->modelpdf)) { // dperecated
} elseif (!empty($this->modelpdf)) { // deprecated
$modele = $this->modelpdf;
} elseif (!empty($conf->global->COMMANDE_ADDON_PDF)) {
$modele = $conf->global->COMMANDE_ADDON_PDF;

View File

@ -91,7 +91,7 @@ $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), G
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
$search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int'));
$search_thirdparty = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha');
$search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha');
$search_req_nb = GETPOST("req_nb", 'alpha');
$search_num_releve = GETPOST("search_num_releve", 'alpha');
$search_conciliated = GETPOST("search_conciliated", 'int');
@ -142,16 +142,16 @@ $extrafields->fetch_name_optionals_label('banktransaction');
$search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_');
$arrayfields = array(
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
@ -191,7 +191,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_ref = "";
$search_req_nb = '';
$search_description = '';
$search_thirdparty = '';
$search_thirdparty_user = '';
$search_num_releve = '';
$search_conciliated = '';
$thirdparty = '';
@ -255,7 +255,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
$param .= '&search_conciliated='.urlencode($search_conciliated);
if ($page) $param .= '&page='.urlencode($page);
if ($offset) $param .= '&offset='.urlencode($offset);
if ($search_thirdparty) $param .= '&search_thirdparty='.urlencode($search_thirdparty);
if ($search_thirdparty_user) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
if ($search_num_releve) $param .= '&search_num_releve='.urlencode($search_num_releve);
if ($search_description) $param .= '&search_description='.urlencode($search_description);
if ($search_start_dt) $param .= '&search_start_dt='.urlencode($search_start_dt);
@ -359,6 +359,7 @@ $formaccounting = new FormAccounting($db);
$companystatic = new Societe($db);
$bankaccountstatic = new Account($db);
$userstatic= new User($db);
$banktransferstatic = new BonPrelevement($db);
$societestatic = new Societe($db);
@ -390,7 +391,7 @@ if (!empty($ref)) $param .= '&ref='.urlencode($ref);
if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref);
if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description);
if (!empty($search_type)) $param .= '&type='.urlencode($search_type);
if (!empty($search_thirdparty)) $param .= '&search_thirdparty='.urlencode($search_thirdparty);
if (!empty($search_thirdparty_user)) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
if (!empty($search_debit)) $param .= '&search_debit='.urlencode($search_debit);
if (!empty($search_credit)) $param .= '&search_credit='.urlencode($search_credit);
if (!empty($search_account)) $param .= '&search_account='.urlencode($search_account);
@ -482,7 +483,7 @@ if ($id > 0 || !empty($ref))
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
$sql .= " b.fk_account, b.fk_type,";
$sql .= " ba.rowid as bankid, ba.ref as bankref,";
$sql .= " bu.url_id,";
$sql .= " bu.url_id, bu.type as type_url,";
$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -512,7 +513,7 @@ if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1);
if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb);
if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve);
if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".urlencode($search_conciliated);
if ($search_thirdparty) $sql .= natural_search("s.nom", $search_thirdparty);
if ($search_thirdparty_user) $sql .= natural_search(array("s.nom", "u.firstname", "u.lastname"), $search_thirdparty_user);
if ($search_description)
{
$search_description_to_use = $search_description;
@ -587,7 +588,7 @@ if (!empty($search_description)) $mode_balance_ok = false;
if (!empty($search_type)) $mode_balance_ok = false;
if (!empty($search_debit)) $mode_balance_ok = false;
if (!empty($search_credit)) $mode_balance_ok = false;
if (!empty($search_thirdparty)) $mode_balance_ok = false;
if (!empty($search_thirdparty_user)) $mode_balance_ok = false;
if ($search_conciliated != '' && $search_conciliated != '-1') $mode_balance_ok = false;
if (!empty($search_num_releve)) $mode_balance_ok = false;
@ -1012,6 +1013,8 @@ if ($resql)
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($resql);
$links = $bankaccountstatic->get_url($objp->rowid);
// If we are in a situation where we need/can show balance, we calculate the start of balance
if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && ($mode_balance_ok || $search_conciliated === '0'))
{
@ -1202,7 +1205,6 @@ if ($resql)
//print "</a>&nbsp;";
// Add links after description
$links = $bankaccountstatic->get_url($objp->rowid);
$cachebankaccount = array();
foreach ($links as $key=>$val)
{
@ -1372,24 +1374,51 @@ if ($resql)
}
// Third party
if (!empty($arrayfields['bu.label']['checked']))
{
print '<td class="tdoverflowmax150">';
if (!empty($arrayfields['bu.label']['checked']))
{
print '<td class="tdoverflowmax150">';
if ($objp->url_id)
{
$companystatic->id = $objp->url_id;
$companystatic->name = $objp->nom;
$companystatic->name_alias = $objp->name_alias;
$companystatic->client = $objp->client;
$companystatic->email = $objp->email;
$companystatic->fournisseur = $objp->fournisseur;
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->code_compta = $objp->code_compta;
$companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
print $companystatic->getNomUrl(1);
} else {
print '&nbsp;';
if ($objp->type_url == 'company') {
$companystatic->id = $objp->url_id;
$companystatic->name = $objp->nom;
$companystatic->name_alias = $objp->name_alias;
$companystatic->client = $objp->client;
$companystatic->email = $objp->email;
$companystatic->fournisseur = $objp->fournisseur;
$companystatic->code_client = $objp->code_client;
$companystatic->code_fournisseur = $objp->code_fournisseur;
$companystatic->code_compta = $objp->code_compta;
$companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
print $companystatic->getNomUrl(1);
}
}
else //display user or nothing
{
//payment line type to define user display
foreach ($links as $key=>$value){
if ($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc';
if ($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary';
}
$sqlu = "SELECT url_id FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$objp->rowid." AND (type='user' OR type='salary')";
$resqlu = $db->query($sqlu);
if ($resqlu) {
if ($db->num_rows($resqlu) > 0 &&
(($type_link == 'payment_salary' && !empty($user->rights->salaries->read))
|| ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) {
$obj = $db->fetch_object($resqlu);
$userstatic->fetch($obj->url_id);
print $userstatic->getNomUrl(1);
}
else {
print '&nbsp;';
}
} else {
dol_print_error($db);
}
}
print '</td>';
if (!$i) $totalarray['nbfield']++;

View File

@ -591,7 +591,8 @@ class Account extends CommonObject
return $accline->id;
} else {
$this->error = $this->db->lasterror();
$this->error = $accline->error;
$this->errors = $accline->errors;
$this->db->rollback();
return -2;

View File

@ -585,7 +585,7 @@ foreach ($accounts as $key=>$type)
if (!empty($arrayfields['balance']['checked']))
{
print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).'</a>';
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'balance';

View File

@ -58,6 +58,10 @@ $search_accountancy_account = GETPOST("search_accountancy_account");
if ($search_accountancy_account == - 1) $search_accountancy_account = '';
$search_accountancy_subledger = GETPOST("search_accountancy_subledger");
if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = '';
if (empty($search_datep_start)) $search_datep_start = GETPOST("search_datep_start", 'int');
if (empty($search_datep_end)) $search_datep_end = GETPOST("search_datep_end", 'int');
if (empty($search_datev_start)) $search_datev_start = GETPOST("search_datev_start", 'int');
if (empty($search_datev_end)) $search_datev_end = GETPOST("search_datev_end", 'int');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');

View File

@ -73,9 +73,10 @@ $terminalid = $cashcontrol->posnumber;
* View
*/
$title = $langs->trans("CashControl");
$param = '';
llxHeader('', $langs->trans("CashControl"), '', '', 0, 0, array(), array(), $param);
llxHeader('', $title, '', '', 0, 0, array(), array(), $param);
/*$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
$sql.= " b.fk_account, b.fk_type,";

View File

@ -289,11 +289,11 @@ if (empty($reshook))
elseif ($action == 'setref' && $user->rights->facture->creer)
{
//var_dump(GETPOST('ref', 'alpha'));exit;
$result = $object->setValueFrom('title', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
$result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
if ($result > 0)
{
$object->titre = GETPOST('ref', 'alpha'); // deprecated
$object->title = GETPOST('ref', 'alpha');
$object->titre = $ref; // deprecated
$object->title = $ref;
$object->ref = $object->title;
} else {
$error++;

View File

@ -14,7 +14,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.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
@ -193,7 +193,7 @@ if (empty($reshook))
$result = $object->fetch($id);
if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted
$result = $object->set_unpaid($user);
$result = $object->setUnpaid($user);
if ($result > 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit();
@ -483,7 +483,7 @@ if (empty($reshook))
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) {
$object->fetch($id);
$result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == "setabsolutediscount" && $usercancreate) {
// POST[remise_id] or POST[remise_id_for_payment]
@ -747,7 +747,7 @@ if (empty($reshook))
elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment)
{
$object->fetch($id);
$result = $object->set_paid($user);
$result = $object->setPaid($user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} // Classif "paid partialy"
elseif ($action == 'confirm_paid_partially' && $confirm == 'yes' && $usercanissuepayment)
@ -756,7 +756,7 @@ if (empty($reshook))
$close_code = GETPOST("close_code", 'restricthtml');
$close_note = GETPOST("close_note", 'restricthtml');
if ($close_code) {
$result = $object->set_paid($user, $close_code, $close_note);
$result = $object->setPaid($user, $close_code, $close_note);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
@ -767,7 +767,7 @@ if (empty($reshook))
$close_code = GETPOST("close_code", 'restricthtml');
$close_note = GETPOST("close_note", 'restricthtml');
if ($close_code) {
$result = $object->set_canceled($user, $close_code, $close_note);
$result = $object->setCanceled($user, $close_code, $close_note);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
@ -921,7 +921,7 @@ if (empty($reshook))
{
if ($object->type != Facture::TYPE_DEPOSIT) {
// Classe facture
$result = $object->set_paid($user);
$result = $object->setPaid($user);
if ($result >= 0)
{
$db->commit();
@ -4120,7 +4120,7 @@ if ($action == 'create')
if ($objectidnext > 0) {
$facthatreplace = new Facture($db);
$facthatreplace->fetch($objectidnext);
print ' <span class="opacitymediumbycolor paddingleft">('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')</span>';
print ' <span class="opacitymediumbycolor paddingleft">('.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).')</span>';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
@ -4128,7 +4128,10 @@ if ($action == 'create')
$result = $discount->fetch(0, $object->id);
if ($result > 0) {
print ' <span class="opacitymediumbycolor paddingleft">';
print $langs->transnoentities("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount'));
$s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}');
$s = str_replace('{s1}', $object->getLibType(1), $s);
$s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s);
print $s;
print '</span><br>';
}
}
@ -4139,7 +4142,9 @@ if ($action == 'create')
$result = $tmptemplate->fetch($object->fk_fac_rec_source);
if ($result > 0) {
print ' <span class="opacitymediumbycolor paddingleft">';
print $langs->transnoentities("GeneratedFromTemplate", '<a href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.dol_escape_htmltag($tmptemplate->ref).'</a>');
$s = $langs->transnoentities("GeneratedFromTemplate", '{s1}');
$s = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.dol_escape_htmltag($tmptemplate->ref).'</a>', $s);
print $s;
print '</span>';
}
}

View File

@ -910,7 +910,7 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note);
$result = $this->invoice->setPaid(DolibarrApiAccess::$user, $close_code, $close_note);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
}
@ -960,7 +960,7 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->set_unpaid(DolibarrApiAccess::$user);
$result = $this->invoice->setUnpaid(DolibarrApiAccess::$user);
if ($result == 0) {
throw new RestException(304, 'Nothing done');
}
@ -1167,7 +1167,7 @@ class Invoices extends DolibarrApi
{
if ($this->invoice->type != Facture::TYPE_DEPOSIT) {
// Classe facture
$result = $this->invoice->set_paid(DolibarrApiAccess::$user);
$result = $this->invoice->setPaid(DolibarrApiAccess::$user);
if ($result >= 0)
{
$this->db->commit();

View File

@ -280,7 +280,7 @@ class FactureRec extends CommonInvoice
$sql .= ", ".(!empty($facsrc->remise) ? $this->remise : '0');
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
$sql .= ", ".(!empty($this->modelpdf) ? ("'".$this->db->escape($this->modelpdf)."'") : "NULL");
$sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
$sql .= ", '".$this->db->escape($user->id)."'";
$sql .= ", ".(!empty($facsrc->fk_project) ? "'".$this->db->escape($facsrc->fk_project)."'" : "null");
$sql .= ", ".(!empty($facsrc->fk_account) ? "'".$this->db->escape($facsrc->fk_account)."'" : "null");
@ -347,7 +347,7 @@ class FactureRec extends CommonInvoice
{
// Extrafields
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid);
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->id);
$objectline->array_options = $facsrc->lines[$i]->array_options;
}
@ -562,7 +562,7 @@ class FactureRec extends CommonInvoice
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author;
$this->modelpdf = $obj->model_pdf; // deprecatd
$this->modelpdf = $obj->model_pdf; // deprecated
$this->model_pdf = $obj->model_pdf;
$this->rang = $obj->rang;
$this->special_code = $obj->special_code;
@ -1280,9 +1280,8 @@ class FactureRec extends CommonInvoice
{
// We refresh the object in order to have all necessary data (like date_lim_reglement)
$facture->fetch($facture->id);
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
if ($result <= 0)
{
$result = $facture->generateDocument($facturerec->model_pdf, $langs);
if ($result <= 0) {
$this->errors = $facture->errors;
$this->error = $facture->error;
$error++;
@ -1873,7 +1872,7 @@ class FactureRec extends CommonInvoice
dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG);
if ($this->db->query($sql))
{
$this->modelpdf = $model;
$this->model_pdf = $model;
return 1;
} else {
dol_print_error($this->db);

View File

@ -498,7 +498,7 @@ class Facture extends CommonInvoice
$this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project;
$this->note_public = GETPOST('note_public', 'none') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public;
$this->note_private = GETPOST('note_private', 'none') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private;
$this->modelpdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->modelpdf;
$this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
$this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id;
$this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id;
$this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account;
@ -797,6 +797,7 @@ class Facture extends CommonInvoice
if ($result < 0)
{
$this->error = $newinvoiceline->error;
$this->errors = $newinvoiceline->errors;
$error++;
break;
}
@ -1062,8 +1063,8 @@ class Facture extends CommonInvoice
$facture->note_public = $this->note_public;
$facture->note_private = $this->note_private;
$facture->ref_client = $this->ref_client;
$facture->modelpdf = $this->modelpdf; // deprecated
$facture->model_pdf = $this->modelpdf;
$facture->modelpdf = $this->model_pdf; // deprecated
$facture->model_pdf = $this->model_pdf;
$facture->fk_project = $this->fk_project;
$facture->cond_reglement_id = $this->cond_reglement_id;
$facture->mode_reglement_id = $this->mode_reglement_id;
@ -2293,6 +2294,8 @@ class Facture extends CommonInvoice
* Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1
* or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
*
* @deprecated
* @see setPaid()
* @param User $user Object user that modify
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
@ -2301,6 +2304,21 @@ class Facture extends CommonInvoice
public function set_paid($user, $close_code = '', $close_note = '')
{
// phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($user, $close_code, $close_note);
}
/**
* Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1
* or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
*
* @param User $user Object user that modify
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
* @return int <0 if KO, >0 if OK
*/
public function setPaid($user, $close_code = '', $close_note = '')
{
$error = 0;
if ($this->paye != 1)
@ -2352,12 +2370,28 @@ class Facture extends CommonInvoice
* Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte.
*
* @deprecated
* @see setUnpaid()
* @param User $user Object user that change status
* @return int <0 if KO, >0 if OK
*/
public function set_unpaid($user)
{
// phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
return $this->setUnpaid($user);
}
/**
* Tag la facture comme non payee completement + appel trigger BILL_UNPAYED
* Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte.
*
* @param User $user Object user that change status
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$error = 0;
$this->db->begin();
@ -2399,6 +2433,8 @@ class Facture extends CommonInvoice
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
* of no payment even if merchandises were sent).
*
* @deprecated
* @see setCanceled()
* @param User $user Object user making change
* @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
* @param string $close_note Comment
@ -2407,8 +2443,23 @@ class Facture extends CommonInvoice
public function set_canceled($user, $close_code = '', $close_note = '')
{
// phpcs:enable
dol_syslog(get_class($this)."::set_canceled is deprecated, use setCanceled instead", LOG_NOTICE);
return $this->setCanceled($user, $close_code, $close_note);
}
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
/**
* Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
* of no payment even if merchandises were sent).
*
* @param User $user Object user making change
* @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
* @param string $close_note Comment
* @return int <0 if KO, >0 if OK
*/
public function setCanceled($user, $close_code = '', $close_note = '')
{
dol_syslog(get_class($this)."::setCanceled rowid=".$this->id, LOG_DEBUG);
$this->db->begin();
@ -2542,7 +2593,7 @@ class Facture extends CommonInvoice
return -12;
}
$result = $facreplaced->set_canceled($user, self::CLOSECODE_REPLACED, '');
$result = $facreplaced->setCanceled($user, self::CLOSECODE_REPLACED, '');
if ($result < 0)
{
$this->error = $facreplaced->error;
@ -3202,6 +3253,7 @@ class Facture extends CommonInvoice
}
} else {
$this->error = $this->line->error;
$this->errors = $this->line->errors;
$this->db->rollback();
return -2;
}
@ -3370,8 +3422,8 @@ class Facture extends CommonInvoice
}
$this->line->id = $rowid;
$this->line->rowid = $rowid;
$this->line->label = $label;
$this->line->rowid = $rowid;
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->ref_ext = $ref_ext;
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
@ -3567,6 +3619,8 @@ class Facture extends CommonInvoice
/**
* Set percent discount
*
* @deprecated
* @see setDiscount()
* @param User $user User that set discount
* @param double $remise Discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
@ -3575,6 +3629,20 @@ class Facture extends CommonInvoice
public function set_remise($user, $remise, $notrigger = 0)
{
// phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
return $this->setDiscount($user, $remise, $notrigger);
}
/**
* Set percent discount
*
* @param User $user User that set discount
* @param double $remise Discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
public function setDiscount($user, $remise, $notrigger = 0)
{
// Clean parameters
if (empty($remise)) $remise = 0;
@ -3732,7 +3800,7 @@ class Facture extends CommonInvoice
}
if (!empty($addon)) {
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG);
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->name.", type=".$soc->typent_code, LOG_DEBUG);
$mybool = false;

View File

@ -268,7 +268,7 @@ if ($search_status != '' && $search_status >= -1)
if ($search_status == -1) $sql .= ' AND suspended = 1';
}
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day_date_when, $search_month_date_when, $search_year_date_when);
$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when);
$sql .= $db->order($sortfield, $sortorder);

View File

@ -119,7 +119,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$fac->generateDocument($fac->modelpdf, $outputlangs);
$fac->generateDocument($fac->model_pdf, $outputlangs);
}
}

View File

@ -788,7 +788,7 @@ class RemiseCheque extends CommonObject
{
$invoice = new Facture($this->db);
$invoice->fetch($obj->fk_facture);
$invoice->set_unpaid($user);
$invoice->setUnpaid($user);
$rejectedPayment->amounts[$obj->fk_facture] = price2num($obj->amount) * -1;
}

View File

@ -398,7 +398,7 @@ class Paiement extends CommonObject
// Set invoice to paid
if (!$error)
{
$result = $invoice->set_paid($user, '', '');
$result = $invoice->setPaid($user, '', '');
if ($result < 0)
{
$this->error = $invoice->error;
@ -425,7 +425,7 @@ class Paiement extends CommonObject
$outputlangs->setDefaultLang($newlang);
}
$ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
$result = $invoice->generateDocument($invoice->model_pdf, $outputlangs);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
@ -1312,7 +1312,7 @@ class Paiement extends CommonObject
$invoice = new Facture($this->db);
if ($invoice->fetch($billsarray[0]) > 0)
{
$force_thirdparty_id = $invoice->fk_soc;
$force_thirdparty_id = $invoice->socid;
}
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2016-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -111,11 +111,10 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
$paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'restricthtml');
$paiement->note_private = GETPOST("note", 'restricthtml');
$paiement->note = (string) GETPOST("note", 'restricthtml');
$paiement->note_private = (string) GETPOST("note", 'restricthtml');
if (!$error)
{
if (!$error) {
$paymentid = $paiement->create($user, (GETPOST('closepaidvat') == 'on' ? 1 : 0));
if ($paymentid < 0)
{
@ -193,7 +192,7 @@ if ($action == 'create')
print '<input type="hidden" name="chid" value="'.$chid.'">';
print '<input type="hidden" name="action" value="add_payment">';
dol_fiche_head('', '');
print dol_get_fiche_head('', '');
print '<table class="border centpercent">';
@ -208,8 +207,7 @@ if ($action == 'create')
$sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as p";
$sql .= " WHERE p.fk_tva = ".$chid;
$resql = $db->query($sql);
if ($resql)
{
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
@ -248,7 +246,7 @@ if ($action == 'create')
print '</table>';
dol_fiche_end();
print dol_get_fiche_end();
/*
* Autres charges impayees
@ -314,8 +312,7 @@ if ($action == 'create')
$totalrecu += $objp->am;
$i++;
}
if ($i > 1)
{
if ($i > 1) {
// Print total
print '<tr class="oddeven">';
print '<td colspan="2" class="left">'.$langs->trans("Total").':</td>';

View File

@ -138,13 +138,12 @@ $h++;
*/
dol_fiche_head($head, $hselected, $langs->trans("VATPayment"), -1, 'payment');
print dol_get_fiche_head($head, $hselected, $langs->trans("VATPayment"), -1, 'payment');
/*
* Deletion confirmation of payment
*/
if ($action == 'delete')
{
if ($action == 'delete') {
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete', '', 0, 2);
}
@ -213,7 +212,7 @@ print '</table>';
print '</div>';
dol_fiche_end();
print dol_get_fiche_end();
/*

View File

@ -375,7 +375,7 @@ class BonPrelevement extends CommonObject
dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
$fac = new Facture($this->db);
$fac->fetch($facs[$i]);
$result = $fac->set_paid($user);
$result = $fac->setPaid($user);
}
}
@ -482,7 +482,7 @@ class BonPrelevement extends CommonObject
// @TODO Move this after creation of payment
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
$result = $fac->set_paid($user);
$result = $fac->setPaid($user);
if ($result < 0) {
$this->error = $fac->error;
$this->errors = $fac->errors;

View File

@ -184,7 +184,7 @@ class RejetPrelevement
//Tag invoice as unpaid
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
$fac->set_unpaid($user);
$fac->setUnpaid($user);
//TODO: Must be managed by notifications module
// Send email to sender of the standing order request

View File

@ -47,6 +47,8 @@ $type = GETPOST('type', 'aZ09');
// Get supervariables
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real';
$format = GETPOST('format', 'aZ09');
$id_bankaccount = GETPOST('id_bankaccount', 'int');
@ -61,6 +63,7 @@ $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard'));
/*
* Actions
*/
if (GETPOST('cancel', 'alpha')) { $massaction = ''; }
$parameters = array('mode' => $mode, 'format' => $format, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -122,6 +125,9 @@ if (empty($reshook)) {
exit;
}
}
$objectclass = "BonPrelevement";
$uploaddir = $conf->prelevement->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -138,6 +144,12 @@ if ($type != 'bank-transfer') {
$invoicestatic = new FactureFournisseur($db);
}
$bprev = new BonPrelevement($db);
$arrayofselected = is_array($toselect) ? $toselect : array();
// List of mass actions available
$arrayofmassactions = array(
);
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
llxHeader('', $langs->trans("NewStandingOrder"));
@ -273,7 +285,7 @@ print '<br>';
*/
$sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql .= " pfd.date_demande, pfd.amount";
$sql .= " pfd.rowid as request_row_id, pfd.date_demande, pfd.amount";
if ($type == 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
} else {
@ -332,7 +344,7 @@ if ($resql)
if ($type == 'bank-transfer') {
$title = $langs->trans("InvoiceWaitingPaymentByBankTransfer");
}
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
$tradinvoice = "Invoice";
if ($type == 'bank-transfer') {
@ -347,6 +359,10 @@ if ($resql)
print '<td>'.$langs->trans("RUM").'</td>';
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
print '<td class="right">'.$langs->trans("DateRequest").'</td>';
if ($massactionbutton || $massaction ) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
print '<td align="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
}
print '</tr>';
if ($num)
@ -402,6 +418,15 @@ if ($resql)
print '<td class="right">';
print dol_print_date($db->jdate($obj->date_demande), 'day');
print '</td>';
// Action column
if ($massactionbutton || $massaction ) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
print '<td class="nowrap center">';
$selected = 0;
if (in_array($obj->request_row_id, $arrayofselected)) $selected = 1;
print '<input id="cb'.$obj->request_row_id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->request_row_id.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
print '</tr>';
$i++;
}

View File

@ -252,7 +252,7 @@ if ($modecompta == 'BOOKKEEPING')
$sql .= " AND f.entity = ".$conf->entity;
if (!empty($date_start) && !empty($date_end))
$sql .= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
$sql .= " GROUP BY pcg_type, name, socid";
$sql .= " GROUP BY pcg_type DESC, name, socid";
$sql .= $db->order($sortfield, $sortorder);
$oldpcgtype = '';
@ -284,6 +284,15 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht += (isset($objp->amount) ? $objp->amount : 0);
$total_ttc += (isset($objp->amount) ? $objp->amount : 0);
if ($objp->pcg_type == 'INCOME') {
$total_ht_income += (isset($objp->amount) ? $objp->amount : 0);
$total_ttc_income += (isset($objp->amount) ? $objp->amount : 0);
}
if ($objp->pcg_type == 'EXPENSE') {
$total_ht_outcome -= (isset($objp->amount) ? $objp->amount : 0);
$total_ttc_outcome -= (isset($objp->amount) ? $objp->amount : 0);
}
// Loop on detail of all accounts
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail != 'no')
@ -446,6 +455,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_income += $total_ht;
$total_ttc_income += $total_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($total_ht).'</td>';
@ -525,11 +535,12 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_income += $subtotal_ht;
$total_ttc_income += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
}
/*
@ -609,6 +620,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -686,6 +698,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -764,6 +777,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -841,6 +855,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -926,6 +941,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
@ -963,6 +979,7 @@ if ($modecompta == 'BOOKKEEPING')
{
$subtotal_ht += -$obj->amount;
$subtotal_ttc += -$obj->amount;
$total_ht_outcome += $obj->amount;
$total_ttc_outcome += $obj->amount;
}
@ -978,6 +995,7 @@ if ($modecompta == 'BOOKKEEPING')
{
$subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount;
$total_ht_income += $obj->amount;
$total_ttc_income += $obj->amount;
}
@ -1038,8 +1056,10 @@ if ($modecompta == 'BOOKKEEPING')
}
$total_ht += $subtotal_ht;
$total_ttc += $subtotal_ttc;
$total_ht_income += $subtotal_ht;
$total_ttc_income += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
@ -1101,8 +1121,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_outcome -= 0;
$total_ttc_outcome -= $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATToPay")."</td>\n";
print '<td class="right">&nbsp;</td>'."\n";
@ -1151,6 +1173,7 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_income += 0;
$total_ttc_income += $amount;
@ -1197,8 +1220,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_outcome -= 0;
$total_ttc_outcome -= $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATPaid")."</td>\n";
if ($modecompta == 'CREANCES-DETTES')
@ -1243,8 +1268,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_income += 0;
$total_ttc_income += $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATCollected")."</td>\n";
if ($modecompta == 'CREANCES-DETTES')
@ -1279,19 +1306,22 @@ print '<tr>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
if ($modecompta == 'CREANCES-DETTES')
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
if ($modecompta == 'CREANCES-DETTES')
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
if ($modecompta == 'CREANCES-DETTES')
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
print '</tr>';

View File

@ -866,9 +866,9 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
if ($obj->pcg_type == 'INCOME') {
if (!isset($encaiss[$obj->dm])) $encaiss[$obj->dm] = 0; // To avoid warning of var not defined
$encaiss[$obj->dm] += $obj->credit;
$encaiss[$obj->dm] -= $obj->credit;
$encaiss[$obj->dm] -= $obj->debit;
}
if ($obj->pcg_type == 'INCOME') {
if ($obj->pcg_type == 'EXPENSE') {
if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0; // To avoid warning of var not defined
$decaiss[$obj->dm] += $obj->debit;
$decaiss[$obj->dm] -= $obj->credit;

View File

@ -74,14 +74,14 @@ $object = new ChargeSociales($db);
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes')
{
$object->fetch($id);
$result = $object->set_paid($user);
$result = $object->setPaid($user);
}
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
$result = $object->fetch($id);
if ($object->paye)
{
$result = $object->set_unpaid($user);
$result = $object->setUnpaid($user);
if ($result > 0)
{
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
@ -359,7 +359,7 @@ if ($action == 'create')
print '<tr><td>';
print $langs->trans('Employee');
print '</td>';
print '<td>'.$form->select_dolusers($fk_user, 'userid', 1).'</td></tr>';
print '<td>'.img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers($fk_user, 'userid', 1).'</td></tr>';
// Project
if (!empty($conf->projet->enabled))
@ -371,7 +371,7 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1);
print '</td></tr>';
}
@ -385,7 +385,7 @@ if ($action == 'create')
if (!empty($conf->banque->enabled))
{
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 2);
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 2, '', 0, '', 1);
print '</td></tr>';
}

View File

@ -432,12 +432,26 @@ class ChargeSociales extends CommonObject
/**
* Tag social contribution as paid completely
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
* @deprecated
* @see setPaid()
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function set_paid($user)
{
// phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($user);
}
/**
* Tag social contribution as paid completely
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setPaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
$sql .= " paye = 1";
$sql .= " WHERE rowid = ".$this->id;
@ -450,12 +464,26 @@ class ChargeSociales extends CommonObject
/**
* Remove tag paid on social contribution
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
* @deprecated
* @see setUnpaid()
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function set_unpaid($user)
{
// phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
return $this->setUnpaid($user);
}
/**
* Remove tag paid on social contribution
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
$sql .= " paye = 0";
$sql .= " WHERE rowid = ".$this->id;

View File

@ -197,7 +197,7 @@ class PaymentSocialContribution extends CommonObject
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0)
{
$result = $contrib->set_paid($user);
$result = $contrib->setPaid($user);
} else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
}
}
@ -567,6 +567,25 @@ class PaymentSocialContribution extends CommonObject
$socialcontrib->fetch($key);
$result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc');
if ($result <= 0) dol_print_error($this->db);
if ($socialcontrib->fk_user) {
$fuser = new User($this->db);
$fuser->fetch($socialcontrib->fk_user);
// Add link 'user' in bank_url between operation and bank transaction
$result = $acc->add_url_line(
$bank_line_id,
$socialcontrib->fk_user,
DOL_URL_ROOT . '/user/card.php?id=',
$fuser->getFullName($langs),
'user'
);
if ($result <= 0) {
$this->error = $acc->error;
$error++;
}
}
}
}
} else {

View File

@ -43,7 +43,11 @@ $id = GETPOST("id", 'int');
$action = GETPOST("action", "alpha");
$confirm = GETPOST('confirm');
$refund = GETPOST("refund", "int");
$auto_create_payment = GETPOST("auto_create_paiement", "int");
if (GETPOSTISSET('auto_create_paiement') || $action === 'add') {
$auto_create_payment = GETPOST("auto_create_paiement", "int");
} else {
$auto_create_payment = empty($conf->global->CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT);
}
if (empty($refund)) $refund = 0;
@ -111,14 +115,14 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes')
{
$object->fetch($id);
$result = $object->set_paid($user);
$result = $object->setPaid($user);
}
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
$result = $object->fetch($id);
if ($object->paye)
{
$result = $object->set_unpaid($user);
$result = $object->setUnpaid($user);
if ($result > 0)
{
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
@ -377,17 +381,10 @@ if ($action == 'create')
if (!empty($conf->use_javascript_ajax))
{
print "\n".'<script type="text/javascript" language="javascript">';
print '$(document).ready(function () {
$("#radiopayment").click(function() {
$("#label").val($(this).data("label"));
});
$("#radiorefund").click(function() {
$("#label").val($(this).data("label"));
});
$("#auto_create_paiement").click(function() {
if($(this).is(":checked")) {
print /** @lang JavaScript */'
$(document).ready(function () {
let onAutoCreatePaiementChange = function () {
if($("#auto_create_paiement").is(":checked")) {
$("#label_fk_account").addClass("fieldrequired");
$("#label_type_payment").addClass("fieldrequired");
$(".hide_if_no_auto_create_payment").show();
@ -396,21 +393,21 @@ if ($action == 'create')
$("#label_type_payment").removeClass("fieldrequired");
$(".hide_if_no_auto_create_payment").hide();
}
});';
};
$("#radiopayment").click(function() {
$("#label").val($(this).data("label"));
});
$("#radiorefund").click(function() {
$("#label").val($(this).data("label"));
if ($_REQUEST['action'] === 'add') { // form has been send but there is at least one error
if (empty($auto_create_payment)) {
print '$("#label_fk_account").removeClass("fieldrequired");
$("#label_type_payment").removeClass("fieldrequired");
$(".hide_if_no_auto_create_payment").hide();';
} else {
print '$("#label_fk_account").addClass("fieldrequired");
$("#label_type_payment").addClass("fieldrequired");
$(".hide_if_no_auto_create_payment").show();';
}
}
});
$("#auto_create_paiement").click(function () {
onAutoCreatePaiementChange();
});
onAutoCreatePaiementChange();
});
';
print '});';
print '</script>'."\n";
}
@ -475,7 +472,7 @@ if ($action == 'create')
// Auto create payment
print '<tr><td>'.$langs->trans('AutomaticCreationPayment').'</td>';
print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" '.($_REQUEST['action'] === 'add' ? (empty($auto_create_payment) ? '' : 'checked="checked"') : 'checked="checked"').' value="1"></td></tr>'."\n";
print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n";
// Number
print '<tr class="hide_if_no_auto_create_payment"><td>'.$langs->trans('Numero');

View File

@ -194,7 +194,7 @@ class PaymentVAT extends CommonObject
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0)
{
$result = $contrib->set_paid($user);
$result = $contrib->setPaid($user);
}
else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
}
@ -480,7 +480,7 @@ class PaymentVAT extends CommonObject
{
$this->id = 0;
$this->fk_tva = '';
$this->fk_tva = 0;
$this->datec = '';
$this->tms = '';
$this->datep = '';
@ -489,9 +489,9 @@ class PaymentVAT extends CommonObject
$this->num_payment = '';
$this->note_private = '';
$this->note_public = '';
$this->fk_bank = '';
$this->fk_user_creat = '';
$this->fk_user_modif = '';
$this->fk_bank = 0;
$this->fk_user_creat = 0;
$this->fk_user_modif = 0;
}

View File

@ -246,14 +246,14 @@ class Tva extends CommonObject
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function set_paid($user)
public function setPaid($user)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
$sql .= " paye = 1";
$sql .= " WHERE rowid = ".$this->id;
$return = $this->db->query($sql);
if ($return) return 1;
$resql = $this->db->query($sql);
if ($resql) return 1;
else return -1;
}
@ -263,14 +263,14 @@ class Tva extends CommonObject
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function set_unpaid($user)
public function setUnpaid($user)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
$sql .= " paye = 0";
$sql .= " WHERE rowid = ".$this->id;
$return = $this->db->query($sql);
if ($return) return 1;
$resql = $this->db->query($sql);
if ($resql) return 1;
else return -1;
}

View File

@ -40,11 +40,11 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
*/
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{
$this->db = $db;
$this->db = $db;
$this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule;
$this->canvas = $canvas;
$this->card = $card;
$this->targetmodule = $targetmodule;
$this->canvas = $canvas;
$this->card = $card;
}
/**
@ -55,13 +55,19 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
*/
private function getTitle($action)
{
global $langs;
global $langs, $conf;
$out = '';
if ($action == 'view') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contact") : $langs->trans("ContactAddress"));
if ($action == 'edit') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("EditContact") : $langs->trans("EditContactAddress"));
if ($action == 'create') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
if ($action == 'view') {
$out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contact") : $langs->trans("ContactAddress"));
}
if ($action == 'edit') {
$out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("EditContact") : $langs->trans("EditContactAddress"));
}
if ($action == 'create') {
$out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
}
return $out;
}
@ -89,8 +95,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors;
if ($action == 'view')
{
if ($action == 'view') {
// Card header
$head = contact_prepare_head($this->object);
$title = $this->getTitle($action);
@ -106,14 +111,12 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
} else {
// Confirm delete contact
if ($action == 'delete' && $user->rights->societe->contact->supprimer)
{
if ($action == 'delete' && $user->rights->societe->contact->supprimer) {
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
}
}
if ($action == 'list')
{
if ($action == 'list') {
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
}
}

View File

@ -260,10 +260,25 @@ class Contact extends CommonObject
public $birthday;
public $default_lang;
public $ref_facturation; // Reference number of invoice for which it is contact
public $ref_contrat; // Nb de reference contrat pour lequel il est contact
public $ref_commande; // Nb de reference commande pour lequel il est contact
public $ref_propal; // Nb de reference propal pour lequel il est contact
/**
* @var int Number of invoices for which he is contact
*/
public $ref_facturation;
/**
* @var int Number of contracts for which he is contact
*/
public $ref_contrat;
/**
* @var int Number of orders for which he is contact
*/
public $ref_commande;
/**
* @var int Number of proposals for which he is contact
*/
public $ref_propal;
/**
* @var int user ID
@ -412,9 +427,15 @@ class Contact extends CommonObject
$this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name);
$this->firstname = trim($this->firstname);
$this->setUpperOrLowerCase();
if (empty($this->socid)) $this->socid = 0;
if (empty($this->priv)) $this->priv = 0;
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
if (empty($this->socid)) {
$this->socid = 0;
}
if (empty($this->priv)) {
$this->priv = 0;
}
if (empty($this->statut)) {
$this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
}
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
@ -610,88 +631,72 @@ class Contact extends CommonObject
$tmpobj = new User($this->db);
$tmpobj->fetch($this->user_id);
$usermustbemodified = 0;
if ($tmpobj->office_phone != $this->phone_pro)
{
if ($tmpobj->office_phone != $this->phone_pro) {
$tmpobj->office_phone = $this->phone_pro;
$usermustbemodified++;
}
if ($tmpobj->office_fax != $this->fax)
{
if ($tmpobj->office_fax != $this->fax) {
$tmpobj->office_fax = $this->fax;
$usermustbemodified++;
}
if ($tmpobj->address != $this->address)
{
if ($tmpobj->address != $this->address) {
$tmpobj->address = $this->address;
$usermustbemodified++;
}
if ($tmpobj->town != $this->town)
{
if ($tmpobj->town != $this->town) {
$tmpobj->town = $this->town;
$usermustbemodified++;
}
if ($tmpobj->zip != $this->zip)
{
if ($tmpobj->zip != $this->zip) {
$tmpobj->zip = $this->zip;
$usermustbemodified++;
}
if ($tmpobj->zip != $this->zip)
{
if ($tmpobj->zip != $this->zip) {
$tmpobj->state_id = $this->state_id;
$usermustbemodified++;
}
if ($tmpobj->country_id != $this->country_id)
{
if ($tmpobj->country_id != $this->country_id) {
$tmpobj->country_id = $this->country_id;
$usermustbemodified++;
}
if ($tmpobj->email != $this->email)
{
if ($tmpobj->email != $this->email) {
$tmpobj->email = $this->email;
$usermustbemodified++;
}
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks)))
{
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks))) {
$tmpobj->socialnetworks = $this->socialnetworks;
$usermustbemodified++;
}
// if ($tmpobj->skype != $this->skype)
// {
// if ($tmpobj->skype != $this->skype) {
// $tmpobj->skype = $this->skype;
// $usermustbemodified++;
// }
// if ($tmpobj->twitter != $this->twitter)
// {
// if ($tmpobj->twitter != $this->twitter) {
// $tmpobj->twitter = $this->twitter;
// $usermustbemodified++;
// }
// if ($tmpobj->facebook != $this->facebook)
// {
// if ($tmpobj->facebook != $this->facebook) {
// $tmpobj->facebook = $this->facebook;
// $usermustbemodified++;
// }
// if ($tmpobj->linkedin != $this->linkedin)
// {
// if ($tmpobj->linkedin != $this->linkedin) {
// $tmpobj->linkedin = $this->linkedin;
// $usermustbemodified++;
// }
if ($usermustbemodified)
{
if ($usermustbemodified) {
$result = $tmpobj->update($user, 0, 1, 1, 1);
if ($result < 0) { $error++; }
}
}
if (!$error && !$notrigger)
{
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_MODIFY', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error)
{
if (!$error) {
$this->db->commit();
return 1;
} else {
@ -723,9 +728,13 @@ class Contact extends CommonObject
// phpcs:enable
global $conf;
$dn = '';
if ($mode == 0) $dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
elseif ($mode == 1) $dn = $conf->global->LDAP_CONTACT_DN;
elseif ($mode == 2) $dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
if ($mode == 0) {
$dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
} elseif ($mode == 1) {
$dn = $conf->global->LDAP_CONTACT_DN;
} elseif ($mode == 2) {
$dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
}
return $dn;
}

View File

@ -889,8 +889,8 @@ if (empty($reshook))
$action = 'editref';
} else {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$old_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($old_ref);
$new_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
$old_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($old_ref);
$new_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$files = dol_dir_list($old_filedir);
if (!empty($files))
@ -935,7 +935,7 @@ if (empty($reshook))
// Actions to build doc
$upload_dir = $conf->contrat->dir_output;
$upload_dir = $conf->contrat->multidir_output[$object->entity];
$permissiontoadd = $user->rights->contrat->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
@ -2137,13 +2137,13 @@ if ($action == 'create')
* Documents generes
*/
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->contrat->lire;
$delallowed = $user->rights->contrat->creer;
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : $conf->global->CONTRACT_ADDON_PDF), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
// Show links to link elements
@ -2168,7 +2168,7 @@ if ($action == 'create')
// Presend form
$modelmail = 'contract';
$defaulttopic = 'SendContractRef';
$diroutput = $conf->contrat->dir_output;
$diroutput = $conf->contrat->multidir_output[$object->entity];
$trackid = 'con'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -1296,7 +1296,7 @@ class Contrat extends CommonObject
$ref = dol_sanitizeFileName($this->ref);
if ($conf->contrat->dir_output)
{
$dir = $conf->contrat->dir_output."/".$ref;
$dir = $conf->contrat->multidir_output[$this->entity]."/".$ref;
if (file_exists($dir))
{
$res = @dol_delete_dir_recursive($dir);

View File

@ -74,7 +74,7 @@ if ($object->id > 0)
$object->fetch_thirdparty();
}
$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$modulepart = 'contract';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

View File

@ -33,6 +33,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -203,7 +204,7 @@ $formcompany = new FormCompany($db);
$contracttmp = new Contrat($db);
$sql = 'SELECT';
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
@ -259,7 +260,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,';
$sql .= " typent.code,";
$sql .= " state.code_departement, state.nom";
@ -643,7 +644,7 @@ while ($i < min($num, $limit))
}
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';
@ -740,7 +741,7 @@ while ($i < min($num, $limit))
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) {
print ' ';

View File

@ -304,7 +304,7 @@ if (!$error && $massaction == 'confirm_presend')
if ($_POST['addmaindocfile'])
{
// TODO Use future field $objectobj->fullpathdoc to know where is stored default file
// TODO If not defined, use $objectobj->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
// TODO If not defined, use $objectobj->model_pdf (or defaut invoice config) to know what is template to use to regenerate doc.
$filename = dol_sanitizeFileName($objectobj->ref).'.pdf';
$subdir = '';
// TODO Set subdir to be compatible with multi levels dir trees
@ -1097,6 +1097,7 @@ if ($action == 'remove_file')
$action = '';
}
// Validate records
if (!$error && $massaction == 'validate' && $permissiontoadd)
{
@ -1281,7 +1282,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread)
if (empty($hideref)) $hideref = 0;
if (empty($moreparams)) $moreparams = null;
$result = $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
$result = $objecttmp->generateDocument($objecttmp->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
if ($result <= 0)
{

View File

@ -201,6 +201,13 @@ if ($type == 'directory')
'mrp-mo'
);
$parameters = array('modulepart'=>$module);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0)
{
$automodules[]=$hookmanager->resArray['module'];
}
// TODO change for multicompany sharing
if ($module == 'company') $upload_dir = $conf->societe->dir_output;
elseif ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
@ -220,6 +227,13 @@ if ($type == 'directory')
elseif ($module == 'recruitment-recruitmentcandidature') $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
elseif ($module == 'mrp-mo') $upload_dir = $conf->mrp->dir_output.'/mo';
else {
$parameters = array('modulepart'=>$module);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
$upload_dir = $hookmanager->resArray['directory'];
}
}
// Automatic list
if (in_array($module, $automodules))

View File

@ -135,7 +135,7 @@ class box_comptes extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right nowraponall"',
'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
'text' => price($solde, 0, $langs, 1, -1, -1, $objp->currency_code)
);
$line++;

View File

@ -55,6 +55,11 @@ abstract class CommonDocGenerator
*/
public $extrafieldsCache;
/**
* @var int If set to 1, save the fullname of generated file with path as the main doc when generating a doc with this template.
*/
public $update_main_doc_field;
/**
* Constructor
*

View File

@ -355,6 +355,13 @@ abstract class CommonObject
*/
public $model_pdf;
/**
* @var string
* @deprecated
* @see model_pdf
*/
public $modelpdf;
/**
* @var string
* Contains relative path of last generated main file
@ -631,12 +638,15 @@ abstract class CommonObject
$this->lastname = dol_ucwords(dol_strtolower($this->lastname));
$this->firstname = dol_ucwords(dol_strtolower($this->firstname));
$this->name = dol_ucwords(dol_strtolower($this->name));
$this->name_alias = dol_ucwords(dol_strtolower($this->name_alias));
}
if (!empty($conf->global->MAIN_ALL_TO_UPPER)) {
$this->lastname = dol_strtoupper($this->lastname);
$this->name = dol_strtoupper($this->name);
$this->name_alias = dol_strtoupper($this->name_alias);
}
if (!empty($conf->global->MAIN_ALL_TOWN_TO_UPPER)) {
$this->address = dol_strtoupper($this->address);
$this->town = dol_strtoupper($this->town);
}
}
@ -963,7 +973,7 @@ abstract class CommonObject
* @param int|string $type_contact Type of contact (code or id). Must be id or code found into table llx_c_type_contact. For example: SALESREPFOLL
* @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
* @return int <0 if KO, 0 if already added, >0 if OK
*/
public function add_contact($fk_socpeople, $type_contact, $source = 'external', $notrigger = 0)
{
@ -1068,7 +1078,9 @@ abstract class CommonObject
return -1;
}
}
} else return 0;
} else {
return 0;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -6875,7 +6887,7 @@ abstract class CommonObject
/**
* Function to show lines of extrafields with output datas.
* This function is responsible to output the <tr> and <td> according to correct number of columns received into $params['colspan']
* This function is responsible to output the <tr> and <td> according to correct number of columns received into $params['colspan'] or <div> according to $display_type
*
* @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output ('view') or input ('create' or 'edit') for extrafield

View File

@ -1227,6 +1227,7 @@ class DolGraph
$this->stringtoshow .= ', stacked: true';
}
$this->stringtoshow .= ' }] }';
// Add a callback to change label to show only positive value
if (is_array($this->tooltipsLabels) || is_array($this->tooltipsTitles)) {
$this->stringtoshow .= ', tooltips: { mode: \'nearest\',
@ -1325,12 +1326,15 @@ class DolGraph
$color = $this->datacolor[$i];
}
if (is_array($this->bordercolor[$i])) {
$bordercolor = $color;
$color = 'rgb(' . $this->bordercolor[$i][0] . ', ' . $this->bordercolor[$i][1] . ', ' . $this->bordercolor[$i][2] . ', 0.9)';
} else {
$bordercolor = $this->bordercolor[$i];
if ($type != 'horizontalBar') {
$bordercolor = $color;
} else {
$bordercolor = $this->bordercolor[$i];
}
}
}
if ($i > 0) $this->stringtoshow .= ', ';
$this->stringtoshow .= "\n";
$this->stringtoshow .= '{';

View File

@ -825,7 +825,7 @@ class dolReceiptPrinter extends Printer
if ($this->printer->connector instanceof DummyPrintConnector || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector")
{
$data = $this->printer->connector->getData();
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo base64_encode($data);
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
dol_syslog($data);
}
// Close and print

View File

@ -839,7 +839,7 @@ class ExtraFields
$array_name_label = array();
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,printable,totalizable,fielddefault,fieldcomputed,entity,enabled,help";
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, perms, langs, list, printable, totalizable, fielddefault, fieldcomputed, entity, enabled, help";
$sql .= " FROM ".MAIN_DB_PREFIX."extrafields";
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
if ($elementtype) $sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'"; // Filed with object->table_element

View File

@ -161,6 +161,7 @@ class HookManager
'addMoreMassActions',
'addSearchEntry',
'addStatisticLine',
'addSectionECMAuto',
'createDictionaryFieldlist',
'editDictionaryFieldlist',
'getFormMail',
@ -247,7 +248,7 @@ class HookManager
$actionclassinstance->error = 0;
$actionclassinstance->errors = array();
dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", action=".$action." context=".$context, LOG_DEBUG);
dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', objectid='.$object->id : ''), LOG_DEBUG);
// Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
$parameters['currentcontext'] = $context;

View File

@ -253,9 +253,9 @@ class Form
if (empty($notabletag)) $ret .= '<td class="left">';
//else $ret.='<div class="clearboth"></div>';
$ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '<br>'."\n";
$ret .= '<input type="submit" class="button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
if (empty($notabletag)) $ret .= '</td>';
if (empty($notabletag)) $ret .= '</tr></table>'."\n";
@ -984,6 +984,7 @@ class Form
print '>'.$langs->trans("Service");
print '</select>';
print ajax_combobox('select_'.$htmlname);
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
}
if ((empty($forceall) && empty($conf->product->enabled) && !empty($conf->service->enabled)) || $forceall == 3)
@ -1479,7 +1480,7 @@ class Form
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql .= " AND sp.statut <> 0";
$sql .= " ORDER BY sp.lastname ASC";
dol_syslog(get_class($this)."::select_contacts", LOG_DEBUG);
dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -2753,9 +2754,10 @@ class Form
* @param int $hidelabel Hide label (0=no, 1=yes)
* @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
* @param string $morecss More CSS
* @param string $placeholder Placeholder
* @return void
*/
public function select_produits_fournisseurs($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $ajaxoptions = array(), $hidelabel = 0, $alsoproductwithnosupplierprice = 0, $morecss = '')
public function select_produits_fournisseurs($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $ajaxoptions = array(), $hidelabel = 0, $alsoproductwithnosupplierprice = 0, $morecss = '', $placeholder = '')
{
// phpcs:enable
global $langs, $conf;
@ -2776,9 +2778,9 @@ class Form
// mode=2 means suppliers products
$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'">';
print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
} else {
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice, $morecss);
print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
}
}
@ -2798,9 +2800,10 @@ class Form
* @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices
* @param string $morecss Add more CSS
* @param int $showstockinlist Show stock information (slower).
* @param string $placeholder Placeholder
* @return array Array of keys for json
*/
public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '', $showstockinlist = 0)
public function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '', $showstockinlist = 0, $placeholder = '')
{
// phpcs:enable
global $langs, $conf, $db, $user;
@ -2884,9 +2887,9 @@ class Form
$num = $this->db->num_rows($result);
//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax
$out .= '<select class="flat maxwidthonsmartphone'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if (!$selected) $out .= '<option value="0" selected>&nbsp;</option>';
else $out .= '<option value="0">&nbsp;</option>';
$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if (!$selected) $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
else $out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
$i = 0;
while ($i < $num)
@ -3101,7 +3104,7 @@ class Form
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt;
array_push($outarray,
@ -3109,12 +3112,12 @@ class Form
'value'=>$outref,
'label'=>$outval,
'qty'=>$outqty,
'up'=>$objp->unitprice,
'price_ht'=>price2num($objp->unitprice, 'MT'),
'discount'=>$outdiscount,
'type'=>$outtype,
'duration_value'=>$outdurationvalue,
'duration_unit'=>$outdurationunit,
'disabled'=>(empty($objp->idprodfournprice) ?true:false),
'disabled'=>(empty($objp->idprodfournprice) ? true : false),
'description'=>$objp->description
)
);
@ -4164,6 +4167,7 @@ class Form
print '<form method="POST" action="'.$page.'">';
print '<input type="hidden" name="action" value="setbankaccount">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
if ($nbaccountfound > 0) print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
@ -4308,7 +4312,7 @@ class Form
* @param string $question Question
* @param string $action Action
* @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>))
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ...
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', 'other' or 'onecolumn'...
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
* @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int|string $height Force height of box (0 = auto)
@ -4362,20 +4366,19 @@ class Form
$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
if ($input['type'] == 'text')
{
if ($input['type'] == 'text') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n";
} elseif ($input['type'] == 'password')
{
} elseif ($input['type'] == 'password') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n";
} elseif ($input['type'] == 'select')
{
} elseif ($input['type'] == 'select') {
if (empty($morecss)) {
$morecss = 'minwidth100';
}
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
if (!empty($input['label'])) $more .= $input['label'].'</div><div class="tagtd left">';
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
$more .= '</div></div>'."\n";
} elseif ($input['type'] == 'checkbox')
{
} elseif ($input['type'] == 'checkbox') {
$more .= '<div class="tagtr">';
$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].' </div><div class="tagtd">';
$more .= '<input type="checkbox" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$moreattr;
@ -4384,8 +4387,7 @@ class Form
if (isset($input['disabled'])) $more .= ' disabled';
$more .= ' /></div>';
$more .= '</div>'."\n";
} elseif ($input['type'] == 'radio')
{
} elseif ($input['type'] == 'radio') {
$i = 0;
foreach ($input['values'] as $selkey => $selval)
{
@ -4400,8 +4402,7 @@ class Form
$more .= '</div></div>'."\n";
$i++;
}
} elseif ($input['type'] == 'date')
{
} elseif ($input['type'] == 'date') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
$more .= '<div class="tagtd">';
$more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0);
@ -4411,17 +4412,19 @@ class Form
$formquestion[] = array('name'=>$input['name'].'year');
$formquestion[] = array('name'=>$input['name'].'hour');
$formquestion[] = array('name'=>$input['name'].'min');
} elseif ($input['type'] == 'other')
{
} elseif ($input['type'] == 'other') {
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
if (!empty($input['label'])) $more .= $input['label'].'</div><div class="tagtd">';
$more .= $input['value'];
$more .= '</div></div>'."\n";
} elseif ($input['type'] == 'onecolumn')
{
} elseif ($input['type'] == 'onecolumn') {
$moreonecolumn .= '<div class="margintoponly">';
$moreonecolumn .= $input['value'];
$moreonecolumn .= '</div>'."\n";
} elseif ($input['type'] == 'hidden') {
// Do nothing more, already added by a previous loop
} else {
$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
}
}
}
@ -4449,16 +4452,24 @@ class Form
}
$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.$action.'&confirm=yes';
$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'confirm=no' : '');
// Add input fields into list of fields to read during submit (inputok and inputko)
if (is_array($formquestion))
{
foreach ($formquestion as $key => $input)
{
if (is_array($formquestion)) {
foreach ($formquestion as $key => $input) {
//print "xx ".$key." rr ".is_array($input)."<br>\n";
if (is_array($input) && isset($input['name'])) array_push($inputok, $input['name']);
// Add name of fields to propagate with the GET when submitting the form with button OK.
if (is_array($input) && isset($input['name'])) {
if (strpos($input['name'], ',') > 0) {
$inputok = array_merge($inputok, explode(',', $input['name']));
} else {
array_push($inputok, $input['name']);
}
}
// Add name of fields to propagate with the GET when submitting the form with button KO.
if (isset($input['inputko']) && $input['inputko'] == 1) array_push($inputko, $input['name']);
}
}
// Show JQuery confirm box.
$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
if (is_array($formquestion) && !empty($formquestion['text'])) {
@ -5030,7 +5041,7 @@ class Form
}
}
print $langs->trans($translationKey, price($amount, 0, $langs, 0, 0, -1, $conf->currency));
if (empty($hidelist)) print ': ';
if (empty($hidelist)) print ' ';
print '</div>';
if (empty($hidelist))
{

View File

@ -263,23 +263,7 @@ class FormActions
// Type
print '<td>';
// TODO Code common with code into comm/action/list.php
$imgpicto = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($actioncomm->type_picto) {
$imgpicto = img_picto('', $actioncomm->type_picto);
} else {
if ($actioncomm->type_code == 'AC_RDV') $imgpicto = img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright');
elseif ($actioncomm->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright');
elseif ($actioncomm->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright');
elseif ($actioncomm->type_code == 'AC_EMAIL') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright');
elseif ($actioncomm->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright');
elseif ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright');
elseif (!preg_match('/_AUTO/', $actioncomm->type_code)) $imgpicto = img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright');
}
}
print $imgpicto;
print $actioncomm->getTypePicto();
if ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') {
print $langs->trans("Message");
} else {

View File

@ -757,30 +757,37 @@ class FormCompany extends Form
* @param string $sortorder Sort criteria ('position', 'code', ...)
* @param int $showempty 1=Add en empty line
* @param string $morecss Add more css to select component
* @param int $output 0=return HTML, 1= direct print
* @param int $forcehidetooltip Force hide tooltip for admin
* @return void
*/
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '')
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '', $output = 1, $forcehidetooltip = 0)
{
global $user, $langs;
$out = '';
if (is_object($object) && method_exists($object, 'liste_type_contact'))
{
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
print '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) print '<option value="0"></option>';
$out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) $out .= '<option value="0"></option>';
foreach ($lesTypes as $key=>$value)
{
print '<option value="'.$key.'"';
if ($key == $selected) print ' selected';
print '>'.$value.'</option>';
$out .= '<option value="'.$key.'"';
if ($key == $selected) $out .= ' selected';
$out .= '>'.$value.'</option>';
}
print "</select>";
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
$out .= "</select>";
if ($user->admin && empty($forcehidetooltip)) $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ajax_combobox($htmlname);
$out .= ajax_combobox($htmlname);
print "\n";
$out .= "\n";
}
if (empty($output)) {
return $out;
} else {
print $out;
}
}

View File

@ -450,7 +450,7 @@ class FormFile
if ($modulepart == 'company')
{
$showempty = 1;
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed;
else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php';
@ -514,6 +514,7 @@ class FormFile
}
} elseif ($modulepart == 'contract')
{
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed;
else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
@ -577,6 +578,7 @@ class FormFile
}
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice')
{
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed;
else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
@ -1570,6 +1572,20 @@ class FormFile
{
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
$object_instance = new Mo($this->db);
} else {
$parameters = array('modulepart'=>$modulepart);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0)
{
if (array_key_exists('classpath', $hookmanager->resArray) && !empty($hookmanager->resArray['classpath'])) {
dol_include_once($hookmanager->resArray['classpath']);
if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) {
if (class_exists($hookmanager->resArray['classname'])) {
$object_instance = new ${$hookmanager->resArray['classname']}($this->db);
}
}
}
}
}
//var_dump($filearray);
@ -1623,6 +1639,17 @@ class FormFile
'banque'))) {
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : '');
} else {
$parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray)>0)
{
if (array_key_exists('ref', $hookmanager->resArray) && !empty($hookmanager->resArray['ref'])) {
$ref = $hookmanager->resArray['ref'];
}
if (array_key_exists('id', $hookmanager->resArray) && !empty($hookmanager->resArray['id'])) {
$id = $hookmanager->resArray['id'];
}
}
//print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n";
}

View File

@ -1257,7 +1257,7 @@ class FormMail extends Form
$sql .= " AND (lang = '".$db->escape($languagetosearch)."'".($languagetosearchmain ? " OR lang = '".$db->escape($languagetosearchmain)."'" : "")." OR lang IS NULL OR lang = '')";
}
if ($id > 0) {
$sql .= " AND rowid=".$id;
$sql .= " AND rowid=".(int) $id;
}
if ($id == -1) {
$sql .= " AND position=0";
@ -1331,6 +1331,8 @@ class FormMail extends Form
return $ret;
} else {
dol_print_error($db);
$this->error=$db->lasterror;
$this->errors[]=$db->lasterror;
return -1;
}
}

View File

@ -368,7 +368,9 @@ class FormTicket
if (response.num) {
var selecthtml_str = response.value;
var selecthtml_dom=$.parseHTML(selecthtml_str);
$("#inputautocomplete"+htmlname).val(selecthtml_dom[0][0].innerHTML);
if (typeof(selecthtml_dom[0][0]) !== \'undefined\') {
$("#inputautocomplete"+htmlname).val(selecthtml_dom[0][0].innerHTML);
}
} else {
$("#inputautocomplete"+htmlname).val("");
}

View File

@ -113,7 +113,12 @@ class Translate
} else $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
} else { // If it's for a codetouse that is a short code xx
// Array to convert short lang code into long code.
$longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO');
$longforshort = array(
'am'=>'am_ET', 'ar'=>'ar_SA', 'bn'=>'bn_DB', 'el'=>'el_GR', 'ca'=>'ca_ES', 'cs'=>'cs_CZ', 'en'=>'en_US', 'fa'=>'fa_IR',
'gl'=>'gl_ES', 'he'=>'he_IL', 'hi'=>'hi_IN', 'ja'=>'ja_JP',
'ka'=>'ka_GE', 'km'=>'km_KH', 'kn'=>'kn_IN', 'ko'=>'ko_KR', 'lo'=>'lo_LA', 'nb'=>'nb_NO', 'no'=>'nb_NO', 'ne'=>'ne_NP',
'sl'=>'sl_SI', 'sq'=>'sq_AL', 'sr'=>'sr_RS', 'sv'=>'sv_SE', 'uk'=>'uk_UA', 'vi'=>'vi_VN', 'zh'=>'zh_CN'
);
if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])];
elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
else $srclang = 'en_US';

View File

@ -50,11 +50,11 @@ class Utils
* Purge files into directory of data files.
* CAN BE A CRON TASK
*
* @param string $choices Choice of purge mode ('tempfiles', '' or 'tempfilesold' to purge temp older than $nbsecondsold seconds, 'allfiles', 'logfile')
* @param string $choices Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than $nbsecondsold seconds, 'logfiles', or mix of this). Note 'allfiles' is possible too but very dangerous.
* @param int $nbsecondsold Nb of seconds old to accept deletion of a directory if $choice is 'tempfilesold'
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
public function purgeFiles($choices = 'tempfilesold,logfile', $nbsecondsold = 86400)
public function purgeFiles($choices = 'tempfilesold+logfiles', $nbsecondsold = 86400)
{
global $conf, $langs, $dolibarr_main_data_root;
@ -62,15 +62,18 @@ class Utils
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (empty($choices)) $choices = 'tempfilesold,logfile';
if (empty($choices)) {
$choices = 'tempfilesold+logfiles';
}
dol_syslog("Utils::purgeFiles choice=".$choices, LOG_DEBUG);
$count = 0;
$countdeleted = 0;
$counterror = 0;
$filelog = '';
$choicesarray = explode(',', $choices);
$choicesarray = preg_split('/[\+,]/', $choices);
foreach ($choicesarray as $choice) {
$filesarray = array();
@ -101,7 +104,7 @@ class Utils
}
}
if ($choice == 'logfile')
if ($choice == 'logfile' || $choice == 'logfiles')
{
// Define files log
if ($dolibarr_main_data_root)
@ -109,7 +112,6 @@ class Utils
$filesarray = dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*(\.gz)?$', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1);
}
$filelog = '';
if (!empty($conf->syslog->enabled))
{
$filelog = $conf->global->SYSLOG_FILE;
@ -140,11 +142,10 @@ class Utils
}
} elseif ($filesarray[$key]['type'] == 'file') {
// If (file that is not logfile) or (if mode is logfile)
if ($filesarray[$key]['fullname'] != $filelog || $choice == 'logfile')
if ($filesarray[$key]['fullname'] != $filelog || $choice == 'logfile' || $choice == 'logfiles')
{
$result = dol_delete_file($filesarray[$key]['fullname'], 1, 1);
if ($result)
{
if ($result) {
$count++;
$countdeleted++;
} else {
@ -166,7 +167,9 @@ class Utils
if ($count > 0) {
$this->output = $langs->trans("PurgeNDirectoriesDeleted", $countdeleted);
if ($count > $countdeleted) $this->output .= '<br>'.$langs->trans("PurgeNDirectoriesFailed", ($count - $countdeleted));
if ($count > $countdeleted) {
$this->output .= '<br>'.$langs->trans("PurgeNDirectoriesFailed", ($count - $countdeleted));
}
} else {
$this->output = $langs->trans("PurgeNothingToDelete").(in_array('tempfilesold', $choicesarray) ? ' (older than 24h for temp files)' : '');
}

View File

@ -137,9 +137,10 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
update: update, textarea: textarea,
pbq: item.pbq,
type: item.type, qty: item.qty, discount: item.discount,
pricebasetype: item.pricebasetype, price_ht: item.price_ht,
pricebasetype: item.pricebasetype,
price_ht: item.price_ht,
price_ttc: item.price_ttc,
up: item.up, description : item.description,
description : item.description,
ref_customer: item.ref_customer }
}));
}
@ -152,32 +153,24 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
console.log("We will trigger change on input '.$htmlname.' because of the select definition of autocomplete code for input#search_'.$htmlname.'");
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
console.log("Propagate before some properties");
console.log("Propagate before some properties retrieved by ajax into data-xxx properties");
//console.log(ui.item);
//For supplier price
$("#'.$htmlname.'").attr("data-up", ui.item.up);
$("#'.$htmlname.'").attr("data-discount", ui.item.discount);
// For supplier price and customer when price by quantity is off
$("#'.$htmlname.'").attr("data-up", ui.item.price_ht);
$("#'.$htmlname.'").attr("data-base", ui.item.pricebasetype);
$("#'.$htmlname.'").attr("data-qty", ui.item.qty);
$("#'.$htmlname.'").attr("data-discount", ui.item.discount);
$("#'.$htmlname.'").attr("data-description", ui.item.description);
$("#'.$htmlname.'").attr("data-ref-customer", ui.item.ref_customer);
//For customer price
';
';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
$script .= '
$("#' . $htmlname . '").attr("data-pbq", ui.item.pbq);
$("#' . $htmlname . '").attr("data-pbqup", ui.item.price_ht);
$("#' . $htmlname . '").attr("data-pbqbase", ui.item.pricebasetype);
$("#' . $htmlname . '").attr("data-pbqqty", ui.item.qty);
$("#' . $htmlname . '").attr("data-pbqpercent", ui.item.discount);
';
} else {
$script .= '
$("#' . $htmlname . '").attr("data-up", ui.item.price_ht);
$("#' . $htmlname . '").attr("data-base", ui.item.pricebasetype);
$("#' . $htmlname . '").attr("data-qty", ui.item.qty);
$("#' . $htmlname . '").attr("data-discount", ui.item.discount);
// For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on
$("#'.$htmlname.'").attr("data-pbq", ui.item.pbq);
$("#'.$htmlname.'").attr("data-pbqup", ui.item.price_ht);
$("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype);
$("#'.$htmlname.'").attr("data-pbqqty", ui.item.qty);
$("#'.$htmlname.'").attr("data-pbqpercent", ui.item.discount);
';
}
$script .= '
@ -217,6 +210,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
console.log("Make action update on each ui.item.update")
// loop on each "update" fields
$.each(ui.item.update, function(key, value) {
console.log("Set value "+value+" into #"+key);
$("#" + key).val(value).trigger("change");
});
}
@ -500,7 +494,9 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
if (response.num) {
var selecthtml_str = response.value;
var selecthtml_dom=$.parseHTML(selecthtml_str);
$("#inputautocomplete"+htmlname).val(selecthtml_dom[0][0].innerHTML);
if (typeof(selecthtml_dom[0][0]) !== \'undefined\') {
$("#inputautocomplete"+htmlname).val(selecthtml_dom[0][0].innerHTML);
}
} else {
$("#inputautocomplete"+htmlname).val("");
}

View File

@ -70,7 +70,7 @@ function contract_prepare_head(Contrat $object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$upload_dir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;

View File

@ -0,0 +1,62 @@
<?php
/* Copyright (C) 2021 Florian Henry <florian.henry@scopen.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
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file eventorganization/lib/eventorganization.lib.php
* \ingroup eventorganization
* \brief Library files with common functions for EventOrganization
*/
/**
* Prepare admin pages header
*
* @return array
*/
function eventorganizationAdminPrepareHead()
{
global $langs, $conf;
$langs->load("eventorganization");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/eventorganization.php';
$head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/eventorganization_confbooth_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields")." (".$langs->trans("EventOrganizationConfOrBooth").")";
$head[$h][2] = 'eventorganization_extrafields';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(
// 'entity:+tabname:Title:@eventorganization:/eventorganization/mypage.php?id=__ID__'
//); // to add new tab
//$this->tabs = array(
// 'entity:-tabname:Title:@eventorganization:/eventorganization/mypage.php?id=__ID__'
//); // to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'eventorganization');
complete_head_from_modules($conf, $langs, null, $head, $h, 'eventorganization', 'remove');
return $head;
}

View File

@ -1192,6 +1192,16 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
{
if ($nophperrors) $ok = @unlink($filename);
else $ok = unlink($filename);
// If it fails and it is because of the missing write permission on parent dir
if (!$ok && file_exists(dirname($filename)) && !(fileperms(dirname($filename)) & 0200)) {
dol_syslog("Error in deletion, but parent directory exists with no permission to write, we try to change permission on parent directory and retry...", LOG_DEBUG);
@chmod(dirname($filename), fileperms(dirname($filename)) | 0200);
// Now we retry deletion
if ($nophperrors) $ok = @unlink($filename);
else $ok = unlink($filename);
}
if ($ok)
{
dol_syslog("Removed file ".$filename, LOG_DEBUG);
@ -2316,10 +2326,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->ficheinter->{$lire}) $accessallowed = 1;
$original_file = $conf->ficheinter->dir_output.'/'.$original_file;
} // Wrapping pour les apercu conat
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->dir_output))
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity]))
{
if ($fuser->rights->contrat->{$lire}) $accessallowed = 1;
$original_file = $conf->contrat->dir_output.'/'.$original_file;
$original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file;
} // Wrapping pour les apercu supplier proposal
elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output))
{
@ -2709,13 +2719,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
if (!empty($conf->stock->enabled)) $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file;
} // Wrapping pour les contrats
elseif ($modulepart == 'contract' && !empty($conf->contrat->dir_output))
elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity]))
{
if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed = 1;
}
$original_file = $conf->contrat->dir_output.'/'.$original_file;
$original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")";
} // Wrapping pour les dons
elseif ($modulepart == 'donation' && !empty($conf->don->dir_output))

View File

@ -13,7 +13,7 @@
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
@ -2480,12 +2480,14 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
$htmllink = $value;
if (empty($value)) return '&nbsp;';
if (empty($value)) {
return '&nbsp;';
}
if (!empty($type)) {
$htmllink = '<div class="divsocialnetwork inline-block valignmiddle">';
// TODO use dictionary definition for picto $dictsocialnetworks[$type]['icon']
$htmllink .= img_picto($langs->trans(dol_ucfirst($type)), $type.'.png', '', false, 0, 0, '', 'paddingright', 0);
// Use dictionary definition for picto $dictsocialnetworks[$type]['icon']
$htmllink .= '<span class="fa paddingright '.($dictsocialnetworks[$type]['icon'] ? $dictsocialnetworks[$type]['icon'] : 'fa-link').'"></span>';
if ($type == 'skype') {
$htmllink .= $value;
$htmllink .= '&nbsp;';
@ -2501,7 +2503,9 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
$addlink = 'AC_SKYPE';
$link = '';
if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$addlink.'&amp;contactid='.$cid.'&amp;socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) {
$link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$addlink.'&amp;contactid='.$cid.'&amp;socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
}
$htmllink .= ($link ? ' '.$link : '');
}
} else {
@ -3228,7 +3232,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
* @param string $moreatt Add more attribute on img tag (For example 'class="pictofixedwidth"')
* @param boolean|int $pictoisfullpath If true or 1, image path is a full path
* @param int $srconly Return only content of the src attribute of img.
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
@ -3241,7 +3245,6 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2)
{
global $conf, $langs;
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
$url = DOL_URL_ROOT;
$theme = isset($conf->theme) ? $conf->theme : null;
@ -3263,18 +3266,19 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cron', 'cubes',
'cash-register', 'category', 'check', 'clock', 'close_title', 'cog', 'company', 'contact', 'contract', 'cron', 'cubes',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
'help', 'holiday',
'intervention', 'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot',
'margin', 'map-marker-alt', 'member', 'money-bill-alt', 'mrp', 'note', 'next',
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'mrp', 'note', 'next',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert',
'object_folder', 'object_folder-open','object_generic',
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice',
'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_label',
'object_margin', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment',
'object_margin', 'object_members', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment',
'object_lot', 'object_mrp', 'object_other',
'object_payment', 'object_pdf', 'object_product', 'object_propal',
'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
@ -3288,11 +3292,12 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
'generic', 'home', 'hrm', 'members', 'products', 'invoicing',
'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'refresh', 'salary', 'supplier_invoice', 'ticket',
'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'refresh', 'salary', 'supplier_invoice', 'technic', 'ticket',
'error', 'warning',
'recruitmentcandidature', 'recruitmentjobposition', 'resource',
'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'user-cog',
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
'eventorganization', 'object_eventorganization'
)
)) {
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
@ -3314,11 +3319,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd',
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly',
'hrm'=>'user-tie', 'margin'=>'calculator', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode',
'hrm'=>'user-tie', 'margin'=>'calculator', 'members'=>'user-friends', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode',
'email'=>'at',
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
'member'=>'users', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
@ -3337,7 +3342,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'title_agenda'=>'calendar-alt',
'uparrow'=>'mail-forward', 'vcard'=>'address-card',
'jabber'=>'comment-o',
'website'=>'globe-americas'
'website'=>'globe-americas',
'eventorganization'=>'id-badge'
);
if ($pictowithouttext == 'off') {
$fakey = 'fa-square';
@ -3365,11 +3371,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fakey = 'fa-'.$pictowithouttext;
}
if (in_array($pictowithouttext, array('member', 'contract'))) {
$fasize = '0.92em';
if (in_array($pictowithouttext, array('member', 'members', 'contract', 'group', 'resource'))) {
$morecss = 'em092';
}
if (in_array($pictowithouttext, array('intervention', 'payment', 'loan'))) {
$fasize = '0.80em';
if (in_array($pictowithouttext, array('intervention', 'payment', 'loan', 'technic'))) {
$morecss = 'em080';
}
// Define $marginleftonlyshort
@ -3412,13 +3418,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// Define $color
$arrayconvpictotocolor = array(
'address'=>'#6c6aa8', 'building'=>'#6c6aa8', 'bom'=>'#a69944',
'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'dynamicprice'=>'#a69944',
'cog'=>'#999', 'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'dynamicprice'=>'#a69944',
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999',
'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944',
'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'globe-americas'=>'#aaa',
'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'uparrow'=>'#555', 'user-cog'=>'#999', 'globe-americas'=>'#aaa',
'website'=>'#304'
);
if (isset($arrayconvpictotocolor[$pictowithouttext])) {
@ -7868,7 +7874,10 @@ function printCommonFooter($zone = 'private')
// Add property 'required' on input
print 'jQuery("input[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
print 'jQuery("textarea[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; // required on a select works only if key is "", this does not happen in Dolibarr
print '// required on a select works only if key is "", so we add the required attributes but also we reset the key -1 or 0 to an empty string'."\n";
print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
print 'jQuery("select[name=\''.$paramkey.'\'] option[value=\'-1\']").prop(\'value\', \'\');'."\n";
print 'jQuery("select[name=\''.$paramkey.'\'] option[value=\'0\']").prop(\'value\', \'\');'."\n";
}
}
}
@ -8197,7 +8206,7 @@ function showDirectDownloadLink($object)
if ($url)
{
$out .= img_picto('', 'globe').' '.$langs->trans("DirectDownloadLink").'<br>';
$out .= img_picto($langs->trans("PublicDownloadLinkdesc"), 'globe').' '.$langs->trans("DirectDownloadLink").'<br>';
$out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'">';
$out .= ajax_autoselect("directdownloadlink", 0);
}

View File

@ -189,7 +189,7 @@ function invoice_rec_prepare_head($object)
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/card-rec.php?id='.$object->id;
$head[$h][1] = $langs->trans("CardBill");
$head[$h][1] = $langs->trans("RepeatableInvoice");
$head[$h][2] = 'card';
$h++;

View File

@ -175,7 +175,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
if ($regenerate || !dol_is_file($filename))
{
if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
$result = $fac->generateDocument($regenerate ? $regenerate : $fac->modelpdf, $outputlangs);
$result = $fac->generateDocument($regenerate ? $regenerate : $fac->model_pdf, $outputlangs);
} else {
if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
}

View File

@ -590,9 +590,9 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " WHERE dbt.rowid IN (".$objectid.")";
$sql .= " AND dbt.".$dbt_keyfield." = ".$user->socid;
} elseif (!empty($conf->societe->enabled)) {
} elseif (!empty($conf->societe->enabled) && !$user->rights->societe->client->voir) {
// If internal user: Check permission for internal users that are restricted on their objects
if ($feature != 'ticket' && !$user->rights->societe->client->voir) {
if ($feature != 'ticket') {
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
@ -601,9 +601,8 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
$sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield;
$sql .= " AND sc.fk_user = ".$user->id;
}
// On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties.
if ($feature == 'ticket' && !$user->rights->societe->client->voir) {
} else {
// On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties.
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = dbt.".$dbt_keyfield." AND sc.fk_user = ".$user->id;

View File

@ -1821,14 +1821,14 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->export->enabled)) {
$langs->load("exports");
$newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export');
$newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer);
//$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire);
}
if (!empty($conf->import->enabled)) {
$langs->load("exports");
$newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import');
$newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run);
}
}
@ -1862,7 +1862,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
$newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire);
$newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer);
$newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire);
$newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire);
@ -1871,7 +1871,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
//if (! empty($conf->export->enabled) && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export);
// Type
$newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup');
$newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members&amp;action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer);
$newmenu->add("/adherents/type.php?leftmenu=setup&amp;mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer);
}

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