Merge branch 'Dolibarr:develop' into PROPALE_MODIFY_MARGIN_RATES

This commit is contained in:
marcusdeangabriel 2023-02-06 09:10:43 +01:00 committed by GitHub
commit f974295a45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 2027 additions and 869 deletions

View File

@ -15,7 +15,7 @@ Following changes may create regressions for some external modules, but were nec
* The method "nb_expedition()" has been renamed into "countNbOfShipments()"
* Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated).
* Deprecated property libelle removed from entrepot class.
* The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that.
***** ChangeLog for 17.0.0 compared to 16.0.0 *****

View File

@ -11,38 +11,38 @@ LaunchProgram=Launch %1
AssocFileExtension=&Associate %1 with the %2 file extension
AssocingFileExtension=Associating %1 with the %2 file extension...
YouWillInstallDoliWamp=You will install DoliWamp (so Dolibarr + all required third party software like Apache, Mysql and PHP) on your computer.
ThisAssistantInstallOrUpgrade=WARNING: Using an ERP CRM installed on a local computer can be dangerous: if your computer break down, you can lose all your data. Do this if you are ready to manage backup yourself seriously. If not, use an installation in Saas instead (see https://saas.dolibarr.org).
IfYouHaveTechnicalKnowledge=Moreover, if you have technical knowledges and want to manage your Apache, Mysql and PHP yourself, you should not use this assistant and make a manual installation of Dolibarr on your existing server with Apache, Mysql and PHP.
ButIfYouLook=But if you look for an automatic setup on your local computer, you''re on the good way...
DoYouWantToStart=Do you want to start installation process ?
YouWillInstallDoliWamp=You will install DoliWamp (so Dolibarr plus all required third-party software like Apache, MySQL and PHP) on your computer.
ThisAssistantInstallOrUpgrade=WARNING: Using an ERP CRM installed on a local computer can be dangerous: if your computer breaks down, you can lose all your data. Do this if you are ready to manage backups yourself seriously. If not, use an installation in SaaS instead (see https://saas.dolibarr.org).
IfYouHaveTechnicalKnowledge=Moreover, if you have technical knowledge and want to manage Apache, MySQL and PHP yourself, you should not use this assistant and instead make a manual installation of Dolibarr on your existing server with Apache, MySQL and PHP.
ButIfYouLook=But if you are looking for an automatic setup on your local computer, you're on the right path...
DoYouWantToStart=Do you want to start the installation process?
TechnicalParameters=Technical parameters
IfFirstInstall=If first install, please specify some technical parameters. If you don't understand, are not sure, or are doing an upgrade, just leave the default values.
IfFirstInstall=If this is the first install, please specify some technical parameters. If you don't understand, are not sure, or are doing an upgrade, just keep the default values.
; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS
SMTPServer=SMTP server (your own or ISP SMTP server, first install only) :
ApachePort=Apache port (first install only, common choice is 80) :
MySqlPort=MySql port (first install only, common choice is 3306) :
MySqlPassword=MySql server and database password you want for root (first install only):
SMTPServer=SMTP server (your own or ISP SMTP server, first install only):
ApachePort=Apache port (first install only, common choice is 80):
MySqlPort=MySQL port (first install only, common choice is 3306):
MySqlPassword=MySQL server and database password you want for root (first install only):
FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You can ignore warning but you may have to remove it manually later when asked. Click OK to continue...
FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You can ignore this warning but you may have to remove the file manually later when asked. Click OK to continue...
PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value ?
PortAlreadyInUse=Port %1 seems to already be in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value?
FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr ?
ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open :
FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr?
ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr?
MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr?
ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open:
LaunchNow=Launch Dolibarr now
ProgramHasBeenRemoved=Dolibarr program files have been removed. However, all your data files are still in directory %1. You must remove this directory manually for a complete uninstall.
ProgramHasBeenRemoved=Dolibarr's program files have been removed. However, all your data files are still in directory %1. You must remove this directory manually for a complete uninstall.
DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache and Mysql, this may last from several seconds to one minute after this confirmation. Start to install or upgrade the web and database server required by Dolibarr ?
DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache and MySQL. This may take from several seconds to one minute. Start to install or upgrade the web and database server required by Dolibarr?
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version
DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
ContinueAnyway=Continue anyway (install process may fails without this prerequisite)
DLLMissing=Your Windows installation is missing the "Microsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
ContinueAnyway=Continue anyway (install process may fail without this prerequisite)

View File

@ -22,8 +22,8 @@ https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-
Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php
* FOR QR-Bill in switzerland
----------------------------
* FOR QR-Bill in switzerland - Facture-QR
-----------------------------------------
Syntax of QR Code https://www.swiss-qr-invoice.org/fr/
Syntax of complentary field named "structured information of invoice S1": https://www.swiss-qr-invoice.org/downloads/qr-bill-s1-syntax-fr.pdf
To test/validate: https://www.swiss-qr-invoice.org/validator/

View File

@ -109,7 +109,7 @@ class Subscription extends CommonObject
'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1),
'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'note' =>array('type'=>'html', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),

View File

@ -342,7 +342,7 @@ if ($sall) {
$moreforfilter = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
@ -353,7 +353,13 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// Line for filters fields
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre right">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
// Line numbering
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="liste_titre">&nbsp;</td>';
@ -431,15 +437,19 @@ if (!empty($arrayfields['c.tms']['checked'])) {
}
// Action column
print '<td class="liste_titre right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print "</tr>\n";
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
if (!empty($arrayfields['d.ref']['checked'])) {
print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
}
@ -484,7 +494,9 @@ if (!empty($arrayfields['c.datec']['checked'])) {
if (!empty($arrayfields['c.tms']['checked'])) {
print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
print "</tr>\n";
@ -540,7 +552,21 @@ while ($i < min($num, $limit)) {
}
} else {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->crowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Ref
if (!empty($arrayfields['d.ref']['checked'])) {
print '<td>'.$subscription->getNomUrl(1).'</td>';
@ -662,19 +688,20 @@ while ($i < min($num, $limit)) {
}
}
// Action column
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->crowid, $arrayofselected)) {
$selected = 1;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->crowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '<input id="cb'.$obj->crowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
}
$i++;

View File

@ -289,6 +289,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<th>&nbsp;</th>';
}
print '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>';
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
@ -297,7 +300,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th class="center">'.$langs->trans("Status").'</th>';
print '<th>&nbsp;</th>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<th>&nbsp;</th>';
}
print "</tr>\n";
$membertype = new AdherentType($db);
@ -333,6 +338,13 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
}
} else {
print '<tr class="oddeven">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($user->rights->adherent->configurer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
} else {
print '<td class="right">&nbsp;</td>';
}
}
print '<td class="nowraponall">';
print $membertype->getNomUrl(1);
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
@ -352,10 +364,12 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<td class="center">'.yn($objp->caneditamount).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>';
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
if ($user->rights->adherent->configurer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
} else {
print '<td class="right">&nbsp;</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($user->rights->adherent->configurer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
} else {
print '<td class="right">&nbsp;</td>';
}
}
print "</tr>";
}
@ -708,13 +722,18 @@ if ($rowid > 0) {
print "</tr>\n";
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
}
print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
}
print "</tr>\n";
$adh = new Adherent($db);
@ -732,7 +751,17 @@ if ($rowid > 0) {
$adh->statut = $objp->status;
print '<tr class="oddeven">';
// Actions
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
if ($user->hasRight('adherent', 'creer')) {
print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
}
if ($user->hasRight('adherent', 'supprimer')) {
print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
}
print "</td>";
}
// Lastname
if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
@ -785,15 +814,16 @@ if ($rowid > 0) {
}
// Actions
print '<td class="center">';
if ($user->hasRight('adherent', 'creer')) {
print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
if ($user->hasRight('adherent', 'creer')) {
print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
}
if ($user->hasRight('adherent', 'supprimer')) {
print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
}
print "</td>";
}
if ($user->hasRight('adherent', 'supprimer')) {
print '<a class="marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=resiliate&token='.newToken().'">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
}
print "</td>";
print "</tr>\n";
$i++;
}

View File

@ -8,7 +8,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -251,7 +251,15 @@ if ($action == 'install') {
}
if ($action == 'set' && $user->admin) {
$checkOldValue = getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE');
$csrfCheckOldValue = getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN');
$resarray = activateModule($value);
if ($checkOldValue != getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE')) {
setEventMessage($langs->trans('WarningModuleHasChangedLastVersionCheckParameter', $value), 'warnings');
}
if ($csrfCheckOldValue != getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) {
setEventMessage($langs->trans('WarningModuleHasChangedSecurityCsrfParameter', $value), 'warnings');
}
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
if (!empty($resarray['errors'])) {
setEventMessages('', $resarray['errors'], 'errors');
@ -796,9 +804,9 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($objMod->isCoreOrExternalModule() == 'external'
&& (
$action == 'checklastversion'
// This is a bad practice to activate a synch external access during building of a page. 1 external module can hang the application.
// Adding a cron job could be a good idea see DolibarrModules::checkForUpdate()
|| !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
// This is a bad practice to activate a check on an external access during the building of the admin page. 1 external module can hang the application.
// Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate()
|| !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
)
) {
$checkRes = $objMod->checkForUpdate();

View File

@ -565,6 +565,9 @@ if ($execmethod == 2) {
print '<br>';
print '<br>';
print '<strong>MAIN_SECURITY_MAXFILESIZE_DOWNLOADED</strong> = '.getDolGlobalString('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 100000000)</span>')."<br>";
print '<br>';
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>')."<br>";
print '<br>';

View File

@ -51,12 +51,12 @@ if ($id > 0) {
$object->fetch($id);
}
// Security check
if (empty($user->rights->bookmark->lire)) {
restrictedArea($user, 'bookmarks');
}
restrictedArea($user, 'bookmark', $object);
$permissiontoread = $user->hasRight('bookmark', 'lire');
$permissiontoadd = $user->hasRight('bookmark', 'creer');
$permissiontodelete = $user->hasRight('bookmark', 'supprimer');
@ -326,12 +326,12 @@ if ($id > 0 && !preg_match('/^add/i', $action)) {
print "<div class=\"tabsAction\">\n";
// Edit
if ($user->rights->bookmark->creer && $action != 'edit') {
if ($permissiontoadd && $action != 'edit') {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Edit").'</a>'."\n";
}
// Remove
if ($user->rights->bookmark->supprimer && $action != 'edit') {
if ($permissiontodelete && $action != 'edit') {
print '<a class="butActionDelete" href="list.php?bid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>'."\n";
}

View File

@ -60,7 +60,7 @@ class Bookmark extends CommonObject
public $id;
/**
* @var int User ID
* @var int User ID. If > 0, bookmark of one user. If == 0, bookmark public (for everybody)
*/
public $fk_user;
@ -233,15 +233,14 @@ class Bookmark extends CommonObject
/**
* Removes the bookmark
*
* @param int $id Id removed bookmark
* @return int <0 si ko, >0 si ok
* @param User $user User deleting
* @return int <0 if KO, >0 if OK
*/
public function remove($id)
public function delete($user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE rowid = ".((int) $id);
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog("Bookmark::remove", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
return 1;

View File

@ -63,14 +63,17 @@ if (!$sortorder) {
// Initialize Objects
$object = new Bookmark($db);
if ($id > 0) {
$object->fetch($id);
}
// Security check
restrictedArea($user, 'bookmark');
restrictedArea($user, 'bookmark', $object);
// Permissions
$permissiontoread = !empty($user->rights->bookmark->lire);
$permissiontoadd = !empty($user->rights->bookmark->creer);
$permissiontodelete = !empty($user->rights->bookmark->supprimer);
$permissiontoread = $user->hasRight('bookmark', 'lire');
$permissiontoadd = $user->hasRight('bookmark', 'creer');
$permissiontodelete = ($user->hasRight('bookmark', 'supprimer') || ($permissiontoadd && $object->fk_user == $user->id));
/*
@ -85,13 +88,15 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
if ($action == 'delete') {
$res = $object->remove($id);
if ($action == 'delete' && $permissiontodelete) {
$object->fetch($id);
$res = $object->delete($user);
if ($res > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}
@ -196,7 +201,7 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', $permissiontoadd);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bookmark', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -235,8 +240,8 @@ while ($i < min($num, $limit)) {
}
$title = $obj->title;
$link = $obj->url;
$canedit = $user->rights->bookmark->supprimer;
$candelete = $user->rights->bookmark->creer;
$canedit = $permissiontoadd;
$candelete = $permissiontodelete;
// Title
print '<td class="tdoverflowmax200" alt="'.dol_escape_htmltag($title).'">';
@ -268,7 +273,7 @@ while ($i < min($num, $limit)) {
// Author
print '<td class="center">';
if ($obj->fk_user) {
if ($obj->fk_user > 0) {
if (empty($conf->cache['users'][$obj->fk_user])) {
$tmpuser = new User($db);
$tmpuser->fetch($obj->fk_user);
@ -294,10 +299,10 @@ while ($i < min($num, $limit)) {
// Actions
print '<td class="nowraponall right">';
if ($canedit) {
print '<a class="editfielda marginleftonly" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
print '<a class="editfielda marginleftonly marginrightonly" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
}
if ($candelete) {
print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$obj->rowid.'">'.img_delete().'</a>';
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$obj->rowid.'">'.img_delete().'</a>';
}
print "</td>";
print "</tr>\n";

View File

@ -327,8 +327,8 @@ class Propal extends CommonObject
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),

View File

@ -328,8 +328,8 @@ class Commande extends CommonOrder
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),

View File

@ -51,7 +51,7 @@ if (isModEnabled('accounting')) {
}
// Load translation files required by the page
$langs->loadLangs(array("banks", "bills", "categories", "companies", "compta"));
$langs->loadLangs(array("banks", "bills", "categories", "companies", "compta", "withdrawals"));
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
@ -140,6 +140,9 @@ if (empty($reshook)) {
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
$object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml'));
$object->owner_town = trim(GETPOST("owner_town", 'alphanohtml'));
$object->owner_country_id = GETPOST("owner_country_id", 'int');
$object->ics = trim(GETPOST("ics", 'alpha'));
$object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
@ -241,6 +244,9 @@ if (empty($reshook)) {
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
$object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
$object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml'));
$object->owner_town = trim(GETPOST("owner_town", 'alphanohtml'));
$object->owner_country_id = GETPOST("owner_country_id", 'int');
$object->ics = trim(GETPOST("ics", 'alpha'));
$object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
@ -422,7 +428,8 @@ if ($action == 'create') {
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
print '<td>';
print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country($selectedcode, 'account_country_id');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
@ -438,6 +445,14 @@ if ($action == 'create') {
}
print '</td></tr>';
$type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
print (GETPOSTISSET('domiciliation') ?GETPOST('domiciliation') : $object->domiciliation);
print "</textarea></td></tr>";
}
// Web
print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td>';
@ -552,18 +567,15 @@ if ($action == 'create') {
print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
if (isModEnabled('paymentbybanktransfer')) {
print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. (empty(GETPOST('pti_in_ctti')) ? '' : ' checked ') . '>&nbsp;';
print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
print '<tr><td>'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).'</td>';
print '<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(GETPOST('pti_in_ctti')) ? '' : ' checked ') . '>';
print '</td></tr>';
}
print '</table>';
print '<hr>';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
print (GETPOSTISSET('domiciliation') ?GETPOST('domiciliation') : $object->domiciliation);
print "</textarea></td></tr>";
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
print '<table class="border centpercent">';
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankAccountOwner").'</td>';
print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST('proprio') ?GETPOST('proprio', 'alpha') : $object->proprio).'">';
print '</td></tr>';
@ -572,8 +584,22 @@ if ($action == 'create') {
print (GETPOST('owner_address') ?GETPOST('owner_address', 'alpha') : $object->owner_address);
print "</textarea></td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerZip").'</td>';
print '<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST('owner_zip') ?GETPOST('owner_zip', 'alpha') : $object->owner_zip).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerTown").'</td>';
print '<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST('owner_town') ?GETPOST('owner_town', 'alpha') : $object->owner_town).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerCountry").'</td>';
print '<td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country(GETPOST('owner_country_id') ?GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id');
print '</td></tr>';
print '</table>';
print '<br>';
print '<hr>';
}
print '<table class="border centpercent">';
@ -722,8 +748,6 @@ if ($action == 'create') {
print '</table>';
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
//print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
@ -787,16 +811,11 @@ if ($action == 'create') {
print '<td>'.$object->ics_transfer.'</td>';
print '</tr>';
print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td><td>';
print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")) . '&nbsp;';
print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
print '<tr><td>'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).'</td><td>';
print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes"));
print "</td></tr>\n";
}
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
print nl2br($object->domiciliation);
print "</td></tr>\n";
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td>';
print $object->proprio;
print "</td></tr>\n";
@ -805,6 +824,22 @@ if ($action == 'create') {
print nl2br($object->owner_address);
print "</td></tr>\n";
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerZip").'</td>';
print '<td>'.$object->owner_zip;
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerTown").'</td>';
print '<td>'.$object->owner_town;
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerCountry").'</td>';
print '<td>';
$object->owner_country_code = dol_getIdFromCode($db, $object->owner_country_id, 'c_country', 'rowid', 'code');
$langs->load("dict");
print (empty($object->owner_country_code) ? '' : $langs->convToOutputCharset($langs->transnoentitiesnoconv("Country".$object->owner_country_code)));
print '</td></tr>';
print '</table>';
}
@ -933,6 +968,14 @@ if ($action == 'create') {
}
print '</td></tr>';
$type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
print $object->domiciliation;
print "</textarea></td></tr>";
}
// Conciliable
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
print '<td>';
@ -942,7 +985,7 @@ if ($action == 'create') {
} elseif ($conciliate == -3) {
print $langs->trans("No").' ('.$langs->trans("Closed").')';
} else {
print '<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> <label for="norappro">'.$langs->trans("DisableConciliation").'</label>';
print '<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> <label for="norappro" class="opacitymedium">'.$langs->trans("DisableConciliation").'</label>';
}
print '</td></tr>';
@ -993,7 +1036,7 @@ if ($action == 'create') {
}
print '</table>';
print '<br>';
print '<hr>';
//print '<div class="underbanner clearboth"></div>';
@ -1030,8 +1073,6 @@ if ($action == 'create') {
if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
print '<br>';
//print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// If bank account
@ -1087,26 +1128,39 @@ if ($action == 'create') {
print '<tr><td>'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'</td>';
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.(GETPOSTISSET('ics_transfer') ? GETPOST('ics_transfer', 'alphanohtml') : $object->ics_transfer).'"></td></tr>';
print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. ($object->pti_in_ctti ? ' checked ' : '') . '>&nbsp;';
print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
print '<tr><td>'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).'</td>';
print '<td><input type="checkbox" class="flat" name="pti_in_ctti"'. ($object->pti_in_ctti ? ' checked ' : '') . '>';
print '</td></tr>';
}
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
print $object->domiciliation;
print "</textarea></td></tr>";
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
print '</tr>';
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
print '</table>';
print '<hr>';
print '<table class="border centpercent">';
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
print $object->owner_address;
print "</textarea></td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerZip").'</td>';
print '<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST('owner_zip') ?GETPOST('owner_zip', 'alpha') : $object->owner_zip).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerTown").'</td>';
print '<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST('owner_town') ?GETPOST('owner_town', 'alpha') : $object->owner_town).'">';
print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerCountry").'</td>';
print '<td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
print $form->select_country(GETPOST('owner_country_id') ?GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id');
print '</td></tr>';
print '</table>';
}

View File

@ -146,12 +146,6 @@ class Account extends CommonObject
*/
public $iban_prefix;
/**
* Address of the bank
* @var string
*/
public $domiciliation;
/**
* XML SEPA format: place Payment Type Information (PmtTpInf) in Credit Transfer Transaction Information (CdtTrfTxInf)
* @var int
@ -169,7 +163,17 @@ class Account extends CommonObject
* @var string
*/
public $owner_address;
public $owner_zip;
public $owner_town;
public $owner_country_id;
public $owner_country_code;
/**
* Address of the bank account
* @var string
*/
public $domiciliation; // deprecated, use now address
public $address;
public $state_id;
public $state_code;
public $state;
@ -297,10 +301,13 @@ class Account extends CommonObject
'country_iban' =>array('type'=>'varchar(2)', 'label'=>'Country iban', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'cle_iban' =>array('type'=>'varchar(2)', 'label'=>'Cle iban', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'domiciliation' =>array('type'=>'varchar(255)', 'label'=>'Domiciliation', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'state_id' =>array('type'=>'integer', 'label'=>'State id', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95),
'state_id' =>array('type'=>'integer', 'label'=>'StateId', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_pays' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95),
'proprio' =>array('type'=>'varchar(60)', 'label'=>'Proprio', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'owner_address' =>array('type'=>'text', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'owner_address' =>array('type'=>'varchar(255)', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'owner_zip' =>array('type'=>'varchar(25)', 'label'=>'Owner zip', 'enabled'=>1, 'visible'=>-1, 'position'=>106),
'owner_town' =>array('type'=>'varchar(50)', 'label'=>'Owner town', 'enabled'=>1, 'visible'=>-1, 'position'=>107),
'owner_country_id' =>array('type'=>'integer', 'label'=>'Owner country', 'enabled'=>1, 'visible'=>-1, 'position'=>108),
'courant' =>array('type'=>'smallint(6)', 'label'=>'Courant', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>110),
'clos' =>array('type'=>'smallint(6)', 'label'=>'Clos', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>115),
'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
@ -316,7 +323,7 @@ class Account extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
@ -698,6 +705,9 @@ class Account extends CommonObject
$sql .= ", pti_in_ctti";
$sql .= ", proprio";
$sql .= ", owner_address";
$sql .= ", owner_zip";
$sql .= ", owner_town";
$sql .= ", owner_country_id";
$sql .= ", currency_code";
$sql .= ", rappro";
$sql .= ", min_allowed";
@ -713,7 +723,7 @@ class Account extends CommonObject
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->escape($this->account_number)."'";
$sql .= ", ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
$sql .= ", ".($this->fk_accountancy_journal > 0 ? ((int) $this->fk_accountancy_journal) : "null");
$sql .= ", '".$this->db->escape($this->bank)."'";
$sql .= ", '".$this->db->escape($this->code_banque)."'";
$sql .= ", '".$this->db->escape($this->code_guichet)."'";
@ -725,6 +735,9 @@ class Account extends CommonObject
$sql .= ", ".((int) $this->pti_in_ctti);
$sql .= ", '".$this->db->escape($this->proprio)."'";
$sql .= ", '".$this->db->escape($this->owner_address)."'";
$sql .= ", '".$this->db->escape($this->owner_zip)."'";
$sql .= ", '".$this->db->escape($this->owner_town)."'";
$sql .= ", ".($this->owner_country_id > 0 ? ((int) $this->owner_country_id) : "null");
$sql .= ", '".$this->db->escape($this->currency_code)."'";
$sql .= ", ".((int) $this->rappro);
$sql .= ", ".price2num($this->min_allowed, 'MT');
@ -836,7 +849,7 @@ class Account extends CommonObject
$sql .= ",rappro = ".((int) $this->rappro);
$sql .= ",url = ".($this->url ? "'".$this->db->escape($this->url)."'" : "null");
$sql .= ",account_number = '".$this->db->escape($this->account_number)."'";
$sql .= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
$sql .= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? ((int) $this->fk_accountancy_journal) : "null");
$sql .= ",bank = '".$this->db->escape($this->bank)."'";
$sql .= ",code_banque='".$this->db->escape($this->code_banque)."'";
$sql .= ",code_guichet='".$this->db->escape($this->code_guichet)."'";
@ -848,6 +861,9 @@ class Account extends CommonObject
$sql .= ",pti_in_ctti=".((int) $this->pti_in_ctti);
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
$sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'";
$sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'";
$sql .= ",owner_country_id = ".($this->owner_country_id > 0 ? ((int) $this->owner_country_id) : "null");
$sql .= ",currency_code = '".$this->db->escape($this->currency_code)."'";
@ -931,6 +947,9 @@ class Account extends CommonObject
$sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
$sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'";
$sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'";
$sql .= ",owner_country_id = ".($this->owner_country_id > 0 ? ((int) $this->owner_country_id) : "null");
$sql .= ",state_id = ".($this->state_id > 0 ? $this->state_id : "null");
$sql .= ",fk_pays = ".($this->country_id > 0 ? $this->country_id : "null");
$sql .= " WHERE rowid = ".((int) $this->id);
@ -967,13 +986,13 @@ class Account extends CommonObject
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
$sql .= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
$sql .= " ba.domiciliation, ba.pti_in_ctti, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
$sql .= " ba.domiciliation as address, ba.pti_in_ctti, ba.proprio, ba.owner_address, ba.owner_zip, ba.owner_town, ba.owner_country_id, ba.state_id, ba.fk_pays as country_id,";
$sql .= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,";
$sql .= " ba.min_allowed, ba.min_desired, ba.comment,";
$sql .= " ba.datec as date_creation, ba.tms as date_update, ba.ics, ba.ics_transfer,";
$sql .= ' c.code as country_code, c.label as country,';
$sql .= ' d.code_departement as state_code, d.nom as state';
$sql .= ' , aj.code as accountancy_journal';
$sql .= ' d.code_departement as state_code, d.nom as state,';
$sql .= ' aj.code as accountancy_journal';
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON ba.fk_pays = c.rowid';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ba.state_id = d.rowid';
@ -1009,10 +1028,14 @@ class Account extends CommonObject
$this->cle_rib = $obj->cle_rib;
$this->bic = $obj->bic;
$this->iban = $obj->iban;
$this->domiciliation = $obj->domiciliation;
$this->domiciliation = $obj->address;
$this->address = $obj->address;
$this->pti_in_ctti = $obj->pti_in_ctti;
$this->proprio = $obj->proprio;
$this->owner_address = $obj->owner_address;
$this->owner_zip = $obj->owner_zip;
$this->owner_town = $obj->owner_town;
$this->owner_country_id = $obj->owner_country_id;
$this->state_id = $obj->state_id;
$this->state_code = $obj->state_code;
@ -1047,7 +1070,7 @@ class Account extends CommonObject
return 0;
}
} else {
$this->error = $this->db->lasterror;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}
@ -1723,6 +1746,9 @@ class Account extends CommonObject
$this->domiciliation = 'Banque de France';
$this->proprio = 'Owner';
$this->owner_address = 'Owner address';
$this->owner_zip = 'Owner zip';
$this->owner_town = 'Owner town';
$this->owner_country_id = 'Owner country_id';
$this->country_id = 1;
}

View File

@ -396,7 +396,7 @@ if ($resql) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
$moreforfilter= '';
print '<div class="div-table-responsive">';
@ -404,6 +404,13 @@ if ($resql) {
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td class="liste_titre">';
print '</td>';
@ -507,16 +514,22 @@ if ($resql) {
print '</td>';
}
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
print '</tr>';
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
}
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
}
@ -563,7 +576,9 @@ if ($resql) {
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
}
print '</tr>';
@ -602,6 +617,10 @@ if ($resql) {
} else {
print '<tr class="oddeven">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
@ -751,8 +770,9 @@ if ($resql) {
print '</td>';
}
print '<td></td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -447,7 +447,7 @@ if (!empty($moreforfilter)) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
@ -457,6 +457,13 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
@ -495,16 +502,22 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '</tr>'."\n";
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
@ -527,7 +540,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
print '</tr>'."\n";
@ -579,6 +594,20 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Show here line of result
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@ -636,15 +665,17 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -185,8 +185,8 @@ class FactureRec extends CommonInvoice
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
'date_when' =>array('type'=>'datetime', 'label'=>'Date when', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'date_last_gen' =>array('type'=>'datetime', 'label'=>'Date last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>135),

View File

@ -341,8 +341,8 @@ class Facture extends CommonInvoice
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),

View File

@ -111,7 +111,7 @@ if (isModEnabled('facture')) {
}
if (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) {
print getNumberInvoicesPieChart('fourn');
print getNumberInvoicesPieChart('suppliers');
print '<br>';
}

View File

@ -643,6 +643,8 @@ class Paiement extends CommonObject
$acc = new Account($this->db);
$result = $acc->fetch($this->fk_account);
if ($result < 0) {
$this->error = $acc->error;
$this->errors = $acc->errors;
$error++;
return -1;
}
@ -768,7 +770,7 @@ class Paiement extends CommonObject
}
// Add link 'InvoiceRefused' in bank_url
if (! $error && $label == '(InvoiceRefused)') {
if (!$error && $label == '(InvoiceRefused)') {
$result=$acc->add_url_line(
$bank_line_id,
$this->id_prelevement,
@ -788,6 +790,7 @@ class Paiement extends CommonObject
}
} else {
$this->error = $acc->error;
$this->errors = $acc->errors;
$error++;
}

View File

@ -412,7 +412,7 @@ $moreforfilter = '';
$massactionbutton = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
@ -422,6 +422,13 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
print '<tr class="liste_titre_filter">';
// Filter: Buttons
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '</td>';
}
// Filters: Line number (placeholder)
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td class="liste_titre">';
@ -522,13 +529,20 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N
print $hookmanager->resPrint;
// Filter: Buttons
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '</td>';
}
print '</tr>';
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
}
@ -571,7 +585,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print '</tr>';
$i = 0;
@ -611,6 +627,12 @@ while ($i < min($num, $limit)) {
} else {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
// Line number
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
@ -750,8 +772,10 @@ while ($i < min($num, $limit)) {
}
}
// Buttons
print '<td></td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -328,7 +328,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-p
print_barre_liste($langs->trans("VATDeclarations"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
@ -338,6 +338,13 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
print '<tr class="liste_titre_filter">';
// Filter: Buttons
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '</td>';
}
// Filters: Lines (placeholder)
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td class="liste_titre">';
@ -417,13 +424,17 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N
print $hookmanager->resPrint;
// Filter: Buttons
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '</td>';
}
print '</tr>';
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
}
@ -454,7 +465,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
}
print '</tr>';
$i = 0;
@ -488,6 +501,11 @@ while ($i < min($num, $limit)) {
} else {
print '<tr class="oddeven">';
// Buttons
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
@ -527,7 +545,10 @@ while ($i < min($num, $limit)) {
}
// Date payment
/*if (!empty($arrayfields['t.datep']['checked'])) {
/*if // Buttons
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}(!empty($arrayfields['t.datep']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
if (!$i) $totalarray['nbfield']++;
}*/
@ -591,8 +612,9 @@ while ($i < min($num, $limit)) {
}
// Buttons
print '<td></td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print '</tr>';
}

View File

@ -101,7 +101,7 @@ class Contact extends CommonObject
'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>52),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70),
'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75),
'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>77, 'searchall'=>1),
@ -117,8 +117,8 @@ class Contact extends CommonObject
'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'ProspectStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1),
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205),
'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>300),

View File

@ -238,8 +238,8 @@ class Contrat extends CommonObject
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
@ -2988,8 +2988,8 @@ class ContratLigne extends CommonObjectLine
'fk_contrat' =>array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_product' =>array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
//'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'note_private' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
//'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
//'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
//'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),

View File

@ -76,8 +76,20 @@ if ($action == 'add' && !empty($permissiontoadd)) {
}
// Set value to insert
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
$value = GETPOST($key, 'restricthtml');
if (preg_match('/^text/', $object->fields[$key]['type'])) {
$tmparray = explode(':', $object->fields[$key]['type']);
if (!empty($tmparray[1])) {
$value = GETPOST($key, $tmparray[1]);
} else {
$value = GETPOST($key, 'nohtml');
}
} elseif (preg_match('/^html/', $object->fields[$key]['type'])) {
$tmparray = explode(':', $object->fields[$key]['type']);
if (!empty($tmparray[1])) {
$value = GETPOST($key, $tmparray[1]);
} else {
$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')); // for date without hour, we use gmt
} elseif ($object->fields[$key]['type'] == 'datetime') {
@ -205,7 +217,14 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
// Set value to update
if (preg_match('/^(text|html)/', $object->fields[$key]['type'])) {
if (preg_match('/^text/', $object->fields[$key]['type'])) {
$tmparray = explode(':', $object->fields[$key]['type']);
if (!empty($tmparray[1])) {
$value = GETPOST($key, $tmparray[1]);
} else {
$value = GETPOST($key, 'nohtml');
}
} elseif (preg_match('/^html/', $object->fields[$key]['type'])) {
$tmparray = explode(':', $object->fields[$key]['type']);
if (!empty($tmparray[1])) {
$value = GETPOST($key, $tmparray[1]);

View File

@ -60,7 +60,12 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel',
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
//see #21072: Update a public note with a "document model not found" is not really a problem : the PDF is not created/updated
//but the note is saved, so just add a notification will be enought
$resultGenDoc = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($resultGenDoc < 0) {
setEventMessages($object->error, $object->errors, 'warnings');
}
if ($result < 0) {
dol_print_error($db, $result);

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
* This program is free software; you can redistribute it and/or modify
@ -65,6 +65,21 @@ abstract class CommonDocGenerator
*/
public $scandir;
/**
* @var string model name
*/
public $name;
/**
* @var string model description (short text)
*/
public $description;
/**
* @var array
*/
public $format;
public $page_hauteur;
public $page_largeur;
public $marge_gauche;

View File

@ -1735,15 +1735,17 @@ abstract class CommonInvoice extends CommonObject
$complementaryinfo .= '/30/'.$this->thirdparty->tva_intra;
}
$bankaccount = new Account($this->db);
// Header
$s = '';
$s .= "SPC\n";
$s .= "0200\n";
$s .= "1\n";
// Info seller
if ($this->fk_account > 0) {
// Bank BAN if country is LI or CH
// TODO Add
$bankaccount = new Account($this->db);
// TODO Add test on bank iban
$bankaccount->fetch($this->fk_account);
$s .= $bankaccount->iban."\n";
} else {

View File

@ -6288,7 +6288,6 @@ abstract class CommonObject
$new_array_options[$key] = $object->id;
} else {
$this->error = "Id/Ref '".$value."' for object '".$object->element."' not found";
$this->db->rollback();
return -1;
}
}
@ -8066,10 +8065,16 @@ abstract class CommonObject
$out .= "\n";
$nbofextrafieldsshown = 0;
$extrafields_collapse_num = '';
$e = 0; // var to manage the modulo (odd/even)
$lastseparatorkeyfound = '';
$extrafields_collapse_num = '';
$extrafields_collapse_num_old = '';
$i = 0;
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $label) {
$i++;
// Show only the key field in params
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) {
continue;
@ -8104,6 +8109,7 @@ abstract class CommonObject
if (empty($perms)) {
continue;
}
// Load language if required
if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) {
$langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
@ -8156,7 +8162,8 @@ abstract class CommonObject
// Output value of the current field
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
$extrafields_collapse_num = '';
$extrafields_collapse_num = $key;
/*
$extrafield_param = $extrafields->attributes[$this->table_element]['param'][$key];
if (!empty($extrafield_param) && is_array($extrafield_param)) {
$extrafield_param_list = array_keys($extrafield_param['options']);
@ -8165,14 +8172,20 @@ abstract class CommonObject
$extrafield_collapse_display_value = intval($extrafield_param_list[0]);
if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) {
$extrafields_collapse_num = $extrafields->attributes[$this->table_element]['pos'][$key];
//$extrafields_collapse_num = $extrafields->attributes[$this->table_element]['pos'][$key];
$extrafields_collapse_num = $key;
}
}
}
*/
// if colspan=0 or 1, the second column is not extended, so the separator must be on 2 columns
$out .= $extrafields->showSeparator($key, $this, ($colspan ? $colspan + 1 : 2), $display_type, $mode);
$lastseparatorkeyfound = $key;
} else {
$collapse_group = $extrafields_collapse_num.(!empty($this->id) ? '_'.$this->id : '');
$class = (!empty($extrafields->attributes[$this->table_element]['hidden'][$key]) ? 'hideobject ' : '');
$csstyle = '';
if (is_array($params) && count($params) > 0) {
@ -8243,13 +8256,13 @@ abstract class CommonObject
$helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]);
if ($display_type == 'card') {
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="field_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="field_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$collapse_group.'" '.$domData.' >';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) {
$out .= '<td></td>';
}
$out .= '<td class="titlefieldcreate wordbreak';
} elseif ($display_type == 'line') {
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="fieldline_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="fieldline_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$collapse_group.'" '.$domData.' >';
$out .= '<div style="display: inline-block; padding-right:4px" class="wordbreak';
}
//$out .= "titlefield";

View File

@ -53,9 +53,11 @@ trait CommonSocialNetworks
}
if ($nbofnetworks > 1) {
print '<tr><td><br><a class="paddingtop paddingbottom socialnetworklnk" id="socialnetworklnk" href="javascript:toogleSocialNetwork(true)"></a></td>';
print '<td'.($colspan ? ' colspan="'.($colspan-1).'"' : '').'>';
print '<br><a class="paddingtop paddingbottom socialnetworklnk" href="javascript:toogleSocialNetwork(true)"><span class="badge badge-secondary socialnetworklnk">'.$nbactive.'</span></a>';
print '<tr><td><br><a class="paddingtop paddingbottom socialnetworklnk onreposition" colspan="'.$colspan.'" id="socialnetworklnk" href="#"></a>';
//print '</td>';
//print '<td'.($colspan ? ' colspan="'.($colspan-1).'"' : '').'>';
//print '<br>';
print ' <a class="paddingtop paddingbottom socialnetworklnk onreposition" href="#"><span class="badge badge-secondary socialnetworklnk">'.$nbactive.'</span></a>';
print '</td>';
print '</tr>';
}
@ -80,9 +82,10 @@ trait CommonSocialNetworks
print '<script type="text/javascript">
$("document").ready(function() { toogleSocialNetwork(false); });
jQuery(".socialnetworklnk").onClick(function() {
jQuery(".socialnetworklnk").click(function() {
console.log("Click on link");
toogleSocialNetwork(true);
return false;
});
function toogleSocialNetwork(chgCookieState) {

View File

@ -98,7 +98,7 @@ class EmailSenderProfile extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1),
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
'signature' => array('type'=>'html', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),

View File

@ -1233,7 +1233,7 @@ class ExtraFields
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
}
//We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
} else {
@ -1690,7 +1690,7 @@ class ExtraFields
$sql = "SELECT ".$keyList;
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra') !== false) {
if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra.') !== false) {
$sql .= ' as main';
}
if ($selectkey == 'rowid' && empty($value)) {
@ -1806,7 +1806,7 @@ class ExtraFields
$sql = "SELECT ".$keyList;
$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
if (strpos($InfoFieldList[4], 'extra') !== false) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
$sql .= ' as main';
}
// $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
@ -1981,8 +1981,12 @@ class ExtraFields
$extrafield_collapse_display_value = intval($extrafield_param_list[0]);
$expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? (empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) ? false : true) : ($extrafield_collapse_display_value == 2 ? false : true));
}
$disabledcookiewrite = 0;
if ($mode == 'create') {
$extrafield_collapse_display_value = 0;
// On create mode, force separator group to not be collapsable
$extrafield_collapse_display_value = 1;
$expand_display = true; // We force group to be shown expanded
$disabledcookiewrite = 1; // We keep status of group unchanged into the cookie
}
$out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">';
@ -2004,19 +2008,21 @@ class ExtraFields
// Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup.
$this->expand_display[$collapse_group] = $expand_display;
if (!empty($conf->use_javascript_ajax) && $mode != 'create') {
if (!empty($conf->use_javascript_ajax)) {
$out .= '<!-- Add js script to manage the collapse/uncollapse of extrafields separators '.$key.' -->'."\n";
$out .= '<script type="text/javascript">'."\n";
$out .= 'jQuery(document).ready(function(){'."\n";
if ($expand_display === false) {
$out .= ' console.log("Inject js for the collapsing of extrafield '.$key.' - hide");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$collapse_group.'").hide();'."\n";
} else {
$out .= ' console.log("Inject js for collapsing of extrafield '.$key.' - keep visible and set cookie");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
if (empty($disabledcookiewrite)) {
if ($expand_display === false) {
$out .= ' console.log("Inject js for the collapsing of extrafield '.$key.' - hide");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$collapse_group.'").hide();'."\n";
} else {
$out .= ' console.log("Inject js for collapsing of extrafield '.$key.' - keep visible and set cookie");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
}
}
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'").click(function(){'."\n";
$out .= ' console.log("We click on collapse/uncollapse .trextrafields_collapse'.$collapse_group.'");'."\n";
$out .= ' console.log("We click on collapse/uncollapse to hide/show .trextrafields_collapse'.$collapse_group.'");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$collapse_group.'").toggle(100, function(){'."\n";
$out .= ' if (jQuery(".trextrafields_collapse'.$collapse_group.'").is(":hidden")) {'."\n";
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n";

View File

@ -417,13 +417,16 @@ class Utils
}
// TODO Replace with Utils->executeCLI() function but
// we must first introduce the variant with $lowmemorydump into this method.
if ($execmethod == 1) {
$output_arr = array();
$retval = null;
exec($fullcommandclear, $output_arr, $retval);
// TODO Replace this exec with Utils->executeCLI() function.
// We must check that the case for $lowmemorydump works too...
//$utils = new Utils($db);
//$outputfile = $conf->admin->dir_temp.'/dump.tmp';
//$utils->executeCLI($fullcommandclear, $outputfile, 0);
if ($retval != 0) {
$langs->load("errors");
@ -438,6 +441,8 @@ class Utils
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) {
continue;
}
// Now check into the result file, that the file end with "-- Dump completed"
// This is possible only if $output_arr is the clear dump file, so not possible with $lowmemorydump set because file is already compressed.
if (!$lowmemorydump) {
fwrite($handle, $read.($execmethod == 2 ? '' : "\n"));
if (preg_match('/'.preg_quote('-- Dump completed', '/').'/i', $read)) {

View File

@ -1011,7 +1011,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>2, 'index'=>1, 'position'=>20),
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35),
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>4, 'index'=>1, 'position'=>40),
'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 0, 'position'=>45),
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),

View File

@ -515,7 +515,7 @@ function GETPOSTISARRAY($paramname, $method = 0)
* 'aZ09'=check it's simple alpha string (recommended for keys)
* 'aZ09comma'=check it's a string for a sortfield or sortorder
* 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string)
* 'nohtml'=check there is no html content and no " and no ../
* 'nohtml'=check there is no html content
* 'restricthtml'=check html content is restricted to some tags only
* 'custom'= custom filter specify $filter and $options)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
@ -5022,8 +5022,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
$out .= "<br>\n";
$syslog .= "url=".dol_escape_htmltag($_SERVER["REQUEST_URI"]);
$syslog .= ", query_string=".dol_escape_htmltag($_SERVER["QUERY_STRING"]);
} else // Mode CLI
{
} else { // Mode CLI
$out .= '> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n";
$syslog .= "pid=".dol_getmypid();
}
@ -5035,12 +5034,15 @@ function dol_print_error($db = '', $error = '', $errors = null)
if (is_object($db)) {
if ($_SERVER['DOCUMENT_ROOT']) { // Mode web
$out .= "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n";
$out .= "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n";
$lastqueryerror = $db->lastqueryerror();
if (!utf8_check($lastqueryerror)) {
$lastqueryerror = "SQL error string is not a valid UTF8 string. We can't show it.";
}
$out .= "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($lastqueryerror ? dol_escape_htmltag($lastqueryerror) : $langs->trans("ErrorNoRequestInError"))."<br>\n";
$out .= "<b>".$langs->trans("ReturnCodeLastAccessInError").":</b> ".($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError"))."<br>\n";
$out .= "<b>".$langs->trans("InformationLastAccessInError").":</b> ".($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n";
$out .= "<br>\n";
} else // Mode CLI
{
} else { // Mode CLI
// No dol_escape_htmltag for output, we are in CLI mode
$out .= '> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n";
$out .= '> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities("ErrorNoRequestInError"))."\n";
@ -8946,108 +8948,116 @@ function verifCond($strToEvaluate)
*/
function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1')
{
// Only global variables can be changed by eval function and returned to caller
global $db, $langs, $user, $conf, $website, $websitepage;
global $action, $mainmenu, $leftmenu;
global $rights;
global $object;
global $mysoc;
try {
// Only global variables can be changed by eval function and returned to caller
global $db, $langs, $user, $conf, $website, $websitepage;
global $action, $mainmenu, $leftmenu;
global $rights;
global $object;
global $mysoc;
global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
global $soc; // For backward compatibility
global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
global $soc; // For backward compatibility
// Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing
if ($onlysimplestring == '1') {
// We must accept: '1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL'
// We must accept: '$conf->barcode->enabled || preg_match(\'/^AAA/\',$leftmenu)'
// We must accept: '$user->rights->cabinetmed->read && !$object->canvas=="patient@cabinetmed"'
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@', '/').']/i', $s)) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s);
return '';
// Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing
if ($onlysimplestring == '1') {
// We must accept: '1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL'
// We must accept: '$conf->barcode->enabled || preg_match(\'/^AAA/\',$leftmenu)'
// We must accept: '$user->rights->cabinetmed->read && !$object->canvas=="patient@cabinetmed"'
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@', '/').']/i', $s)) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s);
return '';
}
// TODO
// We can exclude all parenthesis ( that are not '($db' and 'getDolGlobalInt(' and 'getDolGlobalString(' and 'preg_match(' and 'isModEnabled('
// ...
}
} elseif ($onlysimplestring == '2') {
// We must accept: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found"
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@;[]', '/').']/i', $s)) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s);
return '';
}
}
// TODO
// We can exclude all parenthesis ( that are not '($db' and 'getDolGlobalInt(' and 'getDolGlobalString(' and 'preg_match(' and 'isModEnabled('
// ...
}
} elseif ($onlysimplestring == '2') {
// We must accept: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found"
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@;[]', '/').']/i', $s)) {
if (strpos($s, '::') !== false) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
return 'Bad string syntax to evaluate (double : char is forbidden): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s);
dol_syslog('Bad string syntax to evaluate (double : char is forbidden): '.$s);
return '';
}
}
}
if (strpos($s, '::') !== false) {
if (strpos($s, '`') !== false) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (backtick char is forbidden): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (backtick char is forbidden): '.$s);
return '';
}
}
if (preg_match('/[^0-9]+\.[^0-9]+/', $s)) { // We refuse . if not between 2 numbers
if ($returnvalue) {
return 'Bad string syntax to evaluate (dot char is forbidden): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (dot char is forbidden): '.$s);
return '';
}
}
// We block use of php exec or php file functions
$forbiddenphpstrings = array('$$');
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST'));
$forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI", "verifCond", "base64_decode");
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func"));
$forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b';
do {
$oldstringtoclean = $s;
$s = str_ireplace($forbiddenphpstrings, '__forbiddenstring__', $s);
$s = preg_replace('/'.$forbiddenphpregex.'/i', '__forbiddenstring__', $s);
//$s = preg_replace('/\$[a-zA-Z0-9_\->\$]+\(/i', '', $s); // Remove $function( call and $mycall->mymethod(
} while ($oldstringtoclean != $s);
if (strpos($s, '__forbiddenstring__') !== false) {
dol_syslog('Bad string syntax to evaluate: '.$s, LOG_WARNING);
if ($returnvalue) {
return 'Bad string syntax to evaluate: '.$s;
} else {
dol_syslog('Bad string syntax to evaluate: '.$s);
return '';
}
}
//print $s."<br>\n";
if ($returnvalue) {
return 'Bad string syntax to evaluate (double : char is forbidden): '.$s;
if ($hideerrors) {
return @eval('return '.$s.';');
} else {
return eval('return '.$s.';');
}
} else {
dol_syslog('Bad string syntax to evaluate (double : char is forbidden): '.$s);
return '';
}
}
if (strpos($s, '`') !== false) {
if ($returnvalue) {
return 'Bad string syntax to evaluate (backtick char is forbidden): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (backtick char is forbidden): '.$s);
return '';
}
}
if (preg_match('/[^0-9]+\.[^0-9]+/', $s)) { // We refuse . if not between 2 numbers
if ($returnvalue) {
return 'Bad string syntax to evaluate (dot char is forbidden): '.$s;
} else {
dol_syslog('Bad string syntax to evaluate (dot char is forbidden): '.$s);
return '';
}
}
// We block use of php exec or php file functions
$forbiddenphpstrings = array('$$');
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST'));
$forbiddenphpfunctions = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI", "verifCond", "base64_decode");
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func"));
$forbiddenphpregex = 'global\s+\$|\b('.implode('|', $forbiddenphpfunctions).')\b';
do {
$oldstringtoclean = $s;
$s = str_ireplace($forbiddenphpstrings, '__forbiddenstring__', $s);
$s = preg_replace('/'.$forbiddenphpregex.'/i', '__forbiddenstring__', $s);
//$s = preg_replace('/\$[a-zA-Z0-9_\->\$]+\(/i', '', $s); // Remove $function( call and $mycall->mymethod(
} while ($oldstringtoclean != $s);
if (strpos($s, '__forbiddenstring__') !== false) {
dol_syslog('Bad string syntax to evaluate: '.$s, LOG_WARNING);
if ($returnvalue) {
return 'Bad string syntax to evaluate: '.$s;
} else {
dol_syslog('Bad string syntax to evaluate: '.$s);
return '';
}
}
//print $s."<br>\n";
if ($returnvalue) {
if ($hideerrors) {
return @eval('return '.$s.';');
} else {
return eval('return '.$s.';');
}
} else {
if ($hideerrors) {
@eval($s);
} else {
eval($s);
if ($hideerrors) {
@eval($s);
} else {
eval($s);
}
}
} catch (Error $e) {
$error = 'Caught error : ';
$error .= $e->getMessage() . ', ';
$error .= 'Trace : ';
$error .= json_encode($e->getTrace());
error_log($error, 1);
}
}

View File

@ -107,10 +107,14 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT);
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
/*
if ($maxsize) {
// limit size of downloaded files. TODO Add MAIN_SECURITY_MAXFILESIZE_DOWNLOADED
$maxsize = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED');
if ($maxsize && defined('CURLOPT_MAXFILESIZE_LARGE')) {
curl_setopt($ch, CURLOPT_MAXFILESIZE_LARGE, $maxsize);
} */
}
if ($maxsize && defined('CURLOPT_MAXFILESIZE')) {
curl_setopt($ch, CURLOPT_MAXFILESIZE, $maxsize);
}
//curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response

View File

@ -280,8 +280,9 @@ function supplier_invoice_rec_prepare_head($object)
function getNumberInvoicesPieChart($mode)
{
global $conf, $db, $langs, $user;
if (($mode == 'customers' && isModEnabled('facture') && !empty($user->rights->facture->lire))
|| ($mode = 'suppliers') && (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire)
|| ($mode == 'suppliers' && (isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire))
) {
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
@ -406,7 +407,9 @@ function getNumberInvoicesPieChart($mode)
dol_print_error($db);
}
}
return '';
}
/**
* Return a HTML table that contains a list with customer invoice drafts
*
@ -418,137 +421,140 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
{
global $conf, $db, $langs, $user, $hookmanager;
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
$result = '';
$tmpinvoice = new Facture($db);
$sql = "SELECT f.rowid, f.ref, f.datef as date, f.total_ht, f.total_tva, f.total_ttc, f.ref_client";
$sql .= ", f.type, f.fk_statut as status, f.paye";
$sql .= ", s.nom as name";
$sql .= ", s.rowid as socid, s.email";
$sql .= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
$sql .= ", cc.rowid as country_id, cc.code as country_code";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
$sql .= $hookmanager->resPrint;
$tmpinvoice = new Facture($db);
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
$sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
$sql .= " cc.rowid, cc.code";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
$sql = "SELECT f.rowid, f.ref, f.datef as date, f.total_ht, f.total_tva, f.total_ttc, f.ref_client";
$sql .= ", f.type, f.fk_statut as status, f.paye";
$sql .= ", s.nom as name";
$sql .= ", s.rowid as socid, s.email";
$sql .= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
$sql .= ", cc.rowid as country_id, cc.code as country_code";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
// Add Group from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters);
$sql .= $hookmanager->resPrint;
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
$sql .= $hookmanager->resPrint;
$resql = $db->query($sql);
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
$sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
$sql .= " cc.rowid, cc.code";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
if ($resql) {
$num = $db->num_rows($resql);
$nbofloop = min($num, $maxofloop);
// Add Group from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListGroupByCustomerDraft', $parameters);
$sql .= $hookmanager->resPrint;
$result .= '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder centpercent">';
$resql = $db->query($sql);
$result .= '<tr class="liste_titre">';
$result .= '<th colspan="3">';
$result .= $langs->trans("CustomersDraftInvoices").' ';
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?search_status='.Facture::STATUS_DRAFT.'">';
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
$result .= '</a>';
$result .= '</th>';
$result .= '</tr>';
if ($resql) {
$num = $db->num_rows($resql);
$nbofloop = min($num, $maxofloop);
if ($num) {
$companystatic = new Societe($db);
$result .= '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder centpercent">';
$i = 0;
$othernb = 0;
$tot_ttc = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql);
$result .= '<tr class="liste_titre">';
$result .= '<th colspan="3">';
$result .= $langs->trans("CustomersDraftInvoices").' ';
$result .= '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?search_status='.Facture::STATUS_DRAFT.'">';
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
$result .= '</a>';
$result .= '</th>';
$result .= '</tr>';
if ($i >= $maxCount) {
$othernb += 1;
$i++;
if ($num) {
$companystatic = new Societe($db);
$i = 0;
$othernb = 0;
$tot_ttc = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql);
if ($i >= $maxCount) {
$othernb += 1;
$i++;
$tot_ttc += $obj->total_ttc;
continue;
}
$tmpinvoice->id = $obj->rowid;
$tmpinvoice->ref = $obj->ref;
$tmpinvoice->date = $db->jdate($obj->date);
$tmpinvoice->type = $obj->type;
$tmpinvoice->total_ht = $obj->total_ht;
$tmpinvoice->total_tva = $obj->total_tva;
$tmpinvoice->total_ttc = $obj->total_ttc;
$tmpinvoice->ref_client = $obj->ref_client;
$tmpinvoice->statut = $obj->status;
$tmpinvoice->paye = $obj->paye;
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->email = $obj->email;
$companystatic->country_id = $obj->country_id;
$companystatic->country_code = $obj->country_code;
$companystatic->client = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $tmpinvoice->getNomUrl(1, '');
$result .= '</td>';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $companystatic->getNomUrl(1, 'customer');
$result .= '</td>';
$result .= '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
$result .= '</tr>';
$tot_ttc += $obj->total_ttc;
continue;
$i++;
}
$tmpinvoice->id = $obj->rowid;
$tmpinvoice->ref = $obj->ref;
$tmpinvoice->date = $db->jdate($obj->date);
$tmpinvoice->type = $obj->type;
$tmpinvoice->total_ht = $obj->total_ht;
$tmpinvoice->total_tva = $obj->total_tva;
$tmpinvoice->total_ttc = $obj->total_ttc;
$tmpinvoice->ref_client = $obj->ref_client;
$tmpinvoice->statut = $obj->status;
$tmpinvoice->paye = $obj->paye;
if ($othernb) {
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap" colspan="3">';
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
$result .= '</td>';
$result .= "</tr>\n";
}
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->email = $obj->email;
$companystatic->country_id = $obj->country_id;
$companystatic->country_code = $obj->country_code;
$companystatic->client = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $tmpinvoice->getNomUrl(1, '');
$result .= '</td>';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $companystatic->getNomUrl(1, 'customer');
$result .= '</td>';
$result .= '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
$result .= '</tr>';
$tot_ttc += $obj->total_ttc;
$i++;
} else {
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
}
if ($othernb) {
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap" colspan="3">';
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
$result .= '</td>';
$result .= "</tr>\n";
}
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
$result .= '</tr>';
$result .= "</table></div>";
$db->free($resql);
} else {
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
dol_print_error($db);
}
$result .= "</table></div>";
$db->free($resql);
} else {
dol_print_error($db);
}
return $result;
@ -565,119 +571,122 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
{
global $conf, $db, $langs, $user, $hookmanager;
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
$result = '';
$facturesupplierstatic = new FactureFournisseur($db);
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye";
$sql .= ", s.nom as name";
$sql .= ", s.rowid as socid, s.email";
$sql .= ", s.code_client, s.code_compta";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
$sql .= ", cc.rowid as country_id, cc.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
$sql .= " AND f.entity IN (".getEntity('invoice').')';
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhereSupplierDraft', $parameters);
$sql .= $hookmanager->resPrint;
$resql = $db->query($sql);
if ((isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire)) {
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
if ($resql) {
$num = $db->num_rows($resql);
$nbofloop = min($num, $maxofloop);
$facturesupplierstatic = new FactureFournisseur($db);
$result .= '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder centpercent">';
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye";
$sql .= ", s.nom as name";
$sql .= ", s.rowid as socid, s.email";
$sql .= ", s.code_client, s.code_compta";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
$sql .= ", cc.rowid as country_id, cc.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
$sql .= " AND f.entity IN (".getEntity('invoice').')';
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhereSupplierDraft', $parameters);
$sql .= $hookmanager->resPrint;
$resql = $db->query($sql);
$result .= '<tr class="liste_titre">';
$result .= '<th colspan="3">';
$result .= $langs->trans("SuppliersDraftInvoices").' ';
$result .= '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?search_status='.FactureFournisseur::STATUS_DRAFT.'">';
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
$result .= '</a>';
$result .= '</th>';
$result .= '</tr>';
if ($resql) {
$num = $db->num_rows($resql);
$nbofloop = min($num, $maxofloop);
if ($num) {
$companystatic = new Societe($db);
$result .= '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder centpercent">';
$i = 0;
$othernb = 0;
$tot_ttc = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql);
$result .= '<tr class="liste_titre">';
$result .= '<th colspan="3">';
$result .= $langs->trans("SuppliersDraftInvoices").' ';
$result .= '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?search_status='.FactureFournisseur::STATUS_DRAFT.'">';
$result .= '<span class="badge marginleftonlyshort">'.$num.'</span>';
$result .= '</a>';
$result .= '</th>';
$result .= '</tr>';
if ($i >= $maxCount) {
$othernb += 1;
$i++;
if ($num) {
$companystatic = new Societe($db);
$i = 0;
$othernb = 0;
$tot_ttc = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql);
if ($i >= $maxCount) {
$othernb += 1;
$i++;
$tot_ttc += $obj->total_ttc;
continue;
}
$facturesupplierstatic->ref = $obj->ref;
$facturesupplierstatic->id = $obj->rowid;
$facturesupplierstatic->total_ht = $obj->total_ht;
$facturesupplierstatic->total_tva = $obj->total_tva;
$facturesupplierstatic->total_ttc = $obj->total_ttc;
$facturesupplierstatic->ref_supplier = $obj->ref_supplier;
$facturesupplierstatic->type = $obj->type;
$facturesupplierstatic->statut = $obj->status;
$facturesupplierstatic->paye = $obj->paye;
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->email = $obj->email;
$companystatic->country_id = $obj->country_id;
$companystatic->country_code = $obj->country_code;
$companystatic->fournisseur = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $facturesupplierstatic->getNomUrl(1, '');
$result .= '</td>';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $companystatic->getNomUrl(1, 'supplier');
$result .= '</td>';
$result .= '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
$result .= '</tr>';
$tot_ttc += $obj->total_ttc;
continue;
$i++;
}
$facturesupplierstatic->ref = $obj->ref;
$facturesupplierstatic->id = $obj->rowid;
$facturesupplierstatic->total_ht = $obj->total_ht;
$facturesupplierstatic->total_tva = $obj->total_tva;
$facturesupplierstatic->total_ttc = $obj->total_ttc;
$facturesupplierstatic->ref_supplier = $obj->ref_supplier;
$facturesupplierstatic->type = $obj->type;
$facturesupplierstatic->statut = $obj->status;
$facturesupplierstatic->paye = $obj->paye;
if ($othernb) {
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap" colspan="3">';
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
$result .= '</td>';
$result .= "</tr>\n";
}
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->email = $obj->email;
$companystatic->country_id = $obj->country_id;
$companystatic->country_code = $obj->country_code;
$companystatic->fournisseur = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $facturesupplierstatic->getNomUrl(1, '');
$result .= '</td>';
$result .= '<td class="nowrap tdoverflowmax100">';
$result .= $companystatic->getNomUrl(1, 'supplier');
$result .= '</td>';
$result .= '<td class="right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
$result .= '</tr>';
$tot_ttc += $obj->total_ttc;
$i++;
} else {
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
}
if ($othernb) {
$result .= '<tr class="oddeven">';
$result .= '<td class="nowrap" colspan="3">';
$result .= '<span class="opacitymedium">'.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').'</span>';
$result .= '</td>';
$result .= "</tr>\n";
}
$result .= '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
$result .= '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
$result .= '</tr>';
$result .= "</table></div>";
$db->free($resql);
} else {
$result .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
dol_print_error($db);
}
$result .= "</table></div>";
$db->free($resql);
} else {
dol_print_error($db);
}
return $result;

View File

@ -3,6 +3,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>
* Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,7 +77,10 @@ function salaries_prepare_head($object)
*/
function salaries_admin_prepare_head()
{
global $langs, $conf, $user;
global $conf, $db, $langs, $user;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('salary');
$h = 0;
$head = array();
@ -94,6 +98,10 @@ function salaries_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSalaries");
$nbExtrafields = $extrafields->attributes['salary']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;

View File

@ -635,7 +635,13 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
$nbko = 0;
if ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete') {
foreach ($featuresarray as $feature) {
if ($feature == 'contact') {
if ($feature == 'bookmark') {
if (!$user->rights->bookmark->supprimer) {
if ($user->id != $object->fk_user || empty($user->rights->bookmark->creer)) {
$deleteok = 0;
}
}
} elseif ($feature == 'contact') {
if (!$user->rights->societe->contact->supprimer) {
$deleteok = 0;
}
@ -805,6 +811,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$checkproject = array('projet', 'project'); // Test for project object
$checktask = array('projet_task'); // Test for task object
$checkhierarchy = array('expensereport', 'holiday'); // check permission among the hierarchy of user
$checkuser = array('bookmark'); // check permission among the fk_user (must be myself or null)
$nocheck = array('barcode', 'stock'); // No test
//$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).
@ -1027,6 +1034,15 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
}
}
// For some object, we also have to check it is public or owned by user
// Param $object must be the full object and not a simple id to have this test possible.
if (in_array($feature, $checkuser) && is_object($object) && $objectid > 0) {
$useridtocheck = $object->fk_user;
if (!empty($useridtocheck) && $useridtocheck > 0 && $useridtocheck != $user->id && empty($user->admin)) {
return false;
}
}
if ($sql) {
$resql = $db->query($sql);
if ($resql) {

View File

@ -204,7 +204,7 @@ class modCommande extends DolibarrModules
'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id",
'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate",
'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.total_ht'=>"TotalHT",
'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note",
'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'sm.code'=>'SendingMethod',
'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin',
'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct',
'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC",
@ -235,7 +235,7 @@ class modCommande extends DolibarrModules
$this->export_TypeFields_array[$r] = array(
's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text',
's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date",
'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric",
'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'sm.code'=>"Text", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric",
'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'pj.ref'=>'Text',
'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric",
'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text',
@ -246,7 +246,7 @@ class modCommande extends DolibarrModules
'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order",
'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order",
'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order",
'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line",
'c.date_livraison'=>"order", 'sm.code'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line",
'cd.product_type'=>'order_line', 'cd.tva_tx'=>"order_line", 'cd.qty'=>"order_line", 'cd.total_ht'=>"order_line", 'cd.total_tva'=>"order_line",
'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'
);
@ -277,6 +277,7 @@ class modCommande extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande as c';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as sm ON c.fk_shipping_method = sm.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid';

View File

@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
*/
class modImport extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*

View File

@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
*/
class modUser extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*

View File

@ -69,8 +69,22 @@ foreach ($object->fields as $key => $val) {
$value = GETPOST($key, 'int');
} elseif ($val['type'] == 'double') {
$value = price2num(GETPOST($key, 'alphanohtml'));
} elseif ($val['type'] == 'text' || $val['type'] == 'html') {
$value = GETPOST($key, 'restricthtml');
} elseif (preg_match('/^text/', $val['type'])) {
$tmparray = explode(':', $val['type']);
if (!empty($tmparray[1])) {
$check = $tmparray[1];
} else {
$check = 'nohtml';
}
$value = GETPOST($key, $check);
} elseif (preg_match('/^html/', $val['type'])) {
$tmparray = explode(':', $val['type']);
if (!empty($tmparray[1])) {
$check = $tmparray[1];
} else {
$check = 'restricthtml';
}
$value = GETPOST($key, $check);
} elseif ($val['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
} elseif ($val['type'] == 'datetime') {

View File

@ -72,7 +72,15 @@ foreach ($object->fields as $key => $val) {
$value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key;
} elseif ($val['type'] == 'double') {
$value = GETPOSTISSET($key) ? price2num(GETPOST($key, 'alphanohtml')) : $object->$key;
} elseif (preg_match('/^(text|html)/', $val['type'])) {
} elseif (preg_match('/^text/', $val['type'])) {
$tmparray = explode(':', $val['type']);
if (!empty($tmparray[1])) {
$check = $tmparray[1];
} else {
$check = 'nohtml';
}
$value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key;
} elseif (preg_match('/^html/', $val['type'])) {
$tmparray = explode(':', $val['type']);
if (!empty($tmparray[1])) {
$check = $tmparray[1];

View File

@ -43,7 +43,11 @@ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object,
print $hookmanager->resPrint;
if (empty($reshook)) {
$params = array();
$params['cols'] = isset($parameters['colspanvalue']) ? $parameters['colspanvalue'] : null;
if (isset($tpl_context)) {
$params['tpl_context'] = $tpl_context;
}
$params['cols'] = key_exists('colspanvalue', $parameters) ? $parameters['colspanvalue'] : null;
print $object->showOptionals($extrafields, 'edit', $params);
}

View File

@ -65,6 +65,8 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
$extrafields_collapse_num = '';
$extrafields_collapse_num_old = '';
$i = 0;
// Loop on each extrafield
foreach ($extrafields->attributes[$object->table_element]['label'] as $tmpkeyextra => $tmplabelextra) {
$i++;
@ -114,6 +116,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l
$lastseparatorkeyfound = $tmpkeyextra;
} else {
$collapse_group = $extrafields_collapse_num.(!empty($object->id) ? '_'.$object->id : '');
print '<tr class="trextrafields_collapse'.$collapse_group;
/*if ($extrafields_collapse_num && $extrafields_collapse_num_old && $extrafields_collapse_num != $extrafields_collapse_num_old) {
print ' trextrafields_collapse_new';

View File

@ -70,7 +70,7 @@ if (!empty($inputalsopricewithtax)) {
if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) {
$colspan++; // With this, there is a column move button
}
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) {
$colspan += 2;
}
if (isModEnabled('asset') && $object->element == 'invoice_supplier') {
@ -218,7 +218,7 @@ $coldisplay++;
}
print '></td>';
if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) {
if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) {
$coldisplay++;
print '<td class="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat right" size="5" id="multicurrency_subprice" name="multicurrency_subprice" value="'.(GETPOSTISSET('multicurrency_subprice') ? GETPOST('multicurrency_subprice', 'alpha') : price($line->multicurrency_subprice)).'" /></td>';
}
@ -286,7 +286,7 @@ $coldisplay++;
<?php
// Progession for situation invoices
if ($this->situation_cycle_ref) {
if ($object->situation_cycle_ref) {
$coldisplay++;
print '<td class="nowrap right linecolcycleref"><input class="right" type="text" size="1" value="'.(GETPOSTISSET('progress') ? GETPOST('progress') : $line->situation_percent).'" name="progress">%</td>';
$coldisplay++;
@ -490,7 +490,7 @@ jQuery(document).ready(function()
}
});
<?php if (in_array($this->table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?>
<?php if (in_array($object->table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?>
$("#date_start, #date_end").focusout(function() {
if ( $(this).val() == '' && !$(this).hasClass('inputmandatory') ) {
$(this).addClass('inputmandatory');

View File

@ -219,6 +219,12 @@ if ($resql) {
// Filters lines
print '<tr class="liste_titre_filter">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
@ -252,13 +258,18 @@ if ($resql) {
);
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'search_status maxwidth100 onrightofpage');
print '</td>';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
print "</tr>\n";
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('');
}
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder);
@ -273,7 +284,9 @@ if ($resql) {
}
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('');
}
print "</tr>\n";
while ($i < min($num, $limit)) {
@ -307,6 +320,9 @@ if ($resql) {
}
} else {
print '<tr class="oddeven">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
$donationstatic->id = $objp->rowid;
$donationstatic->ref = $objp->rowid;
$donationstatic->lastname = $objp->lastname;
@ -339,7 +355,9 @@ if ($resql) {
}
print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
print '<td class="right">'.$donationstatic->LibStatut($objp->status, 5).'</td>';
print '<td></td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print "</tr>";
}
$i++;

View File

@ -139,8 +139,6 @@ class EmailCollector extends CommonObject
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>"1", 'position'=>103, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'),
'oauth_service' => array('type'=>'varchar(128)', 'label'=>'oauthService', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>104, 'notnull'=>0, 'index'=>1, 'comment'=>"IMAP login oauthService", 'arrayofkeyval'=>array(), 'help'=>'TokenMustHaveBeenCreated'),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>104, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
//'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105),
//'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106),
'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'help'=>"EmailCollectorTargetDir"),
'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>100),
'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1, 'csslist'=>'nowraponall'),

View File

@ -108,7 +108,7 @@ class ConferenceOrBooth extends ActionComm
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'width100'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',),

View File

@ -191,8 +191,8 @@ class ExpenseReport extends CommonObject
'fk_user_cancel' =>array('type'=>'integer', 'label'=>'Fk user cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'fk_c_paiement' =>array('type'=>'integer', 'label'=>'Fk c paiement', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
'paid' =>array('type'=>'integer', 'label'=>'Paid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>145),
'note_public' =>array('type'=>'text', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>150),
'note_private' =>array('type'=>'text', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'note_public' =>array('type'=>'html', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>150),
'note_private' =>array('type'=>'html', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'detail_refuse' =>array('type'=>'varchar(255)', 'label'=>'Detail refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'detail_cancel' =>array('type'=>'varchar(255)', 'label'=>'Detail cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'integration_compta' =>array('type'=>'integer', 'label'=>'Integration compta', 'enabled'=>1, 'visible'=>-1, 'position'=>170),

View File

@ -57,9 +57,9 @@ class Fichinter extends CommonObject
'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'description' =>array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130),

View File

@ -237,8 +237,8 @@ class CommandeFournisseur extends CommonOrder
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>3, 'position'=>140, 'isameasure'=>1),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>1, 'position'=>145, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155, 'searchall'=>1),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155, 'searchall'=>1),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165),
'fk_input_method' =>array('type'=>'integer', 'label'=>'OrderMode', 'enabled'=>1, 'visible'=>3, 'position'=>170),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175),

View File

@ -201,8 +201,8 @@ class FactureFournisseurRec extends CommonInvoice
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'note_private' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),

View File

@ -300,8 +300,8 @@ class FactureFournisseur extends CommonInvoice
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),

View File

@ -27,6 +27,7 @@
* \brief Test if file conf can be modified and if does not exists, test if install process can create it
*/
define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1);
include_once 'inc.php';
global $langs;

View File

@ -180,33 +180,27 @@ if (!empty($dolibarr_main_document_root_alt)) {
}
// Security check (old method, when directory is renamed /install.lock)
if (preg_match('/install\.lock/i', $_SERVER["SCRIPT_FILENAME"])) {
if (!is_object($langs)) {
$langs = new Translate('..', $conf);
$langs->setDefaultLang('auto');
}
$langs->load("install");
// Check install.lock (for both install and upgrade)
header("X-Content-Type-Options: nosniff");
header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
print $langs->trans("YouTryInstallDisabledByDirLock");
if (!empty($dolibarr_main_url_root)) {
print 'Click on following link, <a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(GETPOSTISSET("login") ? '&username='.urlencode(GETPOST("login")) : '').'">';
print $langs->trans("ClickHereToGoToApp");
print '</a>';
}
exit;
}
$lockfile = DOL_DATA_ROOT.'/install.lock';
$lockfile = DOL_DATA_ROOT.'/install.lock'; // To lock all /install pages
$lockfile2 = DOL_DOCUMENT_ROOT.'/install.lock'; // To lock all /install pages (recommended)
$upgradeunlockfile = DOL_DATA_ROOT.'/upgrade.unlock'; // To unlock upgrade process
$upgradeunlockfile2 = DOL_DOCUMENT_ROOT.'/upgrade.unlock'; // To unlock upgrade process
if (constant('DOL_DATA_ROOT') === null) {
// We don't have a configuration file yet
// Try to detect any lockfile in the default documents path
$lockfile = '../../documents/install.lock';
$upgradeunlockfile = '../../documents/upgrade.unlock';
}
if (@file_exists($lockfile)) {
$islocked=false;
if (@file_exists($lockfile) || @file_exists($lockfile2)) {
if (!defined('ALLOWED_IF_UPGRADE_UNLOCK_FOUND') || (! @file_exists($upgradeunlockfile) && ! @file_exists($upgradeunlockfile2))) {
// If this is a dangerous install page (ALLOWED_IF_UPGRADE_UNLOCK_FOUND not defined) or
// if there is no upgrade unlock files, we lock the pages.
$islocked = true;
}
}
if ($islocked) { // Pages are locked
if (!isset($langs) || !is_object($langs)) {
$langs = new Translate('..', $conf);
$langs->setDefaultLang('auto');
@ -216,14 +210,22 @@ if (@file_exists($lockfile)) {
header("X-Content-Type-Options: nosniff");
header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
print $langs->trans("YouTryInstallDisabledByFileLock");
if (GETPOST('action') != 'upgrade') {
print $langs->trans("YouTryInstallDisabledByFileLock").'<br>';
} else {
print $langs->trans("YouTryUpgradeDisabledByMissingFileUnLock").'<br>';
}
if (!empty($dolibarr_main_url_root)) {
print $langs->trans("ClickOnLinkOrRemoveManualy").'<br>';
if (GETPOST('action') != 'upgrade') {
print $langs->trans("ClickOnLinkOrRemoveManualy").'<br>';
} else {
print $langs->trans("ClickOnLinkOrCreateUnlockFileManualy").'<br>';
}
print '<a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(GETPOSTISSET("login") ? '&username='.urlencode(GETPOST("login")) : '').'">';
print $langs->trans("ClickHereToGoToApp");
print '</a>';
} else {
print 'If you always reach this page, you must remove install.lock file manually.<br>';
print 'If you always reach this page, you must remove the install.lock file manually.<br>';
}
exit;
}

View File

@ -23,6 +23,8 @@
* \brief Show page to select language. This is done only for a first installation.
* For a reinstall this page redirect to page check.php
*/
define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1);
include_once 'inc.php';
include_once '../core/class/html.form.class.php';
include_once '../core/class/html.formadmin.class.php';

View File

@ -37,6 +37,7 @@
-- VMYSQL4.3 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN `rank` rankorder integer;
-- VPGSQL8.2 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN rank rankorder integer;
ALTER TABLE llx_accounting_system CHANGE COLUMN fk_pays fk_country integer;
-- v18
@ -63,3 +64,10 @@ ALTER TABLE llx_website ADD COLUMN pageviews_previous_month BIGINT UNSIGNED DEFA
ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);
ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid);
ALTER TABLE llx_bank_account ADD COLUMN owner_zip varchar(25);
ALTER TABLE llx_bank_account ADD COLUMN owner_town varchar(50);
ALTER TABLE llx_bank_account ADD COLUMN owner_country_id integer DEFAULT NULL;

View File

@ -576,3 +576,81 @@ DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee';
-- DROP TABLE tmp_bank2;
-- CREATE TABLE tmp_bank2 SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment_supplier' INNER JOIN llx_paiementfourn as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank2 as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL;
-- Delete duplicate entries into llx_c_transport_mode
-- VMYSQL4.1 DELETE T1 FROM llx_c_transport_mode as T1, llx_c_transport_mode as T2 where T1.entity = T2.entity AND T1.code = T2.code and T1.rowid > T2.rowid;
-- VPGSQL8.2 DELETE FROM llx_c_transport_mode as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_c_transport_mode GROUP BY code, entity);
-- Delete department of regions linked to no coutry, then delete region with no country
DELETE FROM llx_c_departements WHERE fk_region <> 0 AND fk_region IN (select code_region FROM llx_c_regions WHERE fk_pays NOT IN (select rowid from llx_c_country));
DELETE from llx_c_regions WHERE fk_pays NOT IN (select rowid from llx_c_country);
-- Drop duplicate indexes not named correctly and create the only one we should have
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combination;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_2;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_3;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_4;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_5;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_6;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_7;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_8;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_9;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_10;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_11;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_12;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_13;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_14;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_15;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_16;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_17;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_18;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_19;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_20;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_21;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_22;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_23;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_24;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_25;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_26;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_27;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_28;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_29;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_30;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_31;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_32;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_33;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_34;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_35;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_36;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_37;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_38;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_39;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_40;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_41;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_42;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_43;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_44;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_45;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_46;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_47;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_48;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_49;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_50;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_51;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_52;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_53;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_54;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_55;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_56;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_57;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_58;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_59;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_60;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_61;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_62;
alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_63;
ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE INDEX uk_prod_att_comb_price_level(fk_product_attribute_combination, fk_price_level);

View File

@ -47,6 +47,9 @@ create table llx_bank_account
fk_pays integer NOT NULL,
proprio varchar(60),
owner_address varchar(255),
owner_zip varchar(25),
owner_town varchar(50),
owner_country_id integer DEFAULT NULL,
courant smallint DEFAULT 0 NOT NULL,
clos smallint DEFAULT 0 NOT NULL,
rappro smallint DEFAULT 1,

View File

@ -24,8 +24,18 @@
* \file htdocs/install/step5.php
* \ingroup install
* \brief Last page of upgrade / install process
*
* This page is called with parameter action=set by step4.php or action=upgrade by upgrade2.php
* For installation:
* It creates the login admin and set the MAIN_SECURITY_SALT to a random value.
* It set the value for MAIN_VERSION_LAST_INSTALL
* It creates the install.lock and shows the final message.
* For upgrade:
* It updates the value for MAIN_VERSION_LAST_UPGRADE.
* It (re)creates the install.lock and shows the final message.
*/
define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1);
include_once 'inc.php';
if (file_exists($conffile)) {
include_once $conffile;
@ -384,7 +394,7 @@ if ($action == "set") {
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
$force_install_lockinstall = 444; // For backward compatibility
}
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fwrite($fp, "This is a lock file to prevent use of install or upgrade pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
$createlock = 1;
@ -416,8 +426,9 @@ if ($action == "set") {
} elseif (empty($action) || preg_match('/upgrade/i', $action)) {
// If upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
// Upgrade is finished (database is on same version than files)
print '<img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/checklist.svg" width="20" alt="Configuration"> <span class="valignmiddle">'.$langs->trans("SystemIsUpgraded")."</span><br>";
// Upgrade is finished (database is on the same version than files)
print '<img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/checklist.svg" width="20" alt="Configuration">';
print ' <span class="valignmiddle">'.$langs->trans("SystemIsUpgraded")."</span><br>";
// Create install.lock file if it does not exists.
// Note: it should always exists. A better solution to allow upgrade will be to add an upgrade.unlock file
@ -430,7 +441,7 @@ if ($action == "set") {
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
$force_install_lockinstall = 444; // For backward compatibility
}
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fwrite($fp, "This is a lock file to prevent use of install or upgrade pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
$createlock = 1;

View File

@ -36,6 +36,7 @@
* \brief Run migration script
*/
define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1);
include_once 'inc.php';
if (!file_exists($conffile)) {
print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").';

View File

@ -38,6 +38,7 @@
* \brief Upgrade some data
*/
define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1);
include_once 'inc.php';
if (!file_exists($conffile)) {
print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").';

View File

@ -2366,3 +2366,6 @@ MaxNumberOfAttachementOnForms=Max number of joinded files in a form
IfDefinedUseAValueBeetween=If defined, use a value between %s and %s
Reload=Reload
ConfirmReload=Confirm module reload
WarningModuleHasChangedLastVersionCheckParameter=Warning: the module %s has set a parameter to check its version at each page access. This is a bad and not allowed practice that may make the page to administer modules instable. Please contact author of module to fix this.
WarningModuleHasChangedSecurityCsrfParameter=Warning: the module %s has disabled the CSRF security of your instance. This action is suspect and your installation may no more be secured. Please contact the author of the module for explanation.

View File

@ -49,6 +49,9 @@ BankAccountDomiciliation=Bank address
BankAccountCountry=Account country
BankAccountOwner=Account owner name
BankAccountOwnerAddress=Account owner address
BankAccountOwnerZip=Account owner zip
BankAccountOwnerTown=Account owner town
BankAccountOwnerCountry=Account owner country
CreateAccount=Create account
NewBankAccount=New account
NewFinancialAccount=New financial account

View File

@ -304,6 +304,7 @@ ErrorValueCantBeNull=Value for <b>%s</b> can't be null
ErrorDateOfMovementLowerThanDateOfFileTransmission=The date of the bank transaction can't be lower than the date of the file transmission
ErrorTooMuchFileInForm=Too much files in form, the maximum number is %s file(s)
ErrorSessionInvalidatedAfterPasswordChange=The session was been invalidated following a change of password, status or dates of validity. Please relogin.
ErrorExistingPermission = Permission <b>%s</b> for object <b>%s</b> already exists
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
@ -342,6 +343,7 @@ WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online
WarningThemeForcedTo=Warning, theme has been forced to <b>%s</b> by hidden constant MAIN_FORCETHEME
WarningPagesWillBeDeleted=Warning, this will also delete all existing pages/containers of the website. You should export your website before, so you have a backup to re-import it later.
WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal=Automatic validation is disabled when option to decrease stock is set on "Invoice validation".
WarningModuleNeedRefrech = Module <b>%s</b> has been disabled. Don't forget to enable it
# Validate
RequireValidValue = Value not valid

View File

@ -88,7 +88,7 @@ LoginAlreadyExists=Already exists
DolibarrAdminLogin=Dolibarr admin login
AdminLoginAlreadyExists=Dolibarr administrator account '<b>%s</b>' already exists. Go back if you want to create another one.
FailedToCreateAdminLogin=Failed to create Dolibarr administrator account.
WarningRemoveInstallDir=Warning, for security reasons, once the install or upgrade is complete, you should add a file called <b>install.lock</b> into the Dolibarr document directory in order to prevent the accidental/malicious use of the install tools again.
WarningRemoveInstallDir=Warning, for security reasons, once the installation process is complete, you must add a file called <b>install.lock</b> into the Dolibarr document directory in order to prevent the accidental/malicious use of the install tools again.
FunctionNotAvailableInThisPHP=Not available in this PHP
ChoosedMigrateScript=Choose migration script
DataMigration=Database migration (data)
@ -208,8 +208,10 @@ HideNotAvailableOptions=Hide unavailable options
ErrorFoundDuringMigration=Error(s) were reported during the migration process so next step is not available. To ignore errors, you can <a href="%s">click here</a>, but the application or some features may not work correctly until the errors are resolved.
YouTryInstallDisabledByDirLock=The application tried to self-upgrade, but the install/upgrade pages have been disabled for security (directory renamed with .lock suffix).<br>
YouTryInstallDisabledByFileLock=The application tried to self-upgrade, but the install/upgrade pages have been disabled for security (by the existence of a lock file <strong>install.lock</strong> in the dolibarr documents directory).<br>
YouTryUpgradeDisabledByMissingFileUnLock=The application tried to self-upgrade, but the upgrade process is currently not allowed.<br>
ClickHereToGoToApp=Click here to go to your application
ClickOnLinkOrRemoveManualy=If an upgrade is in progress, please wait. If not, click on the following link. If you always see this same page, you must remove/rename the file install.lock in the documents directory.
ClickOnLinkOrCreateUnlockFileManualy=If an upgrade is in progress, please wait... If not, you must create a file upgrade.unlock into the Dolibarr documents directory.
Loaded=Loaded
FunctionTest=Function test
NodoUpgradeAfterDB=No action requested by external modules after upgrade of database

View File

@ -165,3 +165,8 @@ BadValueForType=Bad value for type %s
DefinePropertiesFromExistingTable=Define properties from an existing table
DefinePropertiesFromExistingTableDesc=If a table in the database (for the object to create) already exists, you can use it to define the properties of the object.
DefinePropertiesFromExistingTableDesc2=Keep empty if the table does not exist yet. The code generator will use different kinds of fields to build an example of table that you can edit later.
GeneratePermissions=I want to add the rights for this object
GeneratePermissionsHelp=generate default rights for this object
PermissionDeletedSuccesfuly=Permission has been successfully removed
PermissionUpdatedSuccesfuly=Permission has been successfully updated
PermissionAddedSuccesfuly=Permission has been successfully added

View File

@ -303,8 +303,10 @@ ErrorValueForTooLow=La valeur pour <b>%s</b> est trop faible
ErrorValueCantBeNull=La valeur pour <b>%s</b> ne peut pas être nulle
ErrorDateOfMovementLowerThanDateOfFileTransmission=La date de l'opération bancaire ne peut être inférieure à la date de transmission du fichier
ErrorTooMuchFileInForm=Trop de fichiers dans le formulaire, le nombre maximum est de %s fichier(s)
ErrorExistingPermission = La permission <b>%s</b> pour l'objet <b>%s</b> est dejà existante
ErrorSessionInvalidatedAfterPasswordChange=La session a été invalidée suite à un changement de mot de passe, d'état ou de dates de validité. Veuillez vous reconnecter.
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Votre paramètre PHP upload_max_filesize (%s) est supérieur au paramètre PHP post_max_size (%s). Ceci n'est pas une configuration cohérente.
WarningPasswordSetWithNoAccount=Un mot de passe a défini pour cet adhérent. Cependant, aucun compte d'utilisateur n'a été créé. Ce mot de passe a donc été stocké, mais ne peut être utilisé pour accéder à Dolibarr. Il peut être utilisé par un module/interface externe, mais si vous n'avez pas besoin de définir ni login ni mot de passe pour un adhérent, vous pouvez désactiver l'option «Gérer un login pour chaque adhérent" depuis la configuration du module Adhérents. Si vous avez besoin de gérer un login, mais pas de mot de passe, vous pouvez laisser ce champ vide pour éviter cet avertissement. Remarque: L'email peut également être utilisé comme login si l'adhérent est lié à un utilisateur.
@ -342,6 +344,7 @@ WarningPaypalPaymentNotCompatibleWithStrict=La valeur 'Strict' fait que les fonc
WarningThemeForcedTo=Attention, le choix du thème a été forcé à <b> %s </b> par la constante cachée MAIN_FORCETHEME
WarningPagesWillBeDeleted=Attention, cela supprimera également toutes les pages/conteneurs existants du site. Vous devriez exporter votre site Web avant, afin d'avoir une sauvegarde pour le réimporter plus tard.
WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal=La validation automatique est désactivée lorsque l'option de diminution du stock est définie sur "Validation de la facture".
WarningModuleNeedRefrech = Module <b>%s</b> desactivé. N'oublier pas de le réactivé
# Validate
RequireValidValue = Valeur non valide

View File

@ -165,3 +165,8 @@ BadValueForType=Mauvaise valeur pour le type %s
DefinePropertiesFromExistingTable=Définir des propriétés à partir d'une table existante
DefinePropertiesFromExistingTableDesc=Si une table dans la base de données (pour l'objet à créer) existe déjà, vous pouvez l'utiliser pour définir les propriétés de l'objet.
DefinePropertiesFromExistingTableDesc2=Laisser vide si la table n'existe pas encore. Le générateur de code utilisera différents types de champs pour créer un exemple de table que vous pourrez modifier ultérieurement.
GeneratePermissions=Je souhaite ajouter les droits pour cet objet
GeneratePermissionsHelp=générer les droits par défault pour cet objet
PermissionDeletedSuccesfuly=La permission a été supprimée avec succès
PermissionUpdatedSuccesfuly=La permission a été mise à jour avec succès
PermissionAddedSuccesfuly= La permission a été ajoutée avec succès

View File

@ -227,27 +227,41 @@ if ($resql) {
// Filters lines
print '<tr class="liste_titre_filter">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons();
print $searchpicto;
print '</td>';
}
print '<td class="liste_titre"><input class="flat" size="4" type="text" name="search_ref" value="'.$search_ref.'"></td>';
print '<td class="liste_titre"><input class="flat" size="12" type="text" name="search_label" value="'.$search_label.'"></td>';
print '<td class="liste_titre right" ><input class="flat" size="8" type="text" name="search_amount" value="'.$search_amount.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons();
print $searchpicto;
print '</td>';
}
print '</tr>';
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "l.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "l.label", "", $param, '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("LoanCapital", $_SERVER["PHP_SELF"], "l.capital", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "l.datestart", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "l.dateend", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "l.paid", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print "</tr>\n";
print "</tr>\n";
@ -287,6 +301,11 @@ if ($resql) {
} else {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
// Ref
print '<td>'.$loan_static->getNomUrl(1).'</td>';
@ -306,7 +325,10 @@ if ($resql) {
print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid);
print '</td>';
print '<td></td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print "</tr>\n";
}

View File

@ -1218,6 +1218,42 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
'core/modules/mymodule/doc/pdf_standard_myobject.modules.php'=>'core/modules/'.strtolower($module).'/doc/pdf_standard_'.strtolower($objectname).'.modules.php'
);
}
if (GETPOST('generatepermissions', 'aZ09')) {
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
dol_include_once($pathtofile);
$class = 'mod'.$module;
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
} catch (Exception $e) {
$error++;
dol_print_error($db, $e->getMessage());
}
}
if (empty($firstobjectname)) {
$rightToadd = preg_replace('/myobject/', $objectname, $rightToadd);
}
if ($objectname != $firstobjectname) {
$rightToadd = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Read objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'read';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Create/Update objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'write';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Delete objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'delete';
\$r++;
";
dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectname).'*/'.$rightToadd."/*END ".strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */'));
}
}
if (!$error) {
@ -1778,6 +1814,36 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($objectname).'*/' => ''));
}
// regenerate permissions and delete them
$rights = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Read objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'read';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Create/Update objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'write';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Delete objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'delete';
\$r++;
";
$deleteright = dolReplaceInFile($moduledescriptorfile, array('/*'.strtoupper($objectname).'*/' => '', $rights => '', "/*END ".strtoupper($objectname).'*/'."\n\t\t" => ''."\n\t\t"));
if ($deleteright > 0) {
if (isModEnabled(strtolower($module))) {
$result = unActivateModule(strtolower($module));
if ($result) {
setEventMessages($result, null, 'errors');
}
setEventMessages($langs->trans("WarningModuleNeedRefrech", $langs->transnoentities($module)), null, 'warnings');
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?index.php?tab=description&module='.$module);
}
}
$resultko = 0;
foreach ($filetodelete as $tmpfiletodelete) {
$resulttmp = dol_delete_file($dir.'/'.$tmpfiletodelete, 0, 0, 1);
@ -1875,7 +1941,223 @@ if ($dirins && $action == 'generatepackage') {
}
}
// Add permission
if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
$error = 0;
// load class and check if right exist
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
dol_include_once($pathtofile);
$class = 'mod'.$module;
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
} catch (Exception $e) {
$error++;
dol_print_error($db, $e->getMessage());
}
}
// verify informations entred
if (!GETPOST('label', 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
}
if (!GETPOST('permissionObj', 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rights")), null, 'errors');
}
$label = GETPOST('label', 'alpha');
$objectForPerms = strtolower(GETPOST('permissionObj', 'alpha'));
$crud = GETPOST('crud', 'alpha');
// check coherence between crud and label
if ($label == "Read objects of $module" && $crud != "read") {
$crud = "read";
$label == "Read objects of $module";
}
if ($label == "Create/Update objects of $module" && $crud != "write") {
$crud = "write";
$label == "Create/Update objects of $module";
}
if ($label == "Delete objects of $module" && $crud != "delete") {
$crud = "delete";
$label == "Delete objects of $module";
}
//check existing object permission
$counter = 0;
$permsForObject =array();
$permissions = $moduleobj->rights;
$firstRight = 0;
$existRight = 0;
$allObject = array();
$nbOfPermissions = count($permissions);
for ($i =0; $i<$nbOfPermissions; $i++) {
if ($permissions[$i][4] == $objectForPerms) {
$counter++;
if (count($permsForObject) < 3) {
$permsForObject[] = $permissions[$i];
}
}
$allObject[] = $permissions[$i][4];
}
$nbOfpermsInObj = count($permsForObject);
// check if label of object already exists
for ($j = 0; $j<$nbOfpermsInObj; $j++) {
if (in_array($label, $permsForObject[$j])) {
$existRight++;
setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)), null, 'errors');
}
}
// if not found permission for the object
if (!in_array($objectForPerms, array_unique($allObject))) {
$firstRight++;
$existRight = 0;
}
if (!$error) {
if (isModEnabled(strtolower($module))) {
$result = unActivateModule(strtolower($module));
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
if ($result) {
setEventMessages($result, null, 'errors');
}
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
}
//prepare stirng to add
$rightToAdd = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$label';
\$this->rights[\$r][4] = '$objectForPerms';
\$this->rights[\$r][5] = '$crud';
\$r++;
";
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
if (!$existRight) {
dolReplaceInFile($moduledescriptorfile, array('/*END '.strtoupper($objectForPerms).'*/' => $rightToAdd.'/*END '.strtoupper($objectForPerms).'*/'));
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
}
if ($firstRight) {
dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectForPerms).'*/'.$rightToAdd."/*END ".strtoupper($objectForPerms).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */'));
setEventMessages($langs->trans('PermissionAddedSuccesfuly'), null);
}
}
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
exit;
}
// Update permission
if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& empty($cancel)) {
$error = 0;
// load class and check if right exist
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
dol_include_once($pathtofile);
$class = 'mod'.$module;
if (class_exists($class)) {
try {
$moduleobj = new $class($db);
} catch (Exception $e) {
$error++;
dol_print_error($db, $e->getMessage());
}
}
// verify informations entred
if (!GETPOST('label', 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
}
if (!GETPOST('permissionObj', 'alpha')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rights")), null, 'errors');
}
$label = GETPOST('label', 'alpha');
$objectForPerms = strtolower(GETPOST('permissionObj', 'alpha'));
$crud = GETPOST('crud', 'alpha');
if ($label == "Read objects of $module" && $crud != "read") {
$crud = "read";
$label == "Read objects of $module";
}
if ($label == "Create/Update objects of $module" && $crud != "write") {
$crud = "write";
$label == "Create/Update objects of $module";
}
if ($label == "Delete objects of $module" && $crud != "delete") {
$crud = "delete";
$label == "Delete objects of $module";
}
$permissions = $moduleobj->rights;
$r =(int) GETPOST('counter');
//get permission want to delete from permissions array
$x1 = $permissions[$r-1][1];
$x2 = $permissions[$r-1][4];
$x3 = $permissions[$r-1][5];
//check existing object permission
$permsForObject =array();
$allObject = array();
$nbOfPermissions = count($permissions);
for ($i =0; $i<$nbOfPermissions; $i++) {
if ($permissions[$i][4] == $objectForPerms) {
if (count($permsForObject) < 3) {
$permsForObject[] = $permissions[$i];
}
}
$allObject[] = $permissions[$i][4];
}
if ($label != $x1 && $crud != $x3) {
$x = count($permsForObject);
for ($j = 0; $j<$x; $j++) {
if (in_array($label, $permsForObject[$j])) {
$error++;
setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)), null, 'errors');
}
}
}
//prepare right want to delete
$right = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$x1';
\$this->rights[\$r][4] = '$x2';
\$this->rights[\$r][5] = '$x3';
\$r++;
";
// right after editing
$rightUpdated = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$label';
\$this->rights[\$r][4] = '$objectForPerms';
\$this->rights[\$r][5] = '$crud';
\$r++;
";
if (!$error) {
if (isModEnabled(strtolower($module))) {
$result = unActivateModule(strtolower($module));
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
if ($result) {
setEventMessages($result, null, 'errors');
}
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
setEventMessages($langs->trans('WarningModuleNeedRefrech', $langs->transnoentities($module)), null, 'warnings');
}
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
$check = dolReplaceInFile($moduledescriptorfile, array($right => $rightUpdated));
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module);
setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null);
exit;
}
}
// Save file
if ($action == 'savefile' && empty($cancel)) {
$relofcustom = basename($dirins);
@ -2760,6 +3042,7 @@ if ($module == 'initmodule') {
print '<br>';
print '<input type="checkbox" name="includerefgeneration" id="includerefgeneration" value="includerefgeneration"> <label class="margintoponly" for="includerefgeneration">'.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).'</label><br>';
print '<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).'</label><br>';
print '<input type="checkbox" name="generatepermissions" id="generatepermissions" value="generatepermissions"> <label for="generatepermissions">'.$form->textwithpicto($langs->trans("GeneratePermissions"), $langs->trans("GeneratePermissionsHelp")).'</label><br>';
print '<br>';
print '<input type="submit" class="button small" name="create" value="'.dol_escape_htmltag($langs->trans("GenerateCode")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '<br>';
@ -3820,6 +4103,36 @@ if ($module == 'initmodule') {
$perms = $moduleobj->rights;
// Scan for object class files
$dir = $dirread.'/'.$modulelowercase.'/class';
$listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$');
$objects = array('myobject');
$reg =array();
foreach ($listofobject as $fileobj) {
$tmpcontent = file_get_contents($fileobj['fullname']);
if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) {
$objects[] = $reg[1];
}
}
// declared select list for actions and labels permissions
$crud = array('Read','Write','Delete');
$labels = array("Read objects of $module","Create/Update objects of $module","Delete objects of $module");
$action = GETPOST('action', 'alpha');
if ($action == 'deleteright') {
$formconfirm = $form->formconfirm(
$_SERVER["PHP_SELF"].'?permskey='.urlencode(GETPOST('permskey', 'int')).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj),
$langs->trans('Delete'),
$langs->trans('Confirm Delete Right', GETPOST('permskey', 'alpha')),
'confirm_deleteright',
'',
0,
1
);
print $formconfirm;
}
if ($action != 'editfile' || empty($file)) {
print '<span class="opacitymedium">';
$htmlhelp = $langs->trans("PermissionsDefDescTooltip", '{s1}');
@ -3846,33 +4159,128 @@ if ($module == 'initmodule') {
print '<table class="noborder">';
print '<tr class="liste_titre">';
print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center");
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center");
print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center");
print_liste_field_titre("CRUD", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center");
print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, "center");
print "</tr>\n";
//form for add new right
print '<tr>';
print '<td><input type="text" readonly name="id" value="'.dol_escape_htmltag($moduleobj->numero.sprintf('%02d', $i + count($perms))).'"></td>';
print '<td>';
print '<select name="label" >';
print '<option value=""></option>';
for ($i = 0; $i<3; $i++) {
print '<option value="'.dol_escape_htmltag($labels[$i]).'">'.$labels[$i].'</option>';
}
print '</select></td>';
print '<td ><select name="permissionObj">';
print '<option value=""></option>';
foreach ($objects as $obj) {
if ($obj != 'myobject') {
print '<option value="'.$obj.'">'.$obj.'</option>';
}
}
print '</select></td>';
print '<td><select class="maxwidth" name="crud">';
print '<option value=""></option>';
for ($i = 0;$i<3;$i++) {
print '<option value="'.$crud[$i].'">'.$langs->trans($crud[$i]).'</option>';
}
print '</td>';
print '<td class="center tdstickyright tdstickyghostwhite">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">';
print '</td>';
print '</tr>';
if (count($perms)) {
$i = 0;
foreach ($perms as $perm) {
print '<tr class="oddeven">';
$i++;
// section for editing right
if ($action == 'edit_right' && $perm[0] == (int) GETPOST('permskey', 'int')) {
print '<tr class="oddeven">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="modifPerms">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="tab" value="permissions">';
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
print '<input type="hidden" name="action" value="update_right">';
print '<input type="hidden" name="counter" value="'.$i.'">';
print '<td>';
print $perm[0];
print '</td>';
print '<td>';
print $langs->trans($perm[1]);
print '</td>';
print '<input type="hidden" name="permskey" value="'.$perm[0].'">';
print '<td>';
print $perm[4];
print '</td>';
print '<td class="tdsticky tdstickygray">';
print '<input type="text" readonly value="'.dol_escape_htmltag($perm[0]).'"/>';
print '</td>';
print '<td>';
print $perm[5];
print '</td>';
print '<td>';
print '<select name="label" >';
print '<option value="'.dol_escape_htmltag($perm[1]).'">'.dol_escape_htmltag($perm[1]).'</option>';
for ($i = 0; $i<3; $i++) {
if ($perm[1] != $labels[$i]) {
print '<option value="'.GETPOST('label').'">'.$labels[$i].'</option>';
}
}
print '</select></td>';
print '</tr>';
print '<td ><select name="permissionObj">';
print '<option value="'.dol_escape_htmltag($perm[4]).'">'.$perm[4].'</option>';
print '</select></td>';
print '<td>';
print '<select name="crud">';
print '<option value="'.dol_escape_htmltag($perm[5]).'">'.$langs->trans($perm[5]).'</option>';
for ($i = 0; $i<3; $i++) {
if ($perm[5] != $crud[$i]) {
print '<option value="'.$crud[$i].'">'.$langs->trans($crud[$i]).'</option>';
}
}
print '</select>';
print '</td>';
print '<td class="center tdstickyright tdstickyghostwhite">';
print '<input class="reposition button smallpaddingimp" type="submit" name="modifyright" value="'.$langs->trans("Modify").'"/>';
print '<br>';
print '<input class="reposition button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"/>';
print '</td>';
print '</form>';
print '</tr>';
} else {
print '<tr class="oddeven">';
print '<td>';
print $perm[0];
print '</td>';
print '<td>';
print $langs->trans($perm[1]);
print '</td>';
print '<td>';
print $perm[4];
print '</td>';
print '<td>';
print $perm[5];
print '</td>';
print '<td class="center tdstickyright tdstickyghostwhite">';
if ($perm[4] != 'myobject') {
print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=edit_right&token='.newToken().'&permskey='.urlencode($perm[0]).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deleteright&token='.newToken().'&permskey='.urlencode($i).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
}
print '</td>';
print '</tr>';
}
}
} else {
print '<tr><td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
/* Copyright (C) 2015 Ion Agorria <ion@agorria.com>
* Copyright (C) 2023 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -183,7 +184,7 @@ if ($action != 'create_updater' && $action != 'edit_updater') {
print '</tr>';
}
} else {
print '<tr colspan="7"><td><span class="opacitymedium">';
print '<tr><td colspan="4"><span class="opacitymedium">';
print $langs->trans("None");
print '</span></td></tr>';
}

View File

@ -173,7 +173,7 @@ $help_text .= '<br><br>'.$langs->trans("PriceExpressionEditorHelp3");
$help_text .= '<br><br>'.$langs->trans("PriceExpressionEditorHelp4");
$help_text .= '<br><br>'.$langs->trans("PriceExpressionEditorHelp5");
foreach ($price_globals->listGlobalVariables() as $entry) {
$help_text .= '<br><b>#globals_'.$entry->code.'#</b> '.$entry->description.' = '.$entry->value;
$help_text .= '<br><b>#global_'.$entry->code.'#</b> '.$entry->description.' = '.$entry->value;
}
//Price expression editor

View File

@ -281,8 +281,8 @@ class Project extends CommonObject
'public' =>array('type'=>'integer', 'label'=>'Visibility', 'enabled'=>1, 'visible'=>1, 'position'=>65),
'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>75),
'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>80),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85, 'searchall'=>1),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90, 'searchall'=>1),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85, 'searchall'=>1),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90, 'searchall'=>1),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>95),
'date_close' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'fk_user_close' =>array('type'=>'integer', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>0, 'position'=>110),

View File

@ -69,134 +69,142 @@ $hookmanager->initHooks(array('projectcontactcard', 'globalcard'));
* Actions
*/
// Test if we can add contact to the tasks at the same times, if not or not required, make a redirect
$formconfirmtoaddtasks = '';
if ($action == 'addcontact') {
$form = new Form($db);
$source=GETPOST("source", 'aZ09');
$taskstatic = new Task($db);
$task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0);
$nbTasks = count($task_array);
//If no task avaiblable, redirec to to add confirm
$type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type'));
$personToAffect = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect);
$url_redirect='?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source;
if ($personToAffect > 0 && (empty($conf->global->PROJECT_HIDE_TASKS) || $nbTasks > 0)) {
$text = $langs->trans('AddPersonToTask');
$textbody = $text.' (<a href="#" class="selectall">'.$langs->trans("SelectAll").'</a>)';
$formquestion = array('text' => $textbody);
$task_to_affect = array();
foreach ($task_array as $task) {
$task_already_affected=false;
$personsLinked = $task->liste_contact(-1, $source);
if (!is_array($personsLinked) && count($personsLinked) < 0) {
setEventMessage($object->error, 'errors');
} else {
foreach ($personsLinked as $person) {
if ($person['id']==$personToAffect) {
$task_already_affected = true;
break;
}
}
if (!$task_already_affected) {
$task_to_affect[$task->id] = $task->id;
}
}
}
if (empty($task_to_affect)) {
$action = 'addcontact_confirm';
} else {
$formcompany = new FormCompany($db);
foreach ($task_array as $task) {
$key = $task->id;
$val = $task->ref . ' '.dol_trunc($task->label);
$formquestion[] = array(
'type' => 'other',
'name' => 'person_'.$key.',person_role_'.$key,
'label' => '<input type="checkbox" class="flat'.(in_array($key, $task_to_affect) ? ' taskcheckboxes"' : '" checked disabled').' id="person_'.$key.'" name="person_'.$key.'" value="1"> <label for="person_'.$key.'">'.$val.'<label>',
'value' => $formcompany->selectTypeContact($taskstatic, '', 'person_role_'.$key, $source, 'position', 0, 'minwidth100imp', 0, 1)
);
}
$formquestion[] = array('type'=> 'other', 'name'=>'tasksavailable', 'label'=>'', 'value' => '<input type="hidden" id="tasksavailable" name="tasksavailable" value="'.implode(',', array_keys($task_to_affect)).'">');
}
$formconfirmtoaddtasks = $form->formconfirm($_SERVER['PHP_SELF'] . $url_redirect, $text, '', 'addcontact_confirm', $formquestion, '', 1, 300, 590);
$formconfirmtoaddtasks .='
<script>
$(document).ready(function() {
var saveprop = false;
$(".selectall").click(function(){
console.log("We click on select all with "+saveprop);
if (!saveprop) {
$(".taskcheckboxes").prop("checked", true);
saveprop = true;
} else {
$(".taskcheckboxes").prop("checked", false);
saveprop = false;
}
});
});
</script>';
} else {
$action = 'addcontact_confirm';
}
$parameters = array('id'=>$id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
// Add new contact
if ($action == 'addcontact_confirm' && $user->rights->projet->creer) {
$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
if (empty($reshook)) {
// Test if we can add contact to the tasks at the same times, if not or not required, make a redirect
$formconfirmtoaddtasks = '';
if ($action == 'addcontact') {
$form = new Form($db);
if (! ($contactid > 0)) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Contact")), null, 'errors');
$source=GETPOST("source", 'aZ09');
$taskstatic = new Task($db);
$task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0);
$nbTasks = count($task_array);
//If no task avaiblable, redirec to to add confirm
$type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type'));
$personToAffect = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect);
$url_redirect='?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source;
if ($personToAffect > 0 && (empty($conf->global->PROJECT_HIDE_TASKS) || $nbTasks > 0)) {
$text = $langs->trans('AddPersonToTask');
$textbody = $text.' (<a href="#" class="selectall">'.$langs->trans("SelectAll").'</a>)';
$formquestion = array('text' => $textbody);
$task_to_affect = array();
foreach ($task_array as $task) {
$task_already_affected=false;
$personsLinked = $task->liste_contact(-1, $source);
if (!is_array($personsLinked) && count($personsLinked) < 0) {
setEventMessage($object->error, 'errors');
} else {
foreach ($personsLinked as $person) {
if ($person['id']==$personToAffect) {
$task_already_affected = true;
break;
}
}
if (!$task_already_affected) {
$task_to_affect[$task->id] = $task->id;
}
}
}
if (empty($task_to_affect)) {
$action = 'addcontact_confirm';
} else {
$formcompany = new FormCompany($db);
foreach ($task_array as $task) {
$key = $task->id;
$val = $task->ref . ' '.dol_trunc($task->label);
$formquestion[] = array(
'type' => 'other',
'name' => 'person_'.$key.',person_role_'.$key,
'label' => '<input type="checkbox" class="flat'.(in_array($key, $task_to_affect) ? ' taskcheckboxes"' : '" checked disabled').' id="person_'.$key.'" name="person_'.$key.'" value="1"> <label for="person_'.$key.'">'.$val.'<label>',
'value' => $formcompany->selectTypeContact($taskstatic, '', 'person_role_'.$key, $source, 'position', 0, 'minwidth100imp', 0, 1)
);
}
$formquestion[] = array('type'=> 'other', 'name'=>'tasksavailable', 'label'=>'', 'value' => '<input type="hidden" id="tasksavailable" name="tasksavailable" value="'.implode(',', array_keys($task_to_affect)).'">');
}
$formconfirmtoaddtasks = $form->formconfirm($_SERVER['PHP_SELF'] . $url_redirect, $text, '', 'addcontact_confirm', $formquestion, '', 1, 300, 590);
$formconfirmtoaddtasks .='
<script>
$(document).ready(function() {
var saveprop = false;
$(".selectall").click(function(){
console.log("We click on select all with "+saveprop);
if (!saveprop) {
$(".taskcheckboxes").prop("checked", true);
saveprop = true;
} else {
$(".taskcheckboxes").prop("checked", false);
saveprop = false;
}
});
});
</script>';
} else {
$action = 'addcontact_confirm';
}
}
$result = 0;
$result = $object->fetch($id);
// Add new contact
if ($action == 'addcontact_confirm' && $user->rights->projet->creer) {
$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
if (!$error && $result > 0 && $id > 0) {
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
if ($result == 0) {
if (! ($contactid > 0)) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} elseif ($result < 0) {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Contact")), null, 'errors');
}
$affecttotask=GETPOST('tasksavailable', 'intcomma');
if (!empty($affecttotask)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$task_to_affect = explode(',', $affecttotask);
if (!empty($task_to_affect)) {
foreach ($task_to_affect as $task_id) {
if (GETPOSTISSET('person_'.$task_id) && GETPOST('person_'.$task_id, 'san_alpha')) {
$tasksToAffect = new Task($db);
$result=$tasksToAffect->fetch($task_id);
if ($result < 0) {
setEventMessages($tasksToAffect->error, null, 'errors');
} else {
$result = $tasksToAffect->add_contact($contactid, GETPOST('person_role_'.$task_id), GETPOST("source", 'aZ09'));
$result = 0;
$result = $object->fetch($id);
if (!$error && $result > 0 && $id > 0) {
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
if ($result == 0) {
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} elseif ($result < 0) {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$affecttotask=GETPOST('tasksavailable', 'intcomma');
if (!empty($affecttotask)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$task_to_affect = explode(',', $affecttotask);
if (!empty($task_to_affect)) {
foreach ($task_to_affect as $task_id) {
if (GETPOSTISSET('person_'.$task_id) && GETPOST('person_'.$task_id, 'san_alpha')) {
$tasksToAffect = new Task($db);
$result=$tasksToAffect->fetch($task_id);
if ($result < 0) {
if ($tasksToAffect->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors');
setEventMessages($tasksToAffect->error, null, 'errors');
} else {
$result = $tasksToAffect->add_contact($contactid, GETPOST('person_role_'.$task_id), GETPOST("source", 'aZ09'));
if ($result < 0) {
if ($tasksToAffect->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors');
}
}
}
}
@ -204,37 +212,36 @@ if ($action == 'addcontact_confirm' && $user->rights->projet->creer) {
}
}
}
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
}
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
// Change contact's status
if ($action == 'swapstatut' && $user->rights->projet->creer) {
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
}
// Delete a contact
if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->projet->creer) {
$object->fetch($id);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: contact.php?id=".$object->id);
exit;
} else {
dol_print_error($db);
}
}
}
// Change contact's status
if ($action == 'swapstatut' && $user->rights->projet->creer) {
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
} else {
dol_print_error($db);
}
}
// Delete a contact
if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->projet->creer) {
$object->fetch($id);
$result = $object->delete_contact(GETPOST("lineid", 'int'));
if ($result >= 0) {
header("Location: contact.php?id=".$object->id);
exit;
} else {
dol_print_error($db);
}
}
/*
* View

View File

@ -1855,7 +1855,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
$selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">';
@ -1863,6 +1863,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Fields title search
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
// Date
if (!empty($arrayfields['t.task_date']['checked'])) {
print '<td class="liste_titre left">';
@ -1954,13 +1961,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '</tr>'."\n";
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['t.task_date']['checked'])) {
print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder);
}
@ -2014,7 +2026,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch ');
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print "</tr>\n";
$tasktmp = new Task($db);
@ -2035,6 +2049,42 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall">';
if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) {
print '<input type="hidden" name="lineid" value="'.GETPOST('lineid', 'int').'">';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
print ' ';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks
if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) {
print '&nbsp;';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_split('', 'class="pictofixedwidth"');
print '</a>';
}
print '<a class="reposition editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=editline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_edit('default', 0, 'class="pictofixedwidth paddingleft"');
print '</a>';
print '<a class="reposition paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_delete('default', 'class="pictodelete paddingleft"');
print '</a>';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($task_time->rowid, $arrayofselected)) {
$selected = 1;
}
print '&nbsp;';
print '<input id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
}
}
}
// Date
if (!empty($arrayfields['t.task_date']['checked'])) {
print '<td class="nowrap">';
@ -2318,36 +2368,38 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print $hookmanager->resPrint;
// Action column
print '<td class="center nowraponall">';
if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) {
print '<input type="hidden" name="lineid" value="'.GETPOST('lineid', 'int').'">';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
print ' ';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks
if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) {
print '&nbsp;';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_split('', 'class="pictofixedwidth"');
print '</a>';
}
print '<a class="reposition editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=editline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_edit('default', 0, 'class="pictofixedwidth paddingleft"');
print '</a>';
print '<a class="reposition paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_delete('default', 'class="pictodelete paddingleft"');
print '</a>';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($task_time->rowid, $arrayofselected)) {
$selected = 1;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall">';
if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) {
print '<input type="hidden" name="lineid" value="'.GETPOST('lineid', 'int').'">';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
print ' ';
print '<input type="submit" class="button buttongen margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks
if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) {
print '&nbsp;';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_split('', 'class="pictofixedwidth"');
print '</a>';
}
print '<a class="reposition editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=editline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_edit('default', 0, 'class="pictofixedwidth paddingleft"');
print '</a>';
print '<a class="reposition paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&action=deleteline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_delete('default', 'class="pictodelete paddingleft"');
print '</a>';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($task_time->rowid, $arrayofselected)) {
$selected = 1;
}
print '&nbsp;';
print '<input id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '&nbsp;';
print '<input id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
}
}

View File

@ -186,7 +186,7 @@ if ($action == 'delete_resource') {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -230,6 +230,13 @@ print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
if (!empty($arrayfields['t.ref']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="6">';
@ -243,13 +250,19 @@ if (!empty($arrayfields['ty.label']['checked'])) {
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Action column
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
}
print "</tr>\n";
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['t.ref']['checked'])) {
print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder);
}
@ -258,7 +271,10 @@ if (!empty($arrayfields['ty.label']['checked'])) {
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print "</tr>\n";
@ -266,6 +282,19 @@ if ($ret) {
foreach ($object->lines as $resource) {
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<a class="editfielda" href="./card.php?action=edit&token='.newToken().'&id='.$resource->id.'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a href="./card.php?action=delete&token='.newToken().'&id='.$resource->id.'">';
print img_delete('', 'class="marginleftonly"');
print '</a>';
print '</td>';
}
if (!empty($arrayfields['t.ref']['checked'])) {
print '<td>';
print $resource->getNomUrl(5);
@ -287,15 +316,18 @@ if ($ret) {
$obj = (Object) $resource->array_options;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
print '<td class="center">';
print '<a class="editfielda" href="./card.php?action=edit&token='.newToken().'&id='.$resource->id.'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a href="./card.php?action=delete&token='.newToken().'&id='.$resource->id.'">';
print img_delete('', 'class="marginleftonly"');
print '</a>';
print '</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<a class="editfielda" href="./card.php?action=edit&token='.newToken().'&id='.$resource->id.'">';
print img_edit();
print '</a>';
print '&nbsp;';
print '<a href="./card.php?action=delete&token='.newToken().'&id='.$resource->id.'">';
print img_delete('', 'class="marginleftonly"');
print '</a>';
print '</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}

View File

@ -399,7 +399,7 @@ $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'salary', 0, $newcardbutton, '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
$selectedfields = '';
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
@ -411,6 +411,13 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
// Ref
print '<td class="liste_titre left">';
print '<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).'">';
@ -472,16 +479,22 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '</tr>'."\n";
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
@ -500,7 +513,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
}
print '</tr>'."\n";
@ -567,6 +582,22 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Show here line of result
print '<tr class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Ref
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
if (!$i) {
@ -661,19 +692,20 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";
}
$i++;

View File

@ -212,8 +212,8 @@ class Societe extends CommonObject
'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225),
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230),
'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>"getDolGlobalInt('SOCIETE_USEPREFIX')", 'visible'=>-1, 'position'=>235),
'client' =>array('type'=>'tinyint(4)', 'label'=>'Client', 'enabled'=>1, 'visible'=>-1, 'position'=>240),
'fournisseur' =>array('type'=>'tinyint(4)', 'label'=>'Fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>245),

View File

@ -90,8 +90,8 @@ class SocieteAccount extends CommonObject
'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>0, 'enabled'=>1, 'position'=>48, 'notnull'=>0, 'index'=>1, 'searchall'=>1, 'comment'=>'The id of third party in the external web site (for site_account if site_account defined)',),
'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,),
'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,),
//'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,),
'note_private' => array('type'=>'text', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,),
//'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

View File

@ -4867,6 +4867,7 @@ div.divphotoref > div > .photowithmargin, div.divphotoref > img.photowithmargin,
{
content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/logo_setup.svg', 1) ?>); /* content is used to best fit the container */
display: inline-block;
opacity: 0.2;
}
.nographyet
{

View File

@ -4892,6 +4892,7 @@ div.divphotoref > img.photowithmargin, div.divphotoref > a > .photowithmargin {
{
content:url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/logo_setup.svg', 1) ?>); /* content is used to best fit the container */
display: inline-block;
opacity: 0.2;
}
.nographyet
{

View File

@ -290,7 +290,7 @@ class Ticket extends CommonObject
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'csslist'=>'tdoverflowmax100 maxwidth150onsmartphone'),
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
'message' => array('type'=>'html', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc', 'csslist'=>'tdoverflowmax100'),
'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541),
'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'),

View File

@ -1190,6 +1190,7 @@ class User extends CommonObject
$sql .= " ".$this->db->prefix()."usergroup_user as gu,";
$sql .= " ".$this->db->prefix()."rights_def as r";
$sql .= " WHERE r.id = gr.fk_id";
// A very strange business rules. Must be same than into user->getrights() user/perms.php and user/group/perms.php
if (!empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " AND gu.entity IN (0,".$conf->entity.")";
@ -1198,12 +1199,13 @@ class User extends CommonObject
}
} else {
$sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity
// The entity on the table usergroup_user should be useless and shoumd never be used because it is alreay into gr and r.
// The entity on the table usergroup_user should be useless and should never be used because it is alreay into gr and r.
// but when using MULTICOMPANY_TRANSVERSE_MODE, we may insert record that make rubbish result due to duplicate record of
// other entities, so we are forced to add a filter here
$sql .= " AND gu.entity IN (0,".$conf->entity.")";
$sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity
}
// End of strange business rule
$sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
$sql .= " AND gu.fk_user = ".((int) $this->id);
$sql .= " AND r.perms IS NOT NULL";

View File

@ -216,13 +216,29 @@ if ($result) {
dol_print_error($db);
}
// Lecture des droits groupes
// Read the permissions of a user inherited by its groups
$permsgroupbyentity = array();
$sql = "SELECT DISTINCT gr.fk_id, gu.entity";
$sql = "SELECT DISTINCT gr.fk_id, gu.entity"; // fk_id are permission id and entity is entity of the group
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu";
$sql .= " WHERE gr.entity = ".((int) $entity);
$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; // all groups of a user
$sql .= " WHERE 1 = 1";
// A very strange business rules. Must be same than into user->getrights() user/perms.php and user/group/perms.php
if (!empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql .= " AND gu.entity IN (0,".$conf->entity.")";
} else {
//$sql .= " AND r.entity = ".((int) $conf->entity);
}
} else {
$sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity
// The entity on the table usergroup_user should be useless and should never be used because it is alreay into gr and r.
// but when using MULTICOMPANY_TRANSVERSE_MODE, we may insert record that make rubbish result due to duplicate record of
// other entities, so we are forced to add a filter here
$sql .= " AND gu.entity IN (0,".$conf->entity.")";
//$sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity
}
// End of strange business rule
$sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
$sql .= " AND gu.fk_user = ".((int) $object->id);
@ -245,6 +261,7 @@ if ($result) {
}
/*
* Part to add/remove permissions
*/
@ -499,6 +516,15 @@ if ($result) {
$isexpanded = ! $ishidden;
//var_dump("isexpanded=".$isexpanded);
$permsgroupbyentitypluszero = array();
if (!empty($permsgroupbyentity[0])) {
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
}
if (!empty($permsgroupbyentity[$entity])) {
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
}
//var_dump($permsgroupbyentitypluszero);
// Break found, it's a new module to catch
if (isset($obj->module) && ($oldmod <> $obj->module)) {
$oldmod = $obj->module;
@ -606,8 +632,8 @@ if ($result) {
//print img_picto($langs->trans("Active"), 'tick');
}
print '</td>';
} elseif (isset($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Permission granted by group
} elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
if (in_array($obj->id, $permsgroupbyentitypluszero)) { // Permission granted by group
if ($caneditperms) {
print '<td class="center">';
print $form->textwithtooltip($langs->trans("Inherited"), $langs->trans("PermissionInheritedFromAGroup"));

View File

@ -174,7 +174,7 @@ class WebsitePage extends CommonObject
'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'),
'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'),
'allowed_in_frames' =>array('type'=>'integer', 'label'=>'AllowedInFrames', 'enabled'=>1, 'visible'=>-1, 'position'=>48, 'searchall'=>0, 'default'=>0),
'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0),
'htmlheader' =>array('type'=>'html', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0),
'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0),
'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),

View File

@ -462,7 +462,7 @@ if (!empty($moreforfilter)) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
@ -473,6 +473,13 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
print '</td>';
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
@ -530,10 +537,12 @@ $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '</tr>'."\n";
$totalarray = array();
@ -542,6 +551,11 @@ $totalarray['nbfield'] = 0;
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') {
@ -576,8 +590,10 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalaray['nbfield']++;
}
print '</tr>'."\n";
@ -625,6 +641,21 @@ while ($i < $imaxinloop) {
// Show here line of result
$j = 0;
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
@ -717,17 +748,19 @@ while ($i < $imaxinloop) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($object->id, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
print '</tr>'."\n";