Merge branch 'develop' into productbatch

This commit is contained in:
Laurent Destailleur 2022-09-02 10:11:47 +02:00 committed by GitHub
commit 027e597776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 507 additions and 284 deletions

View File

@ -3,6 +3,7 @@
* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -184,7 +185,7 @@ if (!empty($triggers)) {
}
//print 'module='.$module.' code='.$trigger['code'].'<br>';
if (isModEnabled('module')) {
if (isModEnabled($module)) {
// Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
continue;

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -172,7 +173,7 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
if ($action == 'update') {
foreach ($modules as $module => $delays) {
if (isModEnabled('module')) {
if (isModEnabled($module)) {
foreach ($delays as $delay) {
if (GETPOST($delay['code']) != '') {
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
@ -226,7 +227,7 @@ if ($action == 'edit') {
print '<td class="right">'.$langs->trans("LateWarningAfter").'</td></tr>';
foreach ($modules as $module => $delays) {
if (isModEnabled('module')) {
if (isModEnabled($module)) {
foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
print '<tr class="oddeven">';
@ -260,7 +261,7 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) {
if (isModEnabled('module')) {
if (isModEnabled($module)) {
foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
print '<tr class="oddeven">';

View File

@ -22,22 +22,25 @@
* \brief Page setup for blockedlog module
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "blockedlog"));
$langs->loadLangs(array('admin', 'blockedlog', 'other'));
// Access Control
if (!$user->admin || empty($conf->blockedlog->enabled)) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09');
// Get Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$withtab = GETPOST('withtab', 'int');
$withtab = GETPOST('withtab', 'int');
/*

View File

@ -18,11 +18,13 @@
*/
/**
* \file htdocs/blockedlog/admin/blockedlog_list.php
* \ingroup blockedlog
* \brief Page setup for blockedlog module
* \file htdocs/blockedlog/admin/blockedlog_list.php
* \ingroup blockedlog
* \brief Page setup for blockedlog module
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
@ -31,16 +33,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "blockedlog", "bills"));
$langs->loadLangs(array('admin', 'bills', 'blockedlog', 'other'));
// Access Control
if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09');
// Get Parameters
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_showonlyerrors = GETPOST('search_showonlyerrors', 'int');
if ($search_showonlyerrors < 0) {
@ -95,7 +99,7 @@ $block_static->loadTrackedEvents();
$result = restrictedArea($user, 'blockedlog', 0, '');
// Execution Time
$max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_importexport) {

View File

@ -140,6 +140,7 @@ class BlockedLog
$this->trackedevents = array();
// Customer Invoice/Facture / Payment
if (isModEnabled('facture')) {
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
@ -151,18 +152,19 @@ class BlockedLog
}
/* Supplier
// Supplier Invoice / Payment
if (isModEnabled("fournisseur")) {
$this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
$this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
$this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
$this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
$this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
$this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
$this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
}
*/
// Donation
if (!empty($conf->don->enabled)) {
$this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
$this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
@ -172,23 +174,29 @@ class BlockedLog
}
/*
// Salary
if (!empty($conf->salary->enabled)) {
$this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
$this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
$this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
$this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
$this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
$this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
}
*/
// Members
if (isModEnabled('adherent')) {
$this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
$this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
$this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
}
// Bank
if (isModEnabled("banque")) {
$this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
$this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
$this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
}
// Cashdesk
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules
$moduleposenabled = (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->BANK_ENABLE_POS_CASHCONTROL));
if ($moduleposenabled) {

View File

@ -16,9 +16,9 @@
*/
/**
* \file htdocs/blockedlog/lib/blockedlog.lib.php
* \ingroup system
* \brief Library for common blockedlog functions
* \file htdocs/blockedlog/lib/blockedlog.lib.php
* \ingroup system
* \brief Library for common blockedlog functions
*/
/**

View File

@ -682,9 +682,6 @@ class Categories extends DolibarrApi
unset($object->total_ttc);
unset($object->total_tva);
unset($object->lines);
unset($object->fk_incoterms);
unset($object->label_incoterms);
unset($object->location_incoterms);
unset($object->civility_id);
unset($object->name);
unset($object->lastname);

View File

@ -33,6 +33,8 @@
* \brief Page to list orders
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -51,6 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
$langs->loadLangs(array('orders', 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products'));
// Get Parameters
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
@ -58,6 +61,7 @@ $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist';
// Search Parameters
$search_datecloture_start = GETPOST('search_datecloture_start', 'int');
if (empty($search_datecloture_start)) {
$search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int'));
@ -86,7 +90,7 @@ $socid = GETPOST('socid', 'int');
$search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int');
$search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_ht = GETPOST('search_total_ht', 'alpha');
$search_total_vat = GETPOST('search_total_vat', 'alpha');
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
$search_warehouse = GETPOST('search_warehouse', 'int');
@ -209,6 +213,7 @@ $arrayfields = array(
'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999),
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -724,6 +729,7 @@ if ($action == 'shipped' && $permissiontoadd) {
}
}
}
// Closed records
if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
$db->begin();
@ -760,10 +766,12 @@ if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
}
}
/*
* View
*/
$now = dol_now();
$form = new Form($db);
@ -799,12 +807,14 @@ $sql .= ' c.fk_input_reason, c.import_key';
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -1327,7 +1337,7 @@ if ($resql) {
$moreforfilter = '';
// If the user can view prospects other than his'
// If the user can view prospects? sales other than his own
if ($user->rights->user->user->lire) {
$langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">';
@ -1342,7 +1352,8 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
// If the user can view other products/services than his own
if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -1351,6 +1362,7 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1);
$moreforfilter .= '</div>';
}
// If Categories are enabled & user has rights to see
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -1358,6 +1370,7 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, 'maxwidth300 widthcentpercentminusx');
$moreforfilter .= '</div>';
}
// If Stock is enabled
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
@ -1509,60 +1522,61 @@ if ($resql) {
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1);
print '</td>';
}
// Amount HT / net
if (!empty($arrayfields['c.total_ht']['checked'])) {
// Amount
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).'">';
print '</td>';
}
// Amount of VAT
if (!empty($arrayfields['c.total_vat']['checked'])) {
// Amount
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).'">';
print '</td>';
}
// Total Amount (TTC / gross)
if (!empty($arrayfields['c.total_ttc']['checked'])) {
// Amount
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
print '</td>';
}
// Currency
if (!empty($arrayfields['c.multicurrency_code']['checked'])) {
// Currency
print '<td class="liste_titre">';
print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
print '</td>';
}
// Currency rate
if (!empty($arrayfields['c.multicurrency_tx']['checked'])) {
// Currency rate
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
print '</td>';
}
// Amount HT/net in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) {
// Amount
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
print '</td>';
}
// VAT in foreign currency
if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) {
// Amount VAT
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
print '</td>';
}
// Amount/Total (TTC / gross) in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) {
// Amount
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
print '</td>';
}
// Author
if (!empty($arrayfields['u.login']['checked'])) {
// Author
print '<td class="liste_titre" align="center">';
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
print '</td>';
}
// Sales Representative
if (!empty($arrayfields['sale_representative']['checked'])) {
print '<td class="liste_titre"></td>';
}
@ -1582,12 +1596,15 @@ if ($resql) {
print '<td class="liste_titre right">';
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['c.datec']['checked'])) {
print '<td class="liste_titre">';
@ -1775,8 +1792,10 @@ if ($resql) {
),
'pos' => array(),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array(
'arrayfields' => $arrayfields,
@ -1976,6 +1995,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Alias name
if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="nocellnopadd">';
@ -1985,6 +2005,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="nocellnopadd">';
@ -1994,6 +2015,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">';
@ -2003,6 +2025,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
@ -2010,6 +2033,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center">';
@ -2020,6 +2044,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Type ent
if (!empty($arrayfields['typent.code']['checked'])) {
print '<td class="center">';
@ -2046,6 +2071,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Plannned date of delivery
if (!empty($arrayfields['c.date_delivery']['checked'])) {
print '<td class="center">';
@ -2055,6 +2081,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Shipping Method
if (!empty($arrayfields['c.fk_shipping_method']['checked'])) {
print '<td>';
@ -2064,6 +2091,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Payment terms
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
print '<td>';
@ -2073,6 +2101,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Payment mode
if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) {
print '<td>';
@ -2082,6 +2111,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Channel
if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print '<td>';
@ -2091,7 +2121,8 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Amount HT
// Amount HT/net
if (!empty($arrayfields['c.total_ht']['checked'])) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
if (!$i) {
@ -2106,6 +2137,7 @@ if ($resql) {
$totalarray['val']['c.total_ht'] = $obj->total_ht;
}
}
// Amount VAT
if (!empty($arrayfields['c.total_vat']['checked'])) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_tva)."</span></td>\n";
@ -2117,7 +2149,8 @@ if ($resql) {
}
$totalarray['val']['c.total_tva'] += $obj->total_tva;
}
// Amount TTC
// Amount TTC / gross
if (!empty($arrayfields['c.total_ttc']['checked'])) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
if (!$i) {
@ -2146,21 +2179,22 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Amount HT
// Amount HT/net in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount VAT
// Amount VAT in foreign currency
if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat)."</span></td>\n";
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount TTC
// Amount TTC / gross in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n";
if (!$i) {
@ -2196,8 +2230,8 @@ if ($resql) {
}
}
// Sales representatives
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives
print '<td>';
if ($obj->socid > 0) {
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
@ -2250,6 +2284,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Total margin
if (!empty($arrayfields['total_margin']['checked'])) {
print '<td class="right nowrap">'.price($marginInfo['total_margin']).'</td>';
@ -2261,6 +2296,7 @@ if ($resql) {
}
$totalarray['val']['total_margin'] += $marginInfo['total_margin'];
}
// Total margin rate
if (!empty($arrayfields['total_margin_rate']['checked'])) {
print '<td class="right nowrap">'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
@ -2268,6 +2304,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Total mark rate
if (!empty($arrayfields['total_mark_rate']['checked'])) {
print '<td class="right nowrap">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
@ -2456,6 +2493,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Import key
if (!empty($arrayfields['c.import_key']['checked'])) {
print '<td class="nowrap center">'.$obj->import_key.'</td>';
@ -2463,6 +2501,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['c.fk_statut']['checked'])) {
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';

View File

@ -25,7 +25,7 @@
/**
* \file htdocs/compta/facture/class/facture-rec.class.php
* \ingroup facture
* \brief Fichier de la classe des factures recurentes
* \brief File of class to manage recurring invoices
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
@ -462,7 +462,7 @@ class FactureRec extends CommonInvoice
/**
* Update a line to invoice_rec.
* Update a line invoice_rec.
*
* @param User $user User
* @param int $notrigger No trigger
@ -470,8 +470,6 @@ class FactureRec extends CommonInvoice
*/
public function update(User $user, $notrigger = 0)
{
global $conf;
$error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
@ -480,8 +478,8 @@ class FactureRec extends CommonInvoice
$sql .= " suspended = ".((int) $this->suspended).",";
$sql .= " fk_soc = ".((int) $this->socid).",";
$sql .= " total_tva = ".((float) $this->total_tva).",";
$sql .= " localtax1 = ".((float) $this->localtax1).",";
$sql .= " localtax2 = ".((float) $this->localtax2).",";
$sql .= " localtax1 = ".((float) $this->total_localtax1).",";
$sql .= " localtax2 = ".((float) $this->total_localtax2).",";
$sql .= " total_ht = ".((float) $this->total_ht).",";
$sql .= " total_ttc = ".((float) $this->total_ttc).",";
$sql .= " remise_percent = ".((float) $this->remise_percent);

View File

@ -1316,7 +1316,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$login = dol_buildlogin($object->lastname, $object->firstname);
$generated_password = '';
if (!$ldap_sid) { // TODO ldap_sid ?
if (empty($ldap_sid)) { // TODO ldap_sid ?
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password = getRandomPassword(false);
}

View File

@ -150,6 +150,11 @@ class box_produits extends ModeleBoxes
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
$productstatic->date_modification = $datem;
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
if ($productstatic->isService()) {
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
}
$this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
'text' => $productstatic->getNomUrl(1),
@ -162,22 +167,24 @@ class box_produits extends ModeleBoxes
);
$price = '';
$price_base_type = '';
if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) {
$price_base_type = $langs->trans($objp->price_base_type);
$price = ($objp->price_base_type == 'HT') ?price($objp->price) : $price = price($objp->price_ttc);
} else {
//Parse the dynamic price
$productstatic->fetch($objp->rowid, '', '', 1);
$priceparser = new PriceParser($this->db);
$price_result = $priceparser->parseProduct($productstatic);
if ($price_result >= 0) {
if ($objp->price_base_type == 'HT') {
$price_base_type = $langs->trans("HT");
} else {
$price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
$price_base_type = $langs->trans("TTC");
if ($usercancreadprice) {
if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) {
$price_base_type = $langs->trans($objp->price_base_type);
$price = ($objp->price_base_type == 'HT') ?price($objp->price) : $price = price($objp->price_ttc);
} else {
//Parse the dynamic price
$productstatic->fetch($objp->rowid, '', '', 1);
$priceparser = new PriceParser($this->db);
$price_result = $priceparser->parseProduct($productstatic);
if ($price_result >= 0) {
if ($objp->price_base_type == 'HT') {
$price_base_type = $langs->trans("HT");
} else {
$price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
$price_base_type = $langs->trans("TTC");
}
$price = price($price_result);
}
$price = price($price_result);
}
}
$this->info_box_contents[$line][] = array(

View File

@ -749,7 +749,7 @@ abstract class CommonObject
$this->lastname = dol_ucwords(dol_strtolower($this->lastname));
$this->firstname = dol_ucwords(dol_strtolower($this->firstname));
$this->name = dol_ucwords(dol_strtolower($this->name));
$this->name_alias = dol_ucwords(dol_strtolower($this->name_alias));
$this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):'';
}
if (!empty($conf->global->MAIN_ALL_TO_UPPER)) {
$this->lastname = dol_strtoupper($this->lastname);

View File

@ -42,30 +42,6 @@ class ExtraFields
*/
public $db;
/**
* @var array Array with type of the extra field
* @deprecated
*/
public $attribute_type;
/**
* @var array Array with label of extra field
* @deprecated
*/
public $attribute_label;
/**
* @var array Array with list of possible values for some types of extra fields
* @deprecated
*/
public $attribute_choice;
/**
* @var array array to store extrafields definition
* @deprecated
*/
public $attribute_list;
/**
* @var array New array to store extrafields definition
*/
@ -128,10 +104,6 @@ class ExtraFields
$this->error = '';
$this->errors = array();
$this->attributes = array();
// For old usage
$this->attribute_type = array();
$this->attribute_label = array();
}
/**
@ -838,7 +810,7 @@ class ExtraFields
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load array this->attributes (and some old this->attribute_xxx like attribute_label, attribute_type, ...
* Load array this->attributes
*
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
@ -892,11 +864,6 @@ class ExtraFields
$array_name_label[$tab->name] = $tab->label;
}
// Old usage
$this->attribute_type[$tab->name] = $tab->type;
$this->attribute_label[$tab->name] = $tab->label;
// New usage
$this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type;
$this->attributes[$tab->elementtype]['label'][$tab->name] = $tab->label;
$this->attributes[$tab->elementtype]['size'][$tab->name] = $tab->size;
@ -946,7 +913,7 @@ class ExtraFields
* @param string $keyprefix Suffix string to add before name and id of field (can be used to avoid duplicate names)
* @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric)
* @param int $objectid Current object id
* @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data
* @param string $extrafieldsobjectkey The key to use to store retreived data (for example $object->table_element)
* @param string $mode 1=Used for search filters
* @return string
*/
@ -965,29 +932,26 @@ class ExtraFields
$keyprefix = $keyprefix.'options_';
}
if (!empty($extrafieldsobjectkey)) {
$label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
$type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
$size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
$default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
$computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
$totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
} else {
// Old usage
$label = $this->attribute_label[$key];
$type = $this->attribute_type[$key];
$list = $this->attribute_list[$key];
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
if (empty($extrafieldsobjectkey)) {
dol_syslog(get_class($this).'::showInputField extrafieldsobjectkey required', LOG_ERR);
return 'BadValueForParamExtraFieldsObjectKey';
}
$label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
$type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
$size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
$default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
$computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
$totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
if ($computed) {
if (!preg_match('/^search_/', $keyprefix)) {
return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
@ -1591,26 +1555,25 @@ class ExtraFields
{
global $conf, $langs;
if (!empty($extrafieldsobjectkey)) {
$label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
$type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
$size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; // Can be '255', '24,8'...
$default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
$computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
} else {
// Old usage not allowed anymore
dol_syslog(get_class($this).'::showOutputField extrafieldsobjectkey required', LOG_WARNING);
return '';
if (empty($extrafieldsobjectkey)) {
dol_syslog(get_class($this).'::showOutputField extrafieldsobjectkey required', LOG_ERR);
return 'BadValueForParamExtraFieldsObjectKey';
}
$label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
$type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
$size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; // Can be '255', '24,8'...
$default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
$computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1');
$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1');
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
if ($hidden) {
return ''; // This is a protection. If field is hidden, we should just not call this method.
}

View File

@ -123,7 +123,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$i++;
$texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."',";
$texttoinsert .= " 'label'=>'".$val['label']."',";
if ($val['picto']) {
if (!empty($val['picto'])) {
$texttoinsert .= " 'picto'=>'".$val['picto']."',";
}
$texttoinsert .= " 'enabled'=>'".($val['enabled'] !== '' ? $val['enabled'] : 1)."',";

View File

@ -141,7 +141,7 @@ class modWebhook extends DolibarrModules
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
// The language file dedicated to your module
$this->langfiles = array("webhook");
$this->langfiles = array();
// Prerequisites
$this->phpmin = array(5, 6); // Minimum version of PHP required by module

View File

@ -108,62 +108,62 @@ class Cronjob extends CommonObject
public $datelastresult = '';
/**
* @var string Last result from end job execution
* @var string Last result from end job execution
*/
public $lastresult;
/**
* @var string Last output from end job execution
* @var string Last output from end job execution
*/
public $lastoutput;
/**
* @var string Unit frequency of job execution
* @var string Unit frequency of job execution
*/
public $unitfrequency;
/**
* @var int Frequency of job execution
* @var int Frequency of job execution
*/
public $frequency;
/**
* @var int Status
* @var int Status
*/
public $status;
/**
* @var int Is job processing
* @var int Is job running ?
*/
public $processing;
/**
* @var int The job current PID
* @var int The job current PID
*/
public $pid;
/**
* @var int ID
* @var int User ID of creation
*/
public $fk_user_author;
/**
* @var int ID
* @var int User ID of last modification
*/
public $fk_user_mod;
/**
* @var int Number of run job execution
* @var int Number of run job execution
*/
public $nbrun;
/**
* @var int Maximum run job execution
* @var int Maximum run job execution
*/
public $maxrun;
/**
* @var string Libname
* @var string Libname
*/
public $libname;
@ -1513,10 +1513,12 @@ class Cronjobline
public $datenextrun = '';
public $dateend = '';
public $datestart = '';
public $datelastresult = '';
public $lastresult = '';
public $lastoutput;
public $unitfrequency;
public $frequency;
public $processing;
/**
* @var int Status
@ -1534,8 +1536,10 @@ class Cronjobline
public $fk_user_mod;
public $note;
public $note_private;
public $nbrun;
public $libname;
public $test;
/**
* Constructor

View File

@ -36,36 +36,36 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
*/
class Fichinter extends CommonObject
{
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>20),
'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25),
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>20),
'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25),
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datei' =>array('type'=>'date', 'label'=>'Datei', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>70),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
);
/**
* @var string ID to identify managed object
*/
@ -1267,7 +1267,8 @@ class Fichinter extends CommonObject
$line->fk_fichinter = $fichinterid;
$line->desc = $desc;
$line->datei = $date_intervention;
$line->date = $date_intervention;
$line->datei = $date_intervention; // For backward compatibility
$line->duration = $duration;
if (is_array($array_options) && count($array_options) > 0) {
@ -1316,7 +1317,8 @@ class Fichinter extends CommonObject
while ($xnbp < $nbp) {
$line = new FichinterLigne($this->db);
$line->desc = $langs->trans("Description")." ".$xnbp;
$line->datei = ($now - 3600 * (1 + $xnbp));
$line->date = ($now - 3600 * (1 + $xnbp));
$line->datei = ($now - 3600 * (1 + $xnbp)); // For backward compatibility
$line->duration = 600;
$line->fk_fichinter = 0;
$this->lines[$xnbp] = $line;
@ -1359,7 +1361,7 @@ class Fichinter extends CommonObject
//For invoicing we calculing hours
$line->qty = round($objp->duree / 3600, 2);
$line->date = $this->db->jdate($objp->date);
$line->datei = $this->db->jdate($objp->date);
$line->datei = $this->db->jdate($objp->date); // For backward compatibility
$line->rang = $objp->rang;
$line->product_type = 1;
$line->fetch_optionals();
@ -1486,6 +1488,8 @@ class FichinterLigne extends CommonObjectLine
public $duration; // Duration of intervention
public $rang = 0;
public $tva_tx;
public $subprice;
/**
* @var string ID to identify managed object
@ -1522,8 +1526,7 @@ class FichinterLigne extends CommonObjectLine
*/
public function fetch($rowid)
{
$sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang,';
$sql .= ' ft.date as datei';
$sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang, ft.date';
$sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft';
$sql .= ' WHERE ft.rowid = '.((int) $rowid);
@ -1534,7 +1537,8 @@ class FichinterLigne extends CommonObjectLine
$this->rowid = $objp->rowid;
$this->id = $objp->rowid;
$this->fk_fichinter = $objp->fk_fichinter;
$this->datei = $this->db->jdate($objp->datei);
$this->date = $this->db->jdate($objp->date);
$this->datei = $this->db->jdate($objp->date); // For backward compatibility
$this->desc = $objp->description;
$this->duration = $objp->duree;
$this->rang = $objp->rang;
@ -1562,6 +1566,10 @@ class FichinterLigne extends CommonObjectLine
dol_syslog("FichinterLigne::insert rang=".$this->rang);
if (empty($this->date) && !empty($this->datei)) { // For backward compatibility
$this->date = $this->datei;
}
$this->db->begin();
$rangToUse = $this->rang;
@ -1585,7 +1593,7 @@ class FichinterLigne extends CommonObjectLine
$sql .= ' (fk_fichinter, description, date, duree, rang)';
$sql .= " VALUES (".((int) $this->fk_fichinter).",";
$sql .= " '".$this->db->escape($this->desc)."',";
$sql .= " '".$this->db->idate($this->datei)."',";
$sql .= " '".$this->db->idate($this->date)."',";
$sql .= " ".((int) $this->duration).",";
$sql .= ' '.((int) $rangToUse);
$sql .= ')';
@ -1647,14 +1655,18 @@ class FichinterLigne extends CommonObjectLine
$error = 0;
if (empty($this->date) && !empty($this->datei)) { // For backward compatibility
$this->date = $this->datei;
}
$this->db->begin();
// Mise a jour ligne en base
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET";
$sql .= " description='".$this->db->escape($this->desc)."'";
$sql .= ",date='".$this->db->idate($this->datei)."'";
$sql .= ",duree=".$this->duration;
$sql .= ",rang='".$this->db->escape($this->rang)."'";
$sql .= " description = '".$this->db->escape($this->desc)."',";
$sql .= " date = '".$this->db->idate($this->date)."',";
$sql .= " duree = ".((int) $this->duration).",";
$sql .= " rang = ".((int) $this->rang);
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog("FichinterLigne::update", LOG_DEBUG);

View File

@ -64,7 +64,6 @@ class FichinterRec extends Fichinter
public $number;
public $date;
public $amount;
public $remise;
public $tva;
public $total;
@ -222,7 +221,7 @@ class FichinterRec extends Fichinter
$result_insert = $this->addline(
$fichintsrc->lines[$i]->desc,
$fichintsrc->lines[$i]->duration,
$fichintsrc->lines[$i]->datei,
$fichintsrc->lines[$i]->date,
$fichintsrc->lines[$i]->rang,
$fichintsrc->lines[$i]->subprice,
$fichintsrc->lines[$i]->qty,
@ -350,8 +349,8 @@ class FichinterRec extends Fichinter
// phpcs:enable
$this->lines = array();
$sql = 'SELECT l.rowid, l.fk_product, l.product_type as product_type, l.label as custom_label, l.description, ';
$sql .= ' l.price, l.qty, l.tva_tx, l.remise_percent, l.subprice, l.duree, ';
$sql = 'SELECT l.rowid, l.fk_product, l.product_type as product_type, l.label as custom_label, l.description,';
$sql .= ' l.price, l.qty, l.tva_tx, l.remise_percent, l.subprice, l.duree, l.date,';
$sql .= ' l.total_ht, l.total_tva, l.total_ttc,';
$sql .= ' l.rang, l.special_code,';
$sql .= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,';
@ -381,19 +380,16 @@ class FichinterRec extends Fichinter
$line->qty = $objp->qty;
$line->duree = $objp->duree;
$line->duration = $objp->duree;
$line->datei = $objp->date;
$line->date = $objp->date;
$line->subprice = $objp->subprice;
$line->tva_tx = $objp->tva_tx;
$line->remise_percent = $objp->remise_percent;
$line->fk_remise_except = $objp->fk_remise_except;
$line->fk_product = $objp->fk_product;
$line->date_start = $objp->date_start;
$line->date_end = $objp->date_end;
$line->info_bits = $objp->info_bits;
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_ttc = $objp->total_ttc;
$line->code_ventilation = $objp->fk_code_ventilation;
$line->rang = $objp->rang;
$line->special_code = $objp->special_code;
$line->fk_unit = $objp->fk_unit;
@ -460,7 +456,7 @@ class FichinterRec extends Fichinter
*
* @param string $desc Description de la ligne
* @param integer $duration Durée
* @param string $datei Date
* @param string $date Date
* @param int $rang Position of line
* @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity
@ -477,7 +473,7 @@ class FichinterRec extends Fichinter
* @param string $fk_unit Unit
* @return int <0 if KO, Id of line if OK
*/
public function addline($desc, $duration, $datei, $rang = -1, $pu_ht = 0, $qty = 0, $txtva = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $special_code = 0, $label = '', $fk_unit = null)
public function addline($desc, $duration, $date, $rang = -1, $pu_ht = 0, $qty = 0, $txtva = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $special_code = 0, $label = '', $fk_unit = null)
{
global $mysoc;
@ -520,6 +516,8 @@ class FichinterRec extends Fichinter
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$pu_ht = $tabprice[3];
$product_type = $type;
if ($fk_product) {
$product = new Product($this->db);
@ -539,8 +537,7 @@ class FichinterRec extends Fichinter
$sql .= ", fk_product";
$sql .= ", product_type";
$sql .= ", remise_percent";
//$sql.= ", subprice";
$sql .= ", remise";
$sql .= ", subprice";
$sql .= ", total_ht";
$sql .= ", total_tva";
$sql .= ", total_ttc";
@ -551,7 +548,7 @@ class FichinterRec extends Fichinter
$sql .= (int) $this->id;
$sql .= ", ".(!empty($label) ? "'".$this->db->escape($label)."'" : "null");
$sql .= ", ".(!empty($desc) ? "'".$this->db->escape($desc)."'" : "null");
$sql .= ", ".(!empty($datei) ? "'".$this->db->idate($datei)."'" : "null");
$sql .= ", ".(!empty($date) ? "'".$this->db->idate($date)."'" : "null");
$sql .= ", ".$duration;
//$sql.= ", ".price2num($pu_ht);
//$sql.= ", ".(!empty($qty)? $qty :(!empty($duration)? $duration :"null"));
@ -559,8 +556,7 @@ class FichinterRec extends Fichinter
$sql .= ", ".(!empty($fk_product) ? $fk_product : "null");
$sql .= ", ".$product_type;
$sql .= ", ".(!empty($remise_percent) ? $remise_percent : "null");
//$sql.= ", '".price2num($pu_ht)."'";
$sql .= ", null";
$sql.= ", '".price2num($pu_ht)."'";
$sql .= ", '".price2num($total_ht)."'";
$sql .= ", '".price2num($total_tva)."'";
$sql .= ", '".price2num($total_ttc)."'";

View File

@ -61,6 +61,9 @@ ALTER TABLE llx_user DROP COLUMN idpers3;
ALTER TABLE llx_partnership ADD COLUMN ip varchar(250);
ALTER TABLE llx_adherent ADD COLUMN ip varchar(250);
ALTER TABLE llx_fichinterdet_rec DROP COLUMN remise;
ALTER TABLE llx_fichinterdet_rec DROP COLUMN fk_export_commpta;
UPDATE llx_const set name = 'ADHERENT_MAILMAN_ADMIN_PASSWORD' WHERE name = 'ADHERENT_MAILMAN_ADMINPW';
ALTER TABLE llx_oauth_token ADD COLUMN state text after tokenstring;

View File

@ -41,7 +41,6 @@ create table llx_fichinterdet_rec
localtax2_type VARCHAR(1) NULL DEFAULT NULL,
qty double NULL DEFAULT NULL,
remise_percent double NULL DEFAULT 0,
remise double NULL DEFAULT 0,
fk_remise_except integer NULL DEFAULT NULL,
price DOUBLE(24, 8) NULL DEFAULT NULL,
total_tva DOUBLE(24, 8) NULL DEFAULT NULL,
@ -55,7 +54,6 @@ create table llx_fichinterdet_rec
buy_price_ht DOUBLE(24, 8) NULL DEFAULT 0,
fk_product_fournisseur_price integer NULL DEFAULT NULL,
fk_code_ventilation integer NOT NULL DEFAULT 0,
fk_export_commpta integer NOT NULL DEFAULT 0,
special_code integer UNSIGNED NULL DEFAULT 0,
fk_unit integer NULL DEFAULT NULL,
import_key varchar(14) NULL DEFAULT NULL

View File

@ -341,6 +341,11 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->prod
$product_static->status_buy = $objp->tobuy;
$product_static->status_batch = $objp->tobatch;
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
if ($product_static->isService()) {
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
}
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) {
$sql = "SELECT label";
@ -378,10 +383,12 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->prod
}
}
print '<td class="nowraponall amount right">';
if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') {
print price($objp->price_ttc).' '.$langs->trans("TTC");
} else {
print price($objp->price).' '.$langs->trans("HT");
if ($usercancreadprice) {
if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') {
print price($objp->price_ttc).' '.$langs->trans("TTC");
} else {
print price($objp->price).' '.$langs->trans("HT");
}
}
print '</td>';
}
@ -410,7 +417,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->prod
// TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter"
// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover":
// "commitment engagment" method and "cash accounting" method
if (!empty($conf->global->MAIN_SHOW_PRODUCT_ACTIVITY_TRIM)) {
if (isModEnabled("invoice") && $user->hasRight('facture', 'lire') && getDolGlobalString('MAIN_SHOW_PRODUCT_ACTIVITY_TRIM')) {
if (isModEnabled("product")) {
activitytrim(0);
}

View File

@ -62,6 +62,8 @@ if (is_numeric($entity)) {
define("DOLENTITY", $entity);
}
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
@ -437,10 +439,11 @@ if (empty($reshook) && $action == 'add') {
// Action called after a submitted was send and member created successfully
// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url.
// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
if (empty($reshook) && $action == 'added') {
llxHeaderVierge($langs->trans("NewMemberForm"));
// Si on a pas ete redirige
// If we have not been redirected
print '<br><br>';
print '<div class="center">';
print $langs->trans("NewMemberbyWeb");
@ -556,42 +559,51 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
print '<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.'">';
}
// Company
// Company // TODO : optional hide
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
// Title
print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>';
print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n";
// Lastname
print '<tr><td>'.$langs->trans("Lastname").' <span style="color: red">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
// Firstname
print '<tr><td>'.$langs->trans("Firstname").' <span style="color: red">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
// EMail
print '<tr><td>'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' <span style="color:red;">*</span>' : '').'</td><td>';
//print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input type="text" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td>'.$langs->trans("Login").' <span style="color: red">*</span></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("Password").' <span style="color: red">*</span></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.dol_escape_htmltag(GETPOST("pass1", "none", 2)).'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("PasswordRetype").' <span style="color: red">*</span></td><td><input type="password" maxlength="128" name="pass2" class="minwidth100" value="'.dol_escape_htmltag(GETPOST("pass2", "none", 2)).'"></td></tr>'."\n";
}
// Gender
// Gender // TODO: add diverse gender
print '<tr><td>'.$langs->trans("Gender").'</td>';
print '<td>';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1);
print '</td></tr>';
// Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
print ' / ';
print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
print '</td></tr>';
// Country
print '<tr><td>'.$langs->trans('Country').'</td><td>';
print img_picto('', 'country', 'class="pictofixedwidth"');
@ -621,17 +633,22 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
}
print '</td></tr>';
}
// Birthday
print '<tr id="trbirth" class="trbirth"><td>'.$langs->trans("DateOfBirth").'</td><td>';
print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0);
print '</td></tr>'."\n";
// Photo
print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td><input type="checkbox" name="public"></td></tr>'."\n";
// Other attributes
$tpl_context = 'public'; // define template context to public
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
// Comments
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
@ -733,7 +750,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
print dol_get_fiche_end();
// Save
// Save / Submit
print '<div class="center">';
print '<input type="submit" value="'.$langs->trans("GetMembershipButtonLabel").'" id="submitsave" class="button">';
if (!empty($backtopage)) {

View File

@ -516,6 +516,40 @@ if (empty($reshook)) {
}
}
}
if ($action == 'syncsepatostripe') {
$companybankaccount->fetch(GETPOST('bankid'));
// print "stripe account = " . json_encode($stripe->getStripeAccount($service));
// print json_encode($companybankaccount);
// print "fetch id = " . json_encode($socid);
$companypaymentmode = new CompanyPaymentMode($db);
$companypaymentmode->fetch(null, null, $socid);
// print json_encode($companypaymentmode);
if ($companypaymentmode->type != 'ban') {
$error++;
setEventMessages('ThisPaymentModeIsNotSepa', null, 'errors');
} else {
// Get the Stripe customer
$cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
// print json_encode($cu);
if (!$cu) {
$error++;
setEventMessages($stripe->error, $stripe->errors, 'errors');
}
if (!$error) {
// Creation of Stripe SEPA + update of societe_account
$card = $stripe->sepaStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1);
if (!$card) {
$error++;
setEventMessages($stripe->error, $stripe->errors, 'errors');
} else {
setEventMessages("", array("SEPA on Stripe", "SEPA IBAN is now linked to customer account !"));
}
}
}
}
if ($action == 'setkey_account') {
$error = 0;
@ -632,7 +666,7 @@ if (empty($reshook)) {
} elseif ($action == 'setassourcedefault') { // Set as default when payment mode defined remotely only
try {
$cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
if (preg_match('/pm_/', $source)) {
if (preg_match('/pm_|src_/', $source)) {
$cu->invoice_settings->default_payment_method = (string) $source; // New
} else {
$cu->default_source = (string) $source; // Old
@ -660,6 +694,10 @@ if (empty($reshook)) {
// $card->detach(); Does not work with card_, only with src_
if (method_exists($card, 'detach')) {
$card->detach();
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib as sr ";
$sql .= " SET stripe_card_ref = null";
$sql .= " WHERE sr.stripe_card_ref = '".$db->escape($source)."'";
$resql = $db->query($sql);
} else {
$card->delete();
}
@ -1465,7 +1503,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
// Edit/Delete
print '<td class="right nowraponall">';
if ($permissiontoaddupdatepaymentinformation) {
print '<a class="editfielda marginrightonly marginleftonly" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&id='.$rib->id.'&action=createbanonstripe">';
print '<a class="editfielda marginrightonly marginleftonly" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&id='.$rib->id.'&action=syncsepatostripe">';
print img_picto($langs->trans("CreateBAN"), 'stripe');
print '</a>';

View File

@ -589,6 +589,130 @@ class Stripe extends CommonObject
}
}
/**
* Get the Stripe SEPA of a company payment mode
*
* @param \Stripe\StripeCustomer $cu Object stripe customer.
* @param CompanyPaymentMode $object Object companypaymentmode to check, or create on stripe (create on stripe also update the societe_rib table for current entity)
* @param string $stripeacc ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
* @param int $status Status (0=test, 1=live)
* @param int $createifnotlinkedtostripe 1=Create the stripe sepa and the link if the sepa is not yet linked to a stripe sepa. Deprecated with new Stripe API and SCA.
* @return \Stripe\PaymentMethod|null Stripe SEPA or null if not found
*/
public function sepaStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $status = 0, $createifnotlinkedtostripe = 0)
{
global $conf, $user, $langs;
$sepa = null;
$sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.iban_prefix"; // stripe_card_ref is src_ for sepa
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa";
$sql .= " WHERE sa.rowid = '".$this->db->escape($object->id)."'"; // We get record from ID, no need for filter on entity
$sql .= " AND sa.type = 'ban'"; //type ban to get normal bank account of customer (prelevement)
$soc = new Societe($this->db);
$soc->fetch($object->fk_soc);
dol_syslog(get_class($this)."::fetch search stripe sepa(card) id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num) {
$obj = $this->db->fetch_object($resql);
$cardref = $obj->stripe_card_ref;
dol_syslog(get_class($this)."::cardStripe cardref=".$cardref);
if ($cardref) {
try {
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) {
$sepa = $cu->sources->retrieve($cardref);
} else {
$sepa = \Stripe\PaymentMethod::retrieve($cardref);
}
} else {
if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) {
//$sepa = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided
$sepa = $cu->sources->retrieve($cardref);
} else {
//$sepa = \Stripe\PaymentMethod::retrieve($cardref, array("stripe_account" => $stripeacc)); // Don't know if this works
$sepa = \Stripe\PaymentMethod::retrieve($cardref);
}
}
} catch (Exception $e) {
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
}
} elseif ($createifnotlinkedtostripe) {
$iban = $obj->iban_prefix; //prefix ?
$ipaddress = getUserRemoteIP();
$dataforcard = array(
'type'=>'sepa_debit',
"sepa_debit" => array('iban' => $iban),
'currency' => 'eur',
'usage' => 'reusable',
'owner' => array(
'name' => $soc->name,
),
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress)
);
//$a = \Stripe\Stripe::getApiKey();
//var_dump($a);var_dump($stripeacc);exit;
try {
dol_syslog("Try to create sepa_debit 0");
$service = 'StripeTest';
$servicestatus = 0;
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
$service = 'StripeLive';
$servicestatus = 1;
}
// Force to use the correct API key
global $stripearrayofkeysbyenv;
$stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key'];
dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard));
$s = new \Stripe\StripeClient($stripeacc);
$sepa = $s->sources->create($dataforcard);
if (!$sepa) {
$this->error = 'Creation of sepa_debit on Stripe has failed';
} else {
//association du client avec cette source de paimeent
$cs = $cu->createSource(
$cu->id,
[
'source' => $sepa->id,
]
);
if (!$cs) {
$this->error = 'Link SEPA <-> Customer failed';
} else {
dol_syslog("Try to create sepa_debit 3");
// print json_encode($sepa);
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib";
$sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',";
$sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "'";
$sql .= " WHERE rowid = '".$this->db->escape($object->id)."'";
$sql .= " AND type = 'ban'";
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
}
}
}
} catch (Exception $e) {
$this->error = $e->getMessage();
dol_syslog($this->error, LOG_WARNING);
}
}
}
} else {
dol_print_error($this->db);
}
return $sepa;
}
/**
* Get the Stripe payment intent. Create it with confirmnow=false

View File

@ -833,7 +833,7 @@ class Target extends CommonObject
// phpcs:enable
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs;
//$langs->load("webhook@webhook");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
@ -928,7 +928,6 @@ class Target extends CommonObject
public function getNextNumRef()
{
global $langs, $conf;
$langs->load("webhook@webhook");
if (empty($conf->global->WEBHOOK_TARGET_ADDON)) {
$conf->global->WEBHOOK_TARGET_ADDON = 'mod_target_standard';
@ -993,8 +992,6 @@ class Target extends CommonObject
$result = 0;
$includedocgeneration = 0;
$langs->load("webhook@webhook");
if (!dol_strlen($modele)) {
$modele = 'standard_target';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2022 SuperAdmin <test@dolibarr.com>
/* Copyright (C) 2017 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
@ -30,8 +30,6 @@ function webhookAdminPrepareHead()
{
global $langs, $conf;
$langs->load("webhook@webhook");
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/admin/webhook.php", 1);

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 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
@ -30,8 +30,6 @@ function targetPrepareHead($object)
{
global $db, $langs, $conf;
$langs->load("webhook");
$h = 0;
$head = array();

View File

@ -16,9 +16,9 @@
*/
/**
* \file target_agenda.php
* \ingroup webhook
* \brief Tab of events on Target
* \file htdocs/webhook/target_agenda.php
* \ingroup webhook
* \brief Tab of events on Target
*/
// Load Dolibarr environment
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/webhook/lib/webhook_target.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("webhook@webhook", "other"));
$langs->loadLangs(array('other'));
// Get parameters
$id = GETPOST('id', 'int');
@ -48,6 +48,7 @@ if (GETPOST('actioncode', 'array')) {
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -73,6 +74,7 @@ $object = new Target($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('targetagenda', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);

View File

@ -16,9 +16,9 @@
*/
/**
* \file target_card.php
* \ingroup webhook
* \brief Page to create/edit/view target
* \file target_card.php
* \ingroup webhook
* \brief Page to create/edit/view target
*/
// Load Dolibarr environment
@ -30,7 +30,7 @@ dol_include_once('/webhook/class/target.class.php');
dol_include_once('/webhook/lib/webhook_target.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("webhook@webhook", "other"));
$langs->loadLangs(array('other'));
// Get parameters
$id = GETPOST('id', 'int');
@ -70,6 +70,7 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Permissions
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;

View File

@ -16,9 +16,9 @@
*/
/**
* \file target_contact.php
* \ingroup webhook
* \brief Tab for contacts linked to Target
* \file htdocs/webhook/target_contact.php
* \ingroup webhook
* \brief Tab for contacts linked to Target
*/
// Load Dolibarr environment
@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/webhook/class/target.class.php';
require_once DOL_DOCUMENT_ROOT.'/webhook/lib/webhook_target.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("webhook@webhook", "companies", "other", "mails"));
$langs->loadLangs(array('companies', 'other', 'mails'));
$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
@ -42,12 +42,14 @@ $object = new Target($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('targetcontact', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
// Permissions
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;

View File

@ -17,9 +17,9 @@
*/
/**
* \file target_list.php
* \ingroup webhook
* \brief List page for target
* \file htdocs/webhook/target_list.php
* \ingroup webhook
* \brief List page for target
*/
// Load Dolibarr environment
@ -35,20 +35,22 @@ require_once DOL_DOCUMENT_ROOT.'/webhook/class/target.class.php';
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("webhook@webhook", "other"));
$langs->loadLangs(array('other'));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'targetlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'aZ');
// Get Parameters
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'targetlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'aZ');
$id = GETPOST('id', 'int');
$id = GETPOST('id', 'int');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -120,6 +122,7 @@ foreach ($object->fields as $key => $val) {
);
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -127,6 +130,7 @@ $object->fields = dol_sort_array($object->fields, 'position');
//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
$arrayfields = dol_sort_array($arrayfields, 'position');
// Permissions
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
@ -208,6 +212,7 @@ $now = dol_now();
//$help_url = "EN:Module_Target|FR:Module_Target_FR|ES:Módulo_Target";
$help_url = '';
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Targets"));
$morejs = array();
$morecss = array();

View File

@ -17,9 +17,9 @@
*/
/**
* \file target_note.php
* \ingroup webhook
* \brief Tab for notes on Target
* \file htdocs/webhook/target_note.php
* \ingroup webhook
* \brief Tab for notes on Target
*/
// Load Dolibarr environment
@ -28,20 +28,22 @@ require_once DOL_DOCUMENT_ROOT.'/webhook/class/target.class.php';
require_once DOL_DOCUMENT_ROOT.'/webhook/lib/webhook_target.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("webhook@webhook", "companies"));
$langs->loadLangs(array('companies'));
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Initialize technical objects
$object = new Target($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('targetnote', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
@ -51,7 +53,7 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->webhook->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
// Permissions
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
@ -95,7 +97,7 @@ if (empty($reshook)) {
$form = new Form($db);
//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
//$help_url='EN:Webhooks|FR:Webhooks_FR|ES:Webhooks_ES';
$help_url = '';
$title = $langs->trans('Target').' - '.$langs->trans("Notes");
llxHeader('', $title, $help_url);

View File

@ -28,12 +28,9 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array("webhook"));
// Parameters
$action = GETPOST('action', 'aZ09');
// Security check
// if (! $user->rights->webhook->myobject->read) {
// accessforbidden();

View File

@ -751,7 +751,6 @@ if ($action == 'addcontainer' && $usercanedit) {
$objectpage->content = preg_replace('/^.*<body(\s[^>]*)*>/ims', '', $objectpage->content);
$objectpage->content = preg_replace('/<\/body(\s[^>]*)*>.*$/ims', '', $objectpage->content);
$absoluteurlinaction = $urltograbdirwithoutslash;
// TODO Replace 'action="$urltograbdirwithoutslash' into action="/"
// TODO Replace 'action="$urltograbdirwithoutslash..."' into action="..."
// TODO Replace 'a href="$urltograbdirwithoutslash' into a href="/"
@ -908,7 +907,7 @@ if ($action == 'addcontainer' && $usercanedit) {
getAllImages($object, $objectpage, $urltograbbis, $tmpgeturl['content'], $action, 1, $grabimages, $grabimagesinto);
// We try to convert the CSS we got by adding a prefix .bodywebsite with lessc to avoid conflicit with CSS of Dolibarr.
// We try to convert the CSS we got by adding a prefix .bodywebsite with lessc to avoid conflict with CSS of Dolibarr.
include_once DOL_DOCUMENT_ROOT.'/core/class/lessc.class.php';
$lesscobj = new Lessc();
try {

View File

@ -21,9 +21,9 @@
*/
/**
* \file zapier/admin/about.php
* \ingroup zapier
* \brief About page of module Zapier.
* \file htdocs/zapier/admin/about.php
* \ingroup zapier
* \brief About page of module Zapier.
*/
// Load Dolibarr environment
@ -35,19 +35,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once '../lib/zapier.lib.php';
// Translations
$langs->loadLangs(array("errors", "admin", "zapier"));
$langs->loadLangs(array('admin', 'errors', 'zapier'));
// Access control
if (!$user->admin) {
accessforbidden();
}
if (empty($conf->zapier->enabled)) accessforbidden();
if (empty($user->admin)) accessforbidden();
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
if (empty($conf->zapier->enabled)) accessforbidden();
if (empty($user->admin)) accessforbidden();
/*