Merge branch 'develop' into NEW-recursive-envents
This commit is contained in:
commit
75b8246578
@ -436,6 +436,9 @@ script:
|
||||
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log
|
||||
php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log
|
||||
php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log
|
||||
php upgrade.php 16.0.0 17.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade16001700.log
|
||||
php upgrade2.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-2.log
|
||||
php step5.php 16.0.0 17.0.0 > $TRAVIS_BUILD_DIR/upgrade16001700-3.log
|
||||
ls -alrt $TRAVIS_BUILD_DIR/
|
||||
|
||||
- |
|
||||
|
||||
12
.tx/config
12
.tx/config
@ -140,18 +140,6 @@ source_file = htdocs/langs/en_US/exports.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.externalsite]
|
||||
file_filter = htdocs/langs/<lang>/externalsite.lang
|
||||
source_file = htdocs/langs/en_US/externalsite.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.ftp]
|
||||
file_filter = htdocs/langs/<lang>/ftp.lang
|
||||
source_file = htdocs/langs/en_US/ftp.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.help]
|
||||
file_filter = htdocs/langs/<lang>/help.lang
|
||||
source_file = htdocs/langs/en_US/help.lang
|
||||
|
||||
@ -34,14 +34,15 @@ ParseDown 1.6 MIT License Yes
|
||||
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
|
||||
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
php-iban 4.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
PSR/Logs 1.0 Library for logs (used by DebugBar)
|
||||
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
|
||||
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
|
||||
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
Sabre 3.2.2 BSD Yes DAV support
|
||||
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
|
||||
Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar)
|
||||
Stripe 7.67.0 MIT Licence Yes Library for Stripe module
|
||||
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
23
ChangeLog
23
ChangeLog
@ -2,6 +2,24 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 17.0.0 compared to 16.0.0 *****
|
||||
|
||||
For users:
|
||||
---------------
|
||||
|
||||
...
|
||||
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
...
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.0 compared to 15.0.0 *****
|
||||
@ -118,6 +136,7 @@ NEW: VAT Report by month - Show detail by rate and also by code
|
||||
NEW: Ticket triggers: allow to automatically send messages on new tickets
|
||||
NEW: Accountancy - Add hidden feature for accounting reconciliation
|
||||
NEW: Can store the session into database (instead of beeing managed by PHP)
|
||||
NEW: Added MMK currency (Myanmar Kyat)
|
||||
|
||||
Modules
|
||||
NEW: Module Partnership Management
|
||||
@ -184,6 +203,8 @@ NEW: Add hooks select product list and select thirdparty list function
|
||||
NEW: Add hook to getSellPrice function
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and
|
||||
enable the module project if it is not visible).
|
||||
@ -481,6 +502,8 @@ NEW: we need to be able to put more filters on deleteByParentField() function
|
||||
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
|
||||
NEW: Experimental feature to manage user sessions in database
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -774,7 +774,7 @@ if ($action == 'export_file') {
|
||||
$form_question['notifiedvalidationdate'] = array(
|
||||
'name' => 'notifiedvalidationdate',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedValidationDate'),
|
||||
'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
|
||||
'value' => $checked,
|
||||
);
|
||||
|
||||
@ -1131,6 +1131,10 @@ $line = new BookKeepingLine();
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
|
||||
@ -677,7 +677,8 @@ if (empty($reshook)) {
|
||||
|
||||
if (empty($labeltouse) || (int) $labeltouse === -1) {
|
||||
//fallback on the old configuration.
|
||||
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
|
||||
$langs->load("errors");
|
||||
setEventMessages('<a href="'.DOL_URL_ROOT.'/adherents/admin/member_emails.php">'.$langs->trans('WarningMandatorySetupNotComplete').'</a>', null, 'errors');
|
||||
$error++;
|
||||
} else {
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
@ -2028,9 +2029,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if ($useonlinepayment) {
|
||||
print '<br>';
|
||||
|
||||
if (empty($amount)) { // Take the maximum amount among what the member is supposed to pay / has paid in the past
|
||||
$amount = price(max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount));
|
||||
}
|
||||
if (empty($amount)) {
|
||||
$amount = 0;
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref, $amount);
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
@ -94,6 +94,11 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var int Amount can be choosen by the visitor during subscription (0 or 1)
|
||||
*/
|
||||
public $caneditamount;
|
||||
|
||||
/**
|
||||
* @var string Public note
|
||||
* @deprecated
|
||||
@ -380,6 +385,7 @@ class AdherentType extends CommonObject
|
||||
$sql .= "morphy = '".$this->db->escape($this->morphy)."',";
|
||||
$sql .= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||
$sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).",";
|
||||
$sql .= "caneditamount = ".((int) $this->caneditamount).",";
|
||||
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
|
||||
$sql .= "note = '".$this->db->escape($this->note_public)."',";
|
||||
$sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
@ -474,7 +480,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note as note_public, d.vote";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.caneditamount, d.mail_valid, d.note as note_public, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
||||
|
||||
@ -495,6 +501,7 @@ class AdherentType extends CommonObject
|
||||
$this->duration_unit = substr($obj->duration, -1);
|
||||
$this->subscription = $obj->subscription;
|
||||
$this->amount = $obj->amount;
|
||||
$this->caneditamount = $obj->caneditamount;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
$this->note = $obj->note_public; // deprecated
|
||||
$this->note_public = $obj->note_public;
|
||||
@ -850,6 +857,7 @@ class AdherentType extends CommonObject
|
||||
$this->note_public = 'This is a public note';
|
||||
$this->mail_valid = 'This is welcome email';
|
||||
$this->subscription = 1;
|
||||
$this->caneditamount = 0;
|
||||
$this->vote = 0;
|
||||
|
||||
$this->status = 1;
|
||||
|
||||
@ -63,6 +63,7 @@ $search_email = GETPOST("search_email", 'alpha');
|
||||
$search_categ = GETPOST("search_categ", 'int');
|
||||
$search_filter = GETPOST("search_filter", 'alpha');
|
||||
$search_status = GETPOST("search_status", 'intcomma');
|
||||
$search_morphy = GETPOST("search_morphy", 'alpha');
|
||||
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
|
||||
$catid = GETPOST("catid", 'int');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
@ -382,6 +383,9 @@ if ($search_status != '') {
|
||||
// Peut valoir un nombre ou liste de nombre separes par virgules
|
||||
$sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
|
||||
}
|
||||
if ($search_morphy != '') {
|
||||
$sql .= natural_search("d.morphy", $search_morphy);
|
||||
}
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search("d.ref", $search_ref);
|
||||
}
|
||||
@ -675,7 +679,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
|
||||
if ($massactionbutton) {
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
}
|
||||
@ -685,7 +689,13 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
||||
|
||||
// Line for filters fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre middle">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
// Line numbering
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
@ -725,6 +735,11 @@ if (!empty($arrayfields['d.login']['checked'])) {
|
||||
}
|
||||
if (!empty($arrayfields['d.morphy']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
$arraymorphy = array('mor'=>$langs->trans("Moral"), 'phy'=>$langs->trans("Physical"));
|
||||
print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
@ -962,6 +977,19 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (!empty($conf->global->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->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
|
||||
if (!$i) {
|
||||
|
||||
@ -122,6 +122,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
$object->status = (int) $status;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));
|
||||
$object->caneditamount = GETPOSTINT("caneditamount");
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
@ -229,7 +230,7 @@ llxHeader('', $langs->trans("MembersTypeSetup"), $help_url);
|
||||
if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
//print dol_get_fiche_head('');
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.vote, d.statut as status, d.morphy";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.statut as status, d.morphy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('member_type').")";
|
||||
|
||||
@ -276,6 +277,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
|
||||
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Amount").'</th>';
|
||||
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> </th>';
|
||||
@ -292,6 +294,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
$membertype->status = $objp->status;
|
||||
$membertype->subscription = $objp->subscription;
|
||||
$membertype->amount = $objp->amount;
|
||||
$membertype->caneditamount = $objp->caneditamount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
@ -310,6 +313,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
|
||||
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) {
|
||||
@ -380,6 +384,10 @@ if ($action == 'create') {
|
||||
print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("CanEditAmount").'</td><td>';
|
||||
print $form->selectyesno("caneditamount", 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
|
||||
print '</td></tr>';
|
||||
@ -453,6 +461,10 @@ if ($rowid > 0) {
|
||||
print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).'</td><td>';
|
||||
print yn($object->caneditamount);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print yn($object->vote);
|
||||
print '</tr>';
|
||||
|
||||
@ -46,26 +46,26 @@ $error = 0;
|
||||
*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
|| ($action == 'updateedit')) {
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($action != 'updateedit' && !$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
@ -74,6 +74,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -117,7 +118,7 @@ print '<input type="hidden" name="action" value="update">';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||
|
||||
// Name
|
||||
// Name of Accountant Company
|
||||
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag(GETPOSTISSET('nom') ? GETPOST('nom', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
|
||||
|
||||
@ -125,9 +126,11 @@ print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmlt
|
||||
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOSTISSET('address') ? GETPOST('address', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) ? $conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS : '')).'</textarea></td></tr>'."\n";
|
||||
|
||||
// ZIP
|
||||
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'.dol_escape_htmltag(GETPOSTISSET('zipcode') ? GETPOST('zipcode', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP) ? $conf->global->MAIN_INFO_ACCOUNTANT_ZIP : '')).'"></td></tr>'."\n";
|
||||
|
||||
// Town/City
|
||||
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||
print '<input name="town" class="minwidth100" id="town" value="'.dol_escape_htmltag(GETPOSTISSET('town') ? GETPOST('town', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN) ? $conf->global->MAIN_INFO_ACCOUNTANT_TOWN : '')).'"></td></tr>'."\n";
|
||||
|
||||
@ -140,21 +143,25 @@ if ($user->admin) {
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// State
|
||||
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
||||
print img_picto('', 'state', 'class="pictofixedwidth"');
|
||||
print $formcompany->select_state((GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : '')), (GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : '')), 'state_id');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Telephone
|
||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
||||
print img_picto('', 'object_phoning', '', false, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input name="tel" id="phone" class="maxwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('tel') ? GETPOST('tel', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_PHONE) ? $conf->global->MAIN_INFO_ACCOUNTANT_PHONE : '')).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Fax
|
||||
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
|
||||
print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input name="fax" id="fax" class="maxwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_FAX) ? $conf->global->MAIN_INFO_ACCOUNTANT_FAX : '')).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// eMail
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input name="mail" id="email" class="maxwidth300 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
|
||||
|
||||
@ -55,6 +55,16 @@ if ($action == 'setbarcodeproducton') {
|
||||
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'setbarcodethirdpartyon') {
|
||||
$barcodenumberingmodule = GETPOST('value', 'alpha');
|
||||
$res = dolibarr_set_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
|
||||
if ($barcodenumberingmodule == 'mod_barcode_thirdparty_standard' && empty($conf->global->BARCODE_STANDARD_THIRDPARTY_MASK)) {
|
||||
$res = dolibarr_set_const($db, "BARCODE_STANDARD_THIRDPARTY_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
} elseif ($action == 'setbarcodethirdpartyoff') {
|
||||
$res = dolibarr_del_const($db, "BARCODE_THIRDPARTY_ADDON_NUM", $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'setcoder') {
|
||||
$coder = GETPOST('coder', 'alpha');
|
||||
$code_id = GETPOST('code_id', 'int');
|
||||
@ -241,6 +251,66 @@ if ($conf->product->enabled) {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Select barcode numbering module
|
||||
if ($conf->societe->enabled) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("ThirdParty").")", '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach ($dirbarcodenum as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (preg_match('/^mod_barcode_thirdparty_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$modBarCode = new $file();
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
|
||||
print $modBarCode->info($langs);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
|
||||
if (!empty($conf->global->BARCODE_THIRDPARTY_ADDON_NUM) && $conf->global->BARCODE_THIRDPARTY_ADDON_NUM == "$file") {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodethirdpartyoff&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodethirdpartyon&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td class="center">';
|
||||
$s = $modBarCode->getToolTip($langs, null, -1);
|
||||
print $form->textwithpicto('', $s, 1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
/*
|
||||
* CHOIX ENCODAGE
|
||||
|
||||
@ -47,8 +47,9 @@ if (!in_array('clicktodial', $conf->modules)) {
|
||||
if ($action == 'setvalue' && $user->admin) {
|
||||
$result1 = dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
|
||||
$result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
|
||||
$result3 = dolibarr_set_const($db, "CLICKTODIAL_KEY_FOR_CIDLOOKUP", GETPOST("CLICKTODIAL_KEY_FOR_CIDLOOKUP"), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($result1 >= 0 && $result2 >= 0) {
|
||||
if ($result1 >= 0 && $result2 >= 0 && $result3 >= 0) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
@ -80,7 +81,7 @@ print '<input type="hidden" name="action" value="setvalue">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td class="minwidth200">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -89,21 +90,21 @@ print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("ClickToDialUseTelLink").'</td><td>';
|
||||
print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'<br>';
|
||||
print '<br>';
|
||||
print $langs->trans("ClickToDialUseTelLinkDesc");
|
||||
print '<span class="opacitymedium small">'.$langs->trans("ClickToDialUseTelLinkDesc").'</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("DefaultLink").'</td><td>';
|
||||
print '<input class="quatrevingtpercent" type="text" id="CLICKTODIAL_URL" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS ? ' disabled="disabled"' : '').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
|
||||
print '<input class="quatrevingtpercent" type="text" id="CLICKTODIAL_URL" name="CLICKTODIAL_URL"'.(getDolGlobalString('CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS') ? ' disabled="disabled"' : '').' value="'.getDolGlobalString('CLICKTODIAL_URL').'"><br>';
|
||||
print ajax_autoselect('CLICKTODIAL_URL');
|
||||
print '<br>';
|
||||
print $langs->trans("ClickToDialUrlDesc").'<br>';
|
||||
print '<br>';
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("Examples").':<br>';
|
||||
print 'https://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
|
||||
print 'sip:__PHONETO__@my.sip.server';
|
||||
print '* https://myphoneserver/phoneurl?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
|
||||
print '* sip:__PHONETO__@my.sip.server';
|
||||
print '</span>';
|
||||
|
||||
//if (! empty($user->clicktodial_url))
|
||||
@ -114,6 +115,37 @@ print '</span>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SecurityKey").'</td>';
|
||||
print '<td>';
|
||||
|
||||
global $dolibarr_main_url_root;
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
// Url for CIDLookup
|
||||
//print '<div class="div-table-responsive-no-min">';
|
||||
//print $langs->trans("URLToLaunchCronJobs").':<br>';
|
||||
$url = $urlwithroot.'/public/clicktodial/cidlookup.php?securitykey='.getDolGlobalString('CLICKTODIAL_KEY_FOR_CIDLOOKUP', 'ValueToDefine').'&phone=...';
|
||||
//print img_picto('', 'globe').' <a href="'.$url.'" target="_blank" rel="noopener noreferrer">'.$url."</a><br>\n";
|
||||
//print '</div>';
|
||||
//print '<br>';
|
||||
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("CIDLookupURL").'</span>';
|
||||
print '<br>'.$url;
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<input type="text" class="flat minwidth300" id="CLICKTODIAL_KEY_FOR_CIDLOOKUP" name="CLICKTODIAL_KEY_FOR_CIDLOOKUP" value="'.(GETPOST('CLICKTODIAL_KEY_FOR_CIDLOOKUP') ? GETPOST('CLICKTODIAL_KEY_FOR_CIDLOOKUP') : (!empty($conf->global->CLICKTODIAL_KEY_FOR_CIDLOOKUP) ? $conf->global->CLICKTODIAL_KEY_FOR_CIDLOOKUP : '')).'">';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -156,6 +188,23 @@ if (!empty($conf->global->CLICKTODIAL_URL)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#generate_token").click(function() {
|
||||
console.log("Click done");
|
||||
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
|
||||
action: \'getrandompassword\',
|
||||
generic: true
|
||||
},
|
||||
function(token) {
|
||||
$("#CLICKTODIAL_KEY_FOR_CIDLOOKUP").val(token);
|
||||
});
|
||||
});
|
||||
});';
|
||||
print '</script>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -2090,6 +2090,8 @@ if ($id > 0) {
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
} elseif ($value == 'block_if_negative') {
|
||||
$valuetoshow = yn($obj->{$value});
|
||||
} elseif ($value == 'icon') {
|
||||
$valuetoshow = $obj->{$value}." ".img_picto("", $obj->{$value});
|
||||
} elseif ($value == 'type_duration') {
|
||||
$TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes'));
|
||||
$valuetoshow =$TDurationTypes[$obj->{$value}];
|
||||
|
||||
@ -104,6 +104,16 @@ if ($action == 'update') {
|
||||
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
|
||||
$val = GETPOST('THEME_DARKMODEENABLED');
|
||||
if (!$val) {
|
||||
dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
|
||||
}
|
||||
if ($val) {
|
||||
dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
|
||||
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
||||
if (!$val) {
|
||||
@ -646,7 +656,7 @@ if ($mode == 'login') {
|
||||
print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
|
||||
}
|
||||
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin">' . img_delete($langs->trans("Delete")) . '</a>';
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
|
||||
if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
print ' ';
|
||||
print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">';
|
||||
|
||||
@ -427,11 +427,15 @@ if ($action == 'edit') {
|
||||
|
||||
// Method
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
|
||||
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
|
||||
if (empty($text)) {
|
||||
$text = $langs->trans("Undefined").img_warning();
|
||||
}
|
||||
print $text;
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'default') {
|
||||
print '<span class="opacitymedium">'.$text.'</span>';
|
||||
} else {
|
||||
print $text;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
|
||||
|
||||
@ -54,10 +54,12 @@ if (!empty($conf->eventorganization->enabled)) {
|
||||
|
||||
$langs->loadLangs($langsArray);
|
||||
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
@ -77,6 +79,7 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"')
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000;
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
|
||||
@ -394,11 +394,15 @@ if ($action == 'edit') {
|
||||
|
||||
// Method
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
|
||||
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_TICKET];
|
||||
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
|
||||
if (empty($text)) {
|
||||
$text = $langs->trans("Undefined").img_warning();
|
||||
}
|
||||
print $text;
|
||||
if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'default') {
|
||||
print '<span class="opacitymedium">'.$text.'</span>';
|
||||
} else {
|
||||
print $text;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_SENDMODE_TICKET) && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') {
|
||||
|
||||
@ -89,6 +89,7 @@ $configfileparameters = array(
|
||||
'separator',
|
||||
'?dolibarr_mailing_limit_sendbyweb',
|
||||
'?dolibarr_mailing_limit_sendbycli',
|
||||
'?dolibarr_mailing_limit_sendbyday',
|
||||
'?dolibarr_strict_mode'
|
||||
);
|
||||
$configfilelib = array(
|
||||
|
||||
@ -360,6 +360,7 @@ $configfileparameters = array(
|
||||
'dolibarr_main_restrict_ip' => 'Restrict access to some IPs only',
|
||||
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
|
||||
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
|
||||
'?dolibarr_mailing_limit_sendbyday' => 'Limit nb of email sent per day',
|
||||
'?dolibarr_strict_mode' => 'Strict mode is on/off',
|
||||
'?dolibarr_nocsrfcheck' => 'Disable CSRF security checks'
|
||||
);
|
||||
|
||||
@ -51,6 +51,9 @@ print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
|
||||
print '<br>';
|
||||
print '<hr>';
|
||||
|
||||
// Recupere la version de PHP
|
||||
$phpversion = version_php();
|
||||
print "<br><strong>PHP</strong> - ".$langs->trans("Version").": ".$phpversion."<br>\n";
|
||||
|
||||
@ -172,7 +172,7 @@ print '<tr class="oddeven nohover"><td style="padding-left: 8px" class="nohover"
|
||||
|
||||
print '<table class="centpercent noborderbottom">';
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">';
|
||||
print '<td class="tdtop nopaddingleftimp">';
|
||||
|
||||
print '<div id="div_container_exportoptions">';
|
||||
print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
|
||||
@ -195,10 +195,27 @@ print '</fieldset>';
|
||||
print '</div>';
|
||||
|
||||
print '</td>';
|
||||
print '<td class="tdtop">';
|
||||
print '<td class="tdtop nopaddingrightimp">';
|
||||
|
||||
print '<button id="btn" type="button" onclick="hideoptions()">'.$langs->trans("ShowAdvancedOptions").'</button>';
|
||||
|
||||
print '<div id="div_container_sub_exportoptions">';
|
||||
print '<script type="text/javascript">
|
||||
|
||||
function hideoptions(){
|
||||
const btn = document.getElementById("btn");
|
||||
const div = document.getElementById("div_container_sub_exportoptions");
|
||||
|
||||
if (div.style.display === "none") {
|
||||
div.style.display = "block";
|
||||
btn.innerText="'.$langs->trans("HideAdvancedoptions").'";
|
||||
} else {
|
||||
div.style.display = "none";
|
||||
btn.innerText="'.$langs->trans("ShowAdvancedOptions").'";
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
|
||||
print '<div id="div_container_sub_exportoptions" style="display: none;">';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print "<!-- Fieldset mysqldump -->\n";
|
||||
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
|
||||
@ -554,7 +554,7 @@ if ($mode == 'searchkey') {
|
||||
break;
|
||||
}
|
||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td class="small">';
|
||||
$titleforvalue = $langs->trans("Translation").' en_US for key '.$key.':<br>'.($langsenfileonly->tab_translate[$key] ? $langsenfileonly->trans($key) : '<span class="opacitymedium">'.$langs->trans("None").'</span>');
|
||||
$titleforvalue = $langs->trans("Translation").' en_US for key '.$key.':<br>'.(!empty($langsenfileonly->tab_translate[$key]) ? $langsenfileonly->trans($key) : '<span class="opacitymedium">'.$langs->trans("None").'</span>');
|
||||
print '<span title="'.dol_escape_htmltag($titleforvalue).'" class="classfortooltip">';
|
||||
print dol_escape_htmltag($val);
|
||||
print '</span>';
|
||||
|
||||
@ -35,9 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'members', 'users'));
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -51,6 +48,10 @@ $label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scandir', 'alpha');
|
||||
$type = 'user';
|
||||
|
||||
if (empty($user->admin)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
@ -58,6 +59,8 @@ $type = 'user';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
$reg = array();
|
||||
|
||||
if ($action == 'set_default') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
$res = true;
|
||||
@ -83,6 +86,9 @@ if ($action == 'set_default') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
$res = true;
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
// We disable the template
|
||||
dolibarr_del_const($db, "USER_ADDON_PDF_ODT", $conf->entity);
|
||||
} elseif (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
$code = $reg[1];
|
||||
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) {
|
||||
@ -118,6 +124,9 @@ if ($action == 'set_default') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
dol_mkdir(DOL_DATA_ROOT.'/doctemplates/users');
|
||||
dol_mkdir(DOL_DATA_ROOT.'/doctemplates/usergroups');
|
||||
|
||||
$help_url = 'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios';
|
||||
llxHeader('', $langs->trans("UsersSetup"), $help_url);
|
||||
|
||||
@ -264,14 +273,17 @@ foreach ($dirmodels as $reldir) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print '<td class="center">';
|
||||
if (getDolGlobalString('USER_ADDON_PDF_ODT') == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Default"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
|
||||
@ -257,6 +257,8 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
||||
continue;
|
||||
}
|
||||
|
||||
//dol_syslog("We scan to search api file with into ".$dir_part.$file_searched);
|
||||
|
||||
$regapi = array();
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi)) {
|
||||
$classname = ucwords($regapi[1]);
|
||||
|
||||
@ -35,7 +35,8 @@ $month = dol_print_date($now, '%m');
|
||||
$day = dol_print_date($now, '%d');
|
||||
$forbarcode = GETPOST('forbarcode');
|
||||
$fk_barcode_type = GETPOST('fk_barcode_type');
|
||||
$eraseallbarcode = GETPOST('eraseallbarcode');
|
||||
$eraseallproductbarcode = GETPOST('eraseallproductbarcode');
|
||||
$eraseallthirdpartybarcode = GETPOST('eraseallthirdpartybarcode');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
@ -43,6 +44,7 @@ $producttmp = new Product($db);
|
||||
$thirdpartytmp = new Societe($db);
|
||||
|
||||
$modBarCodeProduct = '';
|
||||
$modBarCodeThirdparty = '';
|
||||
|
||||
$maxperinit = 1000;
|
||||
|
||||
@ -51,6 +53,106 @@ $maxperinit = 1000;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Define barcode template for third-party
|
||||
if (!empty($conf->global->BARCODE_THIRDPARTY_ADDON_NUM)) {
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
|
||||
foreach ($dirbarcodenum as $dirroot) {
|
||||
$dir = dol_buildpath($dirroot, 0);
|
||||
|
||||
$handle = @opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (preg_match('/^mod_barcode_thirdparty_.*php$/', $file)) {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.$file.'.php');
|
||||
} catch (Exception $e) {
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$modBarCodeThirdparty = new $file();
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'initbarcodethirdparties') {
|
||||
if (!is_object($modBarCodeThirdparty)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoBarcodeNumberingTemplateDefined"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$thirdpartystatic = new Societe($db);
|
||||
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
if (!empty($eraseallthirdpartybarcode)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " SET barcode = NULL";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs');
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " WHERE barcode IS NULL or barcode = ''";
|
||||
$sql .= $db->order("datec", "ASC");
|
||||
$sql .= $db->plimit($maxperinit);
|
||||
|
||||
dol_syslog("codeinit", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$i = 0; $nbok = $nbtry = 0;
|
||||
while ($i < min($num, $maxperinit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$thirdpartystatic->id = $obj->rowid;
|
||||
$nextvalue = $modBarCodeThirdparty->getNextValue($thirdpartystatic, '');
|
||||
|
||||
$result = $thirdpartystatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'THIRDPARTY_MODIFY');
|
||||
|
||||
$nbtry++;
|
||||
if ($result > 0) {
|
||||
$nbok++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
//$db->rollback();
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
$action = '';
|
||||
}
|
||||
|
||||
// Define barcode template for products
|
||||
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
|
||||
$dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
||||
@ -91,7 +193,7 @@ if ($action == 'initbarcodeproducts') {
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
if (!empty($eraseallbarcode)) {
|
||||
if (!empty($eraseallproductbarcode)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
||||
$sql .= " SET barcode = NULL";
|
||||
$resql = $db->query($sql);
|
||||
@ -155,7 +257,6 @@ if ($action == 'initbarcodeproducts') {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -180,16 +281,25 @@ print '<br>';
|
||||
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
|
||||
//print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodeproducts">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript">
|
||||
function confirm_erase() {
|
||||
return confirm("'.dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")).'");
|
||||
}
|
||||
</script>';
|
||||
|
||||
|
||||
// For thirdparty
|
||||
if (isModEnabled('societe')) {
|
||||
$nbno = $nbtotal = 0;
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodethirdparties">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$nbthirdpartyno = $nbthirdpartytotal = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
|
||||
|
||||
@ -198,7 +308,7 @@ if (isModEnabled('societe')) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbno = $obj->nb;
|
||||
$nbthirdpartyno = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -207,30 +317,47 @@ if (isModEnabled('societe')) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbtotal = $obj->nb;
|
||||
$nbthirdpartytotal = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n";
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbthirdpartyno, $nbthirdpartytotal, $langs->transnoentitiesnoconv("ThirdParties")).'<br>'."\n";
|
||||
|
||||
print '<br><input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode")) ? '' : 'disabled ').'value="'.$langs->trans("InitEmptyBarCode", $nbno).'"';
|
||||
print ' title="'.dol_escape_htmltag($langs->trans("FeatureNotYetAvailable")).'" disabled';
|
||||
print '>';
|
||||
$disabledthirdparty = $disabledthirdparty1 = 0;
|
||||
|
||||
if (is_object($modBarCodeThirdparty)) {
|
||||
print $langs->trans("BarCodeNumberManager").": ";
|
||||
$objthirdparty = new Societe($db);
|
||||
print '<b>'.(isset($modBarCodeThirdparty->name) ? $modBarCodeThirdparty->name : $modBarCodeThirdparty->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeThirdparty->getNextValue($objthirdparty).'</b><br>';
|
||||
$disabledthirdparty = 0;
|
||||
} else {
|
||||
$disabledthirdparty = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
|
||||
}
|
||||
if (empty($nbthirdpartyno)) {
|
||||
$disabledthirdparty1 = 1;
|
||||
}
|
||||
|
||||
$moretagsthirdparty1 = (($disabledthirdparty || $disabledthirdparty1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<br><input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" value="'.$langs->trans("InitEmptyBarCode", $nbno).'"'.$moretagsthirdparty1.'>';
|
||||
$moretagsthirdparty2 = (($nbthirdpartyno == $nbthirdpartytotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallthirdpartybarcode" id="eraseallthirdpartybarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsthirdparty2.' onClick="return confirm_erase();">';
|
||||
print '<br><br><br><br>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
// For products
|
||||
if ($conf->product->enabled || $conf->product->service) {
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript">
|
||||
function confirm_erase() {
|
||||
return confirm("'.dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")).'");
|
||||
}
|
||||
</script>';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodeproducts">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
$nbno = $nbtotal = 0;
|
||||
$nbproductno = $nbproducttotal = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'product');
|
||||
print '<br>'."\n";
|
||||
@ -247,7 +374,7 @@ if ($conf->product->enabled || $conf->product->service) {
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbno += $obj->nb;
|
||||
$nbproductno += $obj->nb;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -259,35 +386,38 @@ if ($conf->product->enabled || $conf->product->service) {
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbtotal = $obj->nb;
|
||||
$nbproducttotal = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n";
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbproductno, $nbproducttotal, $langs->transnoentitiesnoconv("ProductsOrServices")).'<br>'."\n";
|
||||
|
||||
$disabledproduct = $disabledproduct1 = 0;
|
||||
|
||||
if (is_object($modBarCodeProduct)) {
|
||||
print $langs->trans("BarCodeNumberManager").": ";
|
||||
$objproduct = new Product($db);
|
||||
print '<b>'.(isset($modBarCodeProduct->name) ? $modBarCodeProduct->name : $modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>';
|
||||
$disabled = 0;
|
||||
$disabledproduct = 0;
|
||||
} else {
|
||||
$disabled = 1;
|
||||
$disabledproduct = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
|
||||
}
|
||||
if (empty($nbno)) {
|
||||
$disabled1 = 1;
|
||||
if (empty($nbproductno)) {
|
||||
$disabledproduct1 = 1;
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
//print '<input type="checkbox" id="erasealreadyset" name="erasealreadyset"> '.$langs->trans("ResetBarcodeForAllRecords").'<br>';
|
||||
$moretags1 = (($disabled || $disabled1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbno)).'"'.$moretags1.'>';
|
||||
$moretags2 = (($nbno == $nbtotal) ? ' disabled' : '');
|
||||
$moretagsproduct1 = (($disabledproduct || $disabledproduct1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<input type="submit" class="button" name="submitformbarcodeproductgen" id="submitformbarcodeproductgen" value="'.$langs->trans("InitEmptyBarCode", min($maxperinit, $nbno)).'"'.$moretagsproduct1.'>';
|
||||
$moretagsproduct2 = (($nbproductno == $nbproducttotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallbarcode" id="eraseallbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretags2.' onClick="return confirm_erase();">';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallproductbarcode" id="eraseallproductbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsproduct2.' onClick="return confirm_erase();">';
|
||||
print '<br><br><br><br>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
@ -297,7 +427,6 @@ print $langs->trans("ClickHereToGoTo").' : <a href="'.DOL_URL_ROOT.'/barcode/pri
|
||||
|
||||
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
// End of page
|
||||
|
||||
@ -1186,7 +1186,7 @@ if ($action == 'create') {
|
||||
//print '<tr><td></td><td colspan="3" class="opacitymedium">';
|
||||
print ' <div class="opacitymedium inline-block">';
|
||||
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
|
||||
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
|
||||
print '<input type="hidden" name="recurid" value="'.(empty($object->recurid) ? '' : $object->recurid).'">';
|
||||
|
||||
$selectedrecurrulefreq = 'no';
|
||||
$selectedrecurrulebymonthday = '';
|
||||
@ -1195,6 +1195,7 @@ if ($action == 'create') {
|
||||
$object->recurrule .= GETPOSTISSET('BYMONTHDAY') ? "_BYMONTHDAY".GETPOST('BYMONTHDAY', 'alpha') : "";
|
||||
$object->recurrule .= GETPOSTISSET('BYDAY') ? "_BYDAY".GETPOST('BYDAY', 'alpha') : "";
|
||||
|
||||
$reg1 = array();
|
||||
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) {
|
||||
$selectedrecurrulefreq = $reg1[1];
|
||||
}
|
||||
|
||||
@ -285,17 +285,17 @@ class ActionComm extends CommonObject
|
||||
|
||||
// Properties for links to other objects
|
||||
/**
|
||||
* @var int Id of linked object
|
||||
* @var int Id of linked object
|
||||
*/
|
||||
public $fk_element; // Id of record
|
||||
|
||||
/**
|
||||
* @var int Id of record alternative for API
|
||||
* @var int Id of record alternative for API
|
||||
*/
|
||||
public $elementid;
|
||||
|
||||
/**
|
||||
* @var string Type of record. This if property ->element of object linked to.
|
||||
* @var string Type of record. This if property ->element of object linked to.
|
||||
*/
|
||||
public $elementtype;
|
||||
|
||||
@ -373,6 +373,16 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* Properties to manage the recurring events
|
||||
*/
|
||||
public $recurid;
|
||||
public $recurrule;
|
||||
public $recurdateend;
|
||||
|
||||
public $calling_duration;
|
||||
|
||||
|
||||
/**
|
||||
* Typical value for a event that is in a todo state
|
||||
*/
|
||||
@ -2083,8 +2093,8 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
if (!empty($conf->global->AGENDA_EXPORT_FIX_TZ)) {
|
||||
$timestampStart = - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
$timestampEnd = - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
$timestampStart = $timestampStart - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
$timestampEnd = $timestampEnd - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||
}
|
||||
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
|
||||
@ -1121,7 +1121,8 @@ if ($object->id > 0) {
|
||||
* Latest contracts
|
||||
*/
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity";
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
|
||||
$sql .= " c.last_main_doc, c.model_pdf";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= " AND s.rowid = ".((int) $object->id);
|
||||
@ -1154,6 +1155,8 @@ if ($object->id > 0) {
|
||||
$contrat->ref_customer = $objp->refcus;
|
||||
$contrat->ref_supplier = $objp->refsup;
|
||||
$contrat->statut = $objp->contract_status;
|
||||
$contrat->last_main_doc = $objp->last_main_doc;
|
||||
$contrat->model_pdf = $objp->model_pdf;
|
||||
$contrat->fetch_lines();
|
||||
|
||||
$late = '';
|
||||
@ -1168,30 +1171,32 @@ if ($object->id > 0) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
print $contrat->getNomUrl(1, 12);
|
||||
// Preview
|
||||
$filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
if (is_array($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||
if (!empty($contrat->model_pdf)) {
|
||||
// Preview
|
||||
$filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
$file_list = null;
|
||||
if (!empty($filedir)) {
|
||||
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||
}
|
||||
// Get list of files stored into database for same relative directory
|
||||
if ($relativedir) {
|
||||
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||
|
||||
//var_dump($sortfield.' - '.$sortorder);
|
||||
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||
if (is_array($file_list)) {
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($filedir) {
|
||||
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||
}
|
||||
// Get list of files stored into database for same relative directory
|
||||
if ($relativedir) {
|
||||
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||
|
||||
//var_dump($sortfield.' - '.$sortorder);
|
||||
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
|
||||
}
|
||||
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0);
|
||||
}
|
||||
// $filename = dol_sanitizeFileName($objp->ref);
|
||||
// $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
|
||||
@ -127,6 +127,7 @@ if ($tmp) {
|
||||
/*
|
||||
* Draft customer proposals
|
||||
*/
|
||||
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
@ -224,6 +225,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
/*
|
||||
* Draft supplier proposals
|
||||
*/
|
||||
|
||||
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
|
||||
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
@ -320,6 +322,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
|
||||
/*
|
||||
* Draft customer orders
|
||||
*/
|
||||
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
@ -404,7 +407,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
}
|
||||
}
|
||||
|
||||
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
|
||||
addSummaryTableLine(3, $num, $nbofloop, $total, "NoOrder");
|
||||
finishSimpleTable(true);
|
||||
|
||||
$db->free($resql);
|
||||
@ -417,6 +420,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
/*
|
||||
* Draft purchase orders
|
||||
*/
|
||||
|
||||
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) {
|
||||
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
|
||||
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
|
||||
@ -501,7 +505,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
}
|
||||
}
|
||||
|
||||
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
|
||||
addSummaryTableLine(3, $num, $nbofloop, $total, "NoOrder");
|
||||
finishSimpleTable(true);
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
@ -801,13 +801,20 @@ if ($action == 'create') {
|
||||
// MAILING_NO_USING_PHPMAIL may be defined or not.
|
||||
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden).
|
||||
// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit).
|
||||
// MAILING_LIMIT_SENDBYDAY may be defined ot not (0 or undefined=no limit).
|
||||
if (!empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
|
||||
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
|
||||
// You ensure that every user is using its own SMTP server when using the mass emailing module.
|
||||
$linktoadminemailbefore = '<a href="'.DOL_URL_ROOT.'/admin/mails_emailing.php">';
|
||||
$linktoadminemailend = '</a>';
|
||||
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
|
||||
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings');
|
||||
$messagetoshow = $langs->trans("MailSendSetupIs2", '{s1}', '{s2}', '{s3}', '{s4}');
|
||||
$messagetoshow = str_replace('{s1}', $linktoadminemailbefore, $messagetoshow);
|
||||
$messagetoshow = str_replace('{s2}', $linktoadminemailend, $messagetoshow);
|
||||
$messagetoshow = str_replace('{s3}', $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $messagetoshow);
|
||||
$messagetoshow = str_replace('{s4}', $listofmethods['smtps'], $messagetoshow);
|
||||
setEventMessages($messagetoshow, null, 'warnings');
|
||||
|
||||
if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) {
|
||||
setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
|
||||
}
|
||||
@ -836,14 +843,21 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
$text = '';
|
||||
if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
|
||||
$text .= $langs->trans("MailingNeedCommand");
|
||||
$text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
|
||||
|
||||
if (isset($conf->global->MAILING_LIMIT_SENDBYDAY) && $conf->global->MAILING_LIMIT_SENDBYDAY >= 0) {
|
||||
$text .= $langs->trans('WarningLimitSendByDay', $conf->global->MAILING_LIMIT_SENDBYDAY);
|
||||
$text .= '<br><br>';
|
||||
}
|
||||
$text .= $langs->trans('ConfirmSendingEmailing').'<br>';
|
||||
$text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600);
|
||||
|
||||
if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) {
|
||||
$text .= '<br><br>';
|
||||
$text .= $langs->trans("MailingNeedCommand");
|
||||
$text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft" disabled>php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
|
||||
}
|
||||
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600, 0, $langs->trans("Confirm"), $langs->trans("Cancel"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1526,8 +1526,12 @@ if (!empty($conf->project->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
}
|
||||
|
||||
$title = $langs->trans('Proposal')." - ".$langs->trans('Card');
|
||||
$title = $object->ref." - ".$langs->trans('Card');
|
||||
if ($action == 'create') {
|
||||
$title = $langs->trans("NewPropal");
|
||||
}
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos|DE:Modul_Angebote';
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -1444,7 +1444,7 @@ class Propal extends CommonObject
|
||||
|
||||
// Clear fields
|
||||
$object->user_author = $user->id;
|
||||
$object->user_valid = '';
|
||||
$object->user_valid = 0;
|
||||
$object->date = $now;
|
||||
$object->datep = $now; // deprecated
|
||||
$object->fin_validite = $object->date + ($object->duree_validite * 24 * 3600);
|
||||
@ -2614,8 +2614,22 @@ class Propal extends CommonObject
|
||||
|
||||
$newprivatenote = dol_concatdesc($this->note_private, $note);
|
||||
|
||||
if (empty($conf->global->PROPALE_KEEP_OLD_SIGNATURE_INFO)) {
|
||||
$date_signature = $now;
|
||||
$fk_user_signature = $user->id;
|
||||
} else {
|
||||
$this->info($this->id);
|
||||
if (!isset($this->date_signature) || $this->date_signature == '') {
|
||||
$date_signature = $now;
|
||||
$fk_user_signature = $user->id;
|
||||
} else {
|
||||
$date_signature = $this->date_signature;
|
||||
$fk_user_signature = $this->user_signature->id;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id;
|
||||
$sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($date_signature)."', fk_user_signature=".$fk_user_signature;
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2662,7 +2676,7 @@ class Propal extends CommonObject
|
||||
$this->oldcopy= clone $this;
|
||||
$this->statut = $status;
|
||||
$this->status = $status;
|
||||
$this->date_signature = $now;
|
||||
$this->date_signature = $date_signature;
|
||||
$this->note_private = $newprivatenote;
|
||||
}
|
||||
|
||||
|
||||
@ -112,8 +112,9 @@ if ($action == 'addcontact' && $user->rights->propale->creer) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$title = $langs->trans('Proposal')." - ".$langs->trans('ContactsAddresses');
|
||||
$title = $object->ref." - ".$langs->trans('ContactsAddresses');
|
||||
$help_url = "EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos";
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@ -104,7 +104,7 @@ if ($object->id > 0) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$title = $langs->trans('Proposal')." - ".$langs->trans('Documents');
|
||||
$title = $object->ref." - ".$langs->trans('Documents');
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ restrictedArea($user, 'propal', $object->id);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('Proposal')." - ".$langs->trans('Info');
|
||||
$title = $object->ref." - ".$langs->trans('Info');
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
@ -520,8 +520,9 @@ $companystatic = new Societe($db);
|
||||
$projectstatic = new Project($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
$title = $langs->trans('ListOfProposals');
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
|
||||
//llxHeader('',$langs->trans('Proposal'),$help_url);
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
@ -786,8 +787,6 @@ if ($resql) {
|
||||
exit;
|
||||
}
|
||||
|
||||
llxHeader('', $langs->trans('Proposal'), $help_url);
|
||||
|
||||
$param = '&search_status='.urlencode($search_status);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
@ -1096,13 +1095,22 @@ 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
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
@ -1365,16 +1373,20 @@ if ($resql) {
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
}
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
@ -1527,7 +1539,9 @@ if ($resql) {
|
||||
if (!empty($arrayfields['p.fk_statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$now = dol_now();
|
||||
@ -1608,6 +1622,19 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap" align="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->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
|
||||
@ -2120,15 +2147,17 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
print '<td class="nowrap" align="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->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap" align="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->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -81,8 +81,9 @@ if (empty($reshook)) {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('Proposal')." - ".$langs->trans('Notes');
|
||||
$title = $object->ref." - ".$langs->trans('Notes');
|
||||
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if ($object->id > 0) {
|
||||
|
||||
@ -425,12 +425,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
@ -563,12 +563,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
@ -736,12 +736,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
@ -897,12 +897,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right toverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
|
||||
@ -1484,8 +1484,12 @@ if (empty($reshook)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans('Order')." - ".$langs->trans('Card');
|
||||
$title = $object->ref." - ".$langs->trans('Card');
|
||||
if ($action == 'create') {
|
||||
$title = $langs->trans("NewOrder");
|
||||
}
|
||||
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
@ -1609,7 +1613,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
$fk_account = $soc->fk_account;
|
||||
$availability_id = 0;
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
$warehouse_id = $soc->warehouse_id;
|
||||
$warehouse_id = $soc->fk_warehouse;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
@ -1698,7 +1702,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
// Contacts (ask contact only if thirdparty already defined).
|
||||
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
|
||||
print img_picto('', 'contact', 'class="pictofixedwidth"');
|
||||
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, !empty($srccontactslist)?$srccontactslist:"", '', 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
@ -1722,7 +1726,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
// Date delivery planned
|
||||
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery);
|
||||
$date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
|
||||
print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
@ -1803,7 +1807,12 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
|
||||
$parameters = array();
|
||||
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
|
||||
$parameters['objectsrc'] = $objectsrc;
|
||||
}
|
||||
$parameters['socid'] = $socid;
|
||||
|
||||
// Note that $action and $object may be modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
@ -507,7 +507,7 @@ class Commande extends CommonOrder
|
||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||
$sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
|
||||
$sql .= " date_valid='".$this->db->idate($now)."',";
|
||||
$sql .= " fk_user_valid = ".((int) $user->id).",";
|
||||
$sql .= " fk_user_valid = ".($user->id > 0 ? (int) $user->id : "null").",";
|
||||
$sql .= " fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
@ -1234,7 +1234,8 @@ class Commande extends CommonOrder
|
||||
|
||||
// Clear fields
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->user_valid = 0; // deprecated
|
||||
$this->user_validation_id = 0;
|
||||
$this->date = dol_now();
|
||||
$this->date_commande = dol_now();
|
||||
$this->date_creation = '';
|
||||
@ -1884,7 +1885,7 @@ class Commande extends CommonOrder
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->user_valid = $obj->fk_user_valid; // deprecated
|
||||
$this->user_modification_id = $obj->fk_user_modif;
|
||||
$this->user_modification = $obj->fk_user_modif;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
@ -3351,7 +3352,7 @@ class Commande extends CommonOrder
|
||||
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
|
||||
$sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
|
||||
$sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").",";
|
||||
$sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
|
||||
$sql .= " fk_user_valid=".((isset($this->user_valid) && $this->user_valid > 0) ? $this->user_valid : "null").",";
|
||||
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
|
||||
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
|
||||
$sql .= " deposit_percent=".(! empty($this->deposit_percent) ? strval($this->deposit_percent) : "null").",";
|
||||
@ -3840,21 +3841,13 @@ class Commande extends CommonOrder
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
$this->user_creation_id = $obj->fk_user_author;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
$this->user_validation_id = $obj->fk_user_valid;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture) {
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
$this->user_closing_id = $obj->fk_user_cloture;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
|
||||
@ -96,10 +96,6 @@ if ($action == 'addcontact' && $user->rights->commande->creer) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$title = $langs->trans('Order')." - ".$langs->trans('ContactsAddresses');
|
||||
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formother = new FormOther($db);
|
||||
@ -117,6 +113,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
if ($object->fetch($id, $ref) > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$title = $object->ref." - ".$langs->trans('ContactsAddresses');
|
||||
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), -1, 'order');
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$title = $langs->trans('Order')." - ".$langs->trans('Documents');
|
||||
$title = $object->ref." - ".$langs->trans('Documents');
|
||||
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
@ -320,6 +320,8 @@ if (empty($reshook)) {
|
||||
|
||||
$db->begin();
|
||||
|
||||
$nbOrders = is_array($orders) ? count($orders) : 1;
|
||||
|
||||
foreach ($orders as $id_order) {
|
||||
$cmd = new Commande($db);
|
||||
if ($cmd->fetch($id_order) <= 0) {
|
||||
@ -455,10 +457,11 @@ if (empty($reshook)) {
|
||||
|
||||
$objecttmp->context['createfromclone'];
|
||||
|
||||
$rang = $lines[$i]->rang;
|
||||
$rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
|
||||
//there may already be rows from previous orders
|
||||
if (!empty($createbills_onebythird))
|
||||
if (!empty($createbills_onebythird)) {
|
||||
$rang = $TFactThirdNbLines[$cmd->socid];
|
||||
}
|
||||
|
||||
$result = $objecttmp->addline(
|
||||
$desc,
|
||||
@ -1374,7 +1377,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
|
||||
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
if (GETPOST('autoselectall', 'int')) {
|
||||
@ -1391,6 +1394,14 @@ if ($resql) {
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
@ -1643,15 +1654,20 @@ if ($resql) {
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
}
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
@ -1794,7 +1810,9 @@ if ($resql) {
|
||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$total = 0;
|
||||
@ -1875,6 +1893,18 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (!empty($conf->global->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($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
@ -2438,13 +2468,15 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// 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($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (empty($conf->global->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($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
||||
@ -77,7 +77,7 @@ if (empty($reshook)) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$title = $langs->trans('Order')." - ".$langs->trans('Notes');
|
||||
$title = $object->ref." - ".$langs->trans('Notes');
|
||||
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
@ -47,6 +47,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
|
||||
|
||||
if (!empty($conf->project->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
// Constant to define payment sens
|
||||
const PAY_DEBIT = 0;
|
||||
const PAY_CREDIT = 1;
|
||||
@ -64,6 +69,7 @@ $date_stopMonth = GETPOST('date_stopmonth', 'int');
|
||||
$date_stopYear = GETPOST('date_stopyear', 'int');
|
||||
$date_stop = dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear, 'tzuserrel');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : 0);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('comptafileslist', 'globallist'));
|
||||
@ -175,6 +181,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
|
||||
$sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT;
|
||||
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
|
||||
}
|
||||
// Vendor invoices
|
||||
if (GETPOST('selectsupplierinvoices') && !empty($listofchoices['selectsupplierinvoices']['perms'])) {
|
||||
@ -186,9 +193,10 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
|
||||
$sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT;
|
||||
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
|
||||
}
|
||||
// Expense reports
|
||||
if (GETPOST('selectexpensereports') && !empty($listofchoices['selectexpensereports']['perms'])) {
|
||||
if (GETPOST('selectexpensereports') && !empty($listofchoices['selectexpensereports']['perms']) && empty($projectid)) {
|
||||
if (!empty($sql)) {
|
||||
$sql .= " UNION ALL";
|
||||
}
|
||||
@ -208,6 +216,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$sql .= " WHERE datedon between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
|
||||
$sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT;
|
||||
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
|
||||
}
|
||||
// Payments of salaries
|
||||
if (GETPOST('selectpaymentsofsalaries') && !empty($listofchoices['selectpaymentsofsalaries']['perms'])) {
|
||||
@ -219,6 +228,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
|
||||
//$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT;
|
||||
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
|
||||
}
|
||||
// Social contributions
|
||||
if (GETPOST('selectsocialcontributions') && !empty($listofchoices['selectsocialcontributions']['perms'])) {
|
||||
@ -230,6 +240,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$sql .= " WHERE t.date_ech between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
|
||||
//$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT;
|
||||
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
|
||||
}
|
||||
// Various payments
|
||||
if (GETPOST('selectvariouspayment') && !empty($listofchoices['selectvariouspayment']['perms'])) {
|
||||
@ -240,9 +251,10 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".$db->sanitize($entity == 1 ? '0,1' : $entity).')';
|
||||
if (!empty($projectid)) $sql .= " AND fk_projet = ".((int) $projectid);
|
||||
}
|
||||
// Loan payments
|
||||
if (GETPOST('selectloanspayment') && !empty($listofchoices['selectloanspayment']['perms'])) {
|
||||
if (GETPOST('selectloanspayment') && !empty($listofchoices['selectloanspayment']['perms']) && empty($projectid)) {
|
||||
if (!empty($sql)) {
|
||||
$sql .= " UNION ALL";
|
||||
}
|
||||
@ -460,7 +472,15 @@ if ($result && $action == "dl" && !$error) {
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Country");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("VATIntra");
|
||||
$log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
|
||||
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
|
||||
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel');
|
||||
if (!empty($projectid)) {
|
||||
$project = new Project($db);
|
||||
$project->fetch($projectid);
|
||||
if ($project->ref) {
|
||||
$zipname .= '_'.$project->ref;
|
||||
}
|
||||
}
|
||||
$zipname .='_export.zip';
|
||||
|
||||
dol_delete_file($zipname);
|
||||
|
||||
@ -561,11 +581,13 @@ print $form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0, '', '', '
|
||||
print "\n";
|
||||
|
||||
// Export is for current company only
|
||||
$socid = 0;
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
$mc->getInfo($conf->entity);
|
||||
print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES) ? ' opacitymedium' : '').'">('.$langs->trans("Entity").' : ';
|
||||
print "<td>";
|
||||
if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
||||
$socid = $mc->id;
|
||||
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
|
||||
} else {
|
||||
print $mc->label;
|
||||
@ -576,6 +598,16 @@ if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Project filter
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
$langs->load('projects');
|
||||
print '<span class="marginrightonly">'.$langs->trans('Project').":</span>";
|
||||
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, '');
|
||||
print '<span class="classfortooltip" style="padding: 0px; padding: 0px; padding-right: 3px !important;" title="'.$langs->trans('ExportAccountingProjectHelp').'"><span class="fas fa-info-circle em088 opacityhigh" style=" vertical-align: middle; cursor: help"></span></span>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
if (empty($val['enabled'])) {
|
||||
continue; // list not qualified
|
||||
@ -614,7 +646,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
|
||||
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
||||
|
||||
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&output=file&file='.urlencode($filename).$param.'"';
|
||||
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&projectid='.$projectid.'&output=file&file='.urlencode($filename).$param.'"';
|
||||
if (empty($TData)) {
|
||||
print " disabled";
|
||||
}
|
||||
|
||||
@ -61,10 +61,6 @@ if (!$year_start) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("IOMonthlyReporting");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// Get account informations
|
||||
@ -82,6 +78,10 @@ $annee = '';
|
||||
$totentrees = array();
|
||||
$totsorties = array();
|
||||
|
||||
$title = $object->ref.' - '.$langs->trans("IOMonthlyReporting");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
// Ce rapport de tresorerie est base sur llx_bank (car doit inclure les transactions sans facture)
|
||||
// plutot que sur llx_paiement + llx_paiementfourn
|
||||
|
||||
|
||||
@ -512,7 +512,7 @@ $buttonreconcile = '';
|
||||
$morehtmlref = '';
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Transactions");
|
||||
$title = $object->ref.' - '.$langs->trans("Transactions");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
|
||||
@ -332,18 +332,16 @@ if (!empty($conf->accounting->enabled)) {
|
||||
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
$title = $langs->trans("FinancialAccount")." - ".$langs->trans("Card");
|
||||
|
||||
$help_url = 'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
|
||||
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
|
||||
// Creation
|
||||
|
||||
if ($action == 'create') {
|
||||
$object = new Account($db);
|
||||
|
||||
$title = $langs->trans("NewFinancialAccount");
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account');
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
@ -615,6 +613,9 @@ if ($action == 'create') {
|
||||
$_GET["id"] = $object->id;
|
||||
}
|
||||
|
||||
$title = $object->ref." - ".$langs->trans("Card");
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
// Show tabs
|
||||
$head = bank_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
|
||||
|
||||
@ -1707,19 +1707,20 @@ class Account extends CommonObject
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
// Example of IBAN FR7630001007941234567890185
|
||||
$this->specimen = 1;
|
||||
$this->ref = 'MBA';
|
||||
$this->label = 'My Big Company Bank account';
|
||||
$this->bank = 'MyBank';
|
||||
$this->courant = Account::TYPE_CURRENT;
|
||||
$this->clos = Account::STATUS_OPEN;
|
||||
$this->code_banque = '123';
|
||||
$this->code_guichet = '456';
|
||||
$this->number = 'ABC12345';
|
||||
$this->cle_rib = '50';
|
||||
$this->code_banque = '30001';
|
||||
$this->code_guichet = '00794';
|
||||
$this->number = '12345678901';
|
||||
$this->cle_rib = '85';
|
||||
$this->bic = 'AA12';
|
||||
$this->iban = 'FR999999999';
|
||||
$this->domiciliation = 'My bank address';
|
||||
$this->iban = 'FR7630001007941234567890185';
|
||||
$this->domiciliation = 'Banque de France';
|
||||
$this->proprio = 'Owner';
|
||||
$this->owner_address = 'Owner address';
|
||||
$this->country_id = 1;
|
||||
|
||||
@ -93,8 +93,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Documents");
|
||||
|
||||
$title = $object->ref.' - '.$langs->trans("Documents");
|
||||
$help_url = "EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses";
|
||||
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
@ -55,11 +55,6 @@ $error = 0;
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Graph");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$datetime = dol_now();
|
||||
@ -83,6 +78,10 @@ if (GETPOST("ref")) {
|
||||
$account = $object->id;
|
||||
}
|
||||
|
||||
$title = $object->ref.' - '.$langs->trans("Graph");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$result = dol_mkdir($conf->bank->dir_temp);
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
|
||||
@ -197,11 +197,6 @@ if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($n
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("AccountStatements");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
$societestatic = new Societe($db);
|
||||
$chargestatic = new ChargeSociales($db);
|
||||
@ -253,6 +248,10 @@ if (empty($numref)) {
|
||||
$numrows = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$title = $object->ref.' - '.$langs->trans("AccountStatements");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
// Onglets
|
||||
$head = bank_prepare_head($object);
|
||||
print dol_get_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account');
|
||||
|
||||
@ -57,11 +57,6 @@ $hookmanager->initHooks(array('banktreso', 'globalcard'));
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("PlannedTransactions");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$societestatic = new Societe($db);
|
||||
$facturestatic = new Facture($db);
|
||||
$facturefournstatic = new FactureFournisseur($db);
|
||||
@ -85,6 +80,9 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
$_GET["account"] = $object->id;
|
||||
}
|
||||
|
||||
$title = $object->ref.' - '.$langs->trans("PlannedTransactions");
|
||||
$helpurl = "";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
// Onglets
|
||||
$head = bank_prepare_head($object);
|
||||
|
||||
@ -304,9 +304,6 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("", $langs->trans("VariousPayment"));
|
||||
|
||||
$form = new Form($db);
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
$formaccounting = new FormAccounting($db);
|
||||
@ -324,6 +321,13 @@ if ($id) {
|
||||
}
|
||||
}
|
||||
|
||||
$title = $object->ref." - ".$langs->trans('Card');
|
||||
if ($action == 'create') {
|
||||
$title = $langs->trans("NewVariousPayment");
|
||||
}
|
||||
$help_url = 'EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores|DE:Modul_Lieferantenrechnungen';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$options = array();
|
||||
|
||||
// Load bank groups
|
||||
|
||||
@ -284,7 +284,7 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// must be place behind the last "header(...)" call
|
||||
llxHeader();
|
||||
llxHeader('', $langs->trans("VariousPayments"));
|
||||
|
||||
$i = 0;
|
||||
$total = 0;
|
||||
|
||||
@ -2880,8 +2880,10 @@ if (!empty($conf->project->enabled)) {
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Card');
|
||||
|
||||
$title = $object->ref." - ".$langs->trans('Card');
|
||||
if ($action == 'create') {
|
||||
$title = $langs->trans("NewBill");
|
||||
}
|
||||
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
@ -4182,7 +4184,7 @@ if ($action == 'create') {
|
||||
// Cree un tableau formulaire
|
||||
$formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300'));
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 310);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 340, 600);
|
||||
}
|
||||
|
||||
// Confirmation du classement abandonne
|
||||
@ -5522,9 +5524,9 @@ if ($action == 'create') {
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
// For deposit invoice
|
||||
// For down payment invoice (deposit)
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > Facture::STATUS_DRAFT && empty($discount->id)) {
|
||||
if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT')) {
|
||||
if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT') || ($object->type == Facture::STATUS_ABANDONED && in_array($object->close_code, array('bankcharge', 'discount_vat', 'other')))) {
|
||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
} else {
|
||||
|
||||
@ -167,7 +167,7 @@ class Facture extends CommonInvoice
|
||||
public $revenuestamp;
|
||||
|
||||
/**
|
||||
* ! Closing after partial payment: discount_vat, badsupplier, abandon
|
||||
* ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other
|
||||
* ! Closing when no payment: replaced, abandoned
|
||||
* @var string Close code
|
||||
*/
|
||||
@ -424,7 +424,10 @@ class Facture extends CommonInvoice
|
||||
const STATUS_ABANDONED = 3;
|
||||
|
||||
const CLOSECODE_DISCOUNTVAT = 'discount_vat'; // Abandonned remain - escompte
|
||||
const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned - bad
|
||||
const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned remain - bad customer
|
||||
const CLOSECODE_BANKCHARGE = 'bankcharge'; // Abandonned remain - bank charge
|
||||
const CLOSECODE_OTHER = 'other'; // Abandonned remain - other
|
||||
|
||||
const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other
|
||||
const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice
|
||||
|
||||
@ -3137,6 +3140,7 @@ class Facture extends CommonInvoice
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
}
|
||||
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
if ($num) {
|
||||
@ -3144,7 +3148,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Validate
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
|
||||
$sql .= " SET ref='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
|
||||
$sql .= " SET ref = '".$this->db->escape($num)."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
|
||||
if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { // If option enabled, we force invoice date
|
||||
$sql .= ", datef='".$this->db->idate($this->date)."'";
|
||||
$sql .= ", date_lim_reglement='".$this->db->idate($this->date_lim_reglement)."'";
|
||||
@ -3278,6 +3282,25 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set situation_final to 0 if is a credit note and the invoice source is a invoice situation (case when invoice situation is at 100%)
|
||||
* So we can continue to create new invoice situation
|
||||
*/
|
||||
if (!$error && $this->type == self::TYPE_CREDIT_NOTE && $this->fk_facture_source > 0) {
|
||||
$invoice_situation = new Facture($this->db);
|
||||
$result = $invoice_situation->fetch($this->fk_facture_source);
|
||||
if ($result > 0 && $invoice_situation->type == self::TYPE_SITUATION && $invoice_situation->situation_final == 1) {
|
||||
$invoice_situation->situation_final = 0;
|
||||
// Disable triggers because module can force situation_final to 1 by triggers (ex: SubTotal)
|
||||
$result = $invoice_situation->setFinal($user, 1);
|
||||
}
|
||||
if ($result < 0) {
|
||||
$this->error = $invoice_situation->error;
|
||||
$this->errors = $invoice_situation->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger calls
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
@ -3816,6 +3839,7 @@ class Facture extends CommonInvoice
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->errors[]='status of invoice must be Draft to allow use of ->addline()';
|
||||
dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR);
|
||||
return -3;
|
||||
}
|
||||
@ -4380,7 +4404,6 @@ class Facture extends CommonInvoice
|
||||
|
||||
$mybool = false;
|
||||
|
||||
|
||||
$file = $addon.'.php';
|
||||
$classname = $addon;
|
||||
|
||||
@ -4418,8 +4441,10 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
|
||||
$numref = $obj->getNextValue($soc, $this, $mode);
|
||||
|
||||
|
||||
/**
|
||||
* $numref can be empty in case we ask for the last value because if there is no invoice created with the
|
||||
* set up mask.
|
||||
@ -5446,14 +5471,13 @@ class Facture extends CommonInvoice
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Select all action comm reminder
|
||||
$sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
if (!empty($paymentmode) && $paymentmode != 'all') {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
|
||||
}
|
||||
$sql .= " WHERE f.paye = 0";
|
||||
$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;
|
||||
$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
|
||||
$sql .= " AND f.entity IN (".getEntity('facture').")";
|
||||
if (!empty($paymentmode) && $paymentmode != 'all') {
|
||||
@ -5535,20 +5559,95 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
if (!$error && $to) {
|
||||
$this->db->begin();
|
||||
|
||||
// Errors Recipient
|
||||
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
|
||||
|
||||
$trackid = 'inv'.$tmpinvoice->id;
|
||||
$sendcontext = 'standard';
|
||||
|
||||
// Mail Creation
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', $trackid, '', '', '');
|
||||
$cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
|
||||
|
||||
// Sending Mail
|
||||
if ($cMailFile->sendfile()) {
|
||||
$nbMailSend++;
|
||||
|
||||
// Add a line into event table
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
|
||||
$actioncomm->contact_id = 0;
|
||||
|
||||
$actioncomm->code = 'AC_EMAIL';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateOK';
|
||||
$actioncomm->note_private = $sendContent;
|
||||
$actioncomm->fk_project = $tmpinvoice->fk_project;
|
||||
$actioncomm->datep = dol_now();
|
||||
$actioncomm->datef = $actioncomm->datep;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is an email (content should be added into note)
|
||||
$actioncomm->email_msgid = $cMailFile->msgid;
|
||||
$actioncomm->email_from = $from;
|
||||
$actioncomm->email_sender = '';
|
||||
$actioncomm->email_to = $to;
|
||||
//$actioncomm->email_tocc = $sendtocc;
|
||||
//$actioncomm->email_tobcc = $sendtobcc;
|
||||
//$actioncomm->email_subject = $subject;
|
||||
$actioncomm->errors_to = $errors_to;
|
||||
|
||||
$actioncomm->elementtype = 'invoice';
|
||||
$actioncomm->fk_element = $tmpinvoice->id;
|
||||
|
||||
//$actioncomm->extraparams = $extraparams;
|
||||
|
||||
$actioncomm->create($user);
|
||||
} else {
|
||||
$errormesg = $cMailFile->error.' : '.$to;
|
||||
$error++;
|
||||
|
||||
// Add a line into event table
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$actioncomm->socid = $tmpinvoice->thirdparty->id; // To link to a company
|
||||
$actioncomm->contact_id = 0;
|
||||
|
||||
$actioncomm->code = 'AC_EMAIL';
|
||||
$actioncomm->label = 'sendEmailsRemindersOnInvoiceDueDateKO';
|
||||
$actioncomm->note_private = $errormesg;
|
||||
$actioncomm->fk_project = $tmpinvoice->fk_project;
|
||||
$actioncomm->datep = dol_now();
|
||||
$actioncomm->datef = $actioncomm->datep;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is an email (content should be added into note)
|
||||
$actioncomm->email_msgid = $cMailFile->msgid;
|
||||
$actioncomm->email_from = $from;
|
||||
$actioncomm->email_sender = '';
|
||||
$actioncomm->email_to = $to;
|
||||
//$actioncomm->email_tocc = $sendtocc;
|
||||
//$actioncomm->email_tobcc = $sendtobcc;
|
||||
//$actioncomm->email_subject = $subject;
|
||||
$actioncomm->errors_to = $errors_to;
|
||||
|
||||
//$actioncomm->extraparams = $extraparams;
|
||||
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
|
||||
$this->db->commit(); // We always commit
|
||||
}
|
||||
|
||||
if ($errormesg) {
|
||||
@ -5566,10 +5665,8 @@ class Facture extends CommonInvoice
|
||||
|
||||
if (!$error) {
|
||||
$this->output .= 'Nb of emails sent : '.$nbMailSend;
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
} else {
|
||||
$this->db->commit(); // We commit also on error, to have the error message recorded.
|
||||
$this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error;
|
||||
return $error;
|
||||
}
|
||||
@ -5577,8 +5674,9 @@ class Facture extends CommonInvoice
|
||||
|
||||
/**
|
||||
* See if current invoice date is posterior to the last invoice date among validated invoices of same type.
|
||||
*
|
||||
* @param boolean $allow_validated_drafts return true if the invoice has been validated before returning to DRAFT state.
|
||||
* @return boolean
|
||||
* @return array return array
|
||||
*/
|
||||
public function willBeLastOfSameType($allow_validated_drafts = false)
|
||||
{
|
||||
@ -5602,10 +5700,10 @@ class Facture extends CommonInvoice
|
||||
$is_last_of_same_type = $is_last_of_same_type || (!strpos($this->ref, 'PROV') && $this->status == self::STATUS_DRAFT);
|
||||
}
|
||||
|
||||
return [$is_last_of_same_type, $last_date];
|
||||
return array($is_last_of_same_type, $last_date);
|
||||
} else {
|
||||
// element is first of type to be validated
|
||||
return [true];
|
||||
return array(true);
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
|
||||
@ -100,7 +100,7 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
|
||||
$title = $object->ref." - ".$langs->trans('ContactsAddresses');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
|
||||
@ -100,8 +100,7 @@ if (empty($object->id)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
|
||||
|
||||
$title = $object->ref." - ".$langs->trans('Documents');
|
||||
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
@ -65,7 +65,7 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
|
||||
$title = $object->ref." - ".$langs->trans('Info');
|
||||
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
@ -863,9 +863,9 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
*/
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
@ -1112,10 +1112,10 @@ if ($resql) {
|
||||
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
|
||||
}
|
||||
if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
|
||||
$langs->load("withdrawals");
|
||||
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
|
||||
$langs->load("withdrawals");
|
||||
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
|
||||
}
|
||||
if ($user->rights->facture->supprimer) {
|
||||
if (!empty($user->rights->facture->supprimer)) {
|
||||
if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
|
||||
$arrayofmassactions['predeletedraft'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Deletedraft");
|
||||
} elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation
|
||||
@ -1229,7 +1229,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
|
||||
|
||||
// Show the massaction checkboxes only when this page is not opend from the Extended POS
|
||||
if ($massactionbutton && $contextpage != 'poslist') {
|
||||
@ -1241,6 +1241,15 @@ if ($resql) {
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
// Action column
|
||||
print '<td class="liste_titre center actioncolumn">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
@ -1300,11 +1309,11 @@ if ($resql) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
/*
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';*/
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';*/
|
||||
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before"));
|
||||
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
|
||||
print '</div>';
|
||||
@ -1528,13 +1537,20 @@ if ($resql) {
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre center actioncolumn">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
if (!empty($conf->global->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);
|
||||
}
|
||||
@ -1685,7 +1701,10 @@ if ($resql) {
|
||||
if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$projectstatic = new Project($db);
|
||||
@ -1744,12 +1763,12 @@ if ($resql) {
|
||||
$facturestatic->note_public = $obj->note_public;
|
||||
$facturestatic->note_private = $obj->note_private;
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION) && !empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||
$facturestatic->retained_warranty = $obj->retained_warranty;
|
||||
$facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_final = $obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_final = $obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
|
||||
$facturestatic->situation_counter = $obj->situation_counter;
|
||||
$facturestatic->retained_warranty = $obj->retained_warranty;
|
||||
$facturestatic->retained_warranty_date_limit = $obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_final = $obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_final = $obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_cycle_ref = $obj->situation_cycle_ref;
|
||||
$facturestatic->situation_counter = $obj->situation_counter;
|
||||
}
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
@ -1818,6 +1837,20 @@ if ($resql) {
|
||||
}
|
||||
print '>';
|
||||
|
||||
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap" align="center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// No
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||
print '<td>'.(($offset * $limit) + $i).'</td>';
|
||||
@ -2050,14 +2083,14 @@ if ($resql) {
|
||||
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['f.total_ht']['checked'])) {
|
||||
print '<td class="right nowraponall">'.price($obj->total_ht)."</td>\n";
|
||||
print '<td class="right nowraponall">'.price($obj->total_ht)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
|
||||
}
|
||||
$totalarray['val']['f.total_ht'] += $obj->total_ht;
|
||||
$totalarray['val']['f.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (!empty($arrayfields['f.total_tva']['checked'])) {
|
||||
@ -2225,16 +2258,16 @@ if ($resql) {
|
||||
|
||||
// Currency rate
|
||||
if (!empty($arrayfields['f.multicurrency_tx']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
print '<td class="nowraponall">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Amount HT
|
||||
if (!empty($arrayfields['f.multicurrency_total_ht']['checked'])) {
|
||||
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
print '<td class="right nowraponall amount">'.price($obj->multicurrency_total_ht)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -2392,19 +2425,21 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// Action column (Show the massaction button only when this page is not opend from the Extended POS)
|
||||
print '<td class="nowrap" align="center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="nowrap" align="center">';
|
||||
if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // 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->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
@ -85,7 +85,7 @@ if (empty($object->id)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
|
||||
$title = $object->ref." - ".$langs->trans('Notes');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
|
||||
@ -572,7 +572,6 @@ if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/', $c
|
||||
$title = $object->lastname;
|
||||
}
|
||||
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
@ -623,7 +622,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Show tabs
|
||||
$head = contact_prepare_head($object);
|
||||
|
||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
llxHeader('', $title, $help_url);
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->creer) {
|
||||
@ -643,8 +642,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
|
||||
$linkback = '';
|
||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
print load_fiche_titre($title, $linkback, 'address');
|
||||
|
||||
// Show errors
|
||||
@ -1299,11 +1301,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
// View mode
|
||||
if (!empty($id) && $action != 'edit' && $action != 'create') {
|
||||
$objsoc = new Societe($db);
|
||||
|
||||
// View mode
|
||||
|
||||
// Show errors
|
||||
dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors);
|
||||
|
||||
@ -1528,9 +1529,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($object->user_id) {
|
||||
$dolibarr_user = new User($db);
|
||||
$result = $dolibarr_user->fetch($object->user_id);
|
||||
print $dolibarr_user->getLoginUrl(1);
|
||||
print $dolibarr_user->getLoginUrl(-1);
|
||||
} else {
|
||||
print $langs->trans("NoDolibarrAccess");
|
||||
//print '<span class="opacitymedium">'.$langs->trans("NoDolibarrAccess").'</span>';
|
||||
if (!$object->user_id && $user->rights->user->user->creer) {
|
||||
print '<a class="aaa" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create_user&token='.newToken().'">'.img_picto($langs->trans("CreateDolibarrLogin"), 'add').' '.$langs->trans("CreateDolibarrLogin").'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1563,10 +1567,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
if (!$object->user_id && $user->rights->user->user->creer) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=create_user&token='.newToken().'">'.$langs->trans("CreateDolibarrLogin").'</a>';
|
||||
}
|
||||
|
||||
// Activer
|
||||
if ($object->statut == 0 && $user->rights->societe->contact->creer) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken().'">'.$langs->trans("Reactivate").'</a>';
|
||||
|
||||
@ -132,6 +132,7 @@ if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('b
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
|
||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
if ($type == "p") {
|
||||
if (empty($contextpage) || $contextpage == 'contactlist') {
|
||||
@ -345,8 +346,6 @@ if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)
|
||||
$contactstatic->loadCacheOfProspStatus();
|
||||
}
|
||||
|
||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
// Select every potentiels, and note each potentiels which fit in search parameters
|
||||
$tab_level = array();
|
||||
$sql = "SELECT code, label, sortorder";
|
||||
@ -583,7 +582,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && (
|
||||
}
|
||||
|
||||
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
|
||||
llxHeader('', $title, $help_url);
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
@ -772,7 +771,7 @@ print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
|
||||
$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);
|
||||
}
|
||||
@ -782,6 +781,13 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
||||
|
||||
// Lines for filter fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.rowid']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).'">';
|
||||
@ -934,15 +940,19 @@ if (!empty($arrayfields['p.import_key']['checked'])) {
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Ligne des titres
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
if (!empty($arrayfields['p.rowid']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
@ -1032,7 +1042,9 @@ if (!empty($arrayfields['p.statut']['checked'])) {
|
||||
if (!empty($arrayfields['p.import_key']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -1064,6 +1076,18 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (!empty($conf->global->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($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// ID
|
||||
if (!empty($arrayfields['p.rowid']['checked'])) {
|
||||
print '<td class="tdoverflowmax50">';
|
||||
@ -1292,15 +1316,17 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
// 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($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (empty($conf->global->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($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -784,8 +784,10 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) {
|
||||
// Close all lines
|
||||
$result = $object->activateAll($user);
|
||||
$date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear'));
|
||||
$date_end = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear'));
|
||||
$comment = GETPOST('comment', 'alpha');
|
||||
$result = $object->activateAll($user, $date_start, 0, $comment, $date_end);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -1260,7 +1262,12 @@ if ($action == 'create') {
|
||||
// Confirmation de la fermeture
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("CloseAContract"), $langs->trans("ConfirmCloseContract"), "confirm_close", '', 0, 1);
|
||||
} elseif ($action == 'activate') {
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", '', 0, 1);
|
||||
$formquestion = array(
|
||||
array('type' => 'date', 'name' => 'd_start', 'label' => $langs->trans("DateServiceActivate"), /*'value' => $form->selectDate('', '', $usehm, $usehm, '', "active", 1, 0),*/ /*'socid', '(s.client=1 OR s.client=2 OR s.client=3)'*/),
|
||||
array('type' => 'date', 'name' => 'd_end', 'label' => $langs->trans("DateEndPlanned"), /*'value' => $form->selectDate('', "end", $usehm, $usehm, '', "active", 1, 0),*/ '', ''),
|
||||
array('type' => 'text', 'name' => 'comment', 'label' => $langs->trans("Comment"), 'value' => '', '', '', 'class' => 'minwidth300')
|
||||
);
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("ActivateAllOnContract"), $langs->trans("ConfirmActivateAllOnContract"), "confirm_activate", $formquestion, 'yes', 1, 280);
|
||||
} elseif ($action == 'clone') {
|
||||
// Clone confirmation
|
||||
$formquestion = array(array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')));
|
||||
|
||||
@ -366,10 +366,11 @@ class Contrat extends CommonObject
|
||||
* @param int|string $date_start Date start (now if empty)
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @param string $comment Comment
|
||||
* @param int|string $date_end Date end
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @see ()
|
||||
*/
|
||||
public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '')
|
||||
public function activateAll($user, $date_start = '', $notrigger = 0, $comment = '', $date_end = '')
|
||||
{
|
||||
if (empty($date_start)) {
|
||||
$date_start = dol_now();
|
||||
@ -387,7 +388,7 @@ class Contrat extends CommonObject
|
||||
if ($contratline->statut != ContratLigne::STATUS_OPEN) {
|
||||
$contratline->context = $this->context;
|
||||
|
||||
$result = $contratline->active_line($user, $date_start, -1, $comment); // This call trigger LINECONTRACT_ACTIVATE
|
||||
$result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $contratline->error;
|
||||
@ -667,7 +668,7 @@ class Contrat extends CommonObject
|
||||
if (!$id) {
|
||||
$sql .= " WHERE entity IN (".getEntity('contract').")";
|
||||
} else {
|
||||
$sql .= " WHERE rowid=".(int) $id;
|
||||
$sql .= " WHERE rowid = ".(int) $id;
|
||||
}
|
||||
if ($ref_customer) {
|
||||
$sql .= " AND ref_customer = '".$this->db->escape($ref_customer)."'";
|
||||
@ -676,7 +677,7 @@ class Contrat extends CommonObject
|
||||
$sql .= " AND ref_supplier = '".$this->db->escape($ref_supplier)."'";
|
||||
}
|
||||
if ($ref) {
|
||||
$sql .= " AND ref='".$this->db->escape($ref)."'";
|
||||
$sql .= " AND ref = '".$this->db->escape($ref)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -723,10 +724,13 @@ class Contrat extends CommonObject
|
||||
|
||||
// Retrieve all extrafields
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
$result = $this->fetch_optionals();
|
||||
|
||||
// Lines
|
||||
$result = $this->fetch_lines();
|
||||
if ($result >= 0 && !empty($this->table_element_line)) {
|
||||
$result = $this->fetch_lines();
|
||||
}
|
||||
|
||||
if ($result < 0) {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -3;
|
||||
|
||||
@ -70,7 +70,10 @@ $productstatic = new Product($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("ContractsArea");
|
||||
$help_url = '';
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
print load_fiche_titre($langs->trans("ContractsArea"), '', 'contract');
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
$nbignored = 0;
|
||||
$langs->load("mails");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
|
||||
|
||||
$listofobjectid = array();
|
||||
$listofobjectthirdparties = array();
|
||||
@ -668,6 +669,7 @@ if (!$error && $massaction == 'confirm_presend') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$error && $massaction == 'cancelorders') {
|
||||
$db->begin();
|
||||
|
||||
|
||||
@ -69,10 +69,10 @@ $type = $mode;
|
||||
// Check securitykey
|
||||
$securekeyseed = '';
|
||||
if ($type == 'proposal') {
|
||||
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
|
||||
$securekeyseed = isset($conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
|
||||
}
|
||||
|
||||
if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) {
|
||||
if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) {
|
||||
http_response_code(403);
|
||||
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
|
||||
exit(-1);
|
||||
@ -122,28 +122,40 @@ if ($action == "importSignature") {
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
|
||||
// Defined modele of doc
|
||||
$directdownloadlink = $object->getLastMainDocLink('proposal');
|
||||
|
||||
$pdf = pdf_getInstance();
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF
|
||||
if (preg_match('/\.pdf/i', $directdownloadlink)) {
|
||||
$newpdffilename = $upload_dir.$ref."_signed-".$date.".pdf";
|
||||
$sourcefile = $upload_dir.$ref.".pdf";
|
||||
|
||||
for ($i=1;$i<($pagecount+1);$i++) {
|
||||
if ($i>1) $pdf->AddPage();
|
||||
$tppl=$pdf->importPage($i);
|
||||
$pdf->useTemplate($tppl);
|
||||
if (dol_is_file($sourcefile)) {
|
||||
$pdf = pdf_getInstance();
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
$pagecount = $pdf->setSourceFile($sourcefile); // original PDF
|
||||
|
||||
for ($i=1; $i<($pagecount+1); $i++) {
|
||||
if ($i>1) $pdf->AddPage();
|
||||
$tppl=$pdf->importPage($i);
|
||||
$pdf->useTemplate($tppl);
|
||||
}
|
||||
|
||||
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
|
||||
$pdf->Close();
|
||||
$pdf->Output($newpdffilename, "F");
|
||||
|
||||
// Index the new file and update the last_main_doc property of object.
|
||||
$object->indexFile($newpdffilename, 1);
|
||||
}
|
||||
} else {
|
||||
// Adding signature on doc not yet supported
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
|
||||
$pdf->Close();
|
||||
$pdf->Output($newpdffilename, "F");
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
// Index the new file and update the last_main_doc property of object.
|
||||
$object->indexFile($newpdffilename, 1);
|
||||
|
||||
$online_sign_ip = getUserRemoteIP();
|
||||
$online_sign_name = ''; // TODO Ask name on form to sign
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2019-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,7 +17,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/ajax/pingresult.php
|
||||
* \brief File to save result of an anonymous ping into database (1 ping is done per installation)
|
||||
* \brief Page called after a ping was done in js to the official dolibarr ping service.
|
||||
* This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping.
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
|
||||
@ -34,7 +34,7 @@ class box_actions extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "lastactions";
|
||||
public $boximg = "object_action";
|
||||
public $boxlabel = "BoxLastActions";
|
||||
public $boxlabel = "BoxOldestActions";
|
||||
public $depends = array("agenda");
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ class box_actions extends ModeleBoxes
|
||||
$societestatic = new Societe($this->db);
|
||||
$actionstatic = new ActionComm($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo", $max));
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestActionsToDo", $max));
|
||||
|
||||
if ($user->rights->agenda->myactions->read) {
|
||||
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
|
||||
@ -108,7 +108,7 @@ class box_actions extends ModeleBoxes
|
||||
if (empty($user->rights->agenda->allactions->read)) {
|
||||
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")";
|
||||
}
|
||||
$sql .= " ORDER BY a.datec DESC";
|
||||
$sql .= " ORDER BY a.datep ASC";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
|
||||
|
||||
@ -209,7 +209,7 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
'expensereports' => DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport',
|
||||
'holidays' => DOL_URL_ROOT . '/holiday/list.php?mainmenu=hrm&leftmenu=holiday',
|
||||
'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket',
|
||||
'dolresource' => DOL_URL_ROOT . '/resource/list.php?mainmenu=tools',
|
||||
'dolresource' => DOL_URL_ROOT . '/resource/list.php?mainmenu=agenda',
|
||||
);
|
||||
$titres = array(
|
||||
'users' => "Users",
|
||||
|
||||
@ -520,6 +520,11 @@ abstract class CommonObject
|
||||
*/
|
||||
public $date_modification; // Date last change (tms field)
|
||||
|
||||
/**
|
||||
* @var integer|string $date_cloture;
|
||||
*/
|
||||
public $date_cloture; // Date closing (tms field)
|
||||
|
||||
/**
|
||||
* @var User|int User author/creation
|
||||
* @TODO Merge with user_creation
|
||||
@ -549,6 +554,10 @@ abstract class CommonObject
|
||||
* @var int User id of validation
|
||||
*/
|
||||
public $user_validation_id;
|
||||
/**
|
||||
* @var int User id closing object
|
||||
*/
|
||||
public $user_closing_id;
|
||||
|
||||
/**
|
||||
* @var User|int User last modifier
|
||||
@ -593,6 +602,8 @@ abstract class CommonObject
|
||||
|
||||
|
||||
// No constructor as it is an abstract class
|
||||
|
||||
|
||||
/**
|
||||
* Check an object id/ref exists
|
||||
* If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch
|
||||
@ -639,6 +650,7 @@ abstract class CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to output saved errors
|
||||
*
|
||||
@ -4974,7 +4986,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$text .= ' - '.(!empty($line->label) ? $line->label : $label);
|
||||
$description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
|
||||
$description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : (!empty($line->description) ? dol_htmlentitiesbr($line->description) : '')); // Description is what to show on popup. We shown nothing if already into desc.
|
||||
}
|
||||
|
||||
$line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
|
||||
@ -5521,7 +5533,9 @@ abstract class CommonObject
|
||||
* Index a file into the ECM database
|
||||
*
|
||||
* @param string $destfull Full path of file to index
|
||||
* @param int $update_main_doc_field Update field main_doc file into table of object
|
||||
* @param int $update_main_doc_field Update field main_doc fied into the table of object.
|
||||
* This param is set when called for a document generation if document generator hase
|
||||
* ->update_main_doc_field set and returns ->result['fullpath'].
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function indexFile($destfull, $update_main_doc_field)
|
||||
@ -5560,6 +5574,9 @@ abstract class CommonObject
|
||||
if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey = true;
|
||||
}
|
||||
if ($this->element == 'product' && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey = true;
|
||||
}
|
||||
if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) {
|
||||
$setsharekey = true;
|
||||
}
|
||||
@ -6895,15 +6912,15 @@ abstract class CommonObject
|
||||
if ((!isset($this->fields[$key]['default'])) || ($this->fields[$key]['notnull'] != 1)) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
}
|
||||
foreach ($param['options'] as $key => $val) {
|
||||
if ((string) $key == '') {
|
||||
foreach ($param['options'] as $keyb => $valb) {
|
||||
if ((string) $keyb == '') {
|
||||
continue;
|
||||
}
|
||||
if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val);
|
||||
$out .= '<option value="'.$key.'"';
|
||||
$out .= (((string) $value == (string) $key) ? ' selected' : '');
|
||||
if (strpos($valb, "|") !== false) list($valb, $parent) = explode('|', $valb);
|
||||
$out .= '<option value="'.$keyb.'"';
|
||||
$out .= (((string) $value == (string) $keyb) ? ' selected' : '');
|
||||
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
|
||||
$out .= '>'.$val.'</option>';
|
||||
$out .= '>'.$valb.'</option>';
|
||||
}
|
||||
$out .= '</select>';
|
||||
} elseif ($type == 'sellist') {
|
||||
@ -7052,12 +7069,12 @@ abstract class CommonObject
|
||||
$out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, $morecss, 0, '100%');
|
||||
} elseif ($type == 'radio') {
|
||||
$out = '';
|
||||
foreach ($param['options'] as $keyopt => $val) {
|
||||
foreach ($param['options'] as $keyopt => $valopt) {
|
||||
$out .= '<input class="flat '.$morecss.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '');
|
||||
$out .= ' value="'.$keyopt.'"';
|
||||
$out .= ' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"';
|
||||
$out .= ($value == $keyopt ? 'checked' : '');
|
||||
$out .= '/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
|
||||
$out .= '/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$valopt.'</label><br>';
|
||||
}
|
||||
} elseif ($type == 'chkbxlst') {
|
||||
if (is_array($value)) {
|
||||
@ -7399,8 +7416,10 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
// Format output value differently according to properties of field
|
||||
if ($key == 'ref' && method_exists($this, 'getNomUrl')) {
|
||||
$value = $this->getNomUrl(1, '', 0, '', 1);
|
||||
if (in_array($key, array('rowid', 'ref')) && method_exists($this, 'getNomUrl')) {
|
||||
if ($key != 'rowid' || empty($this->fields['ref'])) { // If we want ref field or if we want ID and there is no ref field, we show the link.
|
||||
$value = $this->getNomUrl(1, '', 0, '', 1);
|
||||
}
|
||||
} elseif ($key == 'status' && method_exists($this, 'getLibStatut')) {
|
||||
$value = $this->getLibStatut(3);
|
||||
} elseif ($type == 'date') {
|
||||
@ -7479,33 +7498,35 @@ abstract class CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$value = ''; // value was used, so now we reste it to use it to build final output
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
if ($numrows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
|
||||
if (is_array($fields_label) && count($fields_label) > 1) {
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$translabel = '';
|
||||
if (!empty($obj->$field_toshow)) {
|
||||
$translabel = $langs->trans($obj->$field_toshow);
|
||||
if (is_array($fields_label) && count($fields_label) > 1) {
|
||||
foreach ($fields_label as $field_toshow) {
|
||||
$translabel = '';
|
||||
if (!empty($obj->$field_toshow)) {
|
||||
$translabel = $langs->trans($obj->$field_toshow);
|
||||
}
|
||||
if ($translabel != $field_toshow) {
|
||||
$value .= dol_trunc($translabel, 18).' ';
|
||||
} else {
|
||||
$value .= $obj->$field_toshow.' ';
|
||||
}
|
||||
}
|
||||
if ($translabel != $field_toshow) {
|
||||
$value .= dol_trunc($translabel, 18).' ';
|
||||
} else {
|
||||
$value .= $obj->$field_toshow.' ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$translabel = '';
|
||||
if (!empty($obj->{$InfoFieldList[1]})) {
|
||||
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
|
||||
}
|
||||
if ($translabel != $obj->{$InfoFieldList[1]}) {
|
||||
$value = dol_trunc($translabel, 18);
|
||||
} else {
|
||||
$value = $obj->{$InfoFieldList[1]};
|
||||
$translabel = '';
|
||||
if (!empty($obj->{$InfoFieldList[1]})) {
|
||||
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
|
||||
}
|
||||
if ($translabel != $obj->{$InfoFieldList[1]}) {
|
||||
$value = dol_trunc($translabel, 18);
|
||||
} else {
|
||||
$value = $obj->{$InfoFieldList[1]};
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -7611,7 +7632,28 @@ abstract class CommonObject
|
||||
$result = $object->fetch($value);
|
||||
}
|
||||
if ($result > 0) {
|
||||
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2);
|
||||
if ($object->element === 'product') {
|
||||
$get_name_url_param_arr = array($getnomurlparam, $getnomurlparam2, 0, -1, 0, '', 0);
|
||||
if (isset($val['get_name_url_params'])) {
|
||||
$get_name_url_params = explode(':', $val['get_name_url_params']);
|
||||
if (!empty($get_name_url_params)) {
|
||||
$param_num_max = count($get_name_url_param_arr) - 1;
|
||||
foreach ($get_name_url_params as $param_num => $param_value) {
|
||||
if ($param_num > $param_num_max) {
|
||||
break;
|
||||
}
|
||||
$get_name_url_param_arr[$param_num] = $param_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Product $object
|
||||
*/
|
||||
$value = $object->getNomUrl($get_name_url_param_arr[0], $get_name_url_param_arr[1], $get_name_url_param_arr[2], $get_name_url_param_arr[3], $get_name_url_param_arr[4], $get_name_url_param_arr[5], $get_name_url_param_arr[6]);
|
||||
} else {
|
||||
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2);
|
||||
}
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
@ -8085,8 +8127,13 @@ abstract class CommonObject
|
||||
//if (GETPOST('action', 'restricthtml') == 'create') $out.='create';
|
||||
// BUG #11554 : For public page, use red dot for required fields, instead of bold label
|
||||
$tpl_context = isset($params["tpl_context"]) ? $params["tpl_context"] : "none";
|
||||
if ($tpl_context != "public") { // Public page : red dot instead of fieldrequired characters
|
||||
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) {
|
||||
$out .= ' fieldrequired';
|
||||
}
|
||||
}
|
||||
$out .= '">';
|
||||
if ($tpl_context == "public") { // Public page : red dot instead of fieldrequired characters
|
||||
$out .= '">';
|
||||
if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) {
|
||||
$out .= $form->textwithpicto($labeltoshow, $helptoshow);
|
||||
} else {
|
||||
@ -8096,10 +8143,6 @@ abstract class CommonObject
|
||||
$out .= ' <span style="color: red">*</span>';
|
||||
}
|
||||
} else {
|
||||
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) {
|
||||
$out .= ' fieldrequired';
|
||||
}
|
||||
$out .= '">';
|
||||
if (!empty($extrafields->attributes[$this->table_element]['help'][$key])) {
|
||||
$out .= $form->textwithpicto($labeltoshow, $helptoshow);
|
||||
} else {
|
||||
@ -8879,7 +8922,7 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null;
|
||||
$this->{$field} = isset($obj->{$field}) ? $obj->{$field} : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -774,6 +774,11 @@ class Conf
|
||||
$this->global->MULTICURRENCY_USE_ORIGIN_TX = 1;
|
||||
}
|
||||
|
||||
// By default, use an enclosure " for field with CRL or LF into content, + we also remove also CRL/LF chars.
|
||||
if (!isset($this->global->USE_STRICT_CSV_RULES)) {
|
||||
$this->global->USE_STRICT_CSV_RULES = 2;
|
||||
}
|
||||
|
||||
// Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined)
|
||||
if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) {
|
||||
$this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1;
|
||||
@ -1033,12 +1038,15 @@ class Conf
|
||||
if (!empty($this->file->mailing_limit_sendbyweb)) {
|
||||
$this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb;
|
||||
}
|
||||
if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) {
|
||||
if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) { // Limit by web can't be 0
|
||||
$this->global->MAILING_LIMIT_SENDBYWEB = 25;
|
||||
}
|
||||
if (!empty($this->file->mailing_limit_sendbycli)) {
|
||||
$this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli;
|
||||
}
|
||||
if (!empty($this->file->mailing_limit_sendbyday)) {
|
||||
$this->global->MAILING_LIMIT_SENDBYDAY = $this->file->mailing_limit_sendbyday;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1316,7 +1316,7 @@ class DolGraph
|
||||
if (empty($showlegend)) {
|
||||
$this->stringtoshow .= 'legend: { display: false }, '."\n";
|
||||
} else {
|
||||
$this->stringtoshow .= 'legend: { maxWidth: '.round($this->width / 2).', labels: { boxWidth: 15 }, position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\' },'."\n";
|
||||
$this->stringtoshow .= 'legend: { maxWidth: '.round(intVal($this->width) / 2).', labels: { boxWidth: 15 }, position: \'' . (($showlegend && $showlegend == 2) ? 'right' : 'top') . '\' },'."\n";
|
||||
}
|
||||
$this->stringtoshow .= "}, \n";
|
||||
|
||||
|
||||
@ -105,6 +105,7 @@ class ExtraFields
|
||||
'phone'=>'ExtrafieldPhone',
|
||||
'mail'=>'ExtrafieldMail',
|
||||
'url'=>'ExtrafieldUrl',
|
||||
'ip'=>'ExtrafieldIP',
|
||||
'password' => 'ExtrafieldPassword',
|
||||
'select' => 'ExtrafieldSelect',
|
||||
'sellist' => 'ExtrafieldSelectList',
|
||||
@ -156,9 +157,10 @@ class ExtraFields
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is a measure. Must show a total on lists
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...)
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
|
||||
{
|
||||
if (empty($attrname)) {
|
||||
return -1;
|
||||
@ -182,12 +184,12 @@ class ExtraFields
|
||||
|
||||
// Create field into database except for separator type which is not stored in database
|
||||
if ($type != 'separate') {
|
||||
$result = $this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed, $help);
|
||||
$result = $this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed, $help, $moreparams);
|
||||
}
|
||||
$err1 = $this->errno;
|
||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') {
|
||||
// Add declaration of field into table
|
||||
$result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable);
|
||||
$result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams);
|
||||
$err2 = $this->errno;
|
||||
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) {
|
||||
$this->error = '';
|
||||
@ -217,9 +219,10 @@ class ExtraFields
|
||||
* @param string $list Into list view by default
|
||||
* @param string $computed Computed value
|
||||
* @param string $help Help on tooltip
|
||||
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function create($attrname, $type = 'varchar', $length = 255, $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = '', $perms = '', $list = '0', $computed = '', $help = '')
|
||||
private function create($attrname, $type = 'varchar', $length = 255, $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = '', $perms = '', $list = '0', $computed = '', $help = '', $moreparams = array())
|
||||
{
|
||||
if ($elementtype == 'thirdparty') {
|
||||
$elementtype = 'societe';
|
||||
@ -243,7 +246,7 @@ class ExtraFields
|
||||
} elseif ($type == 'phone') {
|
||||
$typedb = 'varchar';
|
||||
$lengthdb = '20';
|
||||
} elseif ($type == 'mail') {
|
||||
} elseif ($type == 'mail' || $type == 'ip') {
|
||||
$typedb = 'varchar';
|
||||
$lengthdb = '128';
|
||||
} elseif ($type == 'url') {
|
||||
@ -315,11 +318,12 @@ class ExtraFields
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is a measure. Must show a total on lists
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
* @throws Exception
|
||||
*/
|
||||
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user;
|
||||
@ -354,6 +358,19 @@ class ExtraFields
|
||||
$totalizable = 0;
|
||||
}
|
||||
|
||||
$css = '';
|
||||
if (!empty($moreparams) && !empty($moreparams['css'])) {
|
||||
$css = $moreparams['css'];
|
||||
}
|
||||
$csslist = '';
|
||||
if (!empty($moreparams) && !empty($moreparams['csslist'])) {
|
||||
$csslist = $moreparams['csslist'];
|
||||
}
|
||||
$cssview = '';
|
||||
if (!empty($moreparams) && !empty($moreparams['cssview'])) {
|
||||
$cssview = $moreparams['cssview'];
|
||||
}
|
||||
|
||||
if (!empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname) && !is_numeric($attrname)) {
|
||||
if (is_array($param) && count($param) > 0) {
|
||||
$params = serialize($param);
|
||||
@ -386,7 +403,10 @@ class ExtraFields
|
||||
$sql .= " datec,";
|
||||
$sql .= " enabled,";
|
||||
$sql .= " help,";
|
||||
$sql .= " totalizable";
|
||||
$sql .= " totalizable,";
|
||||
$sql .= " css,";
|
||||
$sql .= " csslist,";
|
||||
$sql .= " cssview";
|
||||
$sql .= " )";
|
||||
$sql .= " VALUES('".$this->db->escape($attrname)."',";
|
||||
$sql .= " '".$this->db->escape($label)."',";
|
||||
@ -410,7 +430,10 @@ class ExtraFields
|
||||
$sql .= "'".$this->db->idate(dol_now())."',";
|
||||
$sql .= " ".($enabled ? "'".$this->db->escape($enabled)."'" : "1").",";
|
||||
$sql .= " ".($help ? "'".$this->db->escape($help)."'" : "null").",";
|
||||
$sql .= " ".($totalizable ? 'TRUE' : 'FALSE');
|
||||
$sql .= " ".($totalizable ? 'TRUE' : 'FALSE').",";
|
||||
$sql .= " ".($css ? "'".$this->db->escape($css)."'" : "null").",";
|
||||
$sql .= " ".($csslist ? "'".$this->db->escape($csslist)."'" : "null").",";
|
||||
$sql .= " ".($cssview ? "'".$this->db->escape($cssview)."'" : "null");
|
||||
$sql .= ')';
|
||||
|
||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||
@ -542,11 +565,12 @@ class ExtraFields
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is extrafield totalizable on list
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
|
||||
* @return int >0 if OK, <=0 if KO
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
@ -572,7 +596,7 @@ class ExtraFields
|
||||
} elseif ($type == 'phone') {
|
||||
$typedb = 'varchar';
|
||||
$lengthdb = '20';
|
||||
} elseif ($type == 'mail') {
|
||||
} elseif ($type == 'mail' || $type == 'ip') {
|
||||
$typedb = 'varchar';
|
||||
$lengthdb = '128';
|
||||
} elseif ($type == 'url') {
|
||||
@ -611,7 +635,7 @@ class ExtraFields
|
||||
}
|
||||
if ($result > 0 || $type == 'separate') {
|
||||
if ($label) {
|
||||
$result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable);
|
||||
$result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams);
|
||||
}
|
||||
if ($result > 0) {
|
||||
$sql = '';
|
||||
@ -663,11 +687,12 @@ class ExtraFields
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is extrafield totalizable on list
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...)
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
* @throws Exception
|
||||
*/
|
||||
private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user;
|
||||
@ -700,6 +725,19 @@ class ExtraFields
|
||||
$alwayseditable = 0;
|
||||
}
|
||||
|
||||
$css = '';
|
||||
if (!empty($moreparams) && !empty($moreparams['css'])) {
|
||||
$css = $moreparams['css'];
|
||||
}
|
||||
$csslist = '';
|
||||
if (!empty($moreparams) && !empty($moreparams['csslist'])) {
|
||||
$csslist = $moreparams['csslist'];
|
||||
}
|
||||
$cssview = '';
|
||||
if (!empty($moreparams) && !empty($moreparams['cssview'])) {
|
||||
$cssview = $moreparams['cssview'];
|
||||
}
|
||||
|
||||
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) {
|
||||
$this->db->begin();
|
||||
|
||||
@ -749,7 +787,10 @@ class ExtraFields
|
||||
$sql .= " fk_user_modif,";
|
||||
$sql .= " datec,";
|
||||
$sql .= " enabled,";
|
||||
$sql .= " help";
|
||||
$sql .= " help,";
|
||||
$sql .= " css,";
|
||||
$sql .= " csslist,";
|
||||
$sql .= " cssview";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($attrname)."',";
|
||||
$sql .= " ".($entity === '' ? $conf->entity : $entity).",";
|
||||
@ -773,7 +814,10 @@ class ExtraFields
|
||||
$sql .= " ".$user->id.",";
|
||||
$sql .= "'".$this->db->idate(dol_now())."',";
|
||||
$sql .= "'".$this->db->escape($enabled)."',";
|
||||
$sql .= " ".($help ? "'".$this->db->escape($help)."'" : "null");
|
||||
$sql .= " ".($help ? "'".$this->db->escape($help)."'" : "null").",";
|
||||
$sql .= " ".($css ? "'".$this->db->escape($css)."'" : "null").",";
|
||||
$sql .= " ".($csslist ? "'".$this->db->escape($csslist)."'" : "null").",";
|
||||
$sql .= " ".($cssview ? "'".$this->db->escape($cssview)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
$resql2 = $this->db->query($sql);
|
||||
@ -864,7 +908,7 @@ class ExtraFields
|
||||
$this->attributes[$tab->elementtype]['param'][$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : '');
|
||||
$this->attributes[$tab->elementtype]['pos'][$tab->name] = $tab->pos;
|
||||
$this->attributes[$tab->elementtype]['alwayseditable'][$tab->name] = $tab->alwayseditable;
|
||||
$this->attributes[$tab->elementtype]['perms'][$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms);
|
||||
$this->attributes[$tab->elementtype]['perms'][$tab->name] = ((is_null($tab->perms) || strlen($tab->perms) == 0) ? 1 : $tab->perms);
|
||||
$this->attributes[$tab->elementtype]['langfile'][$tab->name] = $tab->langs;
|
||||
$this->attributes[$tab->elementtype]['list'][$tab->name] = $tab->list;
|
||||
$this->attributes[$tab->elementtype]['printable'][$tab->name] = $tab->printable;
|
||||
@ -952,7 +996,10 @@ class ExtraFields
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
|
||||
if (empty($morecss)) {
|
||||
// Add automatic css
|
||||
if ($type == 'date') {
|
||||
$morecss = 'minwidth100imp';
|
||||
} elseif ($type == 'datetime' || $type == 'link') {
|
||||
@ -976,6 +1023,10 @@ class ExtraFields
|
||||
$morecss = 'minwidth400';
|
||||
}
|
||||
}
|
||||
// If css forced in attribute, we use this one
|
||||
if (!empty($this->attributes[$extrafieldsobjectkey]['css'][$key])) {
|
||||
$morecss = $this->attributes[$extrafieldsobjectkey]['css'][$key];
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($type, array('date'))) {
|
||||
@ -1034,7 +1085,7 @@ class ExtraFields
|
||||
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>';
|
||||
} elseif (preg_match('/varchar/', $type)) {
|
||||
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>';
|
||||
} elseif (in_array($type, array('mail', 'phone', 'url'))) {
|
||||
} elseif (in_array($type, array('mail', 'ip', 'phone', 'url'))) {
|
||||
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
|
||||
} elseif ($type == 'text') {
|
||||
if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field
|
||||
@ -1594,6 +1645,8 @@ class ExtraFields
|
||||
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
|
||||
} elseif ($type == 'mail') {
|
||||
$value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
|
||||
} elseif ($type == 'ip') {
|
||||
$value = dol_print_ip($value, 0);
|
||||
} elseif ($type == 'url') {
|
||||
$value = dol_print_url($value, '_blank', 32, 1);
|
||||
} elseif ($type == 'phone') {
|
||||
@ -1807,7 +1860,7 @@ class ExtraFields
|
||||
}
|
||||
}
|
||||
}
|
||||
$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
|
||||
if (!empty($toprint)) $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
|
||||
} else {
|
||||
dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING);
|
||||
}
|
||||
@ -2018,6 +2071,7 @@ class ExtraFields
|
||||
}
|
||||
|
||||
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')))) {
|
||||
//when unticking boolean field, it's not set in POST
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -3342,7 +3342,6 @@ class Form
|
||||
}
|
||||
|
||||
$outref = $objp->ref;
|
||||
$outval = '';
|
||||
$outbarcode = $objp->barcode;
|
||||
$outqty = 1;
|
||||
$outdiscount = 0;
|
||||
@ -3523,48 +3522,52 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
$opt = '<option value="'.$outkey.'"';
|
||||
$optstart = '<option value="'.$outkey.'"';
|
||||
if ($selected && $selected == $objp->idprodfournprice) {
|
||||
$opt .= ' selected';
|
||||
$optstart .= ' selected';
|
||||
}
|
||||
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) {
|
||||
$opt .= ' disabled';
|
||||
$optstart .= ' disabled';
|
||||
}
|
||||
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
|
||||
$opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"';
|
||||
$optstart .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"';
|
||||
}
|
||||
$opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
|
||||
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
|
||||
$opt .= '>';
|
||||
$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
|
||||
|
||||
$opt .= $optlabel;
|
||||
$outval .= $outvallabel;
|
||||
$outarrayentry = array(
|
||||
'key' => $outkey,
|
||||
'value' => $outref,
|
||||
'label' => $outvallabel,
|
||||
'qty' => $outqty,
|
||||
'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
|
||||
'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
|
||||
'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
|
||||
'tva_tx' => $objp->tva_tx,
|
||||
'default_vat_code' => $objp->default_vat_code,
|
||||
'discount' => $outdiscount,
|
||||
'type' => $outtype,
|
||||
'duration_value' => $outdurationvalue,
|
||||
'duration_unit' => $outdurationunit,
|
||||
'disabled' => (empty($objp->idprodfournprice) ? true : false),
|
||||
'description' => $objp->description
|
||||
);
|
||||
|
||||
$parameters = array(
|
||||
'objp' => &$objp,
|
||||
'optstart' => &$optstart,
|
||||
'optlabel' => &$optlabel,
|
||||
'outvallabel' => &$outvallabel,
|
||||
'outarrayentry' => &$outarrayentry
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('selectProduitsFournisseurListOption', $parameters, $this);
|
||||
|
||||
$opt .= "</option>\n";
|
||||
|
||||
// Add new entry
|
||||
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
|
||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||
$out .= $opt;
|
||||
array_push(
|
||||
$outarray,
|
||||
array('key'=>$outkey,
|
||||
'value'=>$outref,
|
||||
'label'=>$outval,
|
||||
'qty'=>$outqty,
|
||||
'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
|
||||
'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
|
||||
'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
|
||||
'tva_tx'=>$objp->tva_tx,
|
||||
'default_vat_code'=>$objp->default_vat_code,
|
||||
'discount'=>$outdiscount,
|
||||
'type'=>$outtype,
|
||||
'duration_value'=>$outdurationvalue,
|
||||
'duration_unit'=>$outdurationunit,
|
||||
'disabled'=>(empty($objp->idprodfournprice) ? true : false),
|
||||
'description'=>$objp->description
|
||||
)
|
||||
);
|
||||
$out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "</option>\n";;
|
||||
array_push($outarray, $outarrayentry);
|
||||
|
||||
// Exemple of var_dump $outarray
|
||||
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
|
||||
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
|
||||
@ -4911,7 +4914,7 @@ class Form
|
||||
* @param string $question Question
|
||||
* @param string $action Action
|
||||
* @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>))
|
||||
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', 'other' or 'onecolumn'...
|
||||
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'select', 'multiselect', 'morecss', 'other' or 'onecolumn'...
|
||||
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
|
||||
* @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
|
||||
* @param int|string $height Force height of box (0 = auto)
|
||||
@ -4949,7 +4952,10 @@ class Form
|
||||
foreach ($formquestion as $key => $input) {
|
||||
if (is_array($input) && !empty($input)) {
|
||||
if ($input['type'] == 'hidden') {
|
||||
$more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'">'."\n";
|
||||
$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
|
||||
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
|
||||
|
||||
$more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'" class="'.$morecss.'"'.$moreattr.'>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4979,7 +4985,7 @@ class Form
|
||||
$moreonecolumn .= $input['value'];
|
||||
$moreonecolumn .= '</textarea>';
|
||||
$moreonecolumn .= '</div>';
|
||||
} elseif ($input['type'] == 'select') {
|
||||
} elseif (in_array($input['type'], ['select', 'multiselect'])) {
|
||||
if (empty($morecss)) {
|
||||
$morecss = 'minwidth100';
|
||||
}
|
||||
@ -4996,7 +5002,11 @@ class Form
|
||||
if (!empty($input['label'])) {
|
||||
$more .= $input['label'].'</div><div class="tagtd left">';
|
||||
}
|
||||
$more .= $this->selectarray($input['name'], $input['values'], isset($input['default'])?$input['default']:'', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
|
||||
if ($input['type'] == 'select') {
|
||||
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
|
||||
} else {
|
||||
$more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr);
|
||||
}
|
||||
$more .= '</div></div>'."\n";
|
||||
} elseif ($input['type'] == 'checkbox') {
|
||||
$more .= '<div class="tagtr">';
|
||||
@ -8386,7 +8396,7 @@ class Form
|
||||
</dt>
|
||||
<dd class="dropdowndd">
|
||||
<div class="multiselectcheckbox'.$htmlname.'">
|
||||
<ul class="ul'.$htmlname.' '.$htmlname.$pos.'">
|
||||
<ul class="'.$htmlname.($pos == '1' ? 'left' : '').'">
|
||||
'.$listoffieldsforselection.'
|
||||
</ul>
|
||||
</div>
|
||||
@ -8543,7 +8553,7 @@ class Form
|
||||
if (empty($conf->supplier_proposal->enabled)) {
|
||||
continue; // Do not show if module disabled
|
||||
}
|
||||
} elseif ($objecttype == 'shipping' || $objecttype == 'shipment') {
|
||||
} elseif ($objecttype == 'shipping' || $objecttype == 'shipment' || $objecttype == 'expedition') {
|
||||
$tplpath = 'expedition';
|
||||
if (empty($conf->expedition->enabled)) {
|
||||
continue; // Do not show if module disabled
|
||||
@ -8657,12 +8667,17 @@ class Form
|
||||
|
||||
$possiblelinks = array(
|
||||
'propal'=>array(
|
||||
'enabled'=>(!empty($conf->propal->enabled) ? $conf->propal->enabled : 0),
|
||||
'enabled'=>isModEnabled('propal'),
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToProposal',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
|
||||
'shipping'=>array(
|
||||
'enabled'=>isModEnabled('expedition'),
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToExpedition',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('shipping').')'),
|
||||
'order'=>array(
|
||||
'enabled'=>(!empty($conf->commande->enabled) ? $conf->commande->enabled : 0),
|
||||
'enabled'=>isModEnabled('commande'),
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToOrder',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
|
||||
@ -8677,14 +8692,14 @@ class Form
|
||||
'label'=>'LinkToTemplateInvoice',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
|
||||
'contrat'=>array(
|
||||
'enabled'=>(!empty($conf->contrat->enabled) ? $conf->contrat->enabled : 0),
|
||||
'enabled'=>isModEnabled('contrat'),
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToContract',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
|
||||
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
|
||||
),
|
||||
'fichinter'=>array(
|
||||
'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0),
|
||||
'enabled'=>isModEnabled('ficheinter'),
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToIntervention',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
@ -8703,12 +8718,12 @@ class Form
|
||||
'perms'=>1, 'label'=>'LinkToSupplierInvoice',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
|
||||
'ticket'=>array(
|
||||
'enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0),
|
||||
'enabled'=>isModEnabled('ticket'),
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToTicket',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
|
||||
'mo'=>array(
|
||||
'enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0),
|
||||
'enabled'=>isModEnabled('mrp'),
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToMo',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
|
||||
|
||||
@ -825,13 +825,14 @@ class FormCompany extends Form
|
||||
/**
|
||||
* showContactRoles on view and edit mode
|
||||
*
|
||||
* @param string $htmlname Html component name and id
|
||||
* @param Contact $contact Contact Obejct
|
||||
* @param string $rendermode view, edit
|
||||
* @param array $selected $key=>$val $val is selected Roles for input mode
|
||||
* @return string String with contacts roles
|
||||
* @param string $htmlname Html component name and id
|
||||
* @param Contact $contact Contact Obejct
|
||||
* @param string $rendermode view, edit
|
||||
* @param array $selected $key=>$val $val is selected Roles for input mode
|
||||
* @param string $morecss More css
|
||||
* @return string String with contacts roles
|
||||
*/
|
||||
public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $selected = array())
|
||||
public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $selected = array(), $morecss = 'minwidth500')
|
||||
{
|
||||
if ($rendermode === 'view') {
|
||||
$toprint = array();
|
||||
@ -856,7 +857,7 @@ class FormCompany extends Form
|
||||
$selected = $newselected;
|
||||
}
|
||||
}
|
||||
return $this->multiselectarray($htmlname, $contactType, $selected, 0, 0, 'minwidth500');
|
||||
return $this->multiselectarray($htmlname, $contactType, $selected, 0, 0, $morecss);
|
||||
}
|
||||
|
||||
return 'ErrorBadValueForParameterRenderMode'; // Should not happened
|
||||
|
||||
@ -1291,6 +1291,7 @@ class FormFile
|
||||
$nboflines++;
|
||||
print '<!-- Line list_of_documents '.$key.' relativepath = '.$relativepath.' -->'."\n";
|
||||
// Do we have entry into database ?
|
||||
|
||||
print '<!-- In database: position='.(array_key_exists('position', $filearray[$key]) ? $filearray[$key]['position'] : 0).' -->'."\n";
|
||||
print '<tr class="oddeven" id="row-'.((array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
|
||||
|
||||
@ -1436,7 +1437,7 @@ class FormFile
|
||||
if ($permtoeditline) {
|
||||
// Link to resize
|
||||
$moreparaminurl = '';
|
||||
if ($object->id > 0) {
|
||||
if (!empty($object->id) && $object->id > 0) {
|
||||
$moreparaminurl = '&id='.$object->id;
|
||||
} elseif (GETPOST('website', 'alpha')) {
|
||||
$moreparaminurl = '&website='.GETPOST('website', 'alpha');
|
||||
|
||||
@ -954,7 +954,7 @@ class FormMail extends Form
|
||||
$out .= '<input type="hidden" id="message" name="message" value="'.$defaultmessage.'" />';
|
||||
} else {
|
||||
if (!isset($this->ckeditortoolbar)) {
|
||||
$this->ckeditortoolbar = 'dolibarr_notes';
|
||||
$this->ckeditortoolbar = 'dolibarr_mailings';
|
||||
}
|
||||
|
||||
// Editor wysiwyg
|
||||
@ -1551,7 +1551,7 @@ class FormMail extends Form
|
||||
|
||||
if (!empty($extrafields->attributes[$product->table_element]['label']) && is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) {
|
||||
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {
|
||||
$substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key];
|
||||
$substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = isset($product->array_options['options_'.$key]) ? $product->array_options['options_'.$key] : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1513,9 +1513,10 @@ class FormOther
|
||||
* @param array $search_xaxis Array of preselected fields
|
||||
* @param array $arrayofxaxis Array of groupby to fill
|
||||
* @param string $showempty '1' or 'text'
|
||||
* @param string $morecss More css
|
||||
* @return string HTML string component
|
||||
*/
|
||||
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1')
|
||||
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1', $morecss = 'minwidth250 maxwidth500')
|
||||
{
|
||||
global $form;
|
||||
|
||||
@ -1523,7 +1524,7 @@ class FormOther
|
||||
foreach ($arrayofxaxis as $key => $val) {
|
||||
$arrayofxaxislabel[$key] = $val['label'];
|
||||
}
|
||||
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth250 maxwidth500', 1);
|
||||
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -49,6 +49,8 @@ class RssParser
|
||||
private $_lastfetchdate; // Last successful fetch
|
||||
private $_rssarray = array();
|
||||
|
||||
private $current_namespace;
|
||||
|
||||
// For parsing with xmlparser
|
||||
public $stack = array(); // parser stack
|
||||
private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
|
||||
|
||||
@ -217,7 +217,7 @@ foreach ($arrayoftype as $key => $val) {
|
||||
if (dol_eval($val['enabled'], 1, 1, '1')) {
|
||||
$newarrayoftype[$key] = $arrayoftype[$key];
|
||||
}
|
||||
if ($val['langs']) {
|
||||
if (!empty($val['langs'])) {
|
||||
$langs->load($val['langs']);
|
||||
}
|
||||
}
|
||||
@ -450,7 +450,7 @@ $simplearrayofmesures = array();
|
||||
foreach ($arrayofmesures as $key => $val) {
|
||||
$simplearrayofmesures[$key] = $arrayofmesures[$key]['label'];
|
||||
}
|
||||
print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields
|
||||
print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields
|
||||
print '</div>';
|
||||
|
||||
// XAxis
|
||||
@ -458,7 +458,7 @@ $count = 0;
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>';
|
||||
//var_dump($arrayofxaxis);
|
||||
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis")); // Fill the array $arrayofxaxis with possible fields
|
||||
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400'); // Fill the array $arrayofxaxis with possible fields
|
||||
print '</div>';
|
||||
|
||||
// Group by
|
||||
@ -970,31 +970,31 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
|
||||
// Add main fields of object
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1, 1, '1'))) {
|
||||
$position = (!empty($val['position']) ? $val['position'] : 0);
|
||||
$position = (empty($val['position']) ? 0 : intVal($val['position']));
|
||||
$arrayofmesures[$tablealias.'.'.$key.'-sum'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>',
|
||||
'position' => ($position+($count * 100000)).'.1',
|
||||
'position' => ($position + ($count * 100000)).'.1',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofmesures[$tablealias.'.'.$key.'-average'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>',
|
||||
'position' => ($position+($count * 100000)).'.2',
|
||||
'position' => ($position + ($count * 100000)).'.2',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofmesures[$tablealias.'.'.$key.'-min'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>',
|
||||
'position' => ($position+($count * 100000)).'.3',
|
||||
'position' => ($position + ($count * 100000)).'.3',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofmesures[$tablealias.'.'.$key.'-max'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>',
|
||||
'position' => ($position+($count * 100000)).'.4',
|
||||
'position' => ($position + ($count * 100000)).'.4',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
}
|
||||
}
|
||||
// Add extrafields to Measures
|
||||
if ($object->isextrafieldmanaged) {
|
||||
if (!empty($object->isextrafieldmanaged)) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) {
|
||||
$position = (!empty($val['position']) ? $val['position'] : 0);
|
||||
@ -1098,26 +1098,27 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis,
|
||||
continue;
|
||||
}
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$position = (!empty($val['position']) ? $val['position'] : 0);
|
||||
$position = (empty($val['position']) ? 0 : intVal($val['position']));
|
||||
$arrayofxaxis[$tablealias.'.'.$key.'-year'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>',
|
||||
'position' => ($position+($count * 100000)).'.1',
|
||||
'position' => ($position + ($count * 100000)).'.1',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofxaxis[$tablealias.'.'.$key.'-month'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>',
|
||||
'position' => ($position+($count * 100000)).'.2',
|
||||
'position' => ($position + ($count * 100000)).'.2',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofxaxis[$tablealias.'.'.$key.'-day'] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>',
|
||||
'position' => ($position+($count * 100000)).'.3',
|
||||
'position' => ($position + ($count * 100000)).'.3',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
} else {
|
||||
$position = (empty($val['position']) ? 0 : intVal($val['position']));
|
||||
$arrayofxaxis[$tablealias.'.'.$key] = array(
|
||||
'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']),
|
||||
'position' => ($position+($count * 100000)),
|
||||
'position' => ($position + ($count * 100000)),
|
||||
'table' => $object->table_element
|
||||
);
|
||||
}
|
||||
@ -1125,7 +1126,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis,
|
||||
}
|
||||
|
||||
// Add extrafields to X-Axis
|
||||
if ($object->isextrafieldmanaged) {
|
||||
if (!empty($object->isextrafieldmanaged)) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') {
|
||||
continue;
|
||||
@ -1196,7 +1197,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
|
||||
|
||||
// Add main fields of object
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['isameasure']) {
|
||||
if (empty($val['isameasure'])) {
|
||||
if (in_array($key, array(
|
||||
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
|
||||
@ -1218,26 +1219,27 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
|
||||
continue;
|
||||
}
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$position = (!empty($val['position']) ? $val['position'] : 0);
|
||||
$position = (empty($val['position']) ? 0 : intVal($val['position']));
|
||||
$arrayofgroupby[$tablealias.'.'.$key.'-year'] = array(
|
||||
'label' => img_picto('', $object->picto,
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => ($position+($count * 100000)).'.1',
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => ($position + ($count * 100000)).'.1',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofgroupby[$tablealias.'.'.$key.'-month'] = array(
|
||||
'label' => img_picto('', $object->picto,
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => ($position+($count * 100000)).'.2',
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => ($position + ($count * 100000)).'.2',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
$arrayofgroupby[$tablealias.'.'.$key.'-day'] = array(
|
||||
'label' => img_picto('', $object->picto,
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => ($position+($count * 100000)).'.3',
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => ($position + ($count * 100000)).'.3',
|
||||
'table' => $object->table_element
|
||||
);
|
||||
} else {
|
||||
$position = (empty($val['position']) ? 0 : intVal($val['position']));
|
||||
$arrayofgroupby[$tablealias.'.'.$key] = array(
|
||||
'label' => img_picto('', $object->picto,
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($position+($count * 100000)),
|
||||
'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($position + ($count * 100000)),
|
||||
'table' => $object->table_element
|
||||
);
|
||||
}
|
||||
@ -1245,7 +1247,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
|
||||
}
|
||||
|
||||
// Add extrafields to Group by
|
||||
if ($object->isextrafieldmanaged) {
|
||||
if (! empty($object->isextrafieldmanaged)) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') {
|
||||
continue;
|
||||
|
||||
@ -92,14 +92,14 @@ class DoliDBMysqli extends DoliDB
|
||||
// We do not try to connect to database, only to server. Connect to database is done later in constrcutor
|
||||
$this->db = $this->connect($host, $user, $pass, '', $port);
|
||||
|
||||
if ($this->db->connect_errno) {
|
||||
$this->connected = false;
|
||||
$this->ok = false;
|
||||
$this->error = $this->db->connect_error;
|
||||
dol_syslog(get_class($this)."::DoliDBMysqli Connect error: ".$this->error, LOG_ERR);
|
||||
} else {
|
||||
if ($this->db && empty($this->db->connect_errno)) {
|
||||
$this->connected = true;
|
||||
$this->ok = true;
|
||||
} else {
|
||||
$this->connected = false;
|
||||
$this->ok = false;
|
||||
$this->error = empty($this->db) ? 'Failed to connect' : $this->db->connect_error;
|
||||
dol_syslog(get_class($this)."::DoliDBMysqli Connect error: ".$this->error, LOG_ERR);
|
||||
}
|
||||
|
||||
// If server connection is ok, we try to connect to the database
|
||||
@ -204,7 +204,13 @@ class DoliDBMysqli extends DoliDB
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
|
||||
return $this->db->select_db($database);
|
||||
$result = false;
|
||||
try {
|
||||
$result = $this->db->select_db($database);
|
||||
} catch (Exception $e) {
|
||||
// Nothing done on error
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -216,7 +222,7 @@ class DoliDBMysqli extends DoliDB
|
||||
* @param string $passwd Password
|
||||
* @param string $name Name of database (not used for mysql, used for pgsql)
|
||||
* @param integer $port Port of database server
|
||||
* @return mysqli Database access object
|
||||
* @return mysqli|null Database access object
|
||||
* @see close()
|
||||
*/
|
||||
public function connect($host, $login, $passwd, $name, $port = 0)
|
||||
@ -228,7 +234,13 @@ class DoliDBMysqli extends DoliDB
|
||||
// Can also be
|
||||
// mysqli::init(); mysql::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); mysqli::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
|
||||
// return mysqli::real_connect($host, $user, $pass, $db, $port);
|
||||
return new mysqli($host, $login, $passwd, $name, $port);
|
||||
$tmp = false;
|
||||
try {
|
||||
$tmp = new mysqli($host, $login, $passwd, $name, $port);
|
||||
} catch (Exception $e) {
|
||||
dol_syslog(get_class($this)."::connect failed", LOG_DEBUG);
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -746,6 +758,9 @@ class DoliDBMysqli extends DoliDB
|
||||
// phpcs:enable
|
||||
// FIXME: $fulltext_keys parameter is unused
|
||||
|
||||
$pk = '';
|
||||
$sqluq = $sqlk = array();
|
||||
|
||||
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
|
||||
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
||||
$sql = "CREATE TABLE ".$table."(";
|
||||
|
||||
@ -419,7 +419,11 @@ class DoliDBPgsql extends DoliDB
|
||||
// try first Unix domain socket (local)
|
||||
if ((!empty($host) && $host == "socket") && !defined('NOLOCALSOCKETPGCONNECT')) {
|
||||
$con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; // $name may be empty
|
||||
$this->db = @pg_connect($con_string);
|
||||
try {
|
||||
$this->db = @pg_connect($con_string);
|
||||
} catch (Exception $e) {
|
||||
// No message
|
||||
}
|
||||
}
|
||||
|
||||
// if local connection failed or not requested, use TCP/IP
|
||||
|
||||
@ -237,63 +237,69 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
$isImageValid = image_format_supported($sFileName) > 0 ? true : false;
|
||||
//var_dump($sFileName); var_dump(image_format_supported($sFileName));exit;
|
||||
$isImageValid = (image_format_supported($sFileName) >= 0 ? true : false);
|
||||
if (!$isImageValid) {
|
||||
$sErrorNumber = '202';
|
||||
}
|
||||
|
||||
|
||||
// Check if it is an allowed extension.
|
||||
if (!$sErrorNumber && IsAllowedExt($sExtension, $resourceType)) {
|
||||
$iCounter = 0;
|
||||
if (!$sErrorNumber) {
|
||||
if (IsAllowedExt($sExtension, $resourceType)) {
|
||||
$iCounter = 0;
|
||||
|
||||
while (true) {
|
||||
$sFilePath = $sServerDir.$sFileName;
|
||||
|
||||
if (is_file($sFilePath)) {
|
||||
$iCounter++;
|
||||
$sFileName = RemoveExtension($sOriginalFileName).'('.$iCounter.').'.$sExtension;
|
||||
$sErrorNumber = '201';
|
||||
} else {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_move_uploaded_file($oFile['tmp_name'], $sFilePath, 0, 0);
|
||||
while (true) {
|
||||
$sFilePath = $sServerDir.$sFileName;
|
||||
|
||||
if (is_file($sFilePath)) {
|
||||
if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) {
|
||||
break;
|
||||
$iCounter++;
|
||||
$sFileName = RemoveExtension($sOriginalFileName).'('.$iCounter.').'.$sExtension;
|
||||
$sErrorNumber = '201';
|
||||
} else {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_move_uploaded_file($oFile['tmp_name'], $sFilePath, 0, 0);
|
||||
|
||||
if (is_file($sFilePath)) {
|
||||
if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$permissions = '0777';
|
||||
if (isset($Config['ChmodOnUpload']) && $Config['ChmodOnUpload']) {
|
||||
$permissions = (string) $Config['ChmodOnUpload'];
|
||||
}
|
||||
$permissionsdec = octdec($permissions);
|
||||
dol_syslog("commands.php permission = ".$permissions." ".$permissionsdec." ".decoct($permissionsdec));
|
||||
$oldumask = umask(0);
|
||||
chmod($sFilePath, $permissionsdec);
|
||||
umask($oldumask);
|
||||
}
|
||||
|
||||
$permissions = '0777';
|
||||
if (isset($Config['ChmodOnUpload']) && $Config['ChmodOnUpload']) {
|
||||
$permissions = (string) $Config['ChmodOnUpload'];
|
||||
}
|
||||
$permissionsdec = octdec($permissions);
|
||||
dol_syslog("commands.php permission = ".$permissions." ".$permissionsdec." ".decoct($permissionsdec));
|
||||
$oldumask = umask(0);
|
||||
chmod($sFilePath, $permissionsdec);
|
||||
umask($oldumask);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($sFilePath)) {
|
||||
//previous checks failed, try once again
|
||||
if (isset($isImageValid) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false) {
|
||||
@unlink($sFilePath);
|
||||
$sErrorNumber = '202';
|
||||
} elseif (isset($detectHtml) && $detectHtml === -1 && DetectHtml($sFilePath) === true) {
|
||||
@unlink($sFilePath);
|
||||
$sErrorNumber = '202';
|
||||
if (file_exists($sFilePath)) {
|
||||
//previous checks failed, try once again
|
||||
if (isset($isImageValid) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false) {
|
||||
dol_syslog("commands.php IsImageValid is ko");
|
||||
@unlink($sFilePath);
|
||||
$sErrorNumber = '202';
|
||||
} elseif (isset($detectHtml) && $detectHtml === -1 && DetectHtml($sFilePath) === true) {
|
||||
dol_syslog("commands.php DetectHtml is ko");
|
||||
@unlink($sFilePath);
|
||||
$sErrorNumber = '202';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$sErrorNumber = '202';
|
||||
}
|
||||
} else {
|
||||
$sErrorNumber = '202';
|
||||
}
|
||||
} else {
|
||||
$sErrorNumber = '202';
|
||||
$sErrorNumber = '203';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -159,7 +159,10 @@ $Config['FileTypesAbsolutePath']['File'] = ($Config['UserFilesAbsolutePath'] ==
|
||||
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'];
|
||||
$Config['QuickUploadAbsolutePath']['File'] = $Config['UserFilesAbsolutePath'];
|
||||
|
||||
$Config['AllowedExtensions']['Image'] = array('bmp', 'gif', 'jpeg', 'jpg', 'png');
|
||||
$Config['AllowedExtensions']['Image'] = array('bmp', 'gif', 'jpeg', 'jpg', 'png', 'ai');
|
||||
if (!empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) {
|
||||
$Config['AllowedExtensions']['Image'][] = 'svg';
|
||||
}
|
||||
$Config['DeniedExtensions']['Image'] = array();
|
||||
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'].'image/';
|
||||
$Config['FileTypesAbsolutePath']['Image'] = ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/';
|
||||
|
||||
@ -42,14 +42,14 @@ function SendError($number, $text)
|
||||
|
||||
|
||||
// Check if this uploader has been enabled.
|
||||
if (!$Config['Enabled']) {
|
||||
if (empty($Config['Enabled'])) {
|
||||
SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "filemanagerdol/connectors/php/config.php" file');
|
||||
}
|
||||
|
||||
$sCommand = 'QuickUpload';
|
||||
|
||||
// The file type (from the QueryString, by default 'File').
|
||||
$sType = isset($_GET['Type']) ? $_GET['Type'] : 'File';
|
||||
// The file type (from the QueryString, by default 'File', can be 'Image' or 'Media').
|
||||
$sType = GETPOSTISSET('Type') ? GETPOST('Type') : 'File';
|
||||
|
||||
$sCurrentFolder = "/";
|
||||
|
||||
@ -71,5 +71,5 @@ if (!IsAllowedType($sType)) {
|
||||
// Get the CKEditor Callback
|
||||
$CKEcallback = $_GET['CKEditorFuncNum'];
|
||||
|
||||
//modify the next line adding in the new param
|
||||
// Get uploaded filr and move it at correct place. Note: Some tests on file name are also included into this function
|
||||
FileUpload($sType, $sCurrentFolder, $sCommand, $CKEcallback);
|
||||
|
||||
@ -324,10 +324,11 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
$keyforsql = md5($sqlfile);
|
||||
foreach ($arraysql as $i => $sql) {
|
||||
if ($sql) {
|
||||
// Test if sql is allowed
|
||||
// Test if th SQL is allowed SQL
|
||||
if ($onlysqltoimportwebsite) {
|
||||
$newsql = str_replace(array("\'"), '__BACKSLASHQUOTE__', $sql);
|
||||
// Remove all strings contents
|
||||
$newsql = str_replace(array("\'"), '__BACKSLASHQUOTE__', $sql); // Replace the \' seque,ce
|
||||
|
||||
// Remove all strings contents including the ' so we can analyse SQL instruction only later
|
||||
$l = strlen($newsql);
|
||||
$is = 0;
|
||||
$quoteopen = 0;
|
||||
@ -348,11 +349,12 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
$newsqlclean = str_replace(array("null"), '__000__', $newsqlclean);
|
||||
//print $newsqlclean."<br>\n";
|
||||
|
||||
// A very small control. This can still by bypassed by adding a second SQL request concatenated
|
||||
$qualified = 0;
|
||||
|
||||
// A very small control. This can still by bypassed by adding a second SQL request concatenated
|
||||
if (preg_match('/^--/', $newsqlclean)) {
|
||||
$qualified = 1;
|
||||
} elseif (preg_match('/^UPDATE llx_website SET fk_default_home = \d+\+\d+ WHERE rowid = \d+;$/', $newsqlclean)) {
|
||||
} elseif (preg_match('/^UPDATE llx_website SET \w+ = \d+\+\d+ WHERE rowid = \d+;$/', $newsqlclean)) {
|
||||
$qualified = 1;
|
||||
} elseif (preg_match('/^INSERT INTO llx_website_page\([a-z0-9_\s,]+\) VALUES\([0-9_\s,\+]+\);$/', $newsqlclean)) {
|
||||
// Insert must match
|
||||
@ -360,11 +362,18 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
$qualified = 1;
|
||||
}
|
||||
|
||||
// Another check to allow some legitimate original urls
|
||||
if (!$qualified) {
|
||||
if (preg_match('/^UPDATE llx_website SET \w+ = \'[a-zA-Z,\s]*\' WHERE rowid = \d+;$/', $sql)) {
|
||||
$qualified = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$qualified) {
|
||||
$error++;
|
||||
//print 'Request '.($i + 1)." contains non allowed instructions.<br>\n";
|
||||
//print "newsqlclean = ".$newsqlclean."<br>\n";
|
||||
dol_syslog('Admin.lib::run_sql Request '.($i + 1)." contains non allowed instructions.", LOG_DEBUG);
|
||||
dol_syslog('Admin.lib::run_sql Request '.($i + 1)." contains non allowed instructions.", LOG_WARNING);
|
||||
dol_syslog('$newsqlclean='.$newsqlclean, LOG_DEBUG);
|
||||
break;
|
||||
}
|
||||
@ -424,6 +433,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
||||
$from = '__'.$cursor.'__';
|
||||
$to = $listofinsertedrowid[$cursor];
|
||||
$newsql = str_replace($from, $to, $newsql);
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
* \brief Ensemble de fonctions de base pour le module banque
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
@ -273,13 +274,13 @@ function checkSwiftForAccount($account)
|
||||
* @param Account $account A bank account
|
||||
* @return boolean True if informations are valid, false otherwise
|
||||
*/
|
||||
function checkIbanForAccount($account)
|
||||
function checkIbanForAccount(Account $account)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
|
||||
|
||||
$ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix); // iban or iban_prefix for backward compatibility
|
||||
|
||||
$iban = new IBAN($ibantocheck);
|
||||
$iban = new PHP_IBAN\IBAN($ibantocheck);
|
||||
$check = $iban->Verify();
|
||||
|
||||
if ($check) {
|
||||
|
||||
@ -777,7 +777,7 @@ function isInEEC($object)
|
||||
*/
|
||||
function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatelink = 0, $morehtmlright = '')
|
||||
{
|
||||
global $user;
|
||||
global $user, $action, $hookmanager;
|
||||
|
||||
$i = -1;
|
||||
|
||||
@ -791,8 +791,9 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
|
||||
|
||||
print "\n";
|
||||
print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"), $newcardbutton.$morehtmlright, '');
|
||||
print '<div class="div-table-responsive">';
|
||||
print "\n".'<table class="noborder" width=100%>';
|
||||
|
||||
print '<div class="div-table-responsive">'."\n";
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount";
|
||||
$sql .= ", cls.code as opp_status_code";
|
||||
@ -835,12 +836,12 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td>';
|
||||
print '<td class="nowraponall">';
|
||||
print $projecttmp->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Label
|
||||
print '<td>'.$obj->title.'</td>';
|
||||
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">'.dol_escape_htmltag($obj->title).'</td>';
|
||||
// Date start
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->do), "day").'</td>';
|
||||
// Date end
|
||||
@ -877,6 +878,11 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$parameters = array('sql'=>$sql, 'function'=>'show_projects');
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
@ -890,14 +896,15 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
|
||||
/**
|
||||
* Show html area for list of contacts
|
||||
*
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Societe $object Third party object
|
||||
* @param string $backtopage Url to go once contact is created
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Societe $object Third party object
|
||||
* @param string $backtopage Url to go once contact is created
|
||||
* @param int $showuserlogin 1=Show also user login if it exists
|
||||
* @return int
|
||||
*/
|
||||
function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserlogin = 0)
|
||||
{
|
||||
global $user, $conf, $extrafields, $hookmanager;
|
||||
global $contextpage;
|
||||
@ -1131,13 +1138,16 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
if (in_array($key, array('statut'))) {
|
||||
print $form->selectarray('search_status', array('-1'=>'', '0'=>$contactstatic->LibStatut(0, 1), '1'=>$contactstatic->LibStatut(1, 1)), $search_status);
|
||||
} elseif (in_array($key, array('role'))) {
|
||||
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles);
|
||||
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles, 'minwidth200 maxwidth300');
|
||||
} else {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.(!empty($search[$key]) ? dol_escape_htmltag($search[$key]) : '').'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
if ($showuserlogin) {
|
||||
print '<td></td>';
|
||||
}
|
||||
// Extra fields
|
||||
$extrafieldsobjectkey = $contactstatic->table_element;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
@ -1177,6 +1187,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
print getTitleFieldOfList($arrayfields['sc.'.$key]['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n";
|
||||
}
|
||||
}
|
||||
if ($showuserlogin) {
|
||||
print '<td>'.$langs->trans("DolibarrLogin").'</td>';
|
||||
}
|
||||
// Extra fields
|
||||
$extrafieldsobjectkey = $contactstatic->table_element;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
@ -1275,6 +1288,16 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
print '<td class="center">'.$contactstatic->getLibStatut(5).'</td>';
|
||||
}
|
||||
|
||||
if ($showuserlogin) {
|
||||
print '<td>';
|
||||
$tmpuser= new User($db);
|
||||
$resfetch = $tmpuser->fetch(0, '', '', 0, -1, '', $contactstatic->id);
|
||||
if ($resfetch > 0) {
|
||||
print $tmpuser->getNomUrl(1, '', 0, 0, 24, 1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
$extrafieldsobjectkey = $contactstatic->table_element;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
|
||||
@ -755,10 +755,11 @@ function dol_copy($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1)
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @param array $arrayreplacement Array to use to replace filenames with another one during the copy (works only on file names, not on directory names).
|
||||
* @param int $excludesubdir 0=Do not exclude subdirectories, 1=Exclude subdirectories, 2=Exclude subdirectories if name is not a 2 chars (used for country codes subdirectories).
|
||||
* @param array $excludefileext Exclude some file extensions
|
||||
* @return int <0 if error, 0 if nothing done (all files already exists and overwriteifexists=0), >0 if OK
|
||||
* @see dol_copy()
|
||||
*/
|
||||
function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement = null, $excludesubdir = 0)
|
||||
function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement = null, $excludesubdir = 0, $excludefileext = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -802,10 +803,19 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
|
||||
}
|
||||
}
|
||||
//var_dump("xxx dolCopyDir $srcfile/$file, $destfile/$file, $newmask, $overwriteifexists");
|
||||
$tmpresult = dolCopyDir($srcfile."/".$file, $destfile."/".$newfile, $newmask, $overwriteifexists, $arrayreplacement, $excludesubdir);
|
||||
$tmpresult = dolCopyDir($srcfile."/".$file, $destfile."/".$newfile, $newmask, $overwriteifexists, $arrayreplacement, $excludesubdir, $excludefileext);
|
||||
}
|
||||
} else {
|
||||
$newfile = $file;
|
||||
|
||||
if (is_array($excludefileext)) {
|
||||
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
||||
if (in_array($extension, $excludefileext)) {
|
||||
//print "We exclude the file ".$file." because its extension is inside list ".join(', ', $excludefileext); exit;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Replace destination filename with a new one
|
||||
if (is_array($arrayreplacement)) {
|
||||
foreach ($arrayreplacement as $key => $val) {
|
||||
@ -1717,7 +1727,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
|
||||
// Update index table of files (llx_ecm_files)
|
||||
if ($donotupdatesession == 1) {
|
||||
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', 0, $object);
|
||||
$sharefile = 0;
|
||||
if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && !empty($conf->global->PRODUCT_ALLOW_EXTERNAL_DOWNLOAD)) $sharefile = 1;
|
||||
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', $sharefile, $object);
|
||||
if ($result < 0) {
|
||||
if ($allowoverwrite) {
|
||||
// Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS
|
||||
@ -2977,6 +2989,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
// Wrapping for import module
|
||||
$accessallowed = $user->rights->import->run;
|
||||
$original_file = $conf->import->dir_temp.'/'.$original_file;
|
||||
} elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_temp)) {
|
||||
// Wrapping for recruitment module
|
||||
$accessallowed = $user->rights->$modulepart->recruitmentjobposition->read;
|
||||
$original_file = $conf->recruitment->dir_output .'/'. $original_file;
|
||||
} elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) {
|
||||
// Wrapping for wysiwyg editor
|
||||
$accessallowed = 1;
|
||||
|
||||
@ -3343,6 +3343,17 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
|
||||
//ex: +61_A_BCDE_FGHI
|
||||
$newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4);
|
||||
}
|
||||
} elseif (strtoupper($countrycode) == "LU") {
|
||||
// Luxembourg
|
||||
if (dol_strlen($phone) == 10) {// fixe 6 chiffres +352_AA_BB_CC
|
||||
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2);
|
||||
} elseif (dol_strlen($phone) == 11) {// fixe 7 chiffres +352_AA_BB_CC_D
|
||||
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 1);
|
||||
} elseif (dol_strlen($phone) == 12) {// fixe 8 chiffres +352_AA_BB_CC_DD
|
||||
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
|
||||
} elseif (dol_strlen($phone) == 13) {// mobile +352_AAA_BB_CC_DD
|
||||
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
|
||||
}
|
||||
}
|
||||
if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
|
||||
if ($conf->browser->layout == 'phone' || (!empty($conf->clicktodial->enabled) && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
|
||||
@ -3876,15 +3887,18 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
|
||||
if (strpos($pictowithouttext, 'fontawesome_') !== false || preg_match('/^fa-/', $pictowithouttext)) {
|
||||
// This is a font awesome image 'fonwtawesome_xxx' or 'fa-xxx'
|
||||
$pictowithouttext = str_replace('fontawesome_', '', $pictowithouttext);
|
||||
$pictowithouttext = str_replace('fa-', '', $pictowithouttext);
|
||||
|
||||
$pictowithouttextarray = explode('_', $pictowithouttext);
|
||||
$marginleftonlyshort = 0;
|
||||
|
||||
if (!empty($pictowithouttextarray[1])) {
|
||||
$fakey = 'fa-'.$pictowithouttextarray[1];
|
||||
$fa = empty($pictowithouttextarray[2]) ? 'fa' : $pictowithouttextarray[2];
|
||||
$facolor = empty($pictowithouttextarray[3]) ? '' : $pictowithouttextarray[3];
|
||||
$fasize = empty($pictowithouttextarray[4]) ? '' : $pictowithouttextarray[4];
|
||||
// Syntax is 'fontawesome_fakey_faprefix_facolor_fasize' or 'fa-fakey_faprefix_facolor_fasize'
|
||||
$fakey = 'fa-'.$pictowithouttextarray[0];
|
||||
$fa = empty($pictowithouttextarray[1]) ? 'fa' : $pictowithouttextarray[1];
|
||||
$facolor = empty($pictowithouttextarray[2]) ? '' : $pictowithouttextarray[2];
|
||||
$fasize = empty($pictowithouttextarray[3]) ? '' : $pictowithouttextarray[3];
|
||||
} else {
|
||||
$fakey = 'fa-'.$pictowithouttext;
|
||||
$fa = 'fa';
|
||||
@ -5458,9 +5472,10 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
||||
* @param boolean $addpercent Add a percent % sign in output
|
||||
* @param int $info_bits Miscellaneous information on vat (0=Default, 1=French NPR vat)
|
||||
* @param int $usestarfornpr -1=Never show, 0 or 1=Use '*' for NPR vat rates
|
||||
* @param int $html Used for html output
|
||||
* @return string String with formated amounts ('19,6' or '19,6%' or '8.5% (NPR)' or '8.5% *' or '19,6 (CODEX)')
|
||||
*/
|
||||
function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
|
||||
function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, $html = 0)
|
||||
{
|
||||
$morelabel = '';
|
||||
|
||||
@ -5468,9 +5483,11 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
|
||||
$rate = str_replace('%', '', $rate);
|
||||
$addpercent = true;
|
||||
}
|
||||
$reg = array();
|
||||
if (preg_match('/\((.*)\)/', $rate, $reg)) {
|
||||
$morelabel = ' ('.$reg[1].')';
|
||||
$rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate);
|
||||
$morelabel = ' '.($html ? '<span class="opacitymedium">' : '').'('.$reg[1].')'.($html ? '</span>' : '');
|
||||
}
|
||||
if (preg_match('/\*/', $rate)) {
|
||||
$rate = str_replace('*', '', $rate);
|
||||
@ -7167,6 +7184,8 @@ function dol_textishtml($msg, $option = 0)
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// Remove all urls because 'http://aa?param1=abc&param2=def' must not be used inside detection
|
||||
$msg = preg_replace('/https?:\/\/[^"\'\s]+/i', '', $msg);
|
||||
if (preg_match('/<html/i', $msg)) {
|
||||
return true;
|
||||
} elseif (preg_match('/<body/i', $msg)) {
|
||||
@ -7188,6 +7207,7 @@ function dol_textishtml($msg, $option = 0)
|
||||
} elseif (preg_match('/<h[0-9]>/i', $msg)) {
|
||||
return true;
|
||||
} elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg)) {
|
||||
// TODO If content is 'A link https://aaa?param=abc&param2=def', it return true but must be false
|
||||
return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
|
||||
} elseif (preg_match('/&#[0-9]{2,3};/i', $msg)) {
|
||||
return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
|
||||
@ -7829,6 +7849,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
|
||||
} else {
|
||||
if (! $msgishtml) {
|
||||
$valueishtml = dol_textishtml($value, 1);
|
||||
//var_dump("valueishtml=".$valueishtml);
|
||||
|
||||
if ($valueishtml) {
|
||||
$text = dol_htmlentitiesbr($text);
|
||||
|
||||
@ -508,7 +508,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
|
||||
// User signature
|
||||
if (!empty($object->user_signature)) {
|
||||
if (!empty($object->user_signature) || !empty($object->user_signature_id)) {
|
||||
if ($usetable) {
|
||||
print '<tr><td class="titlefield">';
|
||||
}
|
||||
@ -526,7 +526,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_signature);
|
||||
$userstatic->fetch($object->user_signature_id ? $object->user_signature_id : $object->user_signature);
|
||||
if ($userstatic->id) {
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
} else {
|
||||
@ -563,7 +563,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
|
||||
// User close
|
||||
if (!empty($object->user_cloture) || !empty($object->user_closing)) {
|
||||
if (!empty($object->user_cloture) || !empty($object->user_closing) || !empty($object->user_closing_id)) {
|
||||
if (isset($object->user_cloture) && !empty($object->user_cloture)) {
|
||||
$object->user_closing = $object->user_cloture;
|
||||
}
|
||||
@ -584,7 +584,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_closing);
|
||||
$userstatic->fetch($object->user_closing_id ? $object->user_closing_id : $object->user_closing);
|
||||
if ($userstatic->id) {
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 0);
|
||||
} else {
|
||||
@ -624,7 +624,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
|
||||
// User conciliate
|
||||
if (!empty($object->user_rappro)) {
|
||||
if (!empty($object->user_rappro) || !empty($object->user_rappro_id)) {
|
||||
if ($usetable) {
|
||||
print '<tr><td class="titlefield">';
|
||||
}
|
||||
@ -642,7 +642,7 @@ function dol_print_object_info($object, $usetable = 0)
|
||||
}
|
||||
} else {
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->user_rappro);
|
||||
$userstatic->fetch($object->user_rappro_id ? $object->user_rappro_id : $object->user_rappro);
|
||||
if ($userstatic->id) {
|
||||
print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
} else {
|
||||
|
||||
@ -954,6 +954,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
|
||||
$i++;
|
||||
$total += $obj->total_ht;
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$totalam += $obj->am;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
* @param string $objectname Name of object
|
||||
* @param string $newmask New mask
|
||||
* @param string $readdir Directory source (use $destdir when not defined)
|
||||
* @param string $addfieldentry Array of the field entry to add array('key'=>,'type'=>,''label'=>,'visible'=>,'enabled'=>,'position'=>,'notnull'=>','index'=>,'searchall'=>,'comment'=>,'help'=>,'isameasure')
|
||||
* @param string $addfieldentry Array of 1 field entry to add array('key'=>,'type'=>,''label'=>,'visible'=>,'enabled'=>,'position'=>,'notnull'=>','index'=>,'searchall'=>,'comment'=>,'help'=>,'isameasure')
|
||||
* @param string $delfieldentry Id of field to remove
|
||||
* @return int|object <=0 if KO, Object if OK
|
||||
* @see rebuildObjectSql()
|
||||
@ -40,7 +40,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
global $db, $langs;
|
||||
|
||||
if (empty($objectname)) {
|
||||
return -1;
|
||||
return -6;
|
||||
}
|
||||
if (empty($readdir)) {
|
||||
$readdir = $destdir;
|
||||
@ -48,9 +48,11 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
|
||||
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
|
||||
dol_print_error('', 'Bad parameter addfieldentry with a property arrayofkeyval defined but that is not an array.');
|
||||
return -1;
|
||||
return -7;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Check parameters
|
||||
if (is_array($addfieldentry) && count($addfieldentry) > 0) {
|
||||
if (empty($addfieldentry['name'])) {
|
||||
@ -62,8 +64,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
return -2;
|
||||
}
|
||||
if (!preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
|
||||
&& !preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type'])) {
|
||||
setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors');
|
||||
&& !preg_match('/^(boolean|smallint|real|date|datetime|timestamp|phone|mail|url|ip|password)$/', $addfieldentry['type'])) {
|
||||
setEventMessages($langs->trans('BadValueForType', $addfieldentry['type']), null, 'errors');
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@ -217,10 +219,14 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
|
||||
dol_mkdir(dirname($pathoffiletoedittarget));
|
||||
|
||||
//file_put_contents($pathoffiletoedittmp, $contentclass);
|
||||
file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
|
||||
@chmod($pathoffiletoedittarget, octdec($newmask));
|
||||
$result = file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
|
||||
if ($result) {
|
||||
@chmod($pathoffiletoedittarget, octdec($newmask));
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
|
||||
return $object;
|
||||
return $error ? -1 : $object;
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
return -5;
|
||||
@ -257,13 +263,33 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
|
||||
|
||||
// Edit .sql file
|
||||
if ($moduletype == 'internal') {
|
||||
$pathoffiletoeditsrc = $readdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
|
||||
$pathoffiletoedittarget = $destdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
|
||||
$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
|
||||
if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
|
||||
$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql';
|
||||
if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
|
||||
$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql';
|
||||
if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
|
||||
$pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'.sql';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
|
||||
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : '');
|
||||
$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql';
|
||||
if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
|
||||
$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql';
|
||||
if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
|
||||
$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'-'.strtolower($module).'.sql';
|
||||
if (! dol_is_file($readdir.$pathoffiletoeditsrc)) {
|
||||
$pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'.sql';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete path to be full path
|
||||
$pathoffiletoedittarget = $destdir.$pathoffiletoeditsrc.($readdir != $destdir ? '.new' : '');
|
||||
$pathoffiletoeditsrc = $readdir.$pathoffiletoeditsrc;
|
||||
|
||||
if (!dol_is_file($pathoffiletoeditsrc)) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors');
|
||||
@ -340,16 +366,13 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
|
||||
@chmod($pathoffiletoedittarget, octdec($newmask));
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFailToCreateFile", $pathoffiletoedittarget), null, 'errors');
|
||||
}
|
||||
|
||||
// Edit .key.sql file
|
||||
if ($moduletype == 'internal') {
|
||||
$pathoffiletoeditsrc = $readdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
|
||||
$pathoffiletoedittarget = $destdir.'/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
|
||||
} else {
|
||||
$pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql';
|
||||
$pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : '');
|
||||
}
|
||||
$pathoffiletoeditsrc = preg_replace('/\.sql$/', '.key.sql', $pathoffiletoeditsrc);
|
||||
$pathoffiletoedittarget = preg_replace('/\.sql$/', '.key.sql', $pathoffiletoedittarget);
|
||||
$pathoffiletoedittarget = preg_replace('/\.sql.new$/', '.key.sql.new', $pathoffiletoedittarget);
|
||||
|
||||
$contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
|
||||
|
||||
@ -378,10 +401,11 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
|
||||
dol_mkdir(dirname($pathoffiletoedittarget));
|
||||
|
||||
$result2 = file_put_contents($pathoffiletoedittarget, $contentsql);
|
||||
if ($result) {
|
||||
if ($result2) {
|
||||
@chmod($pathoffiletoedittarget, octdec($newmask));
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFailToCreateFile", $pathoffiletoedittarget), null, 'errors');
|
||||
}
|
||||
|
||||
return $error ? -1 : 1;
|
||||
|
||||
@ -173,9 +173,10 @@ function getValidOnlinePaymentMethods($paymentmethod = '')
|
||||
*
|
||||
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...)
|
||||
* @param string $ref Ref of object
|
||||
* @param int $amount Amount of money to request for
|
||||
* @return string Url string
|
||||
*/
|
||||
function showOnlinePaymentUrl($type, $ref)
|
||||
function showOnlinePaymentUrl($type, $ref, $amount = '9.99')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -185,7 +186,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
$servicename = ''; // Link is a generic link for all payments services (paypal, stripe, ...)
|
||||
|
||||
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>';
|
||||
$url = getOnlinePaymentUrl(0, $type, $ref);
|
||||
$url = getOnlinePaymentUrl(0, $type, $ref, $amount);
|
||||
$out .= '<div class="urllink"><input type="text" id="onlinepaymenturl" class="quatrevingtpercentminusx" value="'.$url.'">';
|
||||
$out .= '<a class="" href="'.$url.'" target="_blank" rel="noopener noreferrer">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
|
||||
$out .= '</div>';
|
||||
@ -199,11 +200,12 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...)
|
||||
* @param string $ref Ref of object
|
||||
* @param string $label Text or HTML tag to display, if empty it display the URL
|
||||
* @param int $amount Amount of money to request for
|
||||
* @return string Url string
|
||||
*/
|
||||
function getHtmlOnlinePaymentLink($type, $ref, $label = '')
|
||||
function getHtmlOnlinePaymentLink($type, $ref, $label = '', $amount = '9.99')
|
||||
{
|
||||
$url = getOnlinePaymentUrl(0, $type, $ref);
|
||||
$url = getOnlinePaymentUrl(0, $type, $ref, $amount);
|
||||
$label = $label ? $label : $url;
|
||||
return '<a href="'.$url.'" target="_blank" rel="noopener noreferrer">'.$label.'</a>';
|
||||
}
|
||||
@ -215,7 +217,7 @@ function getHtmlOnlinePaymentLink($type, $ref, $label = '')
|
||||
* @param int $mode 0=True url, 1=Url formated with colors
|
||||
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member', 'boothlocation', ...)
|
||||
* @param string $ref Ref of object
|
||||
* @param int $amount Amount (required and used for $type='free' only)
|
||||
* @param int $amount Amount of money to request for
|
||||
* @param string $freetag Free tag (required and used for $type='free' only)
|
||||
* @param string $localorexternal 0=Url for browser, 1=Url for external access
|
||||
* @return string Url string
|
||||
@ -318,7 +320,9 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
}
|
||||
} elseif ($type == 'member' || $type == 'membersubscription') {
|
||||
$newtype = 'member';
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=member&ref='.($mode ? '<span style="color: #666666">' : '');
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=member';
|
||||
$out .= '&amount='.$amount;
|
||||
$out .= '&ref='.($mode ? '<span style="color: #666666">' : '');
|
||||
if ($mode == 1) {
|
||||
$out .= 'member_ref';
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ function group_prepare_head($object)
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/group/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("GroupCard");
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'group';
|
||||
$h++;
|
||||
|
||||
@ -455,6 +455,28 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
}
|
||||
|
||||
//Dark mode
|
||||
if ($foruserprofile) {
|
||||
//Nothing
|
||||
} else {
|
||||
$listofdarkmodes = array(
|
||||
'0' => $langs->trans("AlwaysDisabled"),
|
||||
'1' => $langs->trans("AccordingToBrowser"),
|
||||
'2' => $langs->trans("AlwaysEnabled")
|
||||
);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("DarkThemeMode").'</td>';
|
||||
print '<td colspan="'.($colspan - 1).'">';
|
||||
if ($edit) {
|
||||
print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0);
|
||||
} else {
|
||||
print $listofdarkmodes[isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0];
|
||||
}
|
||||
print $form->textwithpicto('', $langs->trans("DoesNotWorkWithAllThemes"));
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// TopMenuDisableImages
|
||||
if ($foruserprofile) {
|
||||
/*
|
||||
|
||||
@ -213,6 +213,53 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts smiley string into the utf8 sequence.
|
||||
* @param string $content Content to replace
|
||||
* @return string Replacement of all smiley strings with their utf8 code
|
||||
* @see dolWebsiteOutput()
|
||||
*/
|
||||
function dolReplaceSmileyCodeWithUTF8($content)
|
||||
{
|
||||
$map = array(
|
||||
":face_with_tears_of_joy:" => "\xF0\x9F\x98\x82",
|
||||
":grinning_face_with_smiling_eyes:" => "\xF0\x9F\x98\x81",
|
||||
":smiling_face_with_open_mouth:" => "\xF0\x9F\x98\x83",
|
||||
":smiling_face_with_open_mouth_and_cold_sweat:" => "\xF0\x9F\x98\x85",
|
||||
":smiling_face_with_open_mouth_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x86",
|
||||
":winking_face:" => "\xF0\x9F\x98\x89",
|
||||
":smiling_face_with_smiling_eyes:" => "\xF0\x9F\x98\x8A",
|
||||
":face_savouring_delicious_food:" => "\xF0\x9F\x98\x8B",
|
||||
":relieved_face:" => "\xF0\x9F\x98\x8C",
|
||||
":smiling_face_with_heart_shaped_eyes:" => "\xF0\x9F\x98\x8D",
|
||||
":smiling_face_with_sunglasses:" => "\xF0\x9F\x98\x8E",
|
||||
":smirking_face:" => "\xF0\x9F\x98\x8F",
|
||||
":neutral_face:" => "\xF0\x9F\x98\x90",
|
||||
":expressionless_face:" => "\xF0\x9F\x98\x91",
|
||||
":unamused_face:" => "\xF0\x9F\x98\x92",
|
||||
":face_with_cold_sweat:" => "\xF0\x9F\x98\x93",
|
||||
":pensive_face:" => "\xF0\x9F\x98\x94",
|
||||
":confused_face:" => "\xF0\x9F\x98\x95",
|
||||
":confounded_face:" => "\xF0\x9F\x98\x96",
|
||||
":kissing_face:" => "\xF0\x9F\x98\x97",
|
||||
":face_throwing_a_kiss:" => "\xF0\x9F\x98\x98",
|
||||
":kissing_face_with_smiling_eyes:" => "\xF0\x9F\x98\x99",
|
||||
":kissing_face_with_closed_eyes:" => "\xF0\x9F\x98\x9A",
|
||||
":face_with_stuck_out_tongue:" => "\xF0\x9F\x98\x9B",
|
||||
":face_with_stuck_out_tongue_and_winking_eye:" => "\xF0\x9F\x98\x9C",
|
||||
":face_with_stuck_out_tongue_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x9D",
|
||||
":disappointed_face:" => "\xF0\x9F\x98\x9E",
|
||||
":worried_face:" => "\xF0\x9F\x98\x9F",
|
||||
":angry_face:" => "\xF0\x9F\x98\xA0",
|
||||
":face_with_symbols_on_mouth:" => "\xF0\x9F\x98\xA1",
|
||||
);
|
||||
foreach ($map as $key => $value) {
|
||||
$content = str_replace($key, $value, $content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render a string of an HTML content and output it.
|
||||
* Used to ouput the page when viewed from a server (Dolibarr or Apache).
|
||||
@ -369,6 +416,8 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
||||
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);
|
||||
}
|
||||
|
||||
$content = dolReplaceSmileyCodeWithUTF8($content);
|
||||
|
||||
dol_syslog("dolWebsiteOutput end");
|
||||
|
||||
print $content;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user