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

This commit is contained in:
Florian HENRY 2021-03-09 18:24:12 +01:00
commit 7234d6dbfd
127 changed files with 6368 additions and 1423 deletions

View File

@ -4,15 +4,17 @@ How to contribute to Dolibarr
Bug reports and feature requests
--------------------------------
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages.
<a name="not-a-support-forum"></a>*Note*: **GitHub Issues is not a support forum.** If you have questions about Dolibarr / need help using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages.
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
Default language here is english. So please prepare your contributions in english.
Default **language here is english**. So please prepare your contributions in english.
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request.
4. Tell us the version you are using! (look at /htdocs/admin/system/dolibarr.php? and check if you are using the latest version)
3. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible).
3. Tell us the version you are using! (look at /htdocs/admin/system/dolibarr.php? and check if you are using the latest version)
4. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible).
5. Delete unnecessary submissions.
6. **Check your Message at Preview before sending.**

View File

@ -1,4 +1,10 @@
#!/bin/sh
# To install this precommit file: put this file in your local repo in .git/hooks directory and make it executable
# you need to adapt the path to your phpcs install
# if phpcs check fail, then it run phpcbf to fix automaticaly the syntax, and git commit is canceled
# if you have a multiprocessor computer, you can add to the option --parallel=xx
# when running git commit, it first execute this file checking only modified files, so it is faster than running on all files
# To run the fix manually: cd ~/git/dolibarr; phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true fileordir
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`

View File

@ -118,9 +118,10 @@ if (empty($reshook)) {
$form = new Form($db);
$help_url = '';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title);
llxHeader('', $title, $help_url);
// Customer
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity";
@ -314,7 +315,7 @@ if ($resql) {
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1);
print '<div class="warning">'.$langs->trans("WarningCreateSubAccounts").'</div>';
print '<div class="info">'.$langs->trans("WarningCreateSubAccounts").'</div>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields

View File

@ -10,6 +10,7 @@
* Copyright (C) 2017-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -945,7 +946,7 @@ if (empty($action) || $action == 'view') {
$vatstatic = new Tva($db);
$donationstatic = new Don($db);
$loanstatic = new Loan($db);
$salarystatic = new PaymentSalary($db);
$salarystatic = new Salary($db);
$variousstatic = new PaymentVarious($db);
llxHeader('', $langs->trans("FinanceJournal"));

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Frédéric France <frederic.france@netlgic.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
@ -29,6 +30,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$hookmanager = new HookManager($db);
@ -42,17 +44,40 @@ $langs->loadLangs(array("companies", "members"));
$result = restrictedArea($user, 'adherent');
/*
* Actions
*/
if (GETPOST('addbox')) {
// Add box (when submit is done from a form when ajax disabled)
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone = GETPOST('areacode', 'aZ09');
$userid = GETPOST('userid', 'int');
$boxorder = GETPOST('boxorder', 'aZ09');
$boxorder .= GETPOST('boxcombo', 'aZ09');
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) {
setEventMessages($langs->trans("BoxAdded"), null);
}
}
/*
* View
*/
$form = new Form($db);
// Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
$resultboxes = FormOther::getBoxesArea($user, "2");
llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$staticmember = new Adherent($db);
$statictype = new AdherentType($db);
$subscriptionstatic = new Subscription($db);
print load_fiche_titre($langs->trans("MembersArea"), '', 'member');
print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist'], 'members');
$Adherents = array();
$AdherentsAValider = array();
@ -125,10 +150,7 @@ if ($result) {
$db->free();
}
print '<div class="fichecenter"><div class="fichethirdleft">';
$searchbox = '';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
// Search contact/address
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
@ -136,27 +158,27 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
}
if (count($listofsearchfields)) {
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
$searchbox .='<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
$searchbox .='<input type="hidden" name="token" value="'.newToken().'">';
$searchbox .='<div class="div-table-responsive-no-min">';
$searchbox .='<table class="noborder nohover centpercent">';
$i = 0;
foreach ($listofsearchfields as $key => $value) {
if ($i == 0) {
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
$searchbox .='<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
}
print '<tr class="oddeven">';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
$searchbox .='<tr class="oddeven">';
$searchbox .='<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) {
print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
$searchbox .='<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
}
print '</tr>';
$searchbox .='</tr>';
$i++;
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
$searchbox .='</table>';
$searchbox .='</div>';
$searchbox .='</form>';
$searchbox .='<br>';
}
}
@ -164,12 +186,12 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
/*
* Statistics
*/
$boxgraph = '';
if ($conf->use_javascript_ajax) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
print '<tr><td class="center" colspan="2">';
$boxgraph .='<div class="div-table-responsive-no-min">';
$boxgraph .='<table class="noborder nohover centpercent">';
$boxgraph .='<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
$boxgraph .='<tr><td class="center" colspan="2">';
$SommeA = 0;
$SommeB = 0;
@ -207,17 +229,26 @@ if ($conf->use_javascript_ajax) {
$dolgraph->SetType(array('pie'));
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
$boxgraph .=$dolgraph->show($total ? 0 : 1);
print '</td></tr>';
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
print $SommeA + $SommeB + $SommeC + $SommeD;
print '</td></tr>';
print '</table>';
print '</div>';
$boxgraph .= '</td></tr>';
$boxgraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
$boxgraph .= $SommeA + $SommeB + $SommeC + $SommeD;
$boxgraph .= '</td></tr>';
$boxgraph .= '</table>';
$boxgraph .= '</div>';
$boxgraph .= '<br>';
}
print '<br>';
// boxes
print '<div class="clearboth"></div>';
print '<div class="fichecenter fichecenterbis">';
print '<div class="twocolumns">';
print '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
print $searchbox;
print $boxgraph;
// List of subscription by year
$Total = array();
@ -257,7 +288,7 @@ print "</tr>\n";
krsort($Total);
$i = 0;
foreach ($Total as $key => $value) {
foreach ($Total as $key=>$value) {
if ($i >= 8) {
print '<tr class="oddeven">';
print "<td>...</td>";
@ -284,17 +315,21 @@ print '<td class="right">'.price($tot)."</td>";
print "<td class=\"right\">".price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT'))."</td>";
print "</tr>\n";
print "</table></div>";
print "<br>\n";
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print $resultboxes['boxlista'];
print '</div>'."\n";
print '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
/*
* Latest modified members
*/
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
$sql = "SELECT a.rowid, a.ref, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql .= " a.gender, a.email, a.photo, a.morphy,";
$sql .= " a.tms as datem, a.datefin as date_end_subscription,";
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription";
@ -318,7 +353,7 @@ if ($resql) {
$obj = $db->fetch_object($resql);
$staticmember->id = $obj->rowid;
$staticmember->ref = $obj->ref;
$staticmember->ref = $obj->rowid;
$staticmember->lastname = $obj->lastname;
$staticmember->firstname = $obj->firstname;
$staticmember->gender = $obj->gender;
@ -457,7 +492,12 @@ print '</tr>';
print "</table>\n";
print "</div>";
print '</div></div></div>';
print $resultboxes['boxlistb'];
print '</div>'."\n";
print '</div>';
print '</div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardMembers', $parameters, $object); // Note that $action and $object may have been modified by hook

View File

@ -266,16 +266,16 @@ if ($result) {
print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->name.'">';
print '<input type="hidden" name="const['.$i.'][type]" value="'.$obj->type.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.htmlspecialchars($obj->value).'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate minwidth150" name="const['.$i.'][value]" value="'.htmlspecialchars($obj->value).'">';
print '</td>';
// Note
print '<td>';
print '<input type="text" id="note_'.$i.'" class="flat inputforupdate" size="40" name="const['.$i.'][note]" value="'.htmlspecialchars($obj->note, 1).'">';
print '<input type="text" id="note_'.$i.'" class="flat inputforupdate minwidth200" name="const['.$i.'][note]" value="'.htmlspecialchars($obj->note, 1).'">';
print '</td>';
// Date last change
print '<td>';
print '<td class="nowraponall">';
print dol_print_date($db->jdate($obj->tms), 'dayhour');
print '</td>';

View File

@ -57,7 +57,9 @@ if ($action == 'setvalue' && $user->admin) {
if (!dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS', GETPOST("objectclass", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_GROUP_FILTER', GETPOST("filter"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME', GETPOST("fieldfullname", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) {
$error++;
}
@ -141,6 +143,13 @@ print '</td><td>'.$langs->trans("LDAPGroupObjectClassListExample").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
// Filter, used to filter search
print '<tr class="oddeven"><td>'.$langs->trans("LDAPFilterConnection").'</td><td>';
print '<input size="48" type="text" name="filter" value="'.$conf->global->LDAP_GROUP_FILTER.'">';
print '</td><td>'.$langs->trans("LDAPGroupFilterExample").'</td>';
print '<td></td>';
print '</tr>';
print '</table>';
print '<br>';
print '<table class="noborder centpercent">';
@ -211,11 +220,18 @@ if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
$dn = $conf->global->LDAP_GROUP_DN;
$objectclass = $conf->global->LDAP_GROUP_OBJECT_CLASS;
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
} elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
$butlabel = $langs->trans("LDAPTestSearch");
$testlabel = 'testsearchgroup';
$key = $conf->global->LDAP_KEY_GROUPS;
$dn = $conf->global->LDAP_GROUP_DN;
$objectclass = $conf->global->LDAP_GROUP_OBJECT_CLASS;
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
}
if (function_exists("ldap_connect")) {
if ($_GET["action"] == 'testgroup') {
if ($action == 'testgroup') {
// Creation objet
$object = new UserGroup($db);
$object->initAsSpecimen();
@ -260,6 +276,62 @@ if (function_exists("ldap_connect")) {
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}
if ($action == 'testsearchgroup') {
// TODO Mutualize code following with other ldap_xxxx.php pages
// Test synchro
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0) {
$required_fields = array(
$conf->global->LDAP_KEY_GROUPS,
// $conf->global->LDAP_GROUP_FIELD_NAME,
$conf->global->LDAP_GROUP_FIELD_DESCRIPTION,
$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS,
$conf->global->LDAP_GROUP_FIELD_GROUPID
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
// Get from LDAP database an array of results
$ldapgroups = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_GROUPS, $required_fields, 'group');
//$ldapgroups = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_GROUPS, '', 'group');
if (is_array($ldapgroups)) {
$liste = array();
foreach ($ldapgroups as $key => $ldapgroup) {
// Define the label string for this group
$label = '';
foreach ($required_fields as $value) {
if ($value) {
$label .= $value."=".$ldapgroup[$value]." ";
}
}
$liste[$key] = $label;
}
} else {
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
print "<br>\n";
print "LDAP search for group:<br>\n";
print "search: *<br>\n";
print "userDN: ".$conf->global->LDAP_GROUP_DN."<br>\n";
print "useridentifier: ".$conf->global->LDAP_KEY_GROUPS."<br>\n";
print "required_fields: ".implode(',', $required_fields)."<br>\n";
print "=> ".count($liste)." records<br>\n";
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}
}
// End of page

View File

@ -309,8 +309,9 @@ function getResultColumn($name, array $activated, array $loaded, array $function
}
if (strtolower($name) == 'xdebug') {
$html .= ' '.$langs->trans("ModuleActivated", "xdebug");
$html .= ' - '.$langs->trans("ModuleActivatedMayExposeInformation");
} else {
$html .= ' '.$langs->trans("PHPSupport", $name);
$html .= ' <span class="opacitymedium">'.$langs->trans("PHPSupport", $name).'</span>';
}
} else {
if (strtolower($name) == 'xdebug') {

View File

@ -76,7 +76,7 @@ if ($test) {
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder');
print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
@ -98,7 +98,7 @@ print '<br>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("Permissions"), '', 'folder');
print load_fiche_titre($langs->trans("PermissionsOnFiles"), '', 'folder');
print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
// TODO Check permission are read only except for custom dir
@ -151,9 +151,18 @@ print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"),
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').'<br>';
print '<span class="opacitymedium"> &nbsp; &nbsp; If unset: \'md5\'</span><br>';
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : $conf->global->MAIN_SECURITY_SALT).'<br>';
}
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<span class="opacitymedium">The recommanded value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.<br>';
print 'If you really want to switch, you must:<br>';
print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'<br>';
print '- In same session, WITHOUT LOGGING OUT, go into your admin user record and set a new password<br>';
print '- You can now logout and login with this new password. You must now reset password of all other users.<br>';
print '</span><br>';
}
print '<br>';
// TODO

View File

@ -37,15 +37,18 @@ llxHeader();
print load_fiche_titre("XDebug", '', 'title_setup');
print "<br>\n";
if (!function_exists('xdebug_is_enabled')) {
print "<br>\n";
print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.';
llxFooter();
exit;
}
print '<span class="opacitymedium">';
print $langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
print '</span>';
print '<br><br>';
if (function_exists('socket_create')) {
$address = ini_get('xdebug.remote_host') ?ini_get('xdebug.remote_host') : '127.0.0.1';

View File

@ -69,13 +69,20 @@ $search_desc = GETPOST("search_desc", "alpha");
$search_ua = GETPOST("search_ua", "restricthtml");
$search_prefix_session = GETPOST("search_prefix_session", "restricthtml");
if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) {
$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
$now = dol_now();
$nowarray = dol_getdate($now);
if (!GETPOSTISSET("date_startmonth")) {
$date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], 'tzuserrel');
} elseif (GETPOST("date_startmonth") > 0) {
$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth", 'int'), GETPOST("date_startday", 'int'), GETPOST("date_startyear", 'int'), 'tzuserrel');
} else {
$date_start = -1;
}
if (GETPOST("date_endmonth") == '' || GETPOST("date_endmonth") > 0) {
$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"));
if (!GETPOSTISSET("date_endmonth")) {
$date_end = dol_get_last_hour(dol_now('gmt'), 'tzuserrel');
} elseif (GETPOST("date_endmonth") > 0) {
$date_end = dol_get_last_hour(dol_mktime(23, 59, 59, GETPOST("date_endmonth", 'int'), GETPOST("date_endday", 'int'), GETPOST("date_endyear", 'int'), 'tzuserrel'), 'tzuserrel');
} else {
$date_end = -1;
}
@ -85,8 +92,6 @@ if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) {
$date_end = $date_start + 86400;
}
$now = dol_now();
$nowarray = dol_getdate($now);
if (empty($date_start)) { // We define date_start and date_end
$date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], false);
@ -114,7 +119,6 @@ $arrayfields = array(
)
);
/*
* Actions
*/
@ -316,19 +320,22 @@ if ($result) {
// Fields title search
print '<tr class="liste_titre">';
print '<td class="liste_titre" width="15%">'.$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0).'</td>';
print '<td class="liste_titre" width="15%">';
print $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '</td>';
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_code" value="'.$search_code.'">';
print '<input class="flat maxwidth100" type="text" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
print '</td>';
// IP
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_ip" value="'.$search_ip.'">';
print '<input class="flat maxwidth100" type="text" name="search_ip" value="'.dol_escape_htmltag($search_ip).'">';
print '</td>';
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_user" value="'.$search_user.'">';
print '<input class="flat maxwidth100" type="text" name="search_user" value="'.dol_escape_htmltag($search_user).'">';
print '</td>';
print '<td class="liste_titre left">';
@ -337,13 +344,13 @@ if ($result) {
if (!empty($arrayfields['e.user_agent']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_ua" value="'.$search_ua.'">';
print '<input class="flat maxwidth100" type="text" name="search_ua" value="'.dol_escape_htmltag($search_ua).'">';
print '</td>';
}
if (!empty($arrayfields['e.prefix_session']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_prefix_session" value="'.$search_prefix_session.'">';
print '<input class="flat maxwidth100" type="text" name="search_prefix_session" value="'.dol_escape_htmltag($search_prefix_session).'">';
print '</td>';
}
@ -376,7 +383,7 @@ if ($result) {
print '<tr class="oddeven">';
// Date
print '<td class="nowrap left">'.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S').'</td>';
print '<td class="nowrap left">'.dol_print_date($db->jdate($obj->dateevent), '%Y-%m-%d %H:%M:%S', 'tzuserrel').'</td>';
// Code
print '<td>'.$obj->type.'</td>';

View File

@ -92,8 +92,8 @@ class BOM extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassembly')),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble')),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),

View File

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Luracast\Restler\RestException;
use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
/**
* API class for Agenda Events
@ -66,7 +67,7 @@ class AgendaEvents extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->agenda->myactions->read) {
throw new RestException(401, "Insufficient rights to read an event");
}
if ($id == 0) {
if ($id === 0) {
$result = $this->actioncomm->initAsSpecimen();
} else {
$result = $this->actioncomm->fetch($id);

View File

@ -207,8 +207,8 @@ if (empty($reshook)) {
$substitutionarray['__OTHER4__'] = $other4;
$substitutionarray['__OTHER5__'] = $other5;
$substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($obj->tag).'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid.'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid.'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
$onlinepaymentenabled = 0;
if (!empty($conf->paypal->enabled)) {

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Pierre-Henry Favre <support@atm-consulting.fr>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1116,7 +1116,7 @@ if ($resql) {
print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center ");
}
if (!empty($arrayfields['bu.label']['checked'])) {
print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], 'bu.label', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['ba.ref']['checked'])) {
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder);
@ -1420,6 +1420,7 @@ if ($resql) {
} elseif ($links[$key]['type'] == 'member') {
} elseif ($links[$key]['type'] == 'sc') {
} elseif ($links[$key]['type'] == 'vat') {
} elseif ($links[$key]['type'] == 'salary') {
} else {
// Show link with label $links[$key]['label']
if (!empty($objp->label) && !empty($links[$key]['label'])) {

View File

@ -315,10 +315,11 @@ if ($result) {
$i++;
// Bank account
print '<tr><td class="titlefield">'.$langs->trans("Account").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Account").'</td>';
print '<td>';
if (!$objp->rappro && !$bankline->getVentilExportCompta()) {
$form->select_comptes($acct->id, 'accountid', 0, '', 0);
print img_picto('', 'bank_account', 'class="paddingright"');
print $form->select_comptes($acct->id, 'accountid', 0, '', 0, '', 0, '', 1);
} else {
print $acct->getNomUrl(1, 'transactions', 'reflabel');
}
@ -367,6 +368,11 @@ if ($result) {
print img_object($langs->trans('VATDeclaration'), 'bill').' ';
print $langs->trans("VATDeclaration").($links[$key]['label'] ? '&nbsp;'.$links[$key]['label'] : '');
print '</a>';
} elseif ($links[$key]['type'] == 'salary') {
print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('Salary'), 'bill').' ';
print $langs->trans("Salary").($links[$key]['label'] ? ' - '.$links[$key]['label'] : '');
print '</a>';
} elseif ($links[$key]['type'] == 'payment_sc') {
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('Payment'), 'payment').' ';
@ -378,7 +384,7 @@ if ($result) {
print $langs->trans("VATPayment");
print '</a>';
} elseif ($links[$key]['type'] == 'payment_salary') {
print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
print '<a href="'.DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$links[$key]['url_id'].'">';
print img_object($langs->trans('PaymentSalary'), 'payment').' ';
print $langs->trans("SalaryPayment");
print '</a>';
@ -561,7 +567,7 @@ if ($result) {
// Bank line
print '<tr><td class="toptd">'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print "</td></tr>";
}

View File

@ -6,6 +6,7 @@
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,7 +32,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -84,7 +85,7 @@ if (!$sortorder) {
$tva_static = new Tva($db);
$socialcontrib = new ChargeSociales($db);
$payment_sc_static = new PaymentSocialContribution($db);
$sal_static = new PaymentSalary($db);
$sal_static = new Salary($db);
$accountstatic = new Account($db);
llxHeader('', $langs->trans("SpecialExpensesArea"));
@ -414,6 +415,8 @@ while ($j < $numlt) {
$num = $db->num_rows($result);
$i = 0;
$total = 0;
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="120"', $sortfield, $sortorder);
@ -455,6 +458,8 @@ while ($j < $numlt) {
print "</tr>";
print "</table>";
print '</div>';
$db->free($result);
} else {
dol_print_error($db);
@ -463,115 +468,6 @@ while ($j < $numlt) {
$j++;
}
// Payment Salary
/*
if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
{
$sal = new PaymentSalary($db);
print "<br>";
print load_fiche_titre($langs->trans("SalariesPayments").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,";
$sql .= " pct.code as payment_code,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id";
$sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE s.entity IN (".getEntity('user').")";
$sql .= " AND u.rowid = s.fk_user";
if ($year > 0)
{
$sql .= " AND (s.datesp between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
$sql .= " OR s.dateep between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."')";
}
if (preg_match('/^s\./', $sortfield)) $sql .= $db->order($sortfield, $sortorder);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$total = 0;
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "s.dateep", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "s.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
if (!empty($conf->banque->enabled)) print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print "</tr>\n";
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td class="left">'.dol_print_date($db->jdate($obj->dateep), 'day').'</td>'."\n";
print "<td>".$obj->label."</td>\n";
// Ref payment
$sal_static->id = $obj->rowid;
$sal_static->ref = $obj->rowid;
print '<td class="left">'.$sal_static->getNomUrl(1)."</td>\n";
// Date
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
// Type payment
print '<td>';
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
print $obj->num_payment.'</td>';
// Account
if (!empty($conf->banque->enabled))
{
print '<td>';
if ($obj->fk_bank > 0)
{
//$accountstatic->fetch($obj->fk_bank);
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;
$accountstatic->accountancy_number = $obj->account_number;
$accountstatic->accountancy_journal = $obj->accountancy_journal;
$accountstatic->label = $obj->blabel;
print $accountstatic->getNomUrl(1);
} else print '&nbsp;';
print '</td>';
}
// Paid
print '<td class="right">'.price($obj->amount)."</td>";
print "</tr>\n";
$i++;
}
print '<tr class="liste_total"><td colspan="6">'.$langs->trans("Total").'</td>';
print '<td class="right">'.price($total)."</td>";
print "</tr>";
print "</table>";
$db->free($result);
print "<br>";
} else {
dol_print_error($db);
}
}
*/
print '</form>';
$parameters = array('user' => $user);

View File

@ -79,19 +79,22 @@ class FactureRec extends CommonInvoice
*/
public $title;
public $socid;
public $number;
public $date;
public $remise;
public $remise_absolue;
public $remise_percent;
public $tva;
public $total;
public $db_table;
public $propalid;
public $date_last_gen;
public $date_when;
public $nb_gen_done;
public $nb_gen_max;
public $user_author;
/**
* @var int Frequency
*/
@ -107,8 +110,22 @@ class FactureRec extends CommonInvoice
public $usenewprice = 0;
public $date_lim_reglement;
public $cond_reglement_code; // Code in llx_c_paiement
public $mode_reglement_code; // Code in llx_c_paiement
public $suspended; // status
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice
public $generate_pdf; // 1 to generate PDF on invoice generation (default)
/**
* @var int 1 if status is draft
* @deprecated
*/
public $brouillon;
/**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
@ -335,14 +352,20 @@ class FactureRec extends CommonInvoice
$facsrc->lines[$i]->special_code,
$facsrc->lines[$i]->label,
$facsrc->lines[$i]->fk_unit,
$facsrc->lines[$i]->multicurrency_subprice
$facsrc->lines[$i]->multicurrency_subprice,
0,
0,
null,
$facsrc->lines[$i]->pa_ht
);
if ($result_insert < 0) {
$error++;
} else {
$objectline = new FactureLigneRec($this->db);
if ($objectline->fetch($result_insert)) {
$result2 = $objectline->fetch($result_insert);
if ($result2 > 0) {
// Extrafields
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->id);
@ -353,6 +376,9 @@ class FactureRec extends CommonInvoice
if ($result < 0) {
$error++;
}
} elseif ($result2 < 0) {
$this->errors[] = $objectline->error;
$error++;
}
}
}
@ -403,6 +429,7 @@ class FactureRec extends CommonInvoice
if ($error) {
$this->db->rollback();
return -3;
} else {
$this->db->commit();
return $this->id;
@ -494,14 +521,15 @@ class FactureRec extends CommonInvoice
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')';
if ($rowid) {
$sql .= ' AND f.rowid='.$rowid;
$sql .= ' AND f.rowid='.((int) $rowid);
} elseif ($ref) {
$sql .= " AND f.titre='".$this->db->escape($ref)."'";
} else {
$sql .= ' AND f.rowid = 0';
}
/* This field are not used for template invoice
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
*/
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
*/
$result = $this->db->query($sql);
if ($result) {
@ -513,11 +541,7 @@ class FactureRec extends CommonInvoice
$this->titre = $obj->title; // deprecated
$this->title = $obj->title;
$this->ref = $obj->title;
$this->ref_client = $obj->ref_client;
$this->suspended = $obj->suspended;
$this->type = $obj->type;
$this->datep = $obj->dp;
$this->date = $obj->df;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->remise = $obj->remise;
@ -526,9 +550,6 @@ class FactureRec extends CommonInvoice
$this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total_ttc;
$this->paye = $obj->paye;
$this->close_code = $obj->close_code;
$this->close_note = $obj->close_note;
$this->socid = $obj->fk_soc;
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement;
@ -540,14 +561,12 @@ class FactureRec extends CommonInvoice
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
$this->fk_project = $obj->fk_project;
$this->fk_account = $obj->fk_account;
$this->fk_facture_source = $obj->fk_facture_source;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author;
$this->modelpdf = $obj->model_pdf; // deprecated
$this->model_pdf = $obj->model_pdf;
$this->rang = $obj->rang;
$this->special_code = $obj->special_code;
//$this->special_code = $obj->special_code;
$this->frequency = $obj->frequency;
$this->unit_frequency = $obj->unit_frequency;
$this->date_when = $this->db->jdate($obj->date_when);
@ -629,11 +648,8 @@ class FactureRec extends CommonInvoice
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, ';
$sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
$sql .= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
//$sql.= ' l.situation_percent, l.fk_prev_id,';
//$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql .= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price, l.buy_price_ht as pa_ht,';
$sql .= ' l.rang, l.special_code,';
//$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql .= ' l.fk_unit, l.fk_contract_line,';
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
@ -655,12 +671,12 @@ class FactureRec extends CommonInvoice
$line->rowid = $objp->rowid;
$line->desc = $objp->description; // Description line
$line->description = $objp->description; // Description line
$line->product_type = $objp->product_type; // Type of line
$line->ref = $objp->product_ref; // Ref product
$line->product_ref = $objp->product_ref; // Ref product
$line->libelle = $objp->product_label; // deprecated
$line->product_label = $objp->product_label; // Label product
$line->product_desc = $objp->product_desc; // Description product
$line->product_type = $objp->product_type; // Type of line
$line->fk_product_type = $objp->fk_product_type; // Type of product
$line->qty = $objp->qty;
$line->subprice = $objp->subprice;
@ -674,7 +690,7 @@ class FactureRec extends CommonInvoice
$line->localtax1_type = $objp->localtax1_type;
$line->localtax2_type = $objp->localtax2_type;
$line->remise_percent = $objp->remise_percent;
$line->fk_remise_except = $objp->fk_remise_except;
//$line->fk_remise_except = $objp->fk_remise_except;
$line->fk_product = $objp->fk_product;
$line->date_start_fill = $objp->date_start_fill;
$line->date_end_fill = $objp->date_end_fill;
@ -682,10 +698,16 @@ class FactureRec extends CommonInvoice
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_ttc = $objp->total_ttc;
//$line->code_ventilation = $objp->fk_code_ventilation;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price;
$line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $objp->fk_product_fournisseur_price, $objp->pa_ht);
$line->buyprice = $marginInfos[0];
$line->pa_ht = $marginInfos[0]; // For backward compatibility
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$line->rang = $objp->rang;
@ -821,6 +843,7 @@ class FactureRec extends CommonInvoice
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg)) {
$vat_src_code = $reg[1];
@ -1261,6 +1284,8 @@ class FactureRec extends CommonInvoice
$facture->type = self::TYPE_STANDARD;
$facture->brouillon = 1;
$facture->statut = self::STATUS_DRAFT;
$facture->status = self::STATUS_DRAFT;
$facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
$facture->socid = $facturerec->socid;
@ -1586,6 +1611,7 @@ class FactureRec extends CommonInvoice
// Initialize parameters
$this->id = 0;
$this->ref = 'SPECIMEN';
$this->title = 'SPECIMEN';
$this->specimen = 1;
$this->socid = 1;
$this->date = $nownotime;
@ -1896,6 +1922,18 @@ class FactureLigneRec extends CommonInvoiceLine
public $table_element = 'facturedet_rec';
public $fk_product_fournisseur_price;
public $fk_fournprice; // For backward compatibility
public $rang;
public $desc;
public $description;
public $fk_product_type; // Use instead product_type
public $fk_contract_line;
/**
* Delete line in database
@ -1962,6 +2000,10 @@ class FactureLigneRec extends CommonInvoiceLine
$sql .= ' l.date_start_fill, l.date_end_fill, l.info_bits, l.total_ht, l.total_tva, l.total_ttc,';
$sql .= ' l.rang, l.special_code,';
$sql .= ' l.fk_unit, l.fk_contract_line,';
$sql .= ' l.import_key, l.fk_multicurrency,';
$sql .= ' l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
$sql .= ' l.buy_price_ht, l.fk_product_fournisseur_price,';
$sql .= ' l.fk_user_author, l.fk_user_modif,';
$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet_rec as l';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
@ -2008,7 +2050,19 @@ class FactureLigneRec extends CommonInvoiceLine
$this->special_code = $objp->special_code;
$this->fk_unit = $objp->fk_unit;
$this->fk_contract_line = $objp->fk_contract_line;
$this->import_key = $objp->import_key;
$this->fk_multicurrency = $objp->fk_multicurrency;
$this->multicurrency_code = $objp->multicurrency_code;
$this->multicurrency_subprice = $objp->multicurrency_subprice;
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$this->buy_price_ht = $objp->buy_price_ht;
$this->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price;
$this->fk_user_author = $objp->fk_user_author;
$this->fk_user_modif = $objp->fk_user_modif;
$this->db->free($result);
return 1;

View File

@ -99,6 +99,12 @@ class Facture extends CommonInvoice
*/
protected $table_ref_field = 'ref';
/**
* @var int 1 if status is draft
* @deprecated
*/
public $brouillon;
/**
* @var int thirdparty ID
*/
@ -171,6 +177,7 @@ class Facture extends CommonInvoice
//! id of source invoice if replacement invoice or credit note
public $fk_facture_source;
public $linked_objects = array();
public $date_lim_reglement;
public $cond_reglement_code; // Code in llx_c_paiement
public $mode_reglement_code; // Code in llx_c_paiement
@ -446,6 +453,8 @@ class Facture extends CommonInvoice
$this->mode_reglement_id = 0;
}
$this->brouillon = 1;
$this->status = self::STATUS_DRAFT;
$this->statut = self::STATUS_DRAFT;
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) {
@ -537,6 +546,8 @@ class Facture extends CommonInvoice
$this->mode_reglement_id = 0;
}
$this->brouillon = 1;
$this->status = self::STATUS_DRAFT;
$this->statut = self::STATUS_DRAFT;
$this->linked_objects = $_facrec->linkedObjectsIds;
// We do not add link to template invoice or next invoice will be linked to all generated invoices
@ -917,8 +928,9 @@ class Facture extends CommonInvoice
$localtax1_tx = $_facrec->lines[$i]->localtax1_tx;
$localtax2_tx = $_facrec->lines[$i]->localtax2_tx;
$fk_product_fournisseur_price = empty($_facrec->lines[$i]->fk_product_fournisseur_price) ?null:$_facrec->lines[$i]->fk_product_fournisseur_price;
$fk_product_fournisseur_price = empty($_facrec->lines[$i]->fk_product_fournisseur_price) ? null : $_facrec->lines[$i]->fk_product_fournisseur_price;
$buyprice = empty($_facrec->lines[$i]->buyprice) ? 0 : $_facrec->lines[$i]->buyprice;
// If buyprice not defined from template invoice, we try to guess the best value
if (!$buyprice && $_facrec->lines[$i]->fk_product > 0) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
@ -1682,7 +1694,7 @@ class Facture extends CommonInvoice
$this->fetchPreviousNextSituationInvoice();
}
if ($this->statut == self::STATUS_DRAFT) {
if ($this->status == self::STATUS_DRAFT) {
$this->brouillon = 1;
}
@ -2583,8 +2595,8 @@ class Facture extends CommonInvoice
$this->fetch_lines();
// Check parameters
if (!$this->brouillon) {
dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING);
if ($this->statut != self::STATUS_DRAFT) {
dol_syslog(get_class($this)."::validate status is not draft. operation canceled.", LOG_WARNING);
return 0;
}
if (count($this->lines) <= 0) {
@ -2848,6 +2860,7 @@ class Facture extends CommonInvoice
$this->ref = $num;
$this->ref = $num;
$this->statut = self::STATUS_VALIDATED;
$this->status = self::STATUS_VALIDATED;
$this->brouillon = 0;
$this->date_validation = $now;
$i = 0;
@ -2886,7 +2899,7 @@ class Facture extends CommonInvoice
* Update price of next invoice
*
* @param Translate $langs Translate object
* @return bool false if KO, true if OK
* @return bool false if KO, true if OK
*/
public function updatePriceNextInvoice(&$langs)
{
@ -2899,6 +2912,7 @@ class Facture extends CommonInvoice
}
$next_invoice->brouillon = 1;
foreach ($next_invoice->lines as $line) {
$result = $next_invoice->updateline(
$line->id,
@ -2994,12 +3008,14 @@ class Facture extends CommonInvoice
$old_statut = $this->statut;
$this->brouillon = 1;
$this->statut = self::STATUS_DRAFT;
$this->status = self::STATUS_DRAFT;
// Call trigger
$result = $this->call_trigger('BILL_UNVALIDATE', $user);
if ($result < 0) {
$error++;
$this->statut = $old_statut;
$this->status = $old_statut;
$this->brouillon = 0;
}
// End call triggers
@ -3361,7 +3377,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::updateline rowid=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, type=$type, fk_parent_line=$fk_parent_line pa_ht=$pa_ht, special_code=$special_code, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
if ($this->brouillon) {
if ($this->statut == self::STATUS_DRAFT) {
if (!$this->is_last_in_cycle() && empty($this->error)) {
if (!$this->checkProgressLine($rowid, $situation_percent)) {
if (!$this->error) {
@ -3630,7 +3646,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
if (!$this->brouillon) {
if ($this->statut != self::STATUS_DRAFT) {
$this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
return -1;
}

View File

@ -364,8 +364,9 @@ if ($action == 'new') {
print '</form>';
print '<br>';
$sql = "SELECT ba.rowid as bid, b.datec as datec, b.dateo as date, b.rowid as transactionid, ";
$sql .= " b.amount, ba.label, b.emetteur, b.num_chq, b.banque,";
$sql = "SELECT ba.rowid as bid, ba.label,";
$sql .= " b.rowid as transactionid, b.label as transactionlabel, b.datec as datec, b.dateo as date, ";
$sql .= " b.amount, b.emetteur, b.num_chq, b.banque,";
$sql .= " p.rowid as paymentid, p.ref as paymentref";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
@ -393,6 +394,8 @@ if ($action == 'new') {
$lines[$obj->bid][$i]["numero"] = $obj->num_chq;
$lines[$obj->bid][$i]["banque"] = $obj->banque;
$lines[$obj->bid][$i]["id"] = $obj->transactionid;
$lines[$obj->bid][$i]["ref"] = $obj->transactionid;
$lines[$obj->bid][$i]["label"] = $obj->transactionlabel;
$lines[$obj->bid][$i]["paymentid"] = $obj->paymentid;
$lines[$obj->bid][$i]["paymentref"] = $obj->paymentref;
$i++;
@ -473,8 +476,9 @@ if ($action == 'new') {
print '</td>';
// Link to bank transaction
print '<td class="center">';
$accountlinestatic->rowid = $value["id"];
if ($accountlinestatic->rowid) {
$accountlinestatic->id = $value["id"];
$accountlinestatic->ref = $value["ref"];
if ($accountlinestatic->id > 0) {
print $accountlinestatic->getNomUrl(1);
} else {
print '&nbsp;';
@ -594,7 +598,7 @@ if ($action == 'new') {
// List of bank checks
$sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,";
$sql = "SELECT b.rowid, b.rowid as ref, b.label, b.amount, b.num_chq, b.emetteur,";
$sql .= " b.dateo as date, b.datec as datec, b.banque,";
$sql .= " p.rowid as pid, p.ref as pref, ba.rowid as bid, p.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
@ -648,8 +652,9 @@ if ($action == 'new') {
print '</td>';
// Link to bank transaction
print '<td class="center">';
$accountlinestatic->rowid = $objp->rowid;
if ($accountlinestatic->rowid) {
$accountlinestatic->id = $objp->rowid;
$accountlinestatic->ref = $objp->ref;
if ($accountlinestatic->id > 0) {
print $accountlinestatic->getNomUrl(1);
} else {
print '&nbsp;';

View File

@ -323,7 +323,7 @@ if ($action == 'create') {
print $langs->trans("Date");
print '</td>';
print '<td>';
print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1);
print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1, 1);
print '</td>';
print "</tr>\n";
@ -536,10 +536,10 @@ if ($id > 0) {
// Amount
if ($action == 'edit') {
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td>";
print '<input type="text" name="amount" size="12" class="flat" value="'.$object->amount.'">';
print '<input type="text" name="amount" size="12" class="flat" value="'.price($object->amount).'">';
print "</td></tr>";
} else {
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'</td></tr>';
}
// Mode of payment

View File

@ -6,6 +6,7 @@
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,7 +32,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
@ -95,7 +96,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$tva_static = new Tva($db);
$socialcontrib = new ChargeSociales($db);
$payment_sc_static = new PaymentSocialContribution($db);
$sal_static = new PaymentSalary($db);
$sal_static = new Salary($db);
$accountstatic = new Account($db);
$formsocialcontrib = new FormSocialContrib($db);

2
htdocs/compta/tva/card.php Normal file → Executable file
View File

@ -549,7 +549,7 @@ if ($id) {
print '</td></tr>';
if ($action == 'edit') {
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . $object->amount . '"></td></tr>';
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . price($object->amount) . '"></td></tr>';
} else {
print '<tr><td>' . $langs->trans("Amount") . '</td><td>' . price($object->amount) . '</td></tr>';
}

View File

@ -1469,9 +1469,13 @@ class Contact extends CommonObject
$result .= $linkstart;
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto == -2) {
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($moreparam ? ' '.$moreparam : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
} else {
$result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
}
}
if ($withpicto != 2) {
if ($withpicto != 2 && $withpicto != -2) {
$result .= ($maxlen ?dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs));
}
$result .= $linkend;

View File

@ -74,9 +74,9 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
$value = GETPOST($key, 'restricthtml');
} elseif ($object->fields[$key]['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
} elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel');
} elseif ($object->fields[$key]['type'] == 'duration') {
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
@ -174,9 +174,9 @@ if ($action == 'update' && !empty($permissiontoadd)) {
$value = GETPOST($key, 'restricthtml');
}
} elseif ($object->fields[$key]['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
} elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel');
} elseif ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
$value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int');

View File

@ -92,7 +92,7 @@ class box_members extends ModeleBoxes
$sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql .= ' a.photo, a.email, a.gender, a.morphy,';
$sql .= " t.subscription";
$sql .= " t.subscription, t.libelle as label";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE a.entity IN (".getEntity('member').")";
$sql .= " AND a.fk_adherent_type = t.rowid";

View File

@ -0,0 +1,277 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Frederic 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
* 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/core/boxes/box_members_by_type.php
* \ingroup adherent
* \brief Module to show box of members
*/
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last modofied members
*/
class box_members_by_type extends ModeleBoxes
{
public $boxcode = "box_members_by_type";
public $boximg = "object_user";
public $boxlabel = "BoxMembersByType";
public $depends = array("adherent");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $conf, $user;
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
$this->enabled = 0; // disabled for external users
}
$this->hidden = !($user->rights->adherent->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
$staticmember = new Adherent($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByType", $max));
if ($user->rights->adherent->lire) {
$MembersToValidate = array();
$MembersValidated = array();
$MemberUpToDate = array();
$MembersResiliated = array();
$SommeA = 0;
$SommeB = 0;
$SommeC = 0;
$SommeD = 0;
$AdherentType = array();
// Type of membership
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
$sql .= " d.statut, count(d.rowid) as somme";
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent_type as t";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "adherent as d";
$sql .= " ON t.rowid = d.fk_adherent_type";
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
$sql .= " WHERE t.entity IN (" . getEntity('member_type') . ")";
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$adhtype = new AdherentType($this->db);
$adhtype->id = $objp->rowid;
$adhtype->subscription = $objp->subscription;
$adhtype->label = $objp->label;
$AdherentType[$objp->rowid] = $adhtype;
if ($objp->statut == -1) {
$MembersToValidate[$objp->rowid] = $objp->somme;
}
if ($objp->statut == 1) {
$MembersValidated[$objp->rowid] = $objp->somme;
}
if ($objp->statut == 0) {
$MembersResiliated[$objp->rowid] = $objp->somme;
}
$i++;
}
$this->db->free($result);
$now = dol_now();
// Members up to date list
// current rule: uptodate = the end date is in future whatever is type
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "adherent_type as t";
$sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND d.statut = 1 AND (d.datefin >= '" . $this->db->idate($now) . "' OR t.subscription = 0)";
$sql .= " AND t.rowid = d.fk_adherent_type";
$sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$num2 = $this->db->num_rows($result);
$i = 0;
while ($i < $num2) {
$objp = $this->db->fetch_object($result);
$MemberUpToDate[$objp->fk_adherent_type] = $objp->somme;
$i++;
}
$this->db->free($result);
}
$line = 0;
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_titre"',
'text' => $langs->trans("MembersTypes"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("MembersStatusToValid"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("OutOfDate"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("UpToDate"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("MembersStatusResiliated"),
);
$line++;
foreach ($AdherentType as $key => $adhtype) {
$SommeA += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
$SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
$SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
$SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $adhtype->getNomUrl(1, dol_size(32)),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(-1, $adhtype->subscription, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(1, $adhtype->subscription, 0, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(1, $adhtype->subscription, $now, 3),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(0, $adhtype->subscription, 0, 3),
'asis' => 1,
);
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoRecordedMembersByType"),
);
} else {
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total"',
'text' => $langs->trans("Total"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength' => 500,
'text' => ($this->db->error() . ' sql=' . $sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -0,0 +1,197 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Frederic 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
* 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/core/boxes/box_last_modified_members.php
* \ingroup adherent
* \brief Module to show box of members
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last modofied members
*/
class box_last_modified_members extends ModeleBoxes
{
public $boxcode = "box_last_modified_members";
public $boximg = "object_user";
public $boxlabel = "BoxLastModifiedMembers";
public $depends = array("adherent");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $conf, $user;
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
$this->enabled = 0; // disabled for external users
}
$this->hidden = !($user->rights->adherent->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
$memberstatic = new Adherent($this->db);
$statictype = new AdherentType($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max));
if ($user->rights->adherent->lire) {
$sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql .= ' a.photo, a.email, a.gender, a.morphy,';
$sql .= " t.rowid as typeid, t.subscription, t.libelle as label";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE a.entity IN (".getEntity('member').")";
$sql .= " AND a.fk_adherent_type = t.rowid";
$sql .= " ORDER BY a.tms DESC";
$sql .= $this->db->plimit($max, 0);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$objp = $this->db->fetch_object($result);
$datec = $this->db->jdate($objp->datec);
$datem = $this->db->jdate($objp->tms);
$memberstatic->lastname = $objp->lastname;
$memberstatic->firstname = $objp->firstname;
$memberstatic->id = $objp->rowid;
$memberstatic->ref = $objp->ref;
$memberstatic->photo = $objp->photo;
$memberstatic->gender = $objp->gender;
$memberstatic->email = $objp->email;
$memberstatic->morphy = $objp->morphy;
$memberstatic->company = $objp->company;
$memberstatic->statut = $objp->status;
$memberstatic->need_subscription = $objp->subscription;
$memberstatic->datefin = $this->db->jdate($objp->date_end_subscription);
if (!empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty();
$memberstatic->name = $memberstatic->thirdparty->name;
} else {
$memberstatic->name = $objp->company;
}
$statictype->id = $objp->typeid;
$statictype->label = $objp->label;
$statictype->subscription = $objp->subscription;
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $memberstatic->getNomUrl(-1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $statictype->getNomUrl(1, 32),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($datem, "day"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $this->db->jdate($objp->date_end_subscription), 3),
);
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedCustomers"),
);
}
$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -0,0 +1,202 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2020 Frederic 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
* 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/core/boxes/box_last_members_subscriptions.php
* \ingroup adherent
* \brief Module to show box of members
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last modofied members
*/
class box_last_members_subscriptions extends ModeleBoxes
{
public $boxcode = "box_last_members_subscriptions";
public $boximg = "object_user";
public $boxlabel = "BoxLastMembersSubscriptions";
public $depends = array("adherent");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $conf, $user;
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
$this->enabled = 0; // disabled for external users
}
$this->hidden = !($user->rights->adherent->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$staticmember = new Adherent($this->db);
$statictype = new AdherentType($this->db);
$subscriptionstatic = new Subscription($this->db);
$this->info_box_head = array('text' => $langs->trans("LastSubscriptionsModified", $max));
if ($user->rights->adherent->lire) {
$sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql .= " a.gender, a.email, a.photo, a.morphy,";
$sql .= " a.datefin as date_end_subscription,";
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
$sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta, ".MAIN_DB_PREFIX."subscription as c";
$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
$sql .= " AND a.fk_adherent_type = ta.rowid";
$sql .= " AND c.fk_adherent = a.rowid";
$sql .= $this->db->order("c.tms", "DESC");
$sql .= $this->db->plimit($max, 0);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$line = 0;
while ($line < $num) {
$obj = $this->db->fetch_object($result);
$staticmember->id = $obj->rowid;
$staticmember->ref = $obj->rowid;
$staticmember->lastname = $obj->lastname;
$staticmember->firstname = $obj->firstname;
$staticmember->gender = $obj->gender;
$staticmember->email = $obj->email;
$staticmember->photo = $obj->photo;
$staticmember->morphy = $obj->morphy;
$staticmember->statut = $obj->status;
$staticmember->need_subscription = $obj->need_subscription;
$staticmember->datefin = $this->db->jdate($obj->date_end_subscription);
if (!empty($obj->fk_soc)) {
$staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty();
$staticmember->name = $staticmember->thirdparty->name;
} else {
$staticmember->name = $obj->company;
}
$subscriptionstatic->id = $obj->cid;
$subscriptionstatic->ref = $obj->cid;
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
'text' => $subscriptionstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => $staticmember->getNomUrl(-1, 32, 'subscription'),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end)),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => price($obj->subscription),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right tdoverflowmax150 maxwidth150onsmartphone"',
'text' => dol_print_date($this->db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour'),
);
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedCustomers"),
);
}
$this->db->free($result);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -0,0 +1,242 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2021 Frederic 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
* 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/core/boxes/box_members_subscriptions_by_year.php
* \ingroup adherent
* \brief Module to show box of members
*/
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last modofied members
*/
class box_members_subscriptions_by_year extends ModeleBoxes
{
public $boxcode = "box_members_subscriptions_by_year";
public $boximg = "object_user";
public $boxlabel = "BoxMembersSubscriptionsByYear";
public $depends = array("adherent");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $conf, $user;
$this->db = $db;
// disable module for such cases
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
$this->enabled = 0; // disabled for external users
}
$this->hidden = !($user->rights->adherent->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $user, $langs, $conf;
$langs->load("boxes");
$this->max = $max;
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
$memberstatic = new Adherent($this->db);
$statictype = new AdherentType($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersSubscriptionsByYear", $max));
if ($user->rights->adherent->lire) {
$num = 0;
$line = 0;
// List of subscription by year
$Total = array();
$Number = array();
$tot = 0;
$numb = 0;
$sql = "SELECT c.subscription, c.dateadh as dateh";
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "subscription as c";
$sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND d.rowid = c.fk_adherent";
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
$tot += $objp->subscription;
$numb += 1;
$i++;
}
$line = 0;
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_titre"',
'text' => $langs->trans("Year"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("Subscriptions"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("AmountTotal"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $langs->trans("AmountAverage"),
);
$line++;
krsort($Total);
$i = 0;
foreach ($Total as $key => $value) {
if ($i >= 8) {
// print '<tr class="oddeven">';
// print "<td>...</td>";
// print "<td class=\"right\"></td>";
// print "<td class=\"right\"></td>";
// print "<td class=\"right\"></td>";
// print "</tr>\n";
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => '...',
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => '',
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => '',
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => '',
);
$line++;
break;
}
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
'text' => '<a href="./subscription/list.php?date_select='.$key.'">'.$key.'</a>',
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => $Number[$key],
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => price($value),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => price(price2num($value / $Number[$key], 'MT')),
);
$line++;
}
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text' => $langs->trans("NoRecordedMembers"),
);
} else {
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total"',
'text' => $langs->trans("Total"),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => $numb,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => price($tot),
);
$this->info_box_contents[$line][] = array(
'td' => 'class="liste_total right"',
'text' => price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength' => 500,
'text' => ($this->db->error() . ' sql=' . $sql),
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -786,6 +786,14 @@ abstract class CommonDocGenerator
$resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
// Load product data optional fields to the line -> enables to use "line_product_options_{extrafield}"
if (isset($line->fk_product) && $line->fk_product > 0) {
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($line->fk_product);
foreach ($tmpproduct->array_options as $key=>$label)
$resarray["line_product_".$key] = $label;
}
return $resarray;
}

View File

@ -875,6 +875,13 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $subprice;
/**
* Unit price before taxes
* @var float
* @deprecated
*/
public $price;
/**
* Id of corresponding product
* @var int
@ -905,12 +912,31 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $localtax2_tx;
/**
* Local tax 1 type
* @var string
*/
public $localtax1_type;
/**
* Local tax 2 type
* @var string
*/
public $localtax2_type;
/**
* Percent of discount
* @var float
*/
public $remise_percent;
/**
* Fixed discount
* @var float
* @deprecated
*/
public $remise;
/**
* Total amount before taxes
* @var float
@ -944,6 +970,13 @@ abstract class CommonInvoiceLine extends CommonObjectLine
public $date_start_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_start at creation
public $date_end_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_end at creation
public $buy_price_ht;
public $buyprice; // For backward compatibility
public $pa_ht; // For backward compatibility
public $marge_tx;
public $marque_tx;
/**
* List of cumulative options:
* Bit 0: 0 for common VAT - 1 if VAT french NPR
@ -960,4 +993,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
public $fk_user_author;
public $fk_user_modif;
}

View File

@ -2237,6 +2237,9 @@ abstract class CommonObject
if (get_class($this) == 'Tva') {
$fieldname = 'fk_typepayment';
}
if (get_class($this) == 'Salary') {
$fieldname = 'fk_typepayment';
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
@ -6452,11 +6455,10 @@ abstract class CommonObject
}
}
if (in_array($type, array('date', 'datetime'))) {
if (in_array($type, array('date'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
$showtime = in_array($type, array('datetime')) ? 1 : 0;
$showtime = 0;
// Do not show current date when field not required (see selectDate() method)
if (!$required && $value == '') {
@ -6465,6 +6467,16 @@ abstract class CommonObject
// TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
} elseif (in_array($type, array('datetime'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
$showtime = 1;
// Do not show current date when field not required (see selectDate() method)
if (!$required && $value == '') $value = '-1';
// TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1, '', '', '', 1, '', '', 'tzuserrel');
} elseif (in_array($type, array('duration'))) {
$out = $form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1);
} elseif (in_array($type, array('int', 'integer'))) {
@ -7022,13 +7034,13 @@ abstract class CommonObject
$value = $this->getLibStatut(3);
} elseif ($type == 'date') {
if (!empty($value)) {
$value = dol_print_date($value, 'day');
$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
} else {
$value = '';
}
} elseif ($type == 'datetime' || $type == 'timestamp') {
if (!empty($value)) {
$value = dol_print_date($value, 'dayhour');
$value = dol_print_date($value, 'dayhour', 'tzuserrel');
} else {
$value = '';
}
@ -7407,12 +7419,19 @@ abstract class CommonObject
}
// Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date', 'datetime'))) {
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date'))) {
$datenotinstring = $this->array_options['options_'.$key];
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
$datenotinstring = $this->db->jdate($datenotinstring);
}
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(12, 0, 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring;
}
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) {
$datenotinstring = $this->array_options['options_'.$key];
if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility
$datenotinstring = $this->db->jdate($datenotinstring);
}
$value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."sec", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3), 'tzuserrel') : $datenotinstring;
}
// Convert float submited string into real php numeric (value in memory must be a php numeric)
if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double'))) {
@ -8171,12 +8190,14 @@ abstract class CommonObject
*/
public function setVarsFromFetchObj(&$obj)
{
global $db;
foreach ($this->fields as $field => $info) {
if ($this->isDate($info)) {
if (empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') {
$this->{$field} = 0;
if (is_null($obj->{$field}) || $obj->{$field} === '' || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') {
$this->{$field} = '';
} else {
$this->{$field} = strtotime($obj->{$field});
$this->{$field} = $db->jdate($obj->{$field});
}
} elseif ($this->isArray($info)) {
if (!empty($obj->{$field})) {
@ -8234,12 +8255,21 @@ abstract class CommonObject
/**
* Function to concat keys of fields
*
* @return string
* @param string $alias String of alias of table for fields. For example 't'.
* @return string list of alias fields
*/
protected function getFieldList()
protected function getFieldList($alias = '')
{
$keys = array_keys($this->fields);
return implode(',', $keys);
if (!empty($alias)) {
$keys_with_alias = array();
foreach ($keys as $fieldname) {
$keys_with_alias[] = $alias . '.' . $fieldname;
}
return implode(',', $keys_with_alias);
} else {
return implode(',', $keys);
}
}
/**
@ -8441,23 +8471,23 @@ abstract class CommonObject
return -1;
}
$fieldlist = $this->getFieldList();
$fieldlist = $this->getFieldList('t');
if (empty($fieldlist)) {
return 0;
}
$sql = 'SELECT '.$fieldlist;
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if (!empty($id)) {
$sql .= ' WHERE rowid = '.$id;
$sql .= ' WHERE t.rowid = '.$id;
} elseif (!empty($ref)) {
$sql .= " WHERE ref = ".$this->quote($ref, $this->fields['ref']);
$sql .= " WHERE t.ref = ".$this->quote($ref, $this->fields['ref']);
} else {
$sql .= ' WHERE 1 = 1'; // usage with empty id and empty ref is very rare
}
if (empty($id) && isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= ' AND entity IN ('.getEntity($this->table_element).')';
$sql .= ' AND t.entity IN ('.getEntity($this->table_element).')';
}
if ($morewhere) {
$sql .= $morewhere;
@ -8501,9 +8531,9 @@ abstract class CommonObject
$objectline = new $objectlineclassname($this->db);
$sql = 'SELECT '.$objectline->getFieldList();
$sql = 'SELECT '.$objectline->getFieldList('l');
$sql .= ' FROM '.MAIN_DB_PREFIX.$objectline->table_element;
$sql .= ' WHERE fk_'.$this->element.' = '.$this->id;
$sql .= ' WHERE l.fk_'.$this->element.' = '.$this->id;
if ($morewhere) {
$sql .= $morewhere;
}

View File

@ -1062,11 +1062,10 @@ class ExtraFields
}
}
if (in_array($type, array('date', 'datetime'))) {
if (in_array($type, array('date'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
$showtime = in_array($type, array('datetime')) ? 1 : 0;
$showtime = 0;
// Do not show current date when field not required (see selectDate() method)
if (!$required && $value == '') {
@ -1079,16 +1078,41 @@ class ExtraFields
'start' => isset($value['start']) ? $value['start'] : '',
'end' => isset($value['end']) ? $value['end'] : ''
);
$out = '<div ' . ($moreparam ? $moreparam : '') . '><div class="nowrap">'
. $form->selectDate($prefill['start'], $keyprefix.$key.$keysuffix.'_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"))
. '</div><div class="nowrap">'
. $form->selectDate($prefill['end'], $keyprefix.$key.$keysuffix.'_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"))
. '</div></div>';
$out = '<div ' . ($moreparam ? $moreparam : '') . '><div class="nowrap">';
$out .= $form->selectDate($prefill['start'], $keyprefix.$key.$keysuffix.'_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
$out .= '</div><div class="nowrap">';
$out .= $form->selectDate($prefill['end'], $keyprefix.$key.$keysuffix.'_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
$out .= '</div></div>';
} else {
// TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
}
} elseif (in_array($type, array('int', 'integer'))) {
} elseif (in_array($type, array('datetime'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
$showtime = 1;
// Do not show current date when field not required (see selectDate() method)
if (!$required && $value == '') {
$value = '-1';
}
if ($mode == 1) {
// search filter on a date extrafield shows two inputs to select a date range
$prefill = array(
'start' => isset($value['start']) ? $value['start'] : '',
'end' => isset($value['end']) ? $value['end'] : ''
);
$out = '<div ' . ($moreparam ? $moreparam : '') . '><div class="nowrap">';
$out .= $form->selectDate($prefill['start'], $keyprefix.$key.$keysuffix.'_start', 1, 1, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"), 'tzuserrel');
$out .= '</div><div class="nowrap">';
$out .= $form->selectDate($prefill['end'], $keyprefix.$key.$keysuffix.'_end', 1, 1, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
$out .= '</div></div>';
} else {
// TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1, '', '', '', 1, '', '', 'tzuserrel');
}
} elseif (in_array($type, array('int', 'integer'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>';
@ -1611,10 +1635,10 @@ class ExtraFields
$showsize = 0;
if ($type == 'date') {
$showsize = 10;
$value = dol_print_date($value, 'day');
$value = dol_print_date($value, 'day'); // For date without hour, date is always GMT for storage and output
} elseif ($type == 'datetime') {
$showsize = 19;
$value = dol_print_date($value, 'dayhour');
$value = dol_print_date($value, 'dayhour', 'tzuserrel');
} elseif ($type == 'int') {
$showsize = 10;
} elseif ($type == 'double') {
@ -2064,12 +2088,10 @@ class ExtraFields
if (in_array($key_type, array('date'))) {
// Clean parameters
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
$value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
$value_key = dol_mktime(12, 0, 0, GETPOST("options_".$key."month", 'int'), GETPOST("options_".$key."day", 'int'), GETPOST("options_".$key."year", 'int'));
} elseif (in_array($key_type, array('datetime'))) {
// Clean parameters
// TODO GMT date in memory must be GMT so we should add gm=true in parameters
$value_key = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]);
$value_key = dol_mktime(GETPOST("options_".$key."hour", 'int'), GETPOST("options_".$key."min", 'int'), GETPOST("options_".$key."sec", 'int'), GETPOST("options_".$key."month", 'int'), GETPOST("options_".$key."day", 'int'), GETPOST("options_".$key."year", 'int'), 'tzuserrel');
} elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) {
$value_arr = GETPOST("options_".$key, 'array'); // check if an array
if (!empty($value_arr)) {
@ -2134,32 +2156,33 @@ class ExtraFields
$key_type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
}
if (in_array($key_type, array('date', 'datetime'))) {
if (in_array($key_type, array('date'))) {
$dateparamname_start = $keysuffix . 'options_' . $key . $keyprefix . '_start';
$dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end';
if (GETPOSTISSET($dateparamname_start . 'year') && GETPOSTISSET($dateparamname_end . 'year')) {
// values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc.
$value_key = array(
'start' => dol_mktime(
0,
0,
0,
GETPOST($dateparamname_start . 'month', 'int'),
GETPOST($dateparamname_start . 'day', 'int'),
GETPOST($dateparamname_start . 'year', 'int')
),
'end' => dol_mktime(
23,
59,
59,
GETPOST($dateparamname_end . 'month', 'int'),
GETPOST($dateparamname_end . 'day', 'int'),
GETPOST($dateparamname_end . 'year', 'int')
)
'start' => dol_mktime(0, 0, 0, GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int')),
'end' => dol_mktime(23, 59, 59, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'))
);
} elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) {
// Clean parameters
$value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'));
$value_key = dol_mktime(12, 0, 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'));
} else {
continue; // Value was not provided, we should not set it.
}
} elseif (in_array($key_type, array('datetime'))) {
$dateparamname_start = $keysuffix . 'options_' . $key . $keyprefix . '_start';
$dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end';
if (GETPOSTISSET($dateparamname_start . 'year') && GETPOSTISSET($dateparamname_end . 'year')) {
// values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc.
$value_key = array(
'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'),
'end' => dol_mktime(GETPOST($dateparamname_end . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel')
);
} elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) {
// Clean parameters
$value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."sec", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int'), 'tzuserrel');
} else {
continue; // Value was not provided, we should not set it.
}

View File

@ -120,7 +120,8 @@ class HookManager
if ($resaction) {
$controlclassname = 'Actions'.ucfirst($module);
$actionInstance = new $controlclassname($this->db);
$this->hooks[$context][$module] = $actionInstance;
$priority = empty($actionInstance->priority) ? 50 : $actionInstance->priority;
$this->hooks[$context][$priority.':'.$module] = $actionInstance;
}
}
}
@ -130,6 +131,10 @@ class HookManager
dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG);
}
if (!empty($this->hooks[$context])) {
ksort($this->hooks[$context], SORT_NATURAL);
}
return 1;
}
@ -238,8 +243,10 @@ class HookManager
$error = 0;
foreach ($this->hooks as $context => $modules) { // $this->hooks is an array with context as key and value is an array of modules that handle this context
if (!empty($modules)) {
// Loop on each active hooks of module for this context
foreach ($modules as $module => $actionclassinstance) {
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
$module = preg_replace('/^\d+:/', '', $module);
//print "Before hook ".get_class($actionclassinstance)." method=".$method." module=".$module." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
// test to avoid running twice a hook, when a module implements several active contexts
if (in_array($module, $modulealreadyexecuted)) {

View File

@ -1368,7 +1368,7 @@ class FormFile
// $section is inside $param
$newparam .= preg_replace('/&file=.*$/', '', $param); // We don't need param file=
$backtopage = DOL_URL_ROOT.'/ecm/index.php?&section_dir='.urlencode($relativepath).$newparam;
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'&backtopage='.urlencode($backtopage).'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
print '<a class="editfielda editfilelink" href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'&backtopage='.urlencode($backtopage).'" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
}
if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) { // 6=Media file manager
@ -1392,7 +1392,7 @@ class FormFile
if ($permtoeditline) {
$paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '&section_dir='.urlencode($relativepath) : '');
print '<a class="editfielda reposition" href="'.(($useinecm == 1 || $useinecm == 5) ? '#' : ($url.'?action=editfile&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" class="editfilelink" rel="'.$filepath.'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
print '<a class="editfielda reposition editfilelink" href="'.(($useinecm == 1 || $useinecm == 5) ? '#' : ($url.'?action=editfile&urlfile='.urlencode($filepath).$paramsectiondir.$param)).'" rel="'.$filepath.'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
}
}
if ($permonobject) {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -517,7 +518,7 @@ class FormTicket
print ' selected="selected"';
} elseif ($selected == $id) {
print ' selected="selected"';
} elseif ($arraytypes['use_default'] == "1" && !$empty) {
} elseif ($arraytypes['use_default'] == "1" && !$selected && !$empty) {
print ' selected="selected"';
}
@ -612,7 +613,7 @@ class FormTicket
print ' selected="selected"';
} elseif ($selected == $id) {
print ' selected="selected"';
} elseif ($arraycategories['use_default'] == "1" && !$empty) {
} elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) {
print ' selected="selected"';
}
@ -713,7 +714,7 @@ class FormTicket
print ' selected="selected"';
} elseif ($selected == $id) {
print ' selected="selected"';
} elseif ($arrayseverities['use_default'] == "1" && !$empty) {
} elseif ($arrayseverities['use_default'] == "1" && !$selected && !$empty) {
print ' selected="selected"';
}

View File

@ -40,6 +40,9 @@ class InfoBox
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
return array(
0 => 'Home',
1 => 'userhome',
2 => 'membersindex',
3 => 'thirdpartiesindex',
27 => 'AccountancyHome'
);
} else {
@ -151,7 +154,7 @@ class InfoBox
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
$box->sourcefile = $relsourcefile;
$box->class = $boxname;
$box->class = $boxname;
if ($mode == 'activated' && !is_object($user)) { // List of activated box was not yet personalized into database
if (is_numeric($box->box_order)) {

View File

@ -139,6 +139,7 @@ class Ldap
$this->groups = $conf->global->LDAP_GROUP_DN;
$this->filter = $conf->global->LDAP_FILTER_CONNECTION; // Filter on user
$this->filtergroup = $conf->global->LDAP_GROUP_FILTER; // Filter on groups
$this->filtermember = $conf->global->LDAP_MEMBER_FILTER; // Filter on member
// Users
@ -935,7 +936,7 @@ class Ldap
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
* @param string $useridentifier Name of key field (Ex: uid)
* @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword)
* @param int $activefilter '1' or 'user'=use field this->filter as filter instead of parameter $search, 'member'=use field this->filtermember as filter
* @param int $activefilter '1' or 'user'=use field this->filter as filter instead of parameter $search, 'group'=use field this->filtergroup as filter, 'member'=use field this->filtermember as filter
* @param array $attributeAsArray Array of fields wanted as an array not a string
* @return array Array of [id_record][ldap_field]=value
*/
@ -955,6 +956,8 @@ class Ldap
if (!empty($activefilter)) {
if (((string) $activefilter == '1' || (string) $activefilter == 'user') && $this->filter) {
$filter = '('.$this->filter.')';
} elseif (((string) $activefilter == 'group') && $this->filtergroup ) {
$filter = '('.$this->filtergroup.')';
} elseif (((string) $activefilter == 'member') && $this->filter) {
$filter = '('.$this->filtermember.')';
} else {

View File

@ -546,24 +546,28 @@ function dol_get_last_day($year, $month = 12, $gm = false)
* Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59)
*
* @param int $date Date GMT
* @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ,
* True or 1 or 'gmt' to compare with GMT date.
* @return int Date for last hour of a given date
*/
function dol_get_last_hour($date)
function dol_get_last_hour($date, $gm = 'tzserver')
{
$tmparray = dol_getdate($date);
return dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], false);
return dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], $gm);
}
/**
* Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
*
* @param int $date Date
* @param int $date Date GMT
* @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ,
* True or 1 or 'gmt' to compare with GMT date.
* @return int Date for last hour of a given date
*/
function dol_get_first_hour($date)
function dol_get_first_hour($date, $gm = 'tzserver')
{
$tmparray = dol_getdate($date);
return dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], false);
return dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], $gm);
}
/** Return first day of week for a date. First day of week may be monday if option MAIN_START_WEEK is 1.

View File

@ -1874,7 +1874,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
} else {
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
}
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva'))) {
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva', 'salary'))) {
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
$tmptxt = $object->getLibStatut(5, $object->totalpaye);
@ -3447,14 +3447,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'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', 'long-arrow-alt-right',
'intervention', 'inventory', 'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_asset', 'object_barcode', 'object_bill', 'object_billr', 'object_billa', 'object_billd', 'object_bom',
'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_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_inventory', 'object_label',
'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',
@ -3500,7 +3500,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'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',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'inventory'=>'boxes', 'label'=>'layer-group', 'loan'=>'money-bill-alt',
'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',
@ -3604,7 +3604,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'cog'=>'#999', 'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'dynamicprice'=>'#a69944',
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999', 'language'=>'#555',
'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'inventory'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944',
'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uparrow'=>'#555', 'user-cog'=>'#999', 'globe-americas'=>'#aaa',
@ -4277,7 +4277,7 @@ function img_searchclear($titlealt = 'default', $other = '')
* @param string $text Text info
* @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
* @param int $nodiv No div
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error','xxx'=Other
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error', 'warning', 'xxx'=Other
* @param string $morecss More CSS ('', 'warning', 'error')
* @param string $textfordropdown Show a text to click to dropdown the info box.
* @return string String with info text

View File

@ -806,7 +806,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
// Contacts of task
// Contacts of tasks. Disabled, because available by default just after
/*
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
print '<td>';
foreach (array('internal', 'external') as $source) {
@ -826,6 +827,36 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
print '</td>';
}*/
// Contacts of task
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td>';
foreach (array('internal', 'external') as $source) {
$tab = $lines[$i]->liste_contact(-1, $source);
$num = count($tab);
if (!empty($num)) {
foreach ($tab as $contacttask) {
//var_dump($contacttask);
if ($source == 'internal') {
$c = new User($db);
} else {
$c = new Contact($db);
}
$c->fetch($contacttask['id']);
if (!empty($c->photo)) {
print $c->getNomUrl(-2).'&nbsp;';
} else {
if (get_class($c) == 'User') {
print $c->getNomUrl(2, '', 0, 0, 24, 1);//.'&nbsp;';
} else {
print $c->getNomUrl(2);//.'&nbsp;';
}
}
}
}
}
print '</td>';
}
// Extra fields
@ -965,10 +996,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '</td>';
}
}
// Contacts of task
// Contacts of task for backward compatibility,
if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
print '<td></td>';
}
// Contacts of task
if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) {
print '<td></td>';
}
print '<td class=""></td>';
print '</tr>';
}

View File

@ -2,6 +2,7 @@
/**
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,7 +34,7 @@ function salaries_prepare_head($object)
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/salaries/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("SalaryPayment");
$head[$h][1] = $langs->trans("Salary");
$head[$h][2] = 'card';
$h++;

View File

@ -282,12 +282,10 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
dol_print_error('', 'BadParameter');
}
$out = '';
$histo = array();
$numaction = 0;
$now = dol_now();
// Open DSI -- Fix order by -- Begin
$sortfield_list = explode(',', $sortfield);
$sortfield_label_list = array('a.id' => 'id', 'a.datep' => 'dp', 'a.percent' => 'percent');
$sortfield_new_list = array();
@ -297,7 +295,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$sortfield_new = implode(',', $sortfield_new_list);
if (!empty($conf->agenda->enabled)) {
// Recherche histo sur actioncomm
// Search histo on actioncomm
if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,";
} else {
@ -464,87 +462,97 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$sql = $sql2;
}
//TODO Add limit in nb of results
$sql .= $db->order($sortfield_new, $sortorder);
// TODO Add limit in nb of results
if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too
$sql .= $db->order($sortfield_new, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
while ($i < $num) {
$obj = $db->fetch_object($resql);
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->type == 'action') {
$contactaction = new ActionComm($db);
$contactaction->id = $obj->id;
$result = $contactaction->fetchResources();
if ($result < 0) {
dol_print_error($db);
setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors');
if ($obj->type == 'action') {
$contactaction = new ActionComm($db);
$contactaction->id = $obj->id;
$result = $contactaction->fetchResources();
if ($result < 0) {
dol_print_error($db);
setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors');
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) {
$tododone = 'todo';
}
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>$tododone,
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo,
'contact_id'=>$obj->fk_contact,
'socpeopleassigned' => $contactaction->socpeopleassigned,
'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname,
'fk_element'=>$obj->fk_element,
'elementtype'=>$obj->elementtype,
// Type of event
'acode'=>$obj->acode,
'alabel'=>$obj->alabel,
'libelle'=>$obj->alabel, // deprecated
'apicto'=>$obj->apicto
);
} else {
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>'done',
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'acode'=>$obj->acode,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo
);
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) {
$tododone = 'todo';
}
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>$tododone,
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo,
'contact_id'=>$obj->fk_contact,
'socpeopleassigned' => $contactaction->socpeopleassigned,
'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname,
'fk_element'=>$obj->fk_element,
'elementtype'=>$obj->elementtype,
// Type of event
'acode'=>$obj->acode,
'alabel'=>$obj->alabel,
'libelle'=>$obj->alabel, // deprecated
'apicto'=>$obj->apicto
);
} else {
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>'done',
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'acode'=>$obj->acode,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo
);
$numaction++;
$i++;
}
$numaction++;
$i++;
} else {
dol_print_error($db);
}
} else {
dol_print_error($db);
}
// Set $out to sow events
$out = '';
if (empty($conf->agenda->enabled)) {
$langs->loadLangs(array("admin", "errors"));
$out = info_admin($langs->trans("WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv("Module2400Name")), 0, 0, 'warning');
}
if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email))) {

View File

@ -1145,8 +1145,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$langs->load("salaries");
$newmenu->add("/salaries/list.php?leftmenu=tax_salary&amp;mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) {
$newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("NewPayment"), 1, $user->rights->salaries->write);
$newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read);
$newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->rights->salaries->write);
$newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->rights->salaries->read);
$newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read);
$newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->rights->salaries->read);
}
}
@ -1608,7 +1609,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire);
}
} else {
$newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"'));
if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") {
$newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write);
$newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read);

View File

@ -1183,7 +1183,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$lastid = $this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def", "rowid");
foreach ($pos_name as $key2 => $val2) {
//print 'key2='.$key2.'-val2='.$val2."<br>\n";
//print 'key2='.$key2.'-val2='.$val2."<br>\n";
if ($enabledbydefaulton && $val2 != $enabledbydefaulton) {
continue; // Not enabled by default onto this page.
}
@ -1202,8 +1202,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if (!$err) {
$this->db->commit();
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
$this->error = $this->db->lasterror();
$this->db->rollback();
}
}
// else box already registered into database

View File

@ -97,7 +97,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
$texte .= '<table class="nobordernopadding" width="100%">';
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode"));
$tooltip .= $langs->trans("GenericMaskCodes3");
$tooltip .= $langs->trans("GenericMaskCodes3EAN");
$tooltip .= '<strong>'.$langs->trans("Example").':</strong><br>';
$tooltip .= '020{000000000}? (for internal use)<br>';
$tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)<br>';

View File

@ -449,7 +449,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
}
// Replace tags of object + external modules
$tmparray = $this->get_substitutionarray_shipment($object, $outputlangs);
$tmparray = array_merge($tmparray, $this->get_substitutionarray_shipment($object, $outputlangs));
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook

View File

@ -161,6 +161,7 @@ class MailingTargets // This can't be abstract as it is used for some method
public function addTargetsToDatabase($mailing_id, $cibles)
{
global $conf;
global $dolibarr_main_instance_unique_id;
$this->db->begin();
@ -183,7 +184,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= "'".$this->db->escape($targetarray['other'])."',";
$sql .= "'".$this->db->escape($targetarray['source_url'])."',";
$sql .= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
$sql .= "'".$this->db->escape(dol_hash($targetarray['email'].';'.$targetarray['lastname'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
$sql .= "'".$this->db->escape(dol_hash($dolibarr_main_instance_unique_id.';'.$targetarray['email'].';'.$targetarray['lastname'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY), 'md5')."',";
$sql .= "'".$this->db->escape($targetarray['source_type'])."')";
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -192,8 +192,12 @@ class modAdherent extends DolibarrModules
// Boxes
//-------
$this->boxes = array(
0=>array('file'=>'box_members.php', 'enabledbydefaulton'=>'Home'),
2=>array('file'=>'box_birthdays_members.php', 'enabledbydefaulton'=>'Home')
0 => array('file'=>'box_members.php', 'enabledbydefaulton'=>'Home'),
2 => array('file'=>'box_birthdays_members.php', 'enabledbydefaulton'=>'Home'),
3 => array('file'=>'box_members_last_modified', 'enabledbydefaulton'=>'membersindex'),
4 => array('file'=>'box_members_last_subscriptions', 'enabledbydefaulton'=>'membersindex'),
5 => array('file'=>'box_members_subscriptions_by_year', 'enabledbydefaulton'=>'membersindex'),
6 => array('file'=>'box_members_by_type', 'enabledbydefaulton'=>'membersindex'),
);
// Permissions
@ -399,19 +403,17 @@ class modAdherent extends DolibarrModules
// Permissions
$this->remove($options);
//ODT template
// ODT template
/*
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/orders';
$dest=$dirodt.'/template_order.odt';
if (file_exists($src) && ! file_exists($dest))
{
if (file_exists($src) && ! file_exists($dest)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
if ($result < 0) {
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;

View File

@ -85,6 +85,7 @@ class modLdap extends DolibarrModules
11=>array('LDAP_FIELD_PHONE', 'chaine', 'telephonenumber', '', 0),
12=>array('LDAP_FIELD_FAX', 'chaine', 'facsimiletelephonenumber', '', 0),
13=>array('LDAP_FIELD_MOBILE', 'chaine', 'mobile', '', 0),
14=>array('LDAP_GROUP_FILTER', 'chaine', '&(objectClass=groupOfNames)', '', 0),
);
// Boxes

View File

@ -587,7 +587,7 @@ class modProduct extends DolibarrModules
));
$this->import_regex_array[$r] = array_merge($this->import_regex_array[$r], array(
'p.tobatch' => '^[0|1]$'
'p.tobatch' => '^[0|1|2]$'
));
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
@ -679,7 +679,7 @@ class modProduct extends DolibarrModules
//clauses copied from import_fields_array
if (!empty($conf->stock->enabled)) {
$import_sample = array_merge($import_sample, array(
'p.tobatch'=>"0 (don't use) / 1 (use batch/serial number)",
'p.tobatch'=>"0 (don't use) / 1 (use batch) / 2 (use serial number)",
'p.seuil_stock_alerte' => '',
'p.pmp' => '0',
'p.desiredstock' => ''

View File

@ -201,14 +201,23 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
print '<td id="'.$html_id.'" class="valuefield '.$object->element.'_extras_'.$tmpkeyextra.' wordbreak"'.(!empty($cols) ? ' colspan="'.$cols.'"' : '').'>';
// Convert date into timestamp format
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date', 'datetime'))) {
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) {
$datenotinstring = $object->array_options['options_'.$tmpkeyextra];
// print 'X'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.'x';
if (!is_numeric($object->array_options['options_'.$tmpkeyextra])) { // For backward compatibility
$datenotinstring = $db->jdate($datenotinstring);
}
//print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');
$value = GETPOSTISSET("options_".$tmpkeyextra) ? dol_mktime(GETPOST("options_".$tmpkeyextra."hour", 'int'), GETPOST("options_".$tmpkeyextra."min", 'int'), 0, GETPOST("options_".$tmpkeyextra."month", 'int'), GETPOST("options_".$tmpkeyextra."day", 'int'), GETPOST("options_".$tmpkeyextra."year", 'int')) : $datenotinstring;
$value = GETPOSTISSET("options_".$tmpkeyextra) ? dol_mktime(12, 0, 0, GETPOST("options_".$tmpkeyextra."month", 'int'), GETPOST("options_".$tmpkeyextra."day", 'int'), GETPOST("options_".$tmpkeyextra."year", 'int')) : $datenotinstring;
}
if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('datetime'))) {
$datenotinstring = $object->array_options['options_'.$tmpkeyextra];
// print 'X'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.'x';
if (!is_numeric($object->array_options['options_'.$tmpkeyextra])) { // For backward compatibility
$datenotinstring = $db->jdate($datenotinstring);
}
//print 'x'.$object->array_options['options_' . $tmpkeyextra].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');
$value = GETPOSTISSET("options_".$tmpkeyextra) ? dol_mktime(GETPOST("options_".$tmpkeyextra."hour", 'int'), GETPOST("options_".$tmpkeyextra."min", 'int'), GETPOST("options_".$tmpkeyextra."sec", 'int'), GETPOST("options_".$tmpkeyextra."month", 'int'), GETPOST("options_".$tmpkeyextra."day", 'int'), GETPOST("options_".$tmpkeyextra."year", 'int'), 'tzuserrel') : $datenotinstring;
}
//TODO Improve element and rights detection

View File

@ -104,10 +104,12 @@ if (($line->info_bits & 2) == 2) {
print '</a>';
if ($line->description) {
if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
} elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) {
} elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
@ -115,11 +117,13 @@ if (($line->info_bits & 2) == 2) {
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
print ' ('.dol_print_date($discount->datec).')';
}
} elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
} elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0));
} elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) {
include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0));

View File

@ -545,13 +545,13 @@ if ($num > 0) {
print '<td class="center">';
if (!empty($obj->datestart)) {
print dol_print_date($db->jdate($obj->datestart), 'dayhour');
print dol_print_date($db->jdate($obj->datestart), 'dayhour', 'tzserver');
}
print '</td>';
print '<td class="center">';
if (!empty($obj->dateend)) {
print dol_print_date($db->jdate($obj->dateend), 'dayhour');
print dol_print_date($db->jdate($obj->dateend), 'dayhour', 'tzserver');
}
print '</td>';
@ -569,7 +569,7 @@ if ($num > 0) {
// Date start last run
print '<td class="center">';
if (!empty($datelastrun)) {
print dol_print_date($datelastrun, 'dayhoursec');
print dol_print_date($datelastrun, 'dayhoursec', 'tzserver');
}
print '</td>';

View File

@ -190,6 +190,8 @@ class ConferenceOrBooth extends ActionComm
/**
* Set Percentage from status
*
* @return void
*/
public function setPercentageFromStatus()
{

View File

@ -1009,16 +1009,7 @@ if ($action == 'create') {
$i++;
}
print '});
jQuery("#autoreset").click(function() { console.log("Reset values to 0"); ';
$i = 0;
while ($i < $numAsked) {
print 'jQuery("#qtyl'.$i.'").val(0);'."\n";
if (!empty($conf->productbatch->enabled)) {
print 'jQuery("#qtyl'.$i.'_'.$i.'").val(0);'."\n";
}
$i++;
}
print '});
jQuery("#autoreset").click(function() { console.log("Reset values to 0"); jQuery(".qtyl").val(0); });
});
</script>';
@ -1252,7 +1243,7 @@ if ($action == 'create') {
$deliverableQty = min($quantityToBeDelivered, $batchStock);
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'>';
print '<td colspan="3" ></td><td class="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>';
print '<!-- Show details of lot -->';
@ -1284,7 +1275,7 @@ if ($action == 'create') {
} else {
print '<!-- Case there is no details of lot at all -->';
print '<tr class="oddeven"><td colspan="3"></td><td class="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
print '</td>';
print '<td class="left">';
@ -1395,7 +1386,7 @@ if ($action == 'create') {
$deliverableQty = 0;
}
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? $bc[$var] : '').'><td colspan="3"></td><td class="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>';
print '<td class="left">';
@ -1439,7 +1430,7 @@ if ($action == 'create') {
if ($warehouse_selected_id <= 0) { // We did not force a given warehouse, so we won't have no warehouse to change qty.
$disabled = 'disabled="disabled"';
}
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
print '<input class="qtyl" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
} else {
print $langs->trans("NA");
}
@ -2141,7 +2132,7 @@ if ($action == 'create') {
foreach ($lines[$i]->detail_batch as $detail_batch) {
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->id.'" id="qtyl'.$line_id.'_'.$detail_batch->id.'" type="text" size="4" value="'.$detail_batch->qty.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->id.'" id="qtyl'.$line_id.'_'.$detail_batch->id.'" type="text" size="4" value="'.$detail_batch->qty.'"></td>';
// Batch number managment
if ($lines[$i]->entrepot_id == 0) {
// only show lot numbers from src warehouse when shipping from multiple warehouses
@ -2153,7 +2144,7 @@ if ($action == 'create') {
// add a 0 qty lot row to be able to add a lot
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$line_id.'_0" id="qtyl'.$line_id.'_0" type="text" size="4" value="0"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'_0" id="qtyl'.$line_id.'_0" type="text" size="4" value="0"></td>';
// Batch number managment
print '<td>'.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'</td>';
print '</tr>';
@ -2163,7 +2154,7 @@ if ($action == 'create') {
print '<!-- case edit 2 -->';
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number managment
@ -2174,7 +2165,7 @@ if ($action == 'create') {
foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'"></td>';
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number managment
@ -2189,7 +2180,7 @@ if ($action == 'create') {
print '<!-- case edit 5 -->';
print '<tr>';
// Qty to ship or shipped
print '<td><input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
// Warehouse source
print '<td></td>';
// Batch number managment

View File

@ -952,7 +952,9 @@ class ProductFournisseur extends Product
}
$out .= '</table>';
} else {
$out = ($showunitprice ?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise).' '.$langs->trans("HT").' &nbsp; <span class="opacitymedium">(</span>' : '').($showsuptitle ? '<span class="opacitymedium">'.$langs->trans("Supplier").'</span>: ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / <span class="opacitymedium">'.$langs->trans("SupplierRef").'</span>: '.$this->fourn_ref.($showunitprice ? '<span class="opacitymedium">)</span>' : '');
$out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise).' '.$langs->trans("HT").' &nbsp; <span class="opacitymedium">(</span>' : '');
$out .= ($showsuptitle ? '<span class="opacitymedium">'.$langs->trans("Supplier").'</span>: ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / <span class="opacitymedium">'.$langs->trans("SupplierRef").'</span>: '.$this->ref_supplier;
$out .= ($showunitprice ? '<span class="opacitymedium">)</span>' : '');
}
return $out;
}

View File

@ -855,7 +855,7 @@ if ($id > 0 || !empty($ref)) {
// Already dispatched
print '<td class="right">'.$products_dispatched[$objp->rowid].'</td>';
if (!empty($conf->productbatch->enabled) && $objp->tobatch == 1) {
if (!empty($conf->productbatch->enabled) && $objp->tobatch > 0) {
$type = 'batch';
print '<td class="right">';
print '</td>'; // Qty to dispatch
@ -967,7 +967,7 @@ if ($id > 0 || !empty($ref)) {
print '</td>';
print '<td>';
if (!empty($conf->productbatch->enabled) && $objp->tobatch == 1) {
if (!empty($conf->productbatch->enabled) && $objp->tobatch > 0) {
$type = 'batch';
print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$i.', \''.$type.'\')"');
} else {

View File

@ -30,7 +30,7 @@ require 'main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// If not defined, we select menu "home"
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ?GETPOST('mainmenu', 'aZ09') : 'home';
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home';
$action = GETPOST('action', 'aZ09');
$hookmanager->initHooks(array('index'));

View File

@ -178,3 +178,6 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE
-- Description of chart of account Canada CA-ENG-BASE
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 14, 'CA-ENG-BASE', 'Canadian basic chart of accounts - English', 1);
-- Description of chart of account Mexico SAT/24-2019
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 154, 'SAT/24-2019', 'Catalogo y codigo agrupador fiscal del 2019', 1);

File diff suppressed because it is too large Load Diff

View File

@ -328,7 +328,7 @@ ALTER TABLE llx_product MODIFY COLUMN desiredstock float;
ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN seuil_stock_alerte float;
ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN desiredstock float;
ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL;
ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL AFTER fk_country;
ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255);
ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255);

View File

@ -48,6 +48,10 @@ UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','D
-- For v14
ALTER TABLE llx_mailing_cibles MODIFY COLUMN tag varchar(64) NULL;
ALTER TABLE llx_mailing_cibles ADD INDEX idx_mailing_cibles_tag (tag);
ALTER TABLE llx_c_availability ADD COLUMN position integer NOT NULL DEFAULT 0;
ALTER TABLE llx_adherent ADD COLUMN ref varchar(30) AFTER rowid;
@ -167,7 +171,7 @@ create table llx_payment_vat
ALTER TABLE llx_tva ADD COLUMN paye smallint default 1 NOT NULL;
ALTER TABLE llx_tva ADD COLUMN fk_account integer;
--INSERT INTO llx_payment_vat (fk_tva, datec, datep, amount, fk_typepaiement, num_paiement, note, fk_bank, fk_user_creat, fk_user_modif) SELECT rowid, NOW(), datep, amount, COALESCE(fk_typepayment, 0), num_payment, '', fk_bank, fk_user_creat, fk_user_modif FROM llx_tva;
INSERT INTO llx_payment_vat (rowid, fk_tva, datec, datep, amount, fk_typepaiement, num_paiement, note, fk_bank, fk_user_creat, fk_user_modif) SELECT rowid, rowid, NOW(), datep, amount, COALESCE(fk_typepayment, 0), num_payment, 'Created automatically by migration v13 to v14', fk_bank, fk_user_creat, fk_user_modif FROM llx_tva WHERE fk_bank IS NOT NULL;
--UPDATE llx_bank_url as url INNER JOIN llx_tva tva ON tva.rowid = url.url_id SET url.type = 'vat', url.label = CONCAT('(', tva.label, ')') WHERE type = 'payment_vat';
--INSERT INTO llx_bank_url (fk_bank, url_id, url, label, type) SELECT b.fk_bank, ptva.rowid, REPLACE(b.url, 'tva/card.php', 'payment_vat/card.php'), '(paiement)', 'payment_vat' FROM llx_bank_url b INNER JOIN llx_tva tva ON (tva.fk_bank = b.fk_bank) INNER JOIN llx_payment_vat ptva on (ptva.fk_bank = b.fk_bank) WHERE type = 'vat';
@ -211,3 +215,44 @@ ALTER TABLE llx_propal CHANGE COLUMN tva total_tva double(24,8) default 0;
ALTER TABLE llx_propal CHANGE COLUMN total total_ttc double(24,8) default 0;
ALTER TABLE llx_commande_fournisseur CHANGE COLUMN tva total_tva double(24,8) default 0;
--VMYSQL4.3 ALTER TABLE llx_c_civility CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
--VPGSQL8.2 CREATE SEQUENCE llx_c_civility_rowid_seq OWNED BY llx_c_civility.rowid;
--VPGSQL8.2 ALTER TABLE llx_c_civility ALTER COLUMN rowid SET DEFAULT nextval('llx_c_civility_rowid_seq');
--VPGSQL8.2 SELECT setval('llx_c_civility_rowid_seq', MAX(rowid)) FROM llx_c_civility;
-- Change for salary intent table
create table llx_salary
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet)
label varchar(255),
tms timestamp,
datec datetime, -- Create date
fk_user integer NOT NULL,
datep date, -- payment date
datev date, -- value date (this field should not be here, only into bank tables)
salary double(24,8), -- salary of user when payment was done
amount double(24,8) NOT NULL DEFAULT 0,
fk_projet integer DEFAULT NULL,
datesp date, -- date start period
dateep date, -- date end period
entity integer DEFAULT 1 NOT NULL, -- multi company id
note text,
fk_bank integer,
paye smallint default 1 NOT NULL,
fk_typepayment integer NOT NULL, -- default payment mode for payment
fk_account integer, -- default bank account for payment
fk_user_author integer, -- user creating
fk_user_modif integer -- user making last change
) ENGINE=innodb;
ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user fk_user integer NULL;
ALTER TABLE llx_payment_salary ADD COLUMN fk_salary integer;
INSERT INTO llx_salary (rowid, ref, fk_user, amount, fk_projet, fk_typepayment, label, datesp, dateep, entity, note, fk_bank, paye) SELECT ps.rowid, ps.rowid, ps.fk_user, ps.amount, ps.fk_projet, ps.fk_typepayment, ps.label, ps.datesp, ps.dateep, ps.entity, ps.note, ps.fk_bank, 1 FROM llx_payment_salary ps WHERE ps.fk_salary IS NULL;
UPDATE llx_payment_salary as ps SET ps.fk_salary = ps.rowid WHERE ps.fk_salary IS NULL;
UPDATE llx_payment_salary as ps SET ps.ref = ps.rowid WHERE ps.ref IS NULL;
ALTER TABLE llx_salary CHANGE paye paye smallint default 0 NOT NULL;

View File

@ -19,7 +19,7 @@
create table llx_c_civility
(
rowid integer PRIMARY KEY,
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
code varchar(6) NOT NULL,
label varchar(50),
active tinyint DEFAULT 1 NOT NULL,

View File

@ -21,3 +21,5 @@ ALTER TABLE llx_mailing_cibles ADD UNIQUE uk_mailing_cibles (fk_mailing, email);
ALTER TABLE llx_mailing_cibles ADD INDEX idx_mailing_cibles_email (email);
ALTER TABLE llx_mailing_cibles ADD INDEX idx_mailing_cibles_tag (tag);

View File

@ -28,7 +28,7 @@ create table llx_mailing_cibles
firstname varchar(160),
email varchar(160) NOT NULL,
other varchar(255) NULL,
tag varchar(128) NULL,
tag varchar(64) NULL, -- a unique key as a hash of: dolibarr_main_instance_unique_id;email;lastname;mailing_id;MAILING_EMAIL_UNSUBSCRIBE_KEY
statut smallint NOT NULL DEFAULT 0, -- -1 = error, 0 = not sent, ...
source_url varchar(255),
source_id integer,

View File

@ -24,4 +24,3 @@ ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_datesp (datesp);
ALTER TABLE llx_payment_salary ADD INDEX idx_payment_salary_dateep (dateep);
ALTER TABLE llx_payment_salary ADD CONSTRAINT fk_payment_salary_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);

View File

@ -22,7 +22,7 @@ create table llx_payment_salary
ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet)
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
datec datetime, -- Create date
fk_user integer NOT NULL,
fk_user integer DEFAULT NULL,
datep date, -- payment date
datev date, -- value date (this field should not be here, only into bank tables)
salary double(24,8), -- salary of user when payment was done
@ -37,5 +37,6 @@ create table llx_payment_salary
note text,
fk_bank integer,
fk_user_author integer, -- user creating
fk_user_modif integer -- user making last change
fk_user_modif integer, -- user making last change
fk_salary integer
)ENGINE=innodb;

View File

@ -0,0 +1,44 @@
-- ===================================================================
-- Copyright (C) 2011-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- 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/>.
--
-- ===================================================================
create table llx_salary
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet)
tms timestamp,
datec datetime, -- Create date
fk_user integer NOT NULL,
datep date, -- payment date
datev date, -- value date (this field should not be here, only into bank tables)
salary double(24,8), -- salary of user when payment was done
amount double(24,8) NOT NULL DEFAULT 0,
fk_projet integer DEFAULT NULL,
fk_typepayment integer NOT NULL,
num_payment varchar(50), -- num cheque or other
label varchar(255),
datesp date, -- date start period
dateep date, -- date end period
entity integer DEFAULT 1 NOT NULL, -- multi company id
note text,
fk_bank integer,
paye smallint default 0 NOT NULL,
fk_account integer,
fk_user_author integer, -- user creating
fk_user_modif integer -- user making last change
)ENGINE=innodb;

View File

@ -897,7 +897,7 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) {
$sql = "SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb ON ps.rowid = pb.fk_product_stock";
$sql .= " WHERE p.rowid = ps.fk_product";
$sql .= " AND p.tobatch = 1";
$sql .= " AND p.tobatch > 0";
$sql .= " GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
$sql .= " HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL";
print $sql;
@ -981,7 +981,7 @@ if ($ok && GETPOST('clean_product_stock_negative_if_batch', 'alpha')) {
$sql = "SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
$sql .= " WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
$sql .= " AND p.tobatch = 1";
$sql .= " AND p.tobatch > 0";
$sql .= " GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
$sql .= " HAVING reel != SUM(pb.qty)";
$resql = $db->query($sql);

View File

@ -131,7 +131,7 @@ InvoiceLinesDone=Bound lines of invoices
ExpenseReportLines=Lines of expense reports to bind
ExpenseReportLinesDone=Bound lines of expense reports
IntoAccount=Bind line with the accounting account
TotalForAccount=Total for accounting account
TotalForAccount=Total accounting account
Ventilate=Bind

View File

@ -37,6 +37,7 @@ UnlockNewSessions=Remove connection lock
YourSession=Your session
Sessions=Users Sessions
WebUserGroup=Web server user/group
PermissionsOnFiles=Permissions on files
PermissionsOnFilesInWebRoot=Permissions on files in web root directory
PermissionsOnFile=Permissions on file %s
NoSessionFound=Your PHP configuration seems to not allow listing of active sessions. The directory used to save sessions (<b>%s</b>) may be protected (for example by OS permissions or by PHP directive open_basedir).
@ -62,6 +63,7 @@ IfModuleEnabled=Note: yes is effective only if module <b>%s</b> is enabled
RemoveLock=Remove/rename file <b>%s</b> if it exists, to allow usage of the Update/Install tool.
RestoreLock=Restore file <b>%s</b>, with read permission only, to disable any further use of the Update/Install tool.
SecuritySetup=Security setup
PHPSetup=PHP setup
SecurityFilesDesc=Define here options related to security about uploading files.
ErrorModuleRequirePHPVersion=Error, this module requires PHP version %s or higher
ErrorModuleRequireDolibarrVersion=Error, this module requires Dolibarr version %s or higher
@ -348,9 +350,10 @@ LastActivationAuthor=Latest activation author
LastActivationIP=Latest activation IP
UpdateServerOffline=Update server offline
WithCounter=Manage a counter
GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:<br><b>{000000}</b> corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask. <br><b>{000000+000}</b> same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s. <br><b>{000000@x}</b> same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required. <br><b>{dd}</b> day (01 to 31).<br><b>{mm}</b> month (01 to 12).<br><b>{yy}</b>, <b>{yyyy}</b> or <b>{y}</b> year over 2, 4 or 1 numbers. <br>
GenericMaskCodes2=<b>{cccc}</b> the client code on n characters<br><b>{cccc000}</b> the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.<br><b>{tttt}</b> The code of third party type on n characters (see menu Home - Setup - Dictionary - Types of third parties). If you add this tag, the counter will be different for each type of third party.<br>
GenericMaskCodes3=All other characters in the mask will remain intact (except * or ? in 13th position in EAN13).<br>Spaces are not allowed.<br>In EAN13, the last character after the last } in 13th position should be * or ? . It will be replaced by the calculated key.<br>
GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags can be used:<br><b>{000000}</b> corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask. <br><b>{000000+000}</b> same as the previous one but an offset corresponding to the number to the right of the + sign is applied starting on the first %s. <br><b>{000000@x}</b> same as the previous one but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then the sequence {yy}{mm} or {yyyy}{mm} is also required. <br><b>{dd}</b> day (01 to 31).<br><b>{mm}</b> month (01 to 12).<br><b>{yy}</b>, <b>{yyyy}</b> or <b>{y}</b> year over 2, 4 or 1 numbers. <br>
GenericMaskCodes2=<b>{cccc}</b> the client code on n characters<br><b>{cccc000}</b> the client code on n characters is followed by a counter dedicated to the customer. This counter dedicated to customer is reset at same time as the global counter.<br><b>{tttt}</b> The code of third party type on n characters (see menu Home - Setup - Dictionary - Types of third parties). If you add this tag, the counter will be different for each type of third party.<br>
GenericMaskCodes3=All other characters in the mask will remain intact.<br>Spaces are not allowed.<br>
GenericMaskCodes3EAN=All other characters in the mask will remain intact (except * or ? in 13th position in EAN13).<br>Spaces are not allowed.<br>In EAN13, the last character after the last } in 13th position should be * or ? . It will be replaced by the calculated key.<br>
GenericMaskCodes4a=<u>Example on the 99th %s of the third party TheCompany, with date 2007-01-31:</u><br>
GenericMaskCodes4b=<u>Example on third party created on 2007-03-01:</u><br>
GenericMaskCodes4c=<u>Example on product created on 2007-03-01:</u><br>
@ -1249,7 +1252,7 @@ RunningUpdateProcessMayBeRequired=Running the upgrade process seems to be requir
YouMustRunCommandFromCommandLineAfterLoginToUser=You must run this command from command line after login to a shell with user <b>%s</b> or you must add -W option at end of command line to provide <b>%s</b> password.
YourPHPDoesNotHaveSSLSupport=SSL functions not available in your PHP
DownloadMoreSkins=More skins to download
SimpleNumRefModelDesc=Returns the reference number with format %syymm-nnnn where yy is year, mm is month and nnnn is sequential with no reset
SimpleNumRefModelDesc=Returns the reference number in the format %syymm-nnnn where yy is the year, mm is the month and nnnn is a sequential auto-incrementing number with no reset
ShowProfIdInAddress=Show professional id with addresses
ShowVATIntaInAddress=Hide intra-Community VAT number with addresses
TranslationUncomplete=Partial translation
@ -1267,7 +1270,7 @@ MAIN_PROXY_HOST=Proxy server: Name/Address
MAIN_PROXY_PORT=Proxy server: Port
MAIN_PROXY_USER=Proxy server: Login/User
MAIN_PROXY_PASS=Proxy server: Password
DefineHereComplementaryAttributes=Define here any additional/custom attributes that you want to be included for: %s
DefineHereComplementaryAttributes=Define any additional / custom attributes that must be added to: %s
ExtraFields=Complementary attributes
ExtraFieldsLines=Complementary attributes (lines)
ExtraFieldsLinesRec=Complementary attributes (templates invoices lines)
@ -1511,6 +1514,7 @@ LDAPFieldLoginUnix=Login (unix)
LDAPFieldLoginExample=Example: uid
LDAPFilterConnection=Search filter
LDAPFilterConnectionExample=Example: &(objectClass=inetOrgPerson)
LDAPGroupFilterExample=Example: &(objectClass=groupOfUsers)
LDAPFieldLoginSamba=Login (samba, activedirectory)
LDAPFieldLoginSambaExample=Example: samaccountname
LDAPFieldFullname=Full name
@ -2096,7 +2100,7 @@ SwitchThisForABetterSecurity=Switching this value to %s is recommended for more
DictionaryProductNature= Nature of product
CountryIfSpecificToOneCountry=Country (if specific to a given country)
YouMayFindSecurityAdviceHere=You may find security advisory here
ModuleActivatedMayExposeInformation=This module may expose sensitive data. If you don't need it, disable it.
ModuleActivatedMayExposeInformation=This PHP extension may expose sensitive data. If you don't need it, disable it.
ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment.
CombinationsSeparator=Separator character for product combinations
SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples

View File

@ -495,6 +495,7 @@ Reported=Delayed
DisabledBecausePayments=Not possible since there are some payments
CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least one invoice classified paid
CantRemovePaymentVATPaid=Can't remove payment since VAT declaration is classified paid
CantRemovePaymentSalaryPaid=Can't remove payment since salary is classified paid
ExpectedToPay=Expected payment
CantRemoveConciliatedPayment=Can't remove reconciled payment
PayedByThisPayment=Paid by this payment
@ -502,6 +503,7 @@ ClosePaidInvoicesAutomatically=Classify automatically all standard, down payment
ClosePaidCreditNotesAutomatically=Classify automatically all credit notes as "Paid" when refund is done entirely.
ClosePaidContributionsAutomatically=Classify automatically all social or fiscal contributions as "Paid" when payment is done entirely.
ClosePaidVATAutomatically=Classify automatically VAT declaration as "Paid" when payment is done entirely.
ClosePaidSalaryAutomatically=Classify automatically salary as "Paid" when payment is done entirely.
AllCompletelyPayedInvoiceWillBeClosed=All invoices with no remainder to pay will be automatically closed with status "Paid".
ToMakePayment=Pay
ToMakePaymentBack=Pay back

View File

@ -18,9 +18,12 @@ BoxLastActions=Latest actions
BoxLastContracts=Latest contracts
BoxLastContacts=Latest contacts/addresses
BoxLastMembers=Latest members
BoxLastModifiedMembers=Latest modified members
BoxFicheInter=Latest interventions
BoxCurrentAccounts=Open accounts balance
BoxTitleMemberNextBirthdays=Birthdays of this month (members)
BoxTitleMembersByType=Members by type
BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year
BoxTitleLastRssInfos=Latest %s news from %s
BoxTitleLastProducts=Products/Services: last %s modified
BoxTitleProductsAlertStock=Products: stock alert
@ -87,8 +90,8 @@ BoxTitleLatestModifiedSupplierOrders=Vendor Orders: last %s modified
BoxTitleLastModifiedCustomerBills=Customer Invoices: last %s modified
BoxTitleLastModifiedCustomerOrders=Sales Orders: last %s modified
BoxTitleLastModifiedPropals=Latest %s modified proposals
BoxTitleLatestModifiedJobPositions=Latest %s modified jobs
BoxTitleLatestModifiedCandidatures=Latest %s modified candidatures
BoxTitleLatestModifiedJobPositions=Latest %s modified jobs
BoxTitleLatestModifiedCandidatures=Latest %s modified candidatures
ForCustomersInvoices=Customers invoices
ForCustomersOrders=Customers orders
ForProposals=Proposals

View File

@ -86,7 +86,7 @@ PaymentCustomerInvoice=Customer invoice payment
PaymentSupplierInvoice=vendor invoice payment
PaymentSocialContribution=Social/fiscal tax payment
PaymentVat=VAT payment
AutomaticCreationPayment=Automatically create a total payment
AutomaticCreationPayment=Automatically record the payment of the salary
ListPayment=List of payments
ListOfCustomerPayments=List of customer payments
ListOfSupplierPayments=List of vendor payments
@ -139,12 +139,16 @@ DateChequeReceived=Check reception date
NbOfCheques=No. of checks
PaySocialContribution=Pay a social/fiscal tax
PayVAT=Pay a VAT declaration
PaySalary=Pay a salary card
ConfirmPaySocialContribution=Are you sure you want to classify this social or fiscal tax as paid ?
ConfirmPayVAT=Are you sure you want to classify this VAT declaration as paid ?
ConfirmPaySalary=Are you sure you want to classify this salary card as paid?
DeleteSocialContribution=Delete a social or fiscal tax payment
DeleteVAT=Delete a VAT declaration
DeleteSalary=Delete a salary card
ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment ?
ConfirmDeleteVAT=Are you sure you want to delete this VAT declaration ?
ConfirmDeleteSalary=Are you sure you want to delete this salary?
ExportDataset_tax_1=Social and fiscal taxes and payments
CalcModeVATDebt=Mode <b>%sVAT on commitment accounting%s</b>.
CalcModeVATEngagement=Mode <b>%sVAT on incomes-expenses%s</b>.
@ -244,6 +248,7 @@ ACCOUNTING_ACCOUNT_SUPPLIER=Accounting account used for vendor third parties
ACCOUNTING_ACCOUNT_SUPPLIER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated vendor accounting account on third party is not defined.
ConfirmCloneTax=Confirm the clone of a social/fiscal tax
ConfirmCloneVAT=Confirm the clone of a VAT declaration
ConfirmCloneSalary=Confirm the clone of a salary
CloneTaxForNextMonth=Clone it for next month
SimpleReport=Simple report
AddExtraReport=Extra reports (add foreign and national customer report)

View File

@ -291,4 +291,5 @@ WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were re
WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into ECM database index table
WarningTheHiddenOptionIsOn=Warning, the hidden option <b>%s</b> is on.
WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list
WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection.
WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection.
WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here.

View File

@ -13,7 +13,7 @@ ToReviewCP=Awaiting approval
ApprovedCP=Approved
CancelCP=Canceled
RefuseCP=Refused
ValidatorCP=Approbator
ValidatorCP=Approver
ListeCP=List of leave
Leave=Leave request
LeaveId=Leave ID
@ -39,11 +39,11 @@ TitreRequestCP=Leave request
TypeOfLeaveId=Type of leave ID
TypeOfLeaveCode=Type of leave code
TypeOfLeaveLabel=Type of leave label
NbUseDaysCP=Number of days of vacation consumed
NbUseDaysCPHelp=The calculation takes into account the non working days and the holidays defined in the dictionary.
NbUseDaysCPShort=Days consumed
NbUseDaysCPShortInMonth=Days consumed in month
DayIsANonWorkingDay=%s is a non working day
NbUseDaysCP=Number of days of leave used
NbUseDaysCPHelp=The calculation takes into account the non-working days and the holidays defined in the dictionary.
NbUseDaysCPShort=Days of leave
NbUseDaysCPShortInMonth=Days of leave in month
DayIsANonWorkingDay=%s is a non-working day
DateStartInMonth=Start date in month
DateEndInMonth=End date in month
EditCP=Edit
@ -55,7 +55,7 @@ TitleDeleteCP=Delete the leave request
ConfirmDeleteCP=Confirm the deletion of this leave request?
ErrorCantDeleteCP=Error you don't have the right to delete this leave request.
CantCreateCP=You don't have the right to make leave requests.
InvalidValidatorCP=You must choose an approbator to your leave request.
InvalidValidatorCP=You must choose the approver for your leave request.
NoDateDebut=You must select a start date.
NoDateFin=You must select an end date.
ErrorDureeCP=Your leave request does not contain working day.
@ -80,14 +80,14 @@ UserCP=User
ErrorAddEventToUserCP=An error occurred while adding the exceptional leave.
AddEventToUserOkCP=The addition of the exceptional leave has been completed.
MenuLogCP=View change logs
LogCP=Log of updates of available vacation days
ActionByCP=Performed by
UserUpdateCP=For the user
LogCP=Log of all updates made to "Balance of Leave"
ActionByCP=Updated by
UserUpdateCP=Updated for
PrevSoldeCP=Previous Balance
NewSoldeCP=New Balance
alreadyCPexist=A leave request has already been done on this period.
FirstDayOfHoliday=First day of vacation
LastDayOfHoliday=Last day of vacation
FirstDayOfHoliday=Beginning day of leave request
LastDayOfHoliday=Ending day of leave request
BoxTitleLastLeaveRequests=Latest %s modified leave requests
HolidaysMonthlyUpdate=Monthly update
ManualUpdate=Manual update
@ -104,8 +104,8 @@ LEAVE_SICK=Sick leave
LEAVE_OTHER=Other leave
LEAVE_PAID_FR=Paid vacation
## Configuration du Module ##
LastUpdateCP=Latest automatic update of leave allocation
MonthOfLastMonthlyUpdate=Month of latest automatic update of leave allocation
LastUpdateCP=Last automatic update of leave allocation
MonthOfLastMonthlyUpdate=Month of last automatic update of leave allocation
UpdateConfCPOK=Updated successfully.
Module27130Name= Management of leave requests
Module27130Desc= Management of leave requests
@ -125,8 +125,8 @@ HolidaysCanceledBody=Your leave request for %s to %s has been canceled.
FollowedByACounter=1: This type of leave need to be followed by a counter. Counter is incremented manually or automatically and when a leave request is validated, counter is decremented.<br>0: Not followed by a counter.
NoLeaveWithCounterDefined=There is no leave types defined that need to be followed by a counter
GoIntoDictionaryHolidayTypes=Go into <strong>Home - Setup - Dictionaries - Type of leave</strong> to setup the different types of leaves.
HolidaySetup=Setup of module Holiday
HolidaysNumberingModules=Leave requests numbering models
HolidaySetup=Setup of module Leave
HolidaysNumberingModules=Numbering models for leave requests
TemplatePDFHolidays=Template for leave requests PDF
FreeLegalTextOnHolidays=Free text on PDF
WatermarkOnDraftHolidayCards=Watermarks on draft leave requests

View File

@ -726,7 +726,7 @@ MenuMembers=Members
MenuAgendaGoogle=Google agenda
MenuTaxesAndSpecialExpenses=Taxes | Special expenses
ThisLimitIsDefinedInSetup=Dolibarr limit (Menu home-setup-security): %s Kb, PHP limit: %s Kb
NoFileFound=No documents saved in this directory
NoFileFound=No documents uploaded
CurrentUserLanguage=Current language
CurrentTheme=Current theme
CurrentMenuManager=Current menu manager

View File

@ -24,3 +24,5 @@ ProductLotSetup=Setup of module lot/serial
ShowCurrentStockOfLot=Show current stock for couple product/lot
ShowLogOfMovementIfLot=Show log of movements for couple product/lot
StockDetailPerBatch=Stock detail per lot
SerialNumberAlreadyInUse=Serial number %s is already used for product %s
TooManyQtyForSerialNumber=You can only have one product %s for serial number %S

View File

@ -2,12 +2,15 @@
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accounting account on user is not defined.
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage payments
CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Automatically create a total payment" when creating a Salary
Salary=Salary
Salaries=Salaries
NewSalaryPayment=New salary payment
NewSalary=New salary
NewSalaryPayment=New salary card
AddSalaryPayment=Add salary payment
SalaryPayment=Salary payment
SalariesPayments=Salaries payments
SalariesPaymentsOf=Salaries payments of %s
ShowSalaryPayment=Show salary payment
THM=Average hourly rate
TJM=Average daily rate

View File

@ -33,7 +33,7 @@ ExpenseReportCanceledMessage=The expense report %s was canceled.<br> - User: %s<
ExpenseReportPaid=An expense report was paid
ExpenseReportPaidMessage=The expense report %s was paid.<br> - User: %s<br> - Paid by: %s<br>Click here to show the expense report: %s
TripId=Id expense report
AnyOtherInThisListCanValidate=Person to inform for validation.
AnyOtherInThisListCanValidate=Person to be informed for validating the request.
TripSociete=Information company
TripNDF=Informations expense report
PDFStandardExpenseReports=Standard template to generate a PDF document for expense report

View File

@ -131,7 +131,7 @@ InvoiceLinesDone=Lignes de factures liées
ExpenseReportLines=Lignes de notes de frais à lier
ExpenseReportLinesDone=Lignes de notes de frais liées
IntoAccount=Lier ligne avec le compte comptable
TotalForAccount=Total pour le compte comptable
TotalForAccount=Total compte comptable
Ventilate=Lier

View File

@ -24,3 +24,5 @@ ProductLotSetup=Configuration du module lot/série
ShowCurrentStockOfLot=Afficher le stock actuel pour le couple produit / lot
ShowLogOfMovementIfLot=Afficher l'historique des mouvements de couple produit / lot
StockDetailPerBatch=Stock détaillé par lot
SerialNumberAlreadyInUse=Le numéro de série %s est déjà utilisé pour le produit %s
TooManyQtyForSerialNumber=Vous ne pouvez avoir qu'un produit %s avec le numéro de série %s

View File

@ -2,6 +2,7 @@
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Compte comptable utilisé pour les utilisateurs
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=Le compte comptable défini sur la fiche utilisateur sera utilisé uniquement pour la comptabilité auxiliaire. Celui-ci sera utilisé pour le grand livre et comme valeur par défaut de la comptabilité auxiliaire si le compte dédié de l'utilisateur n'est pas défini.
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Compte comptable par défaut pour les paiements de salaires
CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=Par défaut, laisser vide loption «Créer automatiquement un règlement total» lors de la création d'un Salaire
Salary=Salaire
Salaries=Salaires
NewSalaryPayment=Nouveau règlement de salaire

View File

@ -425,7 +425,7 @@ class MyObject extends CommonObject
$records = array();
$sql = 'SELECT ';
$sql .= $this->getFieldList();
$sql .= $this->getFieldList('t');
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';

View File

@ -96,7 +96,7 @@ class Mo extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1),
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'maxwidth300'),
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'picto'=>'product'),
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
@ -168,7 +168,7 @@ class Mo extends CommonObject
/**
* @var string Name of subtable line
*/
public $table_element_line = 'mo_production';
public $table_element_line = 'mrp_production';
/**
* @var string Field with ID of parent key if this field has a parent
@ -632,9 +632,21 @@ class Mo extends CommonObject
$moline->fk_mo = $this->id;
$moline->qty = $this->qty;
$moline->fk_product = $this->fk_product;
$moline->role = 'toproduce';
$moline->position = 1;
if ($this->fk_bom > 0) { // If a BOM is defined, we know what to consume.
include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
$bom = new Bom($this->db);
$bom->fetch($this->fk_bom);
if ($bom->bomtype == 1) {
$role = 'toproduce';
$moline->role = 'toconsume';
} else {
$role = 'toconsume';
$moline->role = 'toproduce';
}
}
$resultline = $moline->create($user, false); // Never use triggers here
if ($resultline <= 0) {
$error++;
@ -644,9 +656,6 @@ class Mo extends CommonObject
}
if ($this->fk_bom > 0) { // If a BOM is defined, we know what to consume.
include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
$bom = new Bom($this->db);
$bom->fetch($this->fk_bom);
if ($bom->id > 0) {
// Lines to consume
if (!$error) {
@ -667,7 +676,7 @@ class Mo extends CommonObject
break;
} else {
$moline->fk_product = $line->fk_product;
$moline->role = 'toconsume';
$moline->role = $role;
$moline->position = $line->position;
$moline->qty_frozen = $line->qty_frozen;
$moline->disable_stock_change = $line->disable_stock_change;

View File

@ -76,7 +76,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) {
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
$sortfield = "t.ref"; // Set here default search field. By default 1st field in definition.
}
if (!$sortorder) {
$sortorder = "ASC";

View File

@ -48,7 +48,7 @@ $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$lineid = GETPOST('lineid', 'int');
$collapse = GETPOST('collapse', 'aZ09comma');
@ -724,6 +724,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
print '</td>';
}
if ($permissiontodelete) {
print '<td></td>';
}
print '</tr>';
if ($action == 'addconsumeline') {
@ -849,6 +852,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($conf->productbatch->enabled) {
print '<td></td>'; // Lot
}
if ($permissiontodelete) {
$href = $_SERVER["PHP_SELF"];
$href .= '?id='.$object->id;
$href .= '&action=deleteline';
$href .= '&lineid='.$line->id;
print '<td class="center">';
print '<a href="'.$href.'">';
print img_picto('', "delete");
print '</a>';
print '</td>';
}
print '</tr>';
// Show detailed of already consumed with js code to collapse

View File

@ -1084,11 +1084,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Batch number management
if (!empty($conf->productbatch->enabled)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="3">';
if (empty($conf->global ->MAIN_ADVANCE_NUMLOT)) {
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
} else {
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
}
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch'));
print '</td></tr>';
}
@ -1548,11 +1544,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($conf->productbatch->enabled) {
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="3">';
if (empty($conf->global ->MAIN_ADVANCE_NUMLOT)) {
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
} else {
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
}
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
print $form->selectarray('status_batch', $statutarray, $object->status_batch);
print '</td></tr>';
}
@ -2040,11 +2032,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->productbatch->enabled)) {
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="2">';
if (!empty($conf->use_javascript_ajax) && $usercancreate && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE) && empty($conf->global->MAIN_ADVANCE_NUMLOT)) {
print ajax_object_onoff($object, 'status_batch', 'tobatch', 'ProductStatusOnBatch', 'ProductStatusNotOnBatch');
} else {
print $object->getLibStatut(0, 2);
}
print $object->getLibStatut(0, 2);
print '</td></tr>';
}
}

View File

@ -165,9 +165,10 @@ class Products extends DolibarrApi
* @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service)
* @param int $category Use this param to filter list by category
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)"
* @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long)
* @return array Array of product objects
*/
public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '')
public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false)
{
global $db, $conf;
@ -219,9 +220,13 @@ class Products extends DolibarrApi
$i = 0;
while ($i < $min) {
$obj = $this->db->fetch_object($result);
$product_static = new Product($this->db);
if ($product_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($product_static);
if (!$ids_only) {
$product_static = new Product($this->db);
if ($product_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($product_static);
}
} else {
$obj_ret[] = $obj->rowid;
}
$i++;
}
@ -1794,24 +1799,24 @@ class Products extends DolibarrApi
}
/**
* Get properties of a product object
*
* Get properties of 1 product object.
* Return an array with product information.
*
* @param int $id ID of product
* @param string $ref Ref of element
* @param string $ref_ext Ref ext of element
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower)
* @param bool $includesubproducts Load information about subproducts (if product is a virtual product)
* @param bool $includeparentid Load also ID of parent product (if product is a variant of a parent product)
* @return array|mixed Data without useless information
* @param int $id ID of product
* @param string $ref Ref of element
* @param string $ref_ext Ref ext of element
* @param string $barcode Barcode of element
* @param int $includestockdata Load also information about stock (slower)
* @param bool $includesubproducts Load information about subproducts (if product is a virtual product)
* @param bool $includeparentid Load also ID of parent product (if product is a variant of a parent product)
* @param bool $includeifobjectisused Check if product object is used and set is_object_used with result.
* @return array|mixed Data without useless information
*
* @throws RestException 401
* @throws RestException 403
* @throws RestException 404
*/
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0, $includesubproducts = false, $includeparentid = false)
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0, $includesubproducts = false, $includeparentid = false, $includeifobjectisused = false)
{
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) {
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
@ -1866,6 +1871,10 @@ class Products extends DolibarrApi
}
}
if ($includeifobjectisused) {
$this->product->is_object_used = ($this->product->isObjectUsed() > 0);
}
return $this->_cleanObjectDatas($this->product);
}
}

View File

@ -92,10 +92,10 @@ class Product extends CommonObject
public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into images.lib.php
/*
* @deprecated
* @see label
*/
/**
* @deprecated
* @see $label
*/
public $libelle;
/**
@ -407,15 +407,24 @@ class Product extends CommonObject
*/
public $supplierprices;
/**
* Property set to save result of isObjectUsed(). Used for example by Product API.
*
* @var boolean
*/
public $is_object_used;
/**
* @var array fields of object product
*/
public $fields = array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'visible'=>-1, 'showoncombobox'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>5),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'position'=>20, 'visible'=>-1, 'showoncombobox'=>1),
'fk_barcode_type' => array('type'=>'integer', 'label'=>'BarcodeType', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>-1,),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'note' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
@ -424,6 +433,10 @@ class Product extends CommonObject
'fk_user_author'=>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'localtax1_tx' => array('type'=>'double(6,3)', 'label'=>'Localtax1tx', 'enabled'=>'1', 'position'=>150, 'notnull'=>0, 'visible'=>-1,),
'localtax1_type' => array('type'=>'varchar(10)', 'label'=>'Localtax1type', 'enabled'=>'1', 'position'=>155, 'notnull'=>1, 'visible'=>-1,),
'localtax2_tx' => array('type'=>'double(6,3)', 'label'=>'Localtax2tx', 'enabled'=>'1', 'position'=>160, 'notnull'=>0, 'visible'=>-1,),
'localtax2_type' => array('type'=>'varchar(10)', 'label'=>'Localtax2type', 'enabled'=>'1', 'position'=>165, 'notnull'=>1, 'visible'=>-1,),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
//'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
//'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
@ -4747,10 +4760,10 @@ class Product extends CommonObject
if ($type == 2) {
switch ($mode) {
case 0:
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial')));
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : ($status == 1 ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial')));
return dolGetStatus($label);
case 1:
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort')));
$label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : ($status == 1 ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort')));
return dolGetStatus($label);
case 2:
return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2);
@ -4788,10 +4801,10 @@ class Product extends CommonObject
$labelStatus = $langs->trans('ProductStatusOnBuyShort');
$labelStatusShort = $langs->trans('ProductStatusOnBuy');
} elseif ($type == 2) {
$labelStatus = ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial'));
$labelStatusShort = ($status == 1 || empty($conf->global->MAIN_ADVANCE_NUMLOT) ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort'));
$labelStatus = ($status == 1 ? $langs->trans('ProductStatusOnBatch') : $langs->trans('ProductStatusOnSerial'));
$labelStatusShort = ($status == 1 ? $langs->trans('ProductStatusOnBatchShort') : $langs->trans('ProductStatusOnSerialShort'));
}
} elseif (! empty($conf->global->MAIN_ADVANCE_NUMLOT) && $type == 2 && $status == 2) {
} elseif ( $type == 2 && $status == 2 ) {
$labelStatus = $langs->trans('ProductStatusOnSerial');
$labelStatusShort = $langs->trans('ProductStatusOnSerialShort');
}

View File

@ -57,7 +57,7 @@ class Inventory extends CommonObject
/**
* @var string String with name of icon for inventory
*/
public $picto = 'stock';
public $picto = 'inventory';
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;

View File

@ -351,7 +351,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'product', 0, $newcardbutton, '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit);
// Add code for pre mass action (confirmation or email presend form)
$topicmail = "Information";

View File

@ -971,18 +971,13 @@ if ($resql) {
// To batch
if (!empty($arrayfields['p.tobatch']['checked'])) {
print '<td class="liste_titre center">';
if (empty($conf->global ->MAIN_ADVANCE_NUMLOT)) {
print $form->selectyesno('search_tobatch', $search_tobatch, 1, false, 1);
} else {
$statutarray = array(
'-1' => '',
'0' => $langs->trans("ProductStatusNotOnBatchShort"),
'1' => $langs->trans("ProductStatusOnBatchShort"),
'2' => $langs->trans("ProductStatusOnSerialShort")
);
print $form->selectarray('search_tobatch', $statutarray, $search_tobatch);
}
$statutarray = array(
'-1' => '',
'0' => $langs->trans("ProductStatusNotOnBatchShort"),
'1' => $langs->trans("ProductStatusOnBatchShort"),
'2' => $langs->trans("ProductStatusOnSerialShort")
);
print $form->selectarray('search_tobatch', $statutarray, $search_tobatch);
print '</td>';
}
// Country
@ -1672,11 +1667,7 @@ if ($resql) {
// Lot/Serial
if (!empty($arrayfields['p.tobatch']['checked'])) {
print '<td class="center">';
if (empty($conf->global->MAIN_ADVANCE_NUMLOT)) {
print yn($obj->tobatch);
} else {
print $product_static->getLibStatut(1, 2);
}
print $product_static->getLibStatut(1, 2);
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -1185,6 +1185,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) {
print dol_get_fiche_head('');
print '<div class="div-table-responsive-no-min">';
print '<table class="border centpercent">';
// VAT
@ -1271,6 +1272,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) {
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print '</table>';
print '</div>';
print dol_get_fiche_end();
@ -1318,6 +1320,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) {
print $langs->trans('UseMultipriceRules').' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.($object->price_autogen ? 'checked' : '').'><br><br>';
}
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<thead><tr class="liste_titre">';
@ -1392,6 +1395,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) {
print '</tbody>';
print '</table>';
print '</div>';
//print dol_get_fiche_end();
@ -1493,7 +1497,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
print '<tr class="oddeven">';
// Date
print "<td>".dol_print_date($db->jdate($objp->dp), "dayhour")."</td>";
print "<td>".dol_print_date($db->jdate($objp->dp), "dayhour", 'tzuserrel')."</td>";
// Price level
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
@ -1665,13 +1669,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<input type="hidden" name="action" value="add_customer_price_confirm">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print dol_get_fiche_head();
print '<table class="liste centpercent">';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
print $form->select_company('', 'socid', 's.client IN (1,2,3)', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
print img_picto('', 'company').$form->select_company('', 'socid', 's.client IN (1,2,3)', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
print '</td>';
print '</tr>';
@ -1721,14 +1723,13 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '</table>';
print dol_get_fiche_end();
print '<div class="center">';
// Update all child soc
print '<div class="marginbottomonly">';
print '<input type="checkbox" name="updatechildprice" value="1"> ';
print $langs->trans('ForceUpdateChildPriceSoc');
print '<input type="checkbox" name="updatechildprice" id="updatechildprice" value="1"> ';
print '<label for="updatechildprice">'.$langs->trans('ForceUpdateChildPriceSoc').'</label>';
print '</div>';
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
@ -1753,14 +1754,12 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<input type="hidden" name="action" value="update_customer_price_confirm">';
print '<input type="hidden" name="lineid" value="'.$prodcustprice->id.'">';
print dol_get_fiche_head();
print '<table class="liste centpercent">';
print '<tr>';
print '<td class="titlefield">'.$langs->trans('ThirdParty').'</td>';
print '<td class="titlefield fieldrequired">'.$langs->trans('ThirdParty').'</td>';
$staticsoc = new Societe($db);
$staticsoc->fetch($prodcustprice->fk_soc);
print "<td colspan='2'>".$staticsoc->getNomUrl(1)."</td>";
print "<td>".$staticsoc->getNomUrl(1)."</td>";
print '</tr>';
// Ref. Customer
@ -1768,12 +1767,12 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<td><input name="ref_customer" size="12" value="' . dol_escape_htmltag($prodcustprice->ref_customer) . '"></td></tr>';
// VAT
print '<tr><td>'.$langs->trans("DefaultTaxRate").'</td><td colspan="2">';
print '<tr><td class="fieldrequired">'.$langs->trans("DefaultTaxRate").'</td><td>';
print $form->load_tva("tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.' ('.$prodcustprice->default_vat_code.')' : $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1);
print '</td></tr>';
// Price base
print '<tr><td>';
print '<tr><td class="fieldrequired">';
print $langs->trans('PriceBase');
print '</td>';
print '<td>';
@ -1782,7 +1781,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '</tr>';
// Price
print '<tr><td>';
print '<tr><td class="fieldrequired">';
$text = $langs->trans('SellingPrice');
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
print '</td><td>';
@ -1809,21 +1808,13 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
}
print '</tr>';
// Update all child soc
print '<tr><td>';
print '</td>';
print '<td>';
print '</td>';
print '</tr>';
print '</table>';
print dol_get_fiche_end();
print '<div class="center">';
print '<div class="marginbottomonly">';
print '<input type="checkbox" name="updatechildprice" value="1"> ';
print $langs->trans('ForceUpdateChildPriceSoc');
print '<input type="checkbox" name="updatechildprice" id="updatechildprice" value="1"> ';
print '<label for="updatechildprice">'.$langs->trans('ForceUpdateChildPriceSoc').'</label>';
print "</div>";
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
@ -1866,6 +1857,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">';
print '<tr class="liste_titre">';
@ -1915,8 +1907,8 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<tr class="oddeven">';
print "<td>".$staticsoc->getNomUrl(1)."</td>";
print '<td>' . $line->ref_customer . '</td>';
print "<td>".dol_print_date($line->datec, "dayhour")."</td>";
print '<td>'.$line->ref_customer.'</td>';
print "<td>".dol_print_date($line->datec, "dayhour", 'tzuserrel')."</td>";
print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
print '<td class="right">';
@ -1960,6 +1952,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '</tr>';
}
print "</table>";
print '</div>';
} else {
print $langs->trans('None');
}
@ -1986,6 +1979,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">';
if (count($prodcustprice->lines) > 0 || $search_soc) {
@ -2020,7 +2014,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
print '<td class="right">'.$langs->trans("ChangedBy").'</td>';
print '<td>&nbsp;</td>';
print '<td></td>';
print '</tr>';
// Line for default price
@ -2081,15 +2075,14 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<td class="right">';
print '</td>';
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) {
print '<td class="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=showlog_default_price&amp;id='.$object->id.'">';
print '<td class="nowraponall">';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=showlog_default_price&amp;id='.$object->id.'">';
print img_info($langs->trans('PriceByCustomerLog'));
print '</a>';
print ' ';
print '<a class="marginleftonly editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_price&amp;id='.$object->id.'">';
print '<a class="marginleftonly marginrightonly editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_price&amp;id='.$object->id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"');
print '</a>';
print ' &nbsp; ';
print '</td>';
}
print "</tr>\n";
@ -2124,8 +2117,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print "<td>".$staticsoc->getNomUrl(1)."</td>";
print '<td>' . $line->ref_customer . '</td>';
print "<td>".dol_print_date($line->datec, "dayhour")."</td>";
print "<td>".dol_print_date($line->datec, "dayhour", 'tzuserrel')."</td>";
print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
print '<td class="right">';
@ -2142,6 +2134,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if (empty($positiverates)) {
$positiverates = '0';
}
echo vatrate($positiverates.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), '%', ($line->tva_npr ? $line->tva_npr : $line->recuperableonly));
print "</td>";
@ -2185,16 +2178,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print "</tr>\n";
}
}
/*else
{
$colspan=9;
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1;
print "<tr ".$bc[false].">";
print '<td colspan="'.$colspan.'">'.$langs->trans('None').'</td>';
print "</tr>";
}*/
print "</table>";
print '</div>';
print "</form>";
}

View File

@ -192,7 +192,7 @@ class MouvementStock extends CommonObject
}
}
// end hook at beginning
// Clean parameters
$price = price2num($price, 'MU'); // Clean value for the casse we receive a float zero value, to have it a real zero value.
if (empty($price)) $price = 0;
@ -568,14 +568,32 @@ class MouvementStock extends CommonObject
// Update detail stock for batch product
if (!$error && !empty($conf->productbatch->enabled) && $product->hasbatch() && !$skip_batch)
{
if ($id_product_batch > 0)
// check unicity for serial numbered equipments ( different for lots managed products)
if ( $product->status_batch == 2 && $qty > 0 )
{
$result = $this->createBatch($id_product_batch, $qty);
} else {
$param_batch = array('fk_product_stock' =>$fk_product_stock, 'batchnumber'=>$batch);
$result = $this->createBatch($param_batch, $qty);
if ( $this->getBatchCount($fk_product, $batch) > 0 )
{
$error++;
$this->errors[] = $langs->trans("SerialNumberAlreadyInUse", $batch, $product->ref);
}
elseif ( $qty > 1 )
{
$error++;
$this->errors[] = $langs->trans("TooManyQtyForSerialNumber", $product->ref, $batch);
}
}
if ( ! $error )
{
if ($id_product_batch > 0)
{
$result = $this->createBatch($id_product_batch, $qty);
} else {
$param_batch = array('fk_product_stock' =>$fk_product_stock, 'batchnumber'=>$batch);
$result = $this->createBatch($param_batch, $qty);
}
if ($result < 0) $error++;
}
if ($result < 0) $error++;
}
// Update PMP and denormalized value of stock qty at product level
@ -1208,4 +1226,39 @@ class MouvementStock extends CommonObject
return $this->deleteCommon($user, $notrigger);
//return $this->deleteCommon($user, $notrigger, 1);
}
/**
* Retrieve number of equipments for a product batch
*
* @param int $fk_product Product id
* @param varchar $batch batch number
* @return int <0 if KO, number of equipments if OK
*/
private function getBatchCount($fk_product, $batch)
{
global $conf;
$cpt = 0;
$sql = "SELECT sum(pb.qty) as cpt";
$sql .= " FROM ".MAIN_DB_PREFIX."product_batch as pb";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product_stock as ps ON ps.rowid = pb.fk_product_stock";
$sql .= " WHERE ps.fk_product = " . $fk_product;
$sql .= " AND pb.batch = '" . $this->db->escape($batch) . "'";
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$cpt = $obj->cpt;
}
$this->db->free($result);
} else {
dol_print_error($this->db);
return -1;
}
return $cpt;
}
}

View File

@ -133,18 +133,24 @@ if (empty($reshook)) {
$backurlforlist = dol_buildpath('/product/stock/productlot_list.php', 1);
if ($action == 'seteatby' && $user->rights->stock->creer) {
$newvalue = dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$newvalue = dol_mktime(12, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int'));
$result = $object->setValueFrom('eatby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
dol_print_error($db, $object->error);
setEventMessages($object->error, null, 'errors');
$action == 'editeatby';
} else {
$action = 'view';
}
}
if ($action == 'setsellby' && $user->rights->stock->creer) {
$newvalue = dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$newvalue = dol_mktime(12, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int'));
$result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) {
dol_print_error($db, $object->error);
setEventMessages($object->error, null, 'errors');
$action == 'editsellby';
} else {
$action = 'view';
}
}
@ -172,8 +178,9 @@ if (empty($reshook)) {
}
}
if ($error)
if ($error) {
$action = 'edit_extras';
}
}
// Action to add record
@ -415,7 +422,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</tr>';
}
// Other attributes. Fields from hook formObjectOptions and Extrafields.
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';

View File

@ -6,6 +6,7 @@
* Copyright (C) 2015-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -92,7 +93,7 @@ if (!empty($conf->banque->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
}
if (!empty($conf->salaries->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
}
if (!empty($conf->categorie->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@ -564,7 +565,7 @@ $listofreferent = array(
'salaries'=>array(
'name'=>"Salaries",
'title'=>"ListSalariesAssociatedProject",
'class'=>'PaymentSalary',
'class'=>'Salary',
'table'=>'payment_salary',
'datefieldname'=>'datev',
'margin'=>'minus',

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