diff --git a/ChangeLog b/ChangeLog
index b468ebcc931..f4945b44df0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,20 +10,176 @@ For users:
---------------
NEW: PHP 8.1 compatibility
-
-
+NEW: Support for recurring purchase invoices.
+NEW: #20292 Include German public holidays
+NEW: #17123 added ExtraFields for Stock Mouvement
+NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties
+NEW: #20653 edit discount pourcentage for all lines in one shot
+NEW: Accept 'auto' for ref of object on import of purchase order/proposal
+NEW: Accountancy - Add more filters and info on page to bind accounting accounts
+NEW: Accountancy - Add subledger account when we generate a transaction with a deposit invoice
+NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list)
+NEW: ACE Editor is restored at same cursor position after a save.
+NEW: Add "addMoreActionsButtons" hook to subscription form
+NEW: Add an option in GUI to show a Quick add button into top menu bar
+NEW: Module Recruitment - Add a public page with all list of open job positions.
+NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
+NEW: Add a workflow to auto link contract on a ticket
+NEW: Add column date of Signature on proposal list
+NEW: Add column template invoice in invoice list
+NEW: Add column "Total HT" to products array on document creation card
+NEW: ADD configuration for text color of button action
+NEW: Add constant to hide categories in TakePos
+NEW: Add constant to show category description in TakePos
+NEW: Add constant to show only the products in stock in TakePos
+NEW: Add entity filter in exports
+NEW: Show the event block on recurring invoices #20870
+NEW: Add filter "opportunity status" on statistics of projects.
+NEW: Add firstname, lastname and max number of attendees for module "Event Organization"
+NEW: add margin info in proposal and order list
+NEW: Add massaction "Edit Extrafield" for Product
+NEW: Add more fields to detect duplicate during import of thirdparties
+NEW: Add option to foce delivery on email for purchase order receipt to yes
+NEW: Add param boder table for md theme
+NEW: Add param color button action
+NEW: Add possibility to create contract from invoice
+NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name
+NEW: Add private and public notes on tax files.
+NEW: Add status "Obsolete" to KM articles
+NEW: Add substitutions "user numbers"
+NEW: Add the possibility to add sub-BOMs to BOM
+NEW: allow a ticket to be automatically marked as read when created from backend.
+NEW: allow cut&paste as real numeric value to excel
+NEW: A public form to send a message and create a lead is available
+NEW: automatically set totally received status in reception
+NEW: Auto set invoice paid when adding credit not and remain to pay is 0
+NEW: Availibility dictionnary has a new column unit and number
+NEW: barcode rule to insert product in takepos
+NEW: Can change value of AWP during the inventory
+NEW: Can enter price with tax for predefined products on purchase objects
+NEW: Can filter on a thirdparty on product statistics
+NEW: Can removed doc templates from setup page of thirdparty
+NEW: Can set the parent company during the creation of thirdparty (action=add of societe/card.php)
+NEW: Can use ! to make a search that exclude a string
+NEW: Change in theme colors does not need to use the refresh button
+NEW: clean values and amount in FEC import
+NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action
+NEW: Contact filter project list
+NEW: Create contract from invoice
+NEW: create third-party with contact if not found on public ticket
+NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks)
+NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
+NEW: Dictionaries - add possibility to manage countries in EEC
+NEW: display errors in a message box after generating documents
+NEW: Display physical and virtual stock of the products when creating OF from a BOM
+NEW: Display product ref in "Object link" product tab for BOM
+NEW: Enhance the import. Can use 'auto' for the ref (import of orders)
+NEW: Events on Proposal to Return to Draft
+NEW: Page to list expense report payments
+NEW: JS inventory autocalc input
+NEW: language support for more emailing target selectors
+NEW: leave requests: add field into type dictionary to block request if balance is negative
+NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
+NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
+NEW: Mass action "Close shipments"
+NEW: Module website now supports the multicompany module
+NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...)
+NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens)
+NEW: Add tabs for nets Bom
+NEW: on redirect of page in website module, GET parameters are kept.
+NEW: optional display warning icons on ticket list
+NEW: option to default check "notify tier at creation" in ticket module
+NEW: option update prices on proposal cloning
+NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439)
+NEW: possibility to consume multiple batch
+NEW: Reverse movement product consumption
+NEW: Send email to the supplier order contact
+NEW: New permission to report time on timesheet.
+NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
+NEW: Show number of votes into the label of tab "Results" of a survey
+NEW: Show product reference in Takepos
+NEW: Some core tables are created only at module activation
+NEW: split consumption line on MO
+NEW: stock filter in reassort lists
+NEW: stock limit in stock export CSV
+NEW: Sub-bom are availables
+NEW: Supplier order - Show ref supplier of reception in linked object block
+NEW: support user_modif in order
+NEW: TakePos - pagination on search results
+NEW: The backup tools has an "lowmemory" option for mysqldump on large database
+NEW: The 'reposition' class works on ajax constantonoff that make redirects
+NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice
+NEW: thumbnail field in product list
+NEW: total mark rate in list
+NEW: uncheck "send message" by default on a ticket when private messages has been checked
+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)
Modules
+NEW: Module Partnership Management
NEW: Experimental module Event Organization Management
-NEW: Experimental module Workstations Management
-NEW: Experimental module Partnership Management
-For developers:
----------------
-
-NEW: A lot of addition of hooks.
-
+For developers or integrators:
+------------------------------
+NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
+NEW: Implement a generic method for Kaban views
+NEW: Upgrade chartjs library to 3.7.1
+NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
+NEW: stripe element with more gateways
+NEW: solde() function evolution to be able to get solde until a chosen date
+NEW: Suggest a way to run upgrade per entities.
+NEW: Support html content for multiselect component.
+NEW: ModuleBuilder - Add tabs view in module builder
+NEW: ModuleBuilder - More feature that can be modifed after module generation
+NEW: Hook getNomUrl available everywhere in tooltip of ref links
+NEW: Identification of tr is possible with by attribute data-id on some pages
+NEW: Import with select boxes V2
+NEW: Can update rank of invoice, proposal and order lines with API update
+NEW: Can use current entity filter on 'chkbxlst'
+NEW: Creation of the function select_bom() used to display bom select list
+NEW: add printFieldListWhere hook in product reassort card
+NEW: Add trigger and event on completely received status change
+NEW: Add utility function send backup by mail
+NEW: add WordPress OAuth to save a token (not SSO)
+NEW: A module can embed a sql script run at each Dolibarr upgrade
+NEW: API Proposals - Add POST lines
+NEW: API REST filter states by country
+NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END
+NEW: Add option MAIN_API_DEBUG to save API logs into a file
+NEW: Add param to keep the robot=index meta tag on public pages
+NEW: Add method hintindex() in database handlers.
+NEW: add modifications for new function "$db->prefix()"
+NEW: addMoreActionsButtonsList hook for button in list
+NEW: Add API to get a template invoice
+NEW: Standardize a lot of code.
+NEW: #20736 Allow extrafields SQL filters on REST API product lookup
+NEW: #19294 implement detailed timespent in task of project API
+NEW: Add a protection into PHPunit to avoid to forget a var_dump
+NEW: Add datem and type parameters to API to create movements
+NEW: Add hidden option on contract PDF line to hide qty and price
+NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
+NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
+NEW: TakePos - add hooks complete product display
+NEW: TakePos - add hooks for cart display
+NEW: TakePos - add hooks to complete ajax return array
+NEW: Add hook before the public ticket list
+NEW: Add hook doaction in takepos invoice
+NEW: Add Hook for Notif
+NEW: Add hook for more buttons
+NEW: Add hook printFieldListWhere in "show_contacts" function
+NEW: Add hook printFieldWhere in load_state_board function
+NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts
+NEW: Add hook selectProductsListWhere in select_produits_list function
+NEW: Add hooks in commercial index
+NEW: Add hooks in customers and products boxes
+NEW: Add hooks in thirdparty index page
+NEW: Add hooks on project task time page
+NEW: Add hooks on salaries and sociales card
+NEW: Add hooks select product list and select thirdparty list function
+NEW: Add hook to getSellPrice function
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index 3c2e8763fe1..7a65fa0ffaa 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -349,7 +349,7 @@ if ($action != 'export_csv') {
$sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql);
- $nrows = $resql->num_rows;
+ $nrows = $db->num_rows($resql);
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index 72efffc2b49..28c35016054 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -748,6 +748,7 @@ class AccountingAccount extends CommonObject
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
+ $const_name = '';
if ($type == 'customer') {
$const_name = "SOLD";
} elseif ($type == 'supplier') {
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 1a43a999ea1..d01ad89293f 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -1883,7 +1883,7 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
- $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
+ $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php
index 81caaa05358..405a630942e 100644
--- a/htdocs/accountancy/class/lettering.class.php
+++ b/htdocs/accountancy/class/lettering.class.php
@@ -699,6 +699,8 @@ class Lettering extends BookKeeping
return $grouped_payments;
}
+ $save_payment_by_element = null;
+ $save_element_by_payment = null;
if ($element_id == 0) {
// Save list when is the begin of recursive function
$save_payment_by_element = $payment_by_element;
diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php
index 0d95ff61763..49b4fc2c98c 100644
--- a/htdocs/accountancy/journal/variousjournal.php
+++ b/htdocs/accountancy/journal/variousjournal.php
@@ -43,17 +43,6 @@ if ($in_bookkeeping == '') {
$in_bookkeeping = 'notyet';
}
-// Security check
-if (empty($conf->accounting->enabled)) {
- accessforbidden();
-}
-if ($user->socid > 0) {
- accessforbidden();
-}
-if (empty($user->rights->accounting->mouvements->lire)) {
- accessforbidden();
-}
-
// Get information of journal
$object = new AccountingJournal($db);
$result = $object->fetch($id_journal);
@@ -65,7 +54,7 @@ if ($result > 0) {
accessforbidden($langs->trans('ErrorRecordNotFound'));
}
-$hookmanager->initHooks(array('globaljournal', $object->nature_text . 'journal'));
+$hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
$parameters = array();
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@@ -93,6 +82,18 @@ if (!is_array($journal_data)) {
setEventMessages($object->error, $object->errors, 'errors');
}
+// Security check
+if (empty($conf->accounting->enabled)) {
+ accessforbidden();
+}
+if ($user->socid > 0) {
+ accessforbidden();
+}
+if (empty($user->rights->accounting->mouvements->lire)) {
+ accessforbidden();
+}
+
+
/*
* Actions
*/
diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php
index 64197636d0e..ed2453ef793 100644
--- a/htdocs/adherents/admin/member.php
+++ b/htdocs/adherents/admin/member.php
@@ -248,8 +248,8 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
}
print '
';
-print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
-if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
+print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
+if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
print ''.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'
';
}
print ' ';
@@ -378,16 +378,16 @@ foreach ($dirmodels as $reldir) {
print '';
} else {
print ''."\n";
- print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').' ';
+ print 'scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').' ';
print " ";
}
// Defaut
print '';
- if ($conf->global->MEMBER_ADDON_PDF == $name) {
+ if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
- print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').' ';
+ print 'scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').' ';
}
print ' ';
@@ -398,8 +398,8 @@ foreach ($dirmodels as $reldir) {
$htmltooltip .= ' '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= ''.$langs->trans("FeaturesSupported").': ';
- $htmltooltip .= ' '.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
- $htmltooltip .= ' '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
+ $htmltooltip .= ' '.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
+ $htmltooltip .= ' '.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
print '';
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 350713ca17e..88a63af0ae1 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -2030,7 +2030,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$MAX = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index cafc9338ae8..3f857ce827b 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -121,6 +121,9 @@ class AdherentType extends CommonObject
/** @var array Array of members */
public $members = array();
+ /** @var string string other */
+ public $other = array();
+
public $multilangs = array();
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index c2ef4583bdc..72f75cdf4c8 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -305,6 +305,8 @@ $formother = new FormOther($db);
$membertypestatic = new AdherentType($db);
$memberstatic = new Adherent($db);
+$title = $langs->trans("Members");
+
$now = dol_now();
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
@@ -471,42 +473,41 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit;
}
-llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
+llxHeader('', $title, 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
-$titre = $langs->trans("MembersList");
if (GETPOSTISSET("search_status")) {
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
- $titre = $langs->trans("MembersListQualified");
+ $title = $langs->trans("MembersListQualified");
}
if ($search_status == Adherent::STATUS_DRAFT) {
- $titre = $langs->trans("MembersListToValid");
+ $title = $langs->trans("MembersListToValid");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
- $titre = $langs->trans("MenuMembersValidated");
+ $title = $langs->trans("MenuMembersValidated");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
- $titre = $langs->trans("MembersWithSubscriptionToReceive");
+ $title = $langs->trans("MembersWithSubscriptionToReceive");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'uptodate') {
- $titre = $langs->trans("MembersListUpToDate");
+ $title = $langs->trans("MembersListUpToDate");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
- $titre = $langs->trans("MembersListNotUpToDate");
+ $title = $langs->trans("MembersListNotUpToDate");
}
if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
- $titre = $langs->trans("MembersListResiliated");
+ $title = $langs->trans("MembersListResiliated");
}
if ($search_status == Adherent::STATUS_EXCLUDED) {
- $titre = $langs->trans("MembersListExcluded");
+ $title = $langs->trans("MembersListExcluded");
}
} elseif ($action == 'search') {
- $titre = $langs->trans("MembersListQualified");
+ $title = $langs->trans("MembersListQualified");
}
if ($search_type > 0) {
$membertype = new AdherentType($db);
$result = $membertype->fetch($search_type);
- $titre .= " (".$membertype->label.")";
+ $title .= " (".$membertype->label.")";
}
$param = '';
@@ -623,7 +624,7 @@ print ' ';
print ' ';
print ' ';
-print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information";
$modelmail = "member";
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 493203231b5..2ac4fa76682 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -225,7 +225,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
-$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
+$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
@@ -272,7 +272,7 @@ $tabsqlsort[24] = "code ASC, label ASC";
$tabsqlsort[25] = "t.module ASC, t.code ASC, t.label ASC";
//$tabsqlsort[26]="code ASC";
$tabsqlsort[27] = "code ASC";
-$tabsqlsort[28] = "country ASC, code ASC";
+$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
$tabsqlsort[29] = "position ASC";
$tabsqlsort[30] = "code ASC";
//$tabsqlsort[31]="pcg_version ASC";
@@ -319,7 +319,7 @@ $tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle,picto";
-$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative";
+$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
@@ -366,7 +366,7 @@ $tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle,picto";
-$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative";
+$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label";
@@ -413,7 +413,7 @@ $tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle,picto";
-$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative";
+$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label";
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 32b55d0a612..35c483f33e6 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -420,7 +420,7 @@ if (!empty($moreforfilter)) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
-$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print ''; // You can use div-table-responsive-no-min if you dont need reserved height for your table
diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php
index 900754ef4b4..10b14f8ee99 100644
--- a/htdocs/admin/expensereport_ik.php
+++ b/htdocs/admin/expensereport_ik.php
@@ -36,10 +36,10 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
$error = 0;
$action = GETPOST('action', 'aZ09');
+
$id = GETPOST('id', 'int');
$ikoffset = GETPOST('ikoffset', 'int');
$coef = GETPOST('coef', 'int');
-
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
$fk_range = GETPOST('fk_range', 'int');
@@ -62,9 +62,16 @@ if ($action == 'updateik') {
}
}
- $expIk->setValues($_POST);
- $result = $expIk->create($user);
+ $expIk->coef = $coef;
+ $expIk->ikoffset = $ikoffset;
+ $expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
+ $expIk->fk_range = $fk_range;
+ if ($expIk->id > 0) {
+ $result = $expIk->update($user);
+ } else {
+ $result = $expIk->create($user);
+ }
if ($result > 0) {
setEventMessages('SetupSaved', null, 'mesgs');
diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php
index 62fb097841b..7c27ee6e408 100644
--- a/htdocs/admin/expensereport_rules.php
+++ b/htdocs/admin/expensereport_rules.php
@@ -34,13 +34,19 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
+
+$object = new ExpenseReportRule($db);
+
if (!$user->admin) {
accessforbidden();
}
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
+/*
+ * Action
+ */
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@@ -51,7 +57,6 @@ if ($reshook < 0) {
if (empty($reshook)) {
//Init error
$error = false;
- $message = false;
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
@@ -59,21 +64,20 @@ if (empty($reshook)) {
$apply_to = GETPOST('apply_to');
$fk_user = GETPOST('fk_user', 'int');
$fk_usergroup = GETPOST('fk_usergroup', 'int');
-
- $fk_c_type_fees = GETPOST('fk_c_type_fees');
+ $restrictive = GETPOST('restrictive', 'int');
+ $fk_c_type_fees = GETPOST('fk_c_type_fees', 'int');
$code_expense_rules_type = GETPOST('code_expense_rules_type');
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
- $amount = GETPOST('amount');
+ $amount = price2num(GETPOST('amount'), 'MT', 2);
- $object = new ExpenseReportRule($db);
if (!empty($id)) {
$result = $object->fetch($id);
if ($result < 0) {
dol_print_error('', $object->error, $object->errors);
}
}
- // TODO do action
+
if ($action == 'save') {
$error = 0;
@@ -104,8 +108,6 @@ if (empty($reshook)) {
}
if (empty($error)) {
- $object->setValues($_POST);
-
if ($apply_to == 'U') {
$object->fk_user = (int) $fk_user;
$object->fk_usergroup = 0;
@@ -122,18 +124,30 @@ if (empty($reshook)) {
$object->dates = $dates;
$object->datee = $datee;
-
+ $object->restrictive = $restrictive;
+ $object->fk_c_type_fees = $fk_c_type_fees;
+ $object->code_expense_rules_type = $code_expense_rules_type;
+ $object->amount = $amount;
$object->entity = $conf->entity;
- $res = $object->create($user);
+ if ($object->id > 0) {
+ $res = $object->update($user);
+ } else {
+ $res = $object->create($user);
+ }
if ($res > 0) {
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
} else {
dol_print_error($object->db);
+ $error++;
}
- header('Location: ' . $_SERVER['PHP_SELF']);
- exit;
+ if (!$error) {
+ header('Location: ' . $_SERVER['PHP_SELF']);
+ exit;
+ } else {
+ $action = '';
+ }
}
} elseif ($action == 'delete') {
// TODO add confirm
@@ -207,7 +221,7 @@ if ($action != 'edit') {
echo '
' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . ' ';
echo '' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . ' ';
echo ' ' . $conf->currency . ' ';
+ echo ' ';
echo '' . $form->selectyesno('restrictive', 0, 1) . ' ';
echo ' ';
echo '';
@@ -304,10 +318,10 @@ foreach ($rules as $rule) {
}
echo '';
-
+ // Amount
echo '';
if ($action == 'edit' && $object->id == $rule->id) {
- echo ' ' . $conf->currency;
+ echo ' ';
} else {
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
}
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 8ed6615965b..dbf4ca53686 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -529,7 +529,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').' '.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitleSeparator();
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
- $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
+ $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= '';
//$moreforfilter .= ''.$moreinfo.' '.$moreinfo2.'
';
diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php
index ebd1269f74a..1d3e29c9cd4 100644
--- a/htdocs/admin/resource.php
+++ b/htdocs/admin/resource.php
@@ -78,7 +78,7 @@ print '';
print '
';
print '';
print ''.$langs->trans("Parameters").' '."\n";
-print ''.$langs->trans("Value").' '."\n";
+print ''.$langs->trans("Value").' '."\n";
print ' ';
@@ -106,6 +106,15 @@ if (empty($conf->use_javascript_ajax)) {
print ' ';
+print '';
+print ''.$langs->trans('EnableResourceUsedInEventCheck').' ';
+print '';
+echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
+print ' ';
+print ' ';
+print ' ';
+
+/*
print '';
print ''.$langs->trans('DisabledResourceLinkUser').' ';
print '';
@@ -122,15 +131,7 @@ echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
print ' ';
print ' ';
print ' ';
-
-
-print '';
-print ''.$langs->trans('EnableResourceUsedInEventCheck').' ';
-print '';
-echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
-print ' ';
-print ' ';
-print ' ';
+*/
print '
';
print '
';
diff --git a/htdocs/admin/resource_extrafields.php b/htdocs/admin/resource_extrafields.php
index c4967f75313..0af4a3384e0 100644
--- a/htdocs/admin/resource_extrafields.php
+++ b/htdocs/admin/resource_extrafields.php
@@ -74,7 +74,6 @@ llxHeader('', $langs->trans("ResourceSetup"));
$linkback = ''.$langs->trans("BackToModuleList").' ';
print load_fiche_titre($langs->trans("ResourceSetup"), $linkback, 'title_setup');
-print " \n";
$head = resource_admin_prepare_head();
diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php
index 4df687dd2bd..621eceb50a3 100644
--- a/htdocs/admin/ticket_public.php
+++ b/htdocs/admin/ticket_public.php
@@ -408,7 +408,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print ' ';
- print_fiche_titre($langs->trans("Emails"));
+ print load_fiche_titre($langs->trans("Emails"));
print '';
print '
';
diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php
index 36136aeef24..83d750e1209 100644
--- a/htdocs/admin/tools/dolibarr_export.php
+++ b/htdocs/admin/tools/dolibarr_export.php
@@ -257,7 +257,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
}
if ($execmethod == 1) {
// If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode.
- print ' ';
+ print ' ';
print '';
print $form->textwithpicto($langs->trans('ExportUseLowMemoryMode'), $langs->trans('ExportUseLowMemoryModeHelp'));
print ' ';
diff --git a/htdocs/api/index.php b/htdocs/api/index.php
index c66573e8022..afb0289aa32 100644
--- a/htdocs/api/index.php
+++ b/htdocs/api/index.php
@@ -100,7 +100,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$url = $_SERVER['PHP_SELF'];
if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
- $url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO'];
+ $url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
}
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
if (!empty($conf->global->MAIN_NGINX_FIX)) {
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index c516866b7d0..d94ba613d91 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php
index 19c15839231..410af398bc7 100644
--- a/htdocs/asset/class/asset.class.php
+++ b/htdocs/asset/class/asset.class.php
@@ -144,6 +144,7 @@ class Asset extends CommonObject
public $fk_disposal_type;
public $disposal_depreciated;
public $disposal_subject_to_vat;
+ public $supplier_invoice_id;
public $note_public;
public $note_private;
public $date_creation;
diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php
index eae7b5d0fde..6390ad74c18 100644
--- a/htdocs/asset/class/assetmodel.class.php
+++ b/htdocs/asset/class/assetmodel.class.php
@@ -129,6 +129,7 @@ class AssetModel extends CommonObject
public $import_key;
public $model_pdf;
public $status;
+ public $asset_depreciation_options;
// /**
// * @var string Field with ID of parent key if this object has a parent
diff --git a/htdocs/asset/model/card.php b/htdocs/asset/model/card.php
index 3e0858da55e..89843f0fc4e 100644
--- a/htdocs/asset/model/card.php
+++ b/htdocs/asset/model/card.php
@@ -315,7 +315,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// $MAXEVENT = 10;
//
- // $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
+ // $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
//
// // List of actions on element
// include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php
index 2b9c6f57bbd..4bc9095a57e 100644
--- a/htdocs/bom/bom_agenda.php
+++ b/htdocs/bom/bom_agenda.php
@@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
+$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@@ -79,7 +80,7 @@ $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
if ($id > 0 || !empty($ref)) {
- $upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
// Security check - Protection if external user
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 96fb68b6e9b..3de176a1995 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -742,7 +742,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php
index 64f3cdbfac1..a0390ef5105 100644
--- a/htdocs/bom/bom_document.php
+++ b/htdocs/bom/bom_document.php
@@ -104,6 +104,7 @@ $form = new Form($db);
$title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
$help_url = 'EN:Module_BOM';
+$morehtmlref = "";
llxHeader('', $title, $help_url);
diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php
index 30cd6792c55..d08cce70382 100644
--- a/htdocs/bom/bom_net_needs.php
+++ b/htdocs/bom/bom_net_needs.php
@@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
// Get parameters
$id = GETPOST('id', 'int');
+$lineid = GETPOST('lineid', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
@@ -184,7 +185,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dol_get_fiche_end();
- $viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
+ $viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes');
diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php
index 8ace40cc900..9984a1498b8 100644
--- a/htdocs/bom/bom_note.php
+++ b/htdocs/bom/bom_note.php
@@ -54,7 +54,7 @@ $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
if ($id > 0 || !empty($ref)) {
- $upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 86e07ed424d..fb7fd68e13a 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -916,27 +916,27 @@ class BOM extends CommonObject
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
- if ($obj->fk_user_author) {
+ if (!empty($obj->fk_user_author)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
- if ($obj->fk_user_valid) {
+ if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
- if ($obj->fk_user_cloture) {
+ if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
- $this->date_modification = $this->db->jdate($obj->datem);
- $this->date_validation = $this->db->jdate($obj->datev);
+ $this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
+ $this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
}
$this->db->free($result);
@@ -1134,6 +1134,9 @@ class BOM extends CommonObject
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} else {
+ if (empty($TNetNeeds[$line->fk_product])) {
+ $TNetNeeds[$line->fk_product] = 0;
+ }
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
}
}
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 434b994ccd2..bf9442b82af 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -113,7 +113,7 @@ class Categorie extends CommonObject
*
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_CAT_FK = array(
+ public $MAP_CAT_FK = array(
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
@@ -125,7 +125,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_CAT_TABLE = array(
+ public $MAP_CAT_TABLE = array(
'customer' => 'societe',
'supplier' => 'fournisseur',
'bank_account'=> 'account',
@@ -136,7 +136,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_OBJ_CLASS = array(
+ public $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
@@ -178,7 +178,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
- protected $MAP_OBJ_TABLE = array(
+ public static $MAP_OBJ_TABLE = array(
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
@@ -258,6 +258,12 @@ class Categorie extends CommonObject
*/
public $motherof = array();
+ /**
+ * @var array Childs
+ */
+ public $childs = array();
+
+
/**
* Constructor
*
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index aa513e07794..737ff059eee 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -461,6 +461,13 @@ if (empty($reshook) && $action == 'add') {
}
}
+ // Modify $moreparam so we are sure to see the event we have just created, whatever are the default value of filter on next page.
+ /*$moreparam .= ($moreparam ? '&' : '').'search_actioncode=0';
+ $moreparam .= ($moreparam ? '&' : '').'search_status=-1';
+ $moreparam .= ($moreparam ? '&' : '').'search_filtert='.$object->userownerid;
+ */
+ $moreparam .= ($moreparam ? '&' : '').'disabledefaultvalues=1';
+
if ($error) {
$db->rollback();
} else {
@@ -674,7 +681,7 @@ if (empty($reshook) && $action == 'update') {
$object->errors[] = $object->error;
} else {
if ($db->num_rows($resql) > 0) {
- // already in use
+ // Resource already in use
$error++;
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
while ($obj = $db->fetch_object($resql)) {
@@ -853,7 +860,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
$object->errors[] = $object->error;
} else {
if ($db->num_rows($resql) > 0) {
- // already in use
+ // Resource already in use
$error++;
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
while ($obj = $db->fetch_object($resql)) {
@@ -952,16 +959,17 @@ if ($action == 'create') {
console.log("setdatefields");
setdatefields();
});
+
$("#selectcomplete").change(function() {
- if ($("#selectcomplete").val() == 100)
- {
+ console.log("we change the complete status - set the doneby");
+ if ($("#selectcomplete").val() == 100) {
if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\');
}
- if ($("#selectcomplete").val() == 0)
- {
+ if ($("#selectcomplete").val() == 0) {
$("#doneby").val(-1);
}
});
+
$("#actioncode").change(function() {
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
else $("#dateend").removeClass("fieldrequired");
@@ -1019,59 +1027,15 @@ if ($action == 'create') {
print 'global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").' ';
// Full day
- print ''.$langs->trans("EventOnFullDay").' ';
+ print ''.$langs->trans("Date").' '.$langs->trans("EventOnFullDay").' ';
- $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
- if (GETPOST('datep', 'int', 1)) {
- $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
- }
- $datef = ($datef ? $datef : $object->datef);
- if (GETPOST('datef', 'int', 1)) {
- $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
- }
- if (empty($datef) && !empty($datep)) {
- if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
- $datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
- }
- }
-
- // Date start
- print '';
- print ''.$langs->trans("DateActionStart").' ';
- print ' - ';
- print ''.$langs->trans("DateActionEnd").' ';
- print ' ';
- if (GETPOST("afaire") == 1) {
- print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
- } else {
- print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
- }
- print ' - ';
- //print ' - ';
- if (GETPOST("afaire") == 1) {
- print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
- } else {
- print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
- }
- print ' ';
-
- // Date end
- /*print '';
- print ''.$langs->trans("DateActionEnd").' ';
- print ' ';
- print '';
- if (GETPOST("afaire") == 1) {
- print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
- } else {
- print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
- }
- print ' ';*/
-
- // Dev in progress
+ // Recurring event
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent) {
// Repeat
- print '';
+ //print ' ';
+ print ' ';
+ print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
print ' ';
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
@@ -1120,34 +1084,51 @@ if ($action == 'create') {
});
});
';
- print '
';
+ print '';
+ //print '';
}
- // Status
- print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").' ';
- print '';
- $percent = $complete !=='' ? $complete : -1;
- if (GETPOSTISSET('status')) {
- $percent = GETPOST('status');
- } elseif (GETPOSTISSET('percentage')) {
- $percent = GETPOST('percentage', 'int');
- } else {
- if ($complete == '0' || GETPOST("afaire") == 1) {
- $percent = '0';
- } elseif ($complete == 100 || GETPOST("afaire") == 2) {
- $percent = 100;
- }
- }
- $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print ' ';
- // Location
- if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
- print ''.$langs->trans("Location").' ';
+ $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
+ if (GETPOST('datep', 'int', 1)) {
+ $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
+ }
+ $datef = ($datef ? $datef : $object->datef);
+ if (GETPOST('datef', 'int', 1)) {
+ $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
+ }
+ if (empty($datef) && !empty($datep)) {
+ if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
+ $datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
+ }
}
+ // Date start
+ print '';
+ /*
+ print ''.$langs->trans("DateActionStart").' ';
+ print ' - ';
+ print ''.$langs->trans("DateActionEnd").' ';
+ */
+ print ' ';
+ if (GETPOST("afaire") == 1) {
+ print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
+ } else {
+ print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
+ }
+ print ' - ';
+ if (GETPOST("afaire") == 1) {
+ print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
+ } else {
+ print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
+ }
+ print ' ';
+
+ print ' ';
+
// Assigned to
- print ''.$langs->trans("ActionAffectedTo").' ';
+ print ' '.$langs->trans("ActionAffectedTo").' ';
$listofuserid = array();
$listofcontactid = array();
$listofotherid = array();
@@ -1181,6 +1162,29 @@ if ($action == 'create') {
print ' ';
}
+ // Location
+ if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
+ print ''.$langs->trans("Location").' ';
+ }
+
+ // Status
+ print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").' ';
+ print '';
+ $percent = $complete !=='' ? $complete : -1;
+ if (GETPOSTISSET('status')) {
+ $percent = GETPOST('status');
+ } elseif (GETPOSTISSET('percentage')) {
+ $percent = GETPOST('percentage', 'int');
+ } else {
+ if ($complete == '0' || GETPOST("afaire") == 1) {
+ $percent = '0';
+ } elseif ($complete == 100 || GETPOST("afaire") == 2) {
+ $percent = 100;
+ }
+ }
+ $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
+ print ' ';
+
if ($conf->categorie->enabled) {
// Categories
print ''.$langs->trans("Categories").' ';
@@ -1523,6 +1527,7 @@ if ($id > 0) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print ' '.$langs->trans("Type").' ';
if ($object->type_code != 'AC_OTH_AUTO') {
+ print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
print $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ? GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto", 0, 0, 0, 1);
} else {
print ' ';
@@ -1533,40 +1538,19 @@ if ($id > 0) {
}
// Title
- print ' '.$langs->trans("Title").' ';
+ print 'global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").' ';
// Full day event
- print ''.$langs->trans("EventOnFullDay").' fulldayevent ? ' checked' : '').'> ';
+ print ''.$langs->trans("Date").' fulldayevent ? ' checked' : '').'>';
+ print ''.$langs->trans("EventOnFullDay").' ';
- // Date start - end
- print '';
- print ''.$langs->trans("DateActionStart").' ';
- print ' - ';
- print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").' ';
- print ' ';
- $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
- if (GETPOST("afaire") == 1) {
- print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
- } elseif (GETPOST("afaire") == 2) {
- print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
- } else {
- print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
- }
- print ' - ';
- if (GETPOST("afaire") == 1) {
- print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
- } elseif (GETPOST("afaire") == 2) {
- print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
- } else {
- print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
- }
- print ' ';
-
- // Dev in progress
+ // Recurring event
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent) {
// Repeat
- print '';
+ //print ' ';
+ print ' ';
+ print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
print ' ';
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
@@ -1615,19 +1599,37 @@ if ($id > 0) {
});
});
';
- print '
';
+ print '';
+ //print '';
}
-
- // Status
- print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").' ';
- $percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
- $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print ' ';
- // Location
- if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
- print ''.$langs->trans("Location").' ';
+ // Date start - end
+ print '';
+ /*print ''.$langs->trans("DateActionStart").' ';
+ print ' - ';
+ print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").' ';
+ */
+ print ' ';
+ $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
+ if (GETPOST("afaire") == 1) {
+ print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
+ } elseif (GETPOST("afaire") == 2) {
+ print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
+ } else {
+ print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
+ print ' - ';
+ if (GETPOST("afaire") == 1) {
+ print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
+ } elseif (GETPOST("afaire") == 2) {
+ print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
+ } else {
+ print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
+ }
+ print ' ';
+
+ print ' ';
// Assigned to
$listofuserid = array(); // User assigned
@@ -1678,6 +1680,18 @@ if ($id > 0) {
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
print '';
}
+
+ // Location
+ if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
+ print ''.$langs->trans("Location").' ';
+ }
+
+ // Status
+ print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").' ';
+ $percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
+ $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
+ print ' ';
+
// Tags-Categories
if ($conf->categorie->enabled) {
print ''.$langs->trans("Categories").' ';
@@ -1786,7 +1800,7 @@ if ($id > 0) {
print ' '.$langs->trans("Description").' ';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
+ $doleditor = new DolEditor('note', $object->note_private, '', 120, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
$doleditor->Create();
print ' ';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index f22cea8d04e..aeb20e6c7b4 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1621,7 +1621,7 @@ class ActionComm extends CommonObject
$label = $langs->trans("ShowAction");
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"';
+ $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"';
$linkclose .= ' class="'.$classname.' classfortooltip"';
/*
$hookmanager->initHooks(array('actiondao'));
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 920fe69025d..dee6c459433 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -49,6 +49,8 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
}
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
+$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
+
$check_holiday = GETPOST('check_holiday', 'int');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
@@ -110,7 +112,7 @@ $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
-$type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
+$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW;
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@@ -128,14 +130,11 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
$actioncode = '0';
}
} else {
- $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
-}
-if ($actioncode == '' && empty($actioncodearray)) {
- $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
+ $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($status == '' && !GETPOSTISSET('search_status')) {
- $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
+ $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 86b8a3b5ce5..7d8861aded3 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -45,6 +45,11 @@ $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
+$optioncss = GETPOST('optioncss', 'alpha');
+$toselect = GETPOST('toselect', 'array');
+$confirm = GETPOST('confirm', 'alpha');
+
+$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$mode = GETPOST('mode', 'aZ09');
if (empty($mode) && preg_match('/show_/', $action)) {
@@ -54,12 +59,9 @@ $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid",
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
-$optioncss = GETPOST('optioncss', 'alpha');
$year = GETPOST("year", 'int');
$month = GETPOST("month", 'int');
$day = GETPOST("day", 'int');
-$toselect = GETPOST('toselect', 'array');
-$confirm = GETPOST('confirm', 'alpha');
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('search_actioncode', 'array')) {
@@ -68,11 +70,9 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = '0';
}
} else {
- $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
-}
-if ($actioncode == '' && empty($actioncodearray)) {
- $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
+ $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
+
$search_id = GETPOST('search_id', 'alpha');
$search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha');
@@ -83,7 +83,7 @@ $datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int')
$dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel');
$dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel');
if ($search_status == '' && !GETPOSTISSET('search_status')) {
- $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
+ $search_status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
@@ -216,7 +216,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$datestart_dtend = '';
$dateend_dtstart = '';
$dateend_dtend = '';
+ $actioncode = '';
$search_status = '';
+ $pid = '';
+ $socid = '';
+ $resourceid = '';
+ $filter = '';
+ $filtert = '';
+ $usergroup = '';
$toselect = array();
$search_array_options = array();
}
@@ -299,7 +306,7 @@ if ($actioncode != '') {
if ($resourceid > 0) {
$param .= "&search_resourceid=".urlencode($resourceid);
}
-if ($search_status != '' && $search_status > -1) {
+if ($search_status != '') {
$param .= "&search_status=".urlencode($search_status);
}
if ($filter) {
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index 64b635d169d..d4e005ae3e5 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
$action = GETPOST('action', 'aZ09');
+$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
+
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
@@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = '0';
}
} else {
- $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
-}
-if ($actioncode == '' && empty($actioncodearray)) {
- $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
+ $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
@@ -145,7 +144,7 @@ $begin_d = 1;
$end_d = 53;
if ($status == '' && !GETPOSTISSET('search_status')) {
- $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
+ $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 07bcd90e972..b9e190729e0 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
$action = GETPOST('action', 'aZ09');
+$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
+
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
@@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
$actioncode = '0';
}
} else {
- $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
-}
-if ($actioncode == '' && empty($actioncodearray)) {
- $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
+ $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
@@ -154,7 +153,7 @@ if ($end_d < $begin_d) {
}
if ($status == '' && !GETPOSTISSET('search_status')) {
- $status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
+ $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php
index f82df06313b..b3d3dd25e90 100644
--- a/htdocs/comm/mailing/card.php
+++ b/htdocs/comm/mailing/card.php
@@ -961,7 +961,7 @@ if ($action == 'create') {
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
print "\n\n\n";
- if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) {
+ if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) {
print '
'.$langs->trans("SetToDraft").' ';
}
@@ -1066,7 +1066,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
- print dol_set_focus('#sendto');
+ dol_set_focus('#sendto');
}
diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php
index 588faa392e3..0c2bf539384 100644
--- a/htdocs/comm/mailing/class/mailing.class.php
+++ b/htdocs/comm/mailing/class/mailing.class.php
@@ -86,6 +86,11 @@ class Mailing extends CommonObject
*/
public $email_from;
+ /**
+ * @var string email to
+ */
+ public $sendto;
+
/**
* @var string email reply to
*/
@@ -175,6 +180,11 @@ class Mailing extends CommonObject
*/
public $statuts = array();
+ /**
+ * @var array substitutionarray
+ */
+ public $substitutionarray;
+
/**
* Constructor
diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php
index ffd7d611f5a..258e264c5a7 100644
--- a/htdocs/comm/propal/class/api_proposals.class.php
+++ b/htdocs/comm/propal/class/api_proposals.class.php
@@ -135,8 +135,13 @@ class Proposals extends DolibarrApi
}
// Add external contacts ids.
- $this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->propal->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->propal->contacts_ids = $tmparray;
+ }
+
$this->propal->fetchObjectLinked();
+
return $this->_cleanObjectDatas($this->propal);
}
@@ -228,7 +233,10 @@ class Proposals extends DolibarrApi
$proposal_static = new Propal($this->db);
if ($proposal_static->fetch($obj->rowid)) {
// Add external contacts ids
- $proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
+ $tmparray = $proposal_static->liste_contact(-1, 'external', 1);
+ if (is_array($tmparray)) {
+ $proposal_static->contacts_ids = $tmparray;
+ }
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
}
$i++;
@@ -645,7 +653,7 @@ class Proposals extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- $contacts = $this->invoice->liste_contact();
+ $contacts = $this->propal->liste_contact();
foreach ($contacts as $contact) {
if ($contact['id'] == $contactid && $contact['code'] == $type) {
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 732569fc844..73e73fbe2f9 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -296,8 +296,8 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>24),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
@@ -317,7 +317,7 @@ class Propal extends CommonObject
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
- 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
@@ -327,7 +327,7 @@ class Propal extends CommonObject
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
- 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191),
+ 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
@@ -490,7 +490,6 @@ class Propal extends CommonObject
$line->subprice = -$remise->amount_ht;
$line->fk_product = 0; // Id produit predefined
$line->qty = 1;
- $line->remise = 0;
$line->remise_percent = 0;
$line->rang = -1;
$line->info_bits = 2;
@@ -736,7 +735,6 @@ class Propal extends CommonObject
// TODO deprecated
$this->line->price = $price;
- $this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
@@ -936,7 +934,6 @@ class Propal extends CommonObject
// TODO deprecated
$this->line->price = $price;
- $this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
@@ -1520,6 +1517,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
+ $sql .= ", p.date_signature as dates";
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv";
@@ -1603,6 +1601,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
+ $this->date_signature = $this->db->jdate($obj->dates); // Signature date
$this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);
@@ -1900,14 +1899,15 @@ class Propal extends CommonObject
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
- $line = new Product($this->db);
- $line->fetch($objp->fk_product);
- $line->getMultiLangs();
+ $tmpproduct = new Product($this->db);
+ $tmpproduct->fetch($objp->fk_product);
+ $tmpproduct->getMultiLangs();
+
+ $line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
- //dol_syslog("1 ".$line->fk_product);
- //print "xx $i ".$this->lines[$i]->fk_product;
+
$i++;
}
@@ -3993,6 +3993,7 @@ class PropaleLigne extends CommonObjectLine
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
+
/**
* Class line Contructor
*
@@ -4132,9 +4133,6 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->rang)) {
$this->rang = 0;
}
- if (empty($this->remise)) {
- $this->remise = 0;
- }
if (empty($this->remise_percent) || !is_numeric($this->remise_percent)) {
$this->remise_percent = 0;
}
@@ -4364,9 +4362,6 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->price)) {
$this->price = 0; // TODO A virer
}
- if (empty($this->remise)) {
- $this->remise = 0; // TODO A virer
- }
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 51869825600..d59505e5fb7 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -377,14 +377,14 @@ if ($action == 'validate' && $permissiontovalidate) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
if ($tmpproposal->valid($user) > 0) {
- setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
+ setEventMessages($langs->trans('hasBeenValidated', $tmpproposal->ref), null, 'mesgs');
} else {
- setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
+ setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
} else {
$langs->load("errors");
- setEventMessage($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), 'errors');
+ setEventMessages($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), null, 'errors');
$error++;
}
} else {
@@ -410,7 +410,7 @@ if ($action == "sign" && $permissiontoclose) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
- setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
+ setEventMessages($tmpproposal->ref." ".$langs->trans('Signed'), null, 'mesgs');
} else {
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 2795c325fba..ac9ce98777d 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -133,7 +133,10 @@ class Orders extends DolibarrApi
}
// Add external contacts ids
- $this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->commande->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->commande->contacts_ids = $tmparray;
+ }
$this->commande->fetchObjectLinked();
// Add online_payment_url, cf #20477
@@ -234,7 +237,10 @@ class Orders extends DolibarrApi
$commande_static = new Commande($this->db);
if ($commande_static->fetch($obj->rowid)) {
// Add external contacts ids
- $commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
+ $tmparray = $commande_static->liste_contact(-1, 'external', 1);
+ if (is_array($tmparray)) {
+ $commande_static->contacts_ids = $tmparray;
+ }
// Add online_payment_url, cf #20477
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 7390b5f39b9..a7d237bc780 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -313,8 +313,8 @@ class Commande extends CommonOrder
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@@ -334,14 +334,14 @@ class Commande extends CommonOrder
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
- 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
- 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
+ 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@@ -1666,7 +1666,6 @@ class Commande extends CommonOrder
// TODO Ne plus utiliser
$this->line->price = $price;
- $this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
@@ -2010,7 +2009,6 @@ class Commande extends CommonOrder
$line->price = -$remise->amount_ht;
$line->fk_product = 0; // Id produit predefini
$line->qty = 1;
- $line->remise = 0;
$line->remise_percent = 0;
$line->rang = -1;
$line->info_bits = 2;
@@ -2154,9 +2152,11 @@ class Commande extends CommonOrder
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
- $line = new Product($this->db);
- $line->fetch($objp->fk_product);
- $line->getMultiLangs();
+ $tmpproduct = new Product($this->db);
+ $tmpproduct->fetch($objp->fk_product);
+ $tmpproduct->getMultiLangs();
+
+ $line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
@@ -3262,7 +3262,6 @@ class Commande extends CommonOrder
// TODO deprecated
$this->line->price = $price;
- $this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
@@ -4404,9 +4403,6 @@ class OrderLine extends CommonOrderLine
if (empty($this->rang)) {
$this->rang = 0;
}
- if (empty($this->remise)) {
- $this->remise = 0;
- }
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
@@ -4447,7 +4443,7 @@ class OrderLine extends CommonOrderLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
- $sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
+ $sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,';
$sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
$sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,';
$sql .= ' fk_unit';
@@ -4470,7 +4466,6 @@ class OrderLine extends CommonOrderLine
$sql .= " '".price2num($this->remise_percent)."',";
$sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").",";
$sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").",";
- $sql .= " '".price2num($this->remise)."',";
$sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").',';
$sql .= ' '.((int) $this->special_code).',';
$sql .= ' '.((int) $this->rang).',';
@@ -4579,9 +4574,6 @@ class OrderLine extends CommonOrderLine
if (empty($this->marge_tx)) {
$this->marge_tx = 0;
}
- if (empty($this->remise)) {
- $this->remise = 0;
- }
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php
index cdcd26490a3..77aded9c594 100644
--- a/htdocs/compta/bank/class/paymentvarious.class.php
+++ b/htdocs/compta/bank/class/paymentvarious.class.php
@@ -165,7 +165,7 @@ class PaymentVarious extends CommonObject
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
+ public function __construct(DoliDB $db)
{
$this->db = $db;
$this->element = 'payment_various';
diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php
index e05750918da..c09943540bc 100644
--- a/htdocs/compta/deplacement/class/deplacement.class.php
+++ b/htdocs/compta/deplacement/class/deplacement.class.php
@@ -121,7 +121,7 @@ class Deplacement extends CommonObject
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
+ public function __construct(DoliDB $db)
{
$this->db = $db;
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
index 9f92cecc4a7..2aa03441e9b 100644
--- a/htdocs/compta/deplacement/list.php
+++ b/htdocs/compta/deplacement/list.php
@@ -158,7 +158,7 @@ if ($resql) {
print '
';
}
print '
';
- $formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
+ print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
print '';
print '
';
print ' ';
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 18b1e752c0b..39b8c16614d 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -1700,7 +1700,7 @@ if ($action == 'create') {
$MAXEVENT = 10;
- //$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
+ //$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index f2e57c8b536..adf76b0991e 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
-$usercancreatemargin = $user->rights->margins->creer;
-$usercanreadallmargin = $user->rights->margins->liretous;
-$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
+$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
+$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
+$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index 51fd8c1dd7a..3dababa3dc3 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -148,7 +148,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
- $this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
+ if(is_array($tmparray)) {
+ $this->invoice->contacts_ids = $tmparray;
+ }
}
$this->invoice->fetchObjectLinked();
@@ -267,8 +270,10 @@ class Invoices extends DolibarrApi
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Add external contacts ids
- $invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1);
-
+ $tmparray = $invoice_static->liste_contact(-1, 'external', 1);
+ if (is_array($tmparray)) {
+ $invoice_static->contacts_ids = $tmparray;
+ }
$obj_ret[] = $this->_cleanObjectDatas($invoice_static);
}
$i++;
@@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
- $this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
+ $tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
+ if (is_array($tmparray)) {
+ $this->template_invoice->contacts_ids = $tmparray;
+ }
}
$this->template_invoice->fetchObjectLinked();
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index a406a48c7f6..927da1bf17a 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
@@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
@@ -199,7 +199,7 @@ class FactureRec extends CommonInvoice
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
- 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1),
@@ -222,7 +222,7 @@ class FactureRec extends CommonInvoice
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
+ public function __construct(DoliDB $db)
{
$this->db = $db;
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index a5cb99c2260..64d83cb2123 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -428,7 +428,7 @@ class Facture extends CommonInvoice
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
+ public function __construct(DoliDB $db)
{
$this->db = $db;
}
@@ -560,7 +560,6 @@ class Facture extends CommonInvoice
$this->array_options = $_facrec->array_options;
- //if (! $this->remise) $this->remise = 0;
if (!$this->mode_reglement_id) {
$this->mode_reglement_id = 0;
}
@@ -1652,13 +1651,13 @@ class Facture extends CommonInvoice
0, // date_start
0, // date_end
0,
- $lines[$i]->info_bits, // info_bits
+ 0, // info_bits
0,
'HT',
0,
0, // product_type
1,
- $lines[$i]->special_code,
+ 0, // special_code
$deposit->origin,
0,
0,
@@ -2194,9 +2193,11 @@ class Facture extends CommonInvoice
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
- $line = new Product($this->db);
- $line->fetch($objp->fk_product);
- $line->getMultiLangs();
+ $tmpproduct = new Product($this->db);
+ $tmpproduct->fetch($objp->fk_product);
+ $tmpproduct->getMultiLangs();
+
+ $line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
@@ -5024,7 +5025,7 @@ class Facture extends CommonInvoice
$sql .= " WHERE f.entity IN (".getEntity('invoice', 0).")";
$resql = $this->db->query($sql);
if ($resql) {
- if ($resql->num_rows > 0) {
+ if ($this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$ref = $res['max(situation_cycle_ref)'];
$ref++;
@@ -5069,7 +5070,7 @@ class Facture extends CommonInvoice
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
$res = array();
- if ($resql && $resql->num_rows > 0) {
+ if ($resql && $this->db->num_rows($resql) > 0) {
while ($row = $this->db->fetch_object($resql)) {
$id = $row->rowid;
$situation = new Facture($this->db);
@@ -5147,7 +5148,7 @@ class Facture extends CommonInvoice
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
- if ($resql && $resql->num_rows > 0) {
+ if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$last = $res['max(situation_counter)'];
return ($last == $this->situation_counter);
@@ -5503,6 +5504,7 @@ class Facture extends CommonInvoice
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
// Recipient
+ $to = '';
$res = $tmpinvoice->fetch_thirdparty();
$recipient = $tmpinvoice->thirdparty;
if ($res > 0) {
@@ -5524,7 +5526,7 @@ class Facture extends CommonInvoice
$error++;
}
- if (!$error) {
+ if (!$error && $to) {
// Errors Recipient
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
@@ -6286,7 +6288,7 @@ class FactureLigne extends CommonInvoiceLine
$sql = "SELECT situation_percent FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->fk_prev_id);
$resql = $this->db->query($sql);
- if ($resql && $resql->num_rows > 0) {
+ if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$returnPercent = floatval($res['situation_percent']);
diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php
index a54cd1a6668..522fe9aa2e2 100644
--- a/htdocs/compta/facture/class/facturestats.class.php
+++ b/htdocs/compta/facture/class/facturestats.class.php
@@ -57,7 +57,7 @@ class FactureStats extends Stats
* @param int $typentid Id typent of thirdpary for filter
* @param int $categid Id category of thirdpary for filter
*/
- public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
+ public function __construct(DoliDB $db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
{
global $user, $conf;
diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php
index f94ad573a81..a4441804570 100644
--- a/htdocs/compta/facture/class/paymentterm.class.php
+++ b/htdocs/compta/facture/class/paymentterm.class.php
@@ -68,7 +68,7 @@ class PaymentTerm // extends CommonObject
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
+ public function __construct(DoliDB $db)
{
$this->db = $db;
}
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 43897172779..f726baa4934 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -52,7 +52,7 @@ if ($user->socid) {
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
- $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$result = restrictedArea($user, 'facture', $object->id);
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index 60efaf36e3d..33dde25ca97 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
- $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
// Security check
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index af1ab95c2b5..02925225df9 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -857,7 +857,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.datec']['checked'])) {
- print ' ';
+ print ' ';
print dol_print_date($db->jdate($objp->datec), 'dayhour');
print ' ';
if (!$i) {
@@ -865,7 +865,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.tms']['checked'])) {
- print '
';
+ print ' ';
print dol_print_date($db->jdate($objp->tms), 'dayhour');
print ' ';
if (!$i) {
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 5937eda916c..6fd1e2a7322 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -245,7 +245,7 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
- 'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
+ 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
@@ -1112,7 +1112,7 @@ if ($resql) {
if (!empty($user->rights->facture->paiement)) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
}
- if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
+ if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 6f699774d32..887a0281184 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
- $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
+ $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 583626f0220..989fa28b2f0 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -281,8 +281,8 @@ if ($object->id > 0) {
}
$author = new User($db);
- if ($object->user_author) {
- $author->fetch($object->user_author);
+ if ($object->fk_user_author) {
+ $author->fetch($object->fk_user_author);
}
if ($type == 'bank-transfer') {
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index d12caf36bbe..1c3abfe87bd 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -172,7 +172,7 @@ if ($resql) {
print '
';
}
print '
';
- $formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
+ print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
print '';
print '
';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index cf02c2aeb74..326be7144a8 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -102,7 +102,7 @@ $syear = GETPOST("reyear") ?GETPOST("reyear") : date("Y", time());
print $formother->select_month($cmonth, 'remonth');
-print $formother->select_year($syear, 'reyear');
+print $formother->selectyear($syear, 'reyear');
print ' ';
print '';
diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index 640ffc78d99..db48b2767f2 100644
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -291,7 +291,7 @@ if ($action == 'create') {
print "\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
- $totalrecu += $objp->am;
+ $totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index 0ea9b1ba30d..b586d4c88a6 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -863,7 +863,7 @@ if ($id > 0) {
/*
$MAXEVENT = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 6996c689922..41e036ae937 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -113,6 +113,11 @@ class ChargeSociales extends CommonObject
*/
public $fk_user;
+ /**
+ * @var double total
+ */
+ public $total;
+
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
@@ -123,7 +128,7 @@ class ChargeSociales extends CommonObject
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
+ public function __construct(DoliDB $db)
{
$this->db = $db;
}
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index 9a4b50e3474..1b83915714d 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -100,12 +100,28 @@ class PaymentSocialContribution extends CommonObject
*/
public $fk_user_modif;
+ /**
+ * @var int ID
+ */
+ public $chid;
+
+ /**
+ * @var integer|string datepaye
+ */
+ public $datepaye;
+
+ /**
+ * @var integer|string paiementtype
+ */
+ public $paiementtype;
+
+
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
- public function __construct($db)
+ public function __construct(DoliDB $db)
{
$this->db = $db;
}
diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php
index ed37c72c1c4..26f8e754dd2 100644
--- a/htdocs/compta/tva/card.php
+++ b/htdocs/compta/tva/card.php
@@ -853,7 +853,7 @@ if ($id > 0) {
/*
$MAXEVENT = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index cd664f5970e..1cef1901917 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -316,8 +316,9 @@ if (empty($reshook)) {
$result = $object->delete(); // TODO Add $user as first param
if ($result > 0) {
- if ($backtopage) {
- header("Location: ".$backtopage);
+ setEventMessages("RecordDeleted", null, 'mesgs');
+ if ($backurlforlist) {
+ header("Location: ".$backurlforlist);
exit;
} else {
header("Location: ".DOL_URL_ROOT.'/contact/list.php');
@@ -1550,7 +1551,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$MAXEVENT = 10;
- $morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id);
+ $morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/contact/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 487c075b3a1..587972fa83b 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -181,6 +181,12 @@ class Contact extends CommonObject
*/
public $email;
+ /**
+ * URL
+ * @var string
+ */
+ public $url;
+
/**
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
* @var int
@@ -315,6 +321,7 @@ class Contact extends CommonObject
*/
public $stcomm_picto;
+
/**
* Constructor
*
diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php
index 02813cee469..7f1d9bdc64b 100644
--- a/htdocs/contact/consumption.php
+++ b/htdocs/contact/consumption.php
@@ -410,7 +410,7 @@ if ($sql_select) {
print ' ';
print '
'; // date
print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle');
- $formother->select_year($year ? $year : -1, 'year', 1, 20, 1);
+ print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1);
print ' ';
print '
';
print ' ';
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 7265a69d1af..7ad5ceedb85 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -2161,7 +2161,7 @@ if ($action == 'create') {
$MAXEVENT = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 0befd4820ff..79f2e8e9e15 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -232,8 +232,8 @@ class Contrat extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
@@ -871,9 +871,11 @@ class Contrat extends CommonObject
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
- $line = new Product($this->db);
- $line->fetch($objp->fk_product);
- $line->getMultiLangs();
+ $tmpproduct = new Product($this->db);
+ $tmpproduct->fetch($objp->fk_product);
+ $tmpproduct->getMultiLangs();
+
+ $line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$pos] = $line;
@@ -2744,6 +2746,7 @@ class ContratLigne extends CommonObjectLine
public $commentaire;
+
const STATUS_INITIAL = 0;
const STATUS_OPEN = 4;
const STATUS_CLOSED = 5;
@@ -2988,7 +2991,6 @@ class ContratLigne extends CommonObjectLine
$this->localtax2_type = $obj->localtax2_type;
$this->qty = $obj->qty;
$this->remise_percent = $obj->remise_percent;
- $this->remise = $obj->remise;
$this->fk_remise_except = $obj->fk_remise_except;
$this->subprice = $obj->subprice;
$this->price_ht = $obj->price_ht;
@@ -3046,7 +3048,6 @@ class ContratLigne extends CommonObjectLine
$this->localtax2_tx = trim($this->localtax2_tx);
$this->qty = trim($this->qty);
$this->remise_percent = trim($this->remise_percent);
- $this->remise = trim($this->remise);
$this->fk_remise_except = (int) $this->fk_remise_except;
$this->subprice = price2num($this->subprice);
$this->price_ht = price2num($this->price_ht);
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 57b4657eab4..e76261010da 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -693,7 +693,7 @@ if (!empty($arrayfields['lower_planned_end_date']['checked'])) {
print '';
print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0);
print ' ';
- $formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, '');
+ print $formother->selectyear($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, '');
print '';
}
// Status
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index cec127eeac4..85b854f8ba7 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -101,10 +101,10 @@ if ($action == 'add' && !empty($permissiontoadd)) {
//var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value;
- if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') {
+ if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
$object->$key = '(PROV)';
}
- if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
+ if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index b94655fbc14..5acc6b22ee2 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -1468,6 +1468,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$trackid = 'leav'.$objecttmp->id;
+ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
// Sending email
diff --git a/htdocs/core/ajax/ajaxcompanies.php b/htdocs/core/ajax/ajaxcompanies.php
new file mode 100644
index 00000000000..350f03398aa
--- /dev/null
+++ b/htdocs/core/ajax/ajaxcompanies.php
@@ -0,0 +1,122 @@
+
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2007-2010 Laurent Destailleur
+ * Copyright (C) 2010 Cyrille de Lambert
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/ajax/ajaxcompanies.php
+ * \brief File to return Ajax response on third parties request
+ */
+
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
+if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
+if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
+if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
+if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
+
+require '../../main.inc.php';
+
+
+/*
+ * View
+ */
+
+// Ajout directives pour resoudre bug IE
+//header('Cache-Control: Public, must-revalidate');
+//header('Pragma: public');
+
+//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
+top_httphead();
+
+//print ''."\n";
+
+dol_syslog(join(',', $_GET));
+
+
+// Generation liste des societes
+if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) {
+ $return_arr = array();
+
+ // Define filter on text typed
+ $socid = $_GET['newcompany'] ? $_GET['newcompany'] : '';
+ if (!$socid) $socid = $_GET['socid'] ? $_GET['socid'] : '';
+ if (!$socid) $socid = $_GET['id_fourn'] ? $_GET['id_fourn'] : '';
+
+ $sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec, s.logo";
+ $sql .= " , c.label as country, d.nom as departement";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON d.rowid = s.fk_departement";
+ $sql .= " WHERE s.entity IN (".getEntity('societe').")";
+ if ($socid) {
+ $sql .= " AND (";
+ // Add criteria on name/code
+ if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index
+ $sql .= "s.nom LIKE '".$db->escape($socid)."%'";
+ $sql .= " OR s.code_client LIKE '".$db->escape($socid)."%'";
+ $sql .= " OR s.code_fournisseur LIKE '".$db->escape($socid)."%'";
+ } else {
+ $sql .= "s.nom LIKE '%".$db->escape($socid)."%'";
+ $sql .= " OR s.code_client LIKE '%".$db->escape($socid)."%'";
+ $sql .= " OR s.code_fournisseur LIKE '%".$db->escape($socid)."%'";
+ }
+ if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .= " OR s.rowid = '".$db->escape($socid)."'";
+ $sql .= ")";
+ }
+ //if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters
+ $sql .= " ORDER BY s.nom ASC";
+
+ //dol_syslog("ajaxcompanies", LOG_DEBUG);
+ $resql = $db->query($sql);
+
+ if ($resql) {
+ while ($row = $db->fetch_array($resql)) {
+ $label = $row['nom'];
+ if ($socid) $label = $label;
+ $row_array['label'] = $label;
+ $row_array['value'] = $row['nom'];
+ $row_array['key'] = $row['rowid'];
+ $row_array['name_alias'] = $row['name_alias'];
+ $row_array['code_client'] = $row['code_client'];
+ $row_array['code_fournisseur'] = $row['code_fournisseur'];
+ $row_array['address'] = $row['address'];
+ $row_array['zip'] = $row['zip'];
+ $row_array['town'] = $row['town'];
+ $row_array['email'] = $row['email'];
+ $row_array['siren'] = $row['siren'];
+ $row_array['siret'] = $row['siret'];
+ $row_array['ape'] = $row['ape'];
+ $row_array['idprof4'] = $row['idprof4'];
+ $row_array['client'] = $row['client'];
+ $row_array['fournisseur'] = $row['fournisseur'];
+ $row_array['datec'] = $row['datec'];
+ $row_array['logo'] = $row['logo'];
+ $row_array['country'] = $row['country'];
+ $row_array['departement'] = $row['departement'];
+
+ array_push($return_arr, $row_array);
+ }
+
+ echo json_encode($return_arr);
+ } else {
+ echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error'));
+ }
+} else {
+ echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter'));
+}
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index 371a7a0dbed..02b5070a96c 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -329,7 +329,7 @@ class box_activity extends ModeleBoxes
if (!empty($data)) {
$j = 0;
while ($j < count($data)) {
- $billurl = "search_status=2&paye=1&year=".$data[$j]->annee;
+ $billurl = "search_status=2&paye=1";
$this->info_box_contents[$line][0] = array(
'td' => 'class="left" width="16"',
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
@@ -339,7 +339,7 @@ class box_activity extends ModeleBoxes
$this->info_box_contents[$line][1] = array(
'td' => '',
- 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0)." ".$data[$j]->annee,
+ 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
);
$this->info_box_contents[$line][2] = array(
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index b6acbbbfbc9..94fb05d5346 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -597,7 +597,7 @@ class CMailFile
}
$sendingmode = $this->sendmode;
- if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
+ if ($this->sendcontext == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index a9536f410ca..e80eaa52b14 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -65,6 +65,26 @@ abstract class CommonDocGenerator
*/
public $scandir;
+ public $page_hauteur;
+ public $page_largeur;
+ public $marge_gauche;
+ public $marge_droite;
+ public $marge_haute;
+ public $marge_basse;
+
+ public $option_logo;
+ public $option_tva;
+ public $option_multilang;
+ public $option_freetext;
+ public $option_draft_watermark;
+
+ public $option_modereg;
+ public $option_condreg;
+ public $option_escompte;
+ public $option_credit_note;
+
+ public $emetteur;
+
/**
* Constructor
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index dc35cfbc7aa..e88b42950f3 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -93,12 +93,17 @@ abstract class CommonInvoice extends CommonObject
const STATUS_ABANDONED = 3;
+ public $totalpaid; // duplicate with sumpayed
+ public $totaldeposits; // duplicate with sumdeposit
+ public $totalcreditnotes; // duplicate with sumcreditnote
+
public $sumpayed;
public $sumpayed_multicurrency;
public $sumdeposit;
public $sumdeposit_multicurrency;
public $sumcreditnote;
public $sumcreditnote_multicurrency;
+ public $remaintopay;
/**
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 6466754f241..13bf93e2de4 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -115,6 +115,16 @@ abstract class CommonObject
*/
public $array_languages = null; // Value is array() when load already tried
+ /**
+ * @var array To store result of ->liste_contact()
+ */
+ public $contacts_ids;
+
+ /**
+ * @var mixed Array of linked objects, set and used when calling ->create() to be able to create links during the creation of object
+ */
+ public $linked_objects;
+
/**
* @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked
*/
@@ -201,7 +211,7 @@ abstract class CommonObject
public $user;
/**
- * @var string The type of originating object ('commande', 'facture', ...)
+ * @var string The type of originating object ('commande', 'facture', ...). Note: on some object this field is called $origin_type
* @see fetch_origin()
*/
public $origin;
@@ -4879,7 +4889,7 @@ abstract class CommonObject
$product_static->fetch($line->fk_product);
$product_static->ref = $line->ref; //can change ref in hook
- $product_static->label = $line->label; //can change label in hook
+ $product_static->label = !empty($line->label) ? $line->label : ""; //can change label in hook
$text = $product_static->getNomUrl(1);
@@ -4915,7 +4925,7 @@ abstract class CommonObject
$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.
}
- $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU');
+ $line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
@@ -6837,7 +6847,7 @@ abstract class CommonObject
if ((string) $key == '') {
continue;
}
- list($val, $parent) = explode('|', $val);
+ if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val);
$out .= '{$field} = $obj->{$field};
+ $this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null;
}
}
diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php
index 74bab57c605..c45e3f1698c 100644
--- a/htdocs/core/class/commonobjectline.class.php
+++ b/htdocs/core/class/commonobjectline.class.php
@@ -61,6 +61,34 @@ abstract class CommonObjectLine extends CommonObject
public $date_fin_prevue;
public $date_fin_reel;
+ public $weight;
+ public $weight_units;
+ public $width;
+ public $width_units;
+ public $height;
+ public $height_units;
+ public $length;
+ public $length_units;
+ public $surface;
+ public $surface_units;
+ public $volume;
+ public $volume_units;
+
+ public $multilangs;
+
+ public $product_type; // type in line
+ public $product_ref; // ref in product table
+ public $product_label; // label in product table
+ public $product_desc; // desc in product table
+ public $fk_product_type; // type in product table
+
+ public $qty;
+ public $duree;
+ public $remise_percent;
+ public $info_bits;
+ public $special_code;
+
+
/**
* Constructor
diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php
index 8085adf6283..e388159f978 100644
--- a/htdocs/core/class/commonstickergenerator.class.php
+++ b/htdocs/core/class/commonstickergenerator.class.php
@@ -64,10 +64,40 @@ abstract class CommonStickerGenerator
public $code; // Code of format
/**
- * @var array format Array with informations
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
*/
public $format;
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
// phpcs:disable PEAR.NamingConventions.ValidVariableName.PublicUnderscore
// protected
// Nom du format de l'etiquette
@@ -100,6 +130,8 @@ abstract class CommonStickerGenerator
protected $_COUNTY = 1;
protected $_First = 1;
public $Tformat;
+
+
// phpcs:enable
/**
* Constructor
diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php
deleted file mode 100644
index 1bb4e92a0c9..00000000000
--- a/htdocs/core/class/coreobject.class.php
+++ /dev/null
@@ -1,413 +0,0 @@
-
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/**
- * \file htdocs/core/class/coreobject.class.php
- * \ingroup core
- * \brief File of class to manage all object. Might be replace or merge into commonobject
- */
-
-require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
-
-// TODO Remove this class (used in Expensereportik and ExpenseReportRule
-/**
- * CoreObject
- */
-class CoreObject extends CommonObject
-{
- public $withChild = true;
-
- /**
- * @var Array $_fields Fields to synchronize with Database
- */
- protected $fields = array();
-
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- public function __construct(DoliDB &$db)
- {
- $this->db = $db;
- }
-
- /**
- * Function to init fields
- *
- * @return bool
- */
- protected function init()
- {
- $this->id = 0;
- $this->datec = 0;
- $this->tms = 0;
-
- if (!empty($this->fields)) {
- foreach ($this->fields as $field => $info) {
- if ($this->isDate($info)) {
- $this->{$field} = time();
- } elseif ($this->isArray($info)) {
- $this->{$field} = array();
- } elseif ($this->isInt($info)) {
- $this->{$field} = (int) 0;
- } elseif ($this->isFloat($info)) {
- $this->{$field} = (double) 0;
- } else {
- $this->{$field} = '';
- }
- }
-
- $this->to_delete = false;
- $this->is_clone = false;
-
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Test type of field
- *
- * @param string $field name of field
- * @param string $type type of field to test
- * @return boolean value of field or false
- */
- private function checkFieldType($field, $type)
- {
- if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) {
- return $this->{'is_'.$type}($this->fields[$field]);
- } else {
- return false;
- }
- }
-
- /**
- * Get object and children from database
- *
- * @param int $id Id of object to load
- * @param bool $loadChild used to load children from database
- * @return int >0 if OK, <0 if KO, 0 if not found
- */
- public function fetch($id, $loadChild = true)
- {
- $res = $this->fetchCommon($id);
- if ($res > 0) {
- if ($loadChild) {
- $this->fetchChild();
- }
- }
-
- return $res;
- }
-
-
- /**
- * Function to instantiate a new child
- *
- * @param string $tabName Table name of child
- * @param int $id If id is given, we try to return his key if exist or load if we try_to_load
- * @param string $key Attribute name of the object id
- * @param bool $try_to_load Force the fetch if an id is given
- * @return int
- */
- public function addChild($tabName, $id = 0, $key = 'id', $try_to_load = false)
- {
- if (!empty($id)) {
- foreach ($this->{$tabName} as $k => &$object) {
- if ($object->{$key} === $id) {
- return $k;
- }
- }
- }
-
- $k = count($this->{$tabName});
-
- $className = ucfirst($tabName);
- $this->{$tabName}[$k] = new $className($this->db);
- if ($id > 0 && $key === 'id' && $try_to_load) {
- $this->{$tabName}[$k]->fetch($id);
- }
-
- return $k;
- }
-
-
- /**
- * Function to set a child as to delete
- *
- * @param string $tabName Table name of child
- * @param int $id Id of child to set as to delete
- * @param string $key Attribute name of the object id
- * @return bool
- */
- public function removeChild($tabName, $id, $key = 'id')
- {
- foreach ($this->{$tabName} as &$object) {
- if ($object->{$key} == $id) {
- $object->to_delete = true;
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * Function to fetch children objects
- *
- * @return void
- */
- public function fetchChild()
- {
- if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) {
- foreach ($this->childtables as &$childTable) {
- $className = ucfirst($childTable);
-
- $this->{$className} = array();
-
- $sql = "SELECT rowid FROM ".$this->db->prefix().$childTable." WHERE ".$this->fk_element." = ".((int) $this->id);
- $res = $this->db->query($sql);
-
- if ($res) {
- while ($obj = $this->db->fetch_object($res)) {
- $o = new $className($this->db);
- $o->fetch($obj->rowid);
-
- $this->{$className}[] = $o;
- }
- } else {
- $this->errors[] = $this->db->lasterror();
- }
- }
- }
- }
-
- /**
- * Function to update children data
- *
- * @param User $user user object
- * @return void
- */
- public function saveChild(User &$user)
- {
- if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) {
- foreach ($this->childtables as &$childTable) {
- $className = ucfirst($childTable);
- if (!empty($this->{$className})) {
- foreach ($this->{$className} as $i => &$object) {
- $object->{$this->fk_element} = $this->id;
-
- $object->update($user);
- if ($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete == true) {
- unset($this->{$className}[$i]);
- }
- }
- }
- }
- }
- }
-
-
- /**
- * Function to update object or create or delete if needed
- *
- * @param User $user User object
- * @return int < 0 if KO, > 0 if OK
- */
- public function update(User &$user)
- {
- if (empty($this->id)) {
- return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed
- } elseif (isset($this->to_delete) && $this->to_delete == true) {
- return $this->delete($user);
- }
-
- $error = 0;
- $this->db->begin();
-
- $res = $this->updateCommon($user);
- if ($res) {
- $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
- if ($result < 0) {
- $error++;
- } else {
- $this->saveChild($user);
- }
- } else {
- $error++;
- $this->error = $this->db->lasterror();
- $this->errors[] = $this->error;
- }
-
- if (empty($error)) {
- $this->db->commit();
- return $this->id;
- } else {
- $this->db->rollback();
- return -1;
- }
- }
-
- /**
- * Function to create object in database
- *
- * @param User $user User object
- * @return int < 0 if KO, > 0 if OK
- */
- public function create(User $user)
- {
- if ($this->id > 0) {
- return $this->update($user);
- }
-
- $error = 0;
- $this->db->begin();
-
- $res = $this->createCommon($user);
- if ($res) {
- $this->id = $this->db->last_insert_id($this->table_element);
-
- $result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user);
- if ($result < 0) {
- $error++;
- } else {
- $this->saveChild($user);
- }
- } else {
- $error++;
- $this->error = $this->db->lasterror();
- $this->errors[] = $this->error;
- }
-
- if (empty($error)) {
- $this->db->commit();
- return $this->id;
- } else {
- $this->db->rollback();
- return -1;
- }
- }
-
- /**
- * Function to delete object in database
- *
- * @param User $user user object
- * @return int < 0 if KO, > 0 if OK
- */
- public function delete(User &$user)
- {
- if ($this->id <= 0) {
- return 0;
- }
-
- $error = 0;
- $this->db->begin();
-
- $result = $this->call_trigger(strtoupper($this->element).'_DELETE', $user);
- if ($result < 0) {
- $error++;
- }
-
- if (!$error) {
- $this->deleteCommon($user);
- if ($this->withChild && !empty($this->childtables)) {
- foreach ($this->childtables as &$childTable) {
- $className = ucfirst($childTable);
- if (!empty($this->{$className})) {
- foreach ($this->{$className} as &$object) {
- $object->delete($user);
- }
- }
- }
- }
- }
-
- if (empty($error)) {
- $this->db->commit();
- return 1;
- } else {
- $this->error = $this->db->lasterror();
- $this->errors[] = $this->error;
- $this->db->rollback();
- return -1;
- }
- }
-
-
- /**
- * Function to get a formatted date
- *
- * @param string $field Attribute to return
- * @param string $format Output date format
- * @return string
- */
- public function getDate($field, $format = '')
- {
- if (empty($this->{$field})) {
- return '';
- } else {
- return dol_print_date($this->{$field}, $format);
- }
- }
-
- /**
- * Function to set date in field
- *
- * @param string $field field to set
- * @param string $date formatted date to convert
- * @return mixed
- */
- public function setDate($field, $date)
- {
- if (empty($date)) {
- $this->{$field} = 0;
- } else {
- require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
- $this->{$field} = dol_stringtotime($date);
- }
-
- return $this->{$field};
- }
-
-
- /**
- * Function to update current object
- *
- * @param array $Tab Array of values
- * @return int
- */
- public function setValues(&$Tab)
- {
- foreach ($Tab as $key => $value) {
- if ($this->checkFieldType($key, 'date')) {
- $this->setDate($key, $value);
- } elseif ($this->checkFieldType($key, 'float')) {
- $this->{$key} = (double) price2num($value);
- } elseif ($this->checkFieldType($key, 'int')) {
- $this->{$key} = (int) price2num($value);
- } else {
- $this->{$key} = dol_string_nohtmltag($value);
- }
- }
-
- return 1;
- }
-}
diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php
index 37b8d580d1c..da3ba49095f 100644
--- a/htdocs/core/class/dolreceiptprinter.class.php
+++ b/htdocs/core/class/dolreceiptprinter.class.php
@@ -917,44 +917,46 @@ class dolReceiptPrinter extends Printer
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_array($resql);
+ if (empty($obj)) {
+ $error++;
+ $this->errors[] = 'PrinterDontExist';
+ }
+ if (!$error) {
+ $parameter = (isset($obj['parameter']) ? $obj['parameter'] : '');
+ try {
+ $type = $obj['fk_type'];
+ switch ($type) {
+ case 1:
+ $this->connector = new DummyPrintConnector();
+ break;
+ case 2:
+ $this->connector = new FilePrintConnector($parameter);
+ break;
+ case 3:
+ $parameters = explode(':', $parameter);
+ $this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
+ break;
+ case 4: // LPT1, smb://...
+ $this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
+ break;
+ case 5:
+ $this->connector = new CupsPrintConnector($parameter);
+ break;
+ default:
+ $this->connector = 'CONNECTOR_UNKNOWN';
+ break;
+ }
+ $this->printer = new Printer($this->connector, $this->profile);
+ } catch (Exception $e) {
+ $this->errors[] = $e->getMessage();
+ $error++;
+ }
+ }
} else {
$error++;
$this->errors[] = $this->db->lasterror;
}
- if (empty($obj)) {
- $error++;
- $this->errors[] = 'PrinterDontExist';
- }
- if (!$error) {
- $parameter = $obj['parameter'];
- try {
- switch ($obj['fk_type']) {
- case 1:
- $this->connector = new DummyPrintConnector();
- break;
- case 2:
- $this->connector = new FilePrintConnector($parameter);
- break;
- case 3:
- $parameters = explode(':', $parameter);
- $this->connector = new NetworkPrintConnector($parameters[0], $parameters[1]);
- break;
- case 4: // LPT1, smb://...
- $this->connector = new WindowsPrintConnector(dol_sanitizePathName($parameter));
- break;
- case 5:
- $this->connector = new CupsPrintConnector($parameter);
- break;
- default:
- $this->connector = 'CONNECTOR_UNKNOWN';
- break;
- }
- $this->printer = new Printer($this->connector, $this->profile);
- } catch (Exception $e) {
- $this->errors[] = $e->getMessage();
- $error++;
- }
- }
+
return $error;
}
}
diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php
index 517fc953830..b5b1619443b 100644
--- a/htdocs/core/class/emailsenderprofile.class.php
+++ b/htdocs/core/class/emailsenderprofile.class.php
@@ -56,6 +56,8 @@ class EmailSenderProfile extends CommonObject
*/
public $picto = 'emailsenderprofile';
+ public $fk_user_creat;
+
const STATUS_DISABLED = 0;
const STATUS_ENABLED = 1;
diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php
index ea8618c8b92..8e325fd13e2 100644
--- a/htdocs/core/class/fileupload.class.php
+++ b/htdocs/core/class/fileupload.class.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2011-2022 Regis Houssin
* Copyright (C) 2011-2012 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
@@ -216,7 +216,7 @@ class FileUpload
/**
* Set delete url
*
- * @param string $file Filename
+ * @param object $file Filename
* @return void
*/
protected function setFileDeleteUrl($file)
@@ -301,7 +301,7 @@ class FileUpload
* Enter description here ...
*
* @param string $uploaded_file Uploade file
- * @param string $file File
+ * @param object $file File
* @param string $error Error
* @param string $index Index
* @return boolean True if OK, False if KO
@@ -538,7 +538,7 @@ class FileUpload
/**
* Delete uploaded file
*
- * @return void
+ * @return string
*/
public function delete()
{
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 81fbb83b264..31f69878dda 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -466,6 +466,8 @@ class Form
$ext_element = false;
$button_only = false;
$inputOption = '';
+ $rows = '';
+ $cols = '';
if (is_object($object)) {
$element = $object->element;
@@ -1001,9 +1003,10 @@ class Form
* @param string $htmloption Options html on select object
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
+ * @param array $disableautocomplete Disable autocomplete
* @return string HTML string with select and input
*/
- public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array())
+ public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array(), $disableautocomplete = 0)
{
// phpcs:enable
global $conf, $langs;
@@ -1038,8 +1041,6 @@ class Form
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
- $foundselected = false;
-
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$incotermArray[$i]['rowid'] = $obj->rowid;
@@ -1901,6 +1902,7 @@ class Form
{
// phpcs:enable
global $conf, $user, $langs, $hookmanager;
+ global $action;
// If no preselected user defined, we take current user
if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) {
@@ -2414,6 +2416,7 @@ class Form
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
+ $events = array();
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
}
@@ -2752,7 +2755,6 @@ class Form
$objp->price = $objp2->price;
$objp->unitprice = $objp2->unitprice;
$objp->remise_percent = $objp2->remise_percent;
- $objp->remise = $objp2->remise;
//$objp->tva_tx is not overwritten by $objp2 value
//$objp->default_vat_code is not overwritten by $objp2 value
@@ -3506,7 +3508,7 @@ class Form
$opt .= ' 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.'"';
+ $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.'"';
}
$opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
@@ -4192,6 +4194,7 @@ class Form
}
}
$out .= '>';
+ $value = '';
if ($format == 0) {
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 1) {
@@ -6333,6 +6336,9 @@ class Form
// Analysis of the pre-selection date
$reg = array();
+ $shour = '';
+ $smin = '';
+ $ssec = '';
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) { // deprecated usage
// Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
$syear = (!empty($reg[1]) ? $reg[1] : '');
@@ -6349,10 +6355,6 @@ class Form
$shour = dol_print_date($set_time, "%H", $gm);
$smin = dol_print_date($set_time, "%M", $gm);
$ssec = dol_print_date($set_time, "%S", $gm);
- } else {
- $shour = '';
- $smin = '';
- $ssec = '';
}
} else {
// Date est '' ou vaut -1
@@ -6878,6 +6880,7 @@ class Form
unset($tickettmpselect);
}
+ $urloption = '';
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
@@ -7020,16 +7023,11 @@ class Form
protected function constructTicketListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
{
$outkey = '';
- $outval = '';
$outref = '';
- $outlabel = '';
$outtype = '';
- $label = $objp->label;
-
$outkey = $objp->rowid;
$outref = $objp->ref;
- $outlabel = $objp->label;
$outtype = $objp->fk_product_type;
$opt = 'ref;
$objRef = $objp->ref;
if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '$1 ', $objRef, 1);
- $outval .= $objRef;
$opt .= " \n";
- $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem);
+ $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype);
}
/**
@@ -7621,7 +7618,7 @@ class Form
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...)
$tmpfieldstoshow = '';
foreach ($objecttmp->fields as $key => $val) {
- if (!dol_eval($val['enabled'], 1, 1, 1, '1')) {
+ if (!dol_eval($val['enabled'], 1, 1, '1')) {
continue;
}
if (!empty($val['showoncombobox'])) {
@@ -7648,6 +7645,7 @@ class Form
$out = '';
$outarray = array();
+ $tmparray = array();
$num = 0;
@@ -8286,7 +8284,7 @@ class Form
* @param string $htmlname Name of HTML field
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
* @param string $varpage Id of context for page. Can be set by caller with $varpage=(empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage);
- * @param string $pos position colon on liste value left or right
+ * @param string $pos Position colon on liste value 'left' or '' (meaning 'right').
* @return string HTML multiselect string
* @see selectarray()
*/
@@ -8631,10 +8629,26 @@ class Form
}
$possiblelinks = array(
- 'propal'=>array('enabled'=>$conf->propal->enabled, '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').')'),
- 'order'=>array('enabled'=>$conf->commande->enabled, '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').')'),
- 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', '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()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
- 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, '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').')'),
+ 'propal'=>array(
+ 'enabled'=>$conf->propal->enabled,
+ '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').')'),
+ 'order'=>array(
+ 'enabled'=>$conf->commande->enabled,
+ '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').')'),
+ 'invoice'=>array(
+ 'enabled'=>$conf->facture->enabled,
+ 'perms'=>1,
+ 'label'=>'LinkToInvoice',
+ '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()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
+ 'invoice_template'=>array(
+ 'enabled'=>$conf->facture->enabled,
+ 'perms'=>1,
+ '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'=>$conf->contrat->enabled,
'perms'=>1,
@@ -8642,12 +8656,35 @@ class Form
'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, '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').')'),
- 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
- 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', '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()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
- 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, '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'=>$conf->ticket->enabled, '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'=>$conf->mrp->enabled, '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').')')
+ 'fichinter'=>array(
+ 'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0),
+ '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').')'),
+ 'supplier_proposal'=>array(
+ 'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToSupplierProposal',
+ 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
+ 'order_supplier'=>array(
+ 'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0),
+ 'perms'=>1,
+ 'label'=>'LinkToSupplierOrder',
+ '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()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
+ 'invoice_supplier'=>array(
+ 'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0),
+ '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),
+ '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),
+ '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').')')
);
}
@@ -9353,10 +9390,12 @@ class Form
global $conf, $user, $langs;
// Permettre l'exclusion de groupes
+ $excludeGroups = null;
if (is_array($exclude)) {
$excludeGroups = implode(",", $exclude);
}
// Permettre l'inclusion de groupes
+ $includeGroups = null;
if (is_array($include)) {
$includeGroups = implode(",", $include);
}
@@ -9920,7 +9959,7 @@ class Form
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out .= '>' . $labeltoshow . ' ';
} else {
- if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
+ if ($disabled && ($selected != $obj->rowid)) {
$resultat = '';
} else {
$resultat = 'setid ';
- //$retstring .= 'setlabel ';
}
return $retstring;
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index 457d310492c..fac32e62e5e 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -86,23 +86,21 @@ class FormActions
select_status();
$('#select' + htmlname).change(function() {
+ console.log('We change field select '+htmlname);
select_status();
});
- // FIXME use another method for update combobox
- //$('#val' + htmlname).change(function() {
- //select_status();
- //});
});
function select_status() {
var defaultvalue = $('#select' + htmlname).val();
+ console.log('val='+defaultvalue);
var percentage = $('input[name=percentage]');
var selected = '".(isset($selected) ? dol_escape_js($selected) : '')."';
var value = (selected>0?selected:(defaultvalue>=0?defaultvalue:''));
percentage.val(value);
- if (defaultvalue == -1) {
+ if (defaultvalue == 'na' || defaultvalue == -1) {
percentage.prop('disabled', true);
$('.hideifna').hide();
}
@@ -131,7 +129,7 @@ class FormActions
}
print '';
if ($showempty) {
- print ' ';
+ print ' ';
}
foreach ($listofstatus as $key => $val) {
print ' 0 && $selected < 100) && $key == '50') ? ' selected' : '').'>'.$val.' ';
diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php
index b26438fd9e9..1cfddb588fd 100644
--- a/htdocs/core/class/html.formsetup.class.php
+++ b/htdocs/core/class/html.formsetup.class.php
@@ -240,10 +240,24 @@ class FormSetup
* saveConfFromPost
*
* @param bool $noMessageInUpdate display event message on errors and success
- * @return void|null
+ * @return int -1 if KO, 1 if OK
*/
public function saveConfFromPost($noMessageInUpdate = false)
{
+ global $hookmanager;
+
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
+ if ($reshook < 0) {
+ $this->setErrors($hookmanager->errors);
+ return -1;
+ }
+
+ if ($reshook > 0) {
+ return $reshook;
+ }
+
+
if (empty($this->items)) {
return null;
}
@@ -265,11 +279,13 @@ class FormSetup
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupSaved"), null);
}
+ return 1;
} else {
$this->db->rollback();
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
}
+ return -1;
}
}
@@ -406,7 +422,7 @@ class FormSetup
if (!array($this->items)) { return false; }
foreach ($this->items as $item) {
- $item->reloadValueFromConf();
+ $item->loadValueFromConf();
}
return true;
@@ -571,8 +587,11 @@ class FormSetupItem
/** @var string $fieldValue */
public $fieldValue;
+ /** @var string $defaultFieldValue */
+ public $defaultFieldValue = null;
+
/** @var array $fieldAttr fields attribute only for compatible fields like input text */
- public $fieldAttr;
+ public $fieldAttr = array();
/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
public $fieldOverride = false;
@@ -632,17 +651,33 @@ class FormSetupItem
$this->entity = $conf->entity;
$this->confKey = $confKey;
- $this->fieldValue = $conf->global->{$this->confKey};
+ $this->loadValueFromConf();
}
/**
- * reload conf value from databases
- * @return null
+ * load conf value from databases
+ * @return bool
+ */
+ public function loadValueFromConf()
+ {
+ global $conf;
+ if (isset($conf->global->{$this->confKey})) {
+ $this->fieldValue = $conf->global->{$this->confKey};
+ return true;
+ } else {
+ $this->fieldValue = null;
+ return false;
+ }
+ }
+
+ /**
+ * reload conf value from databases is an aliase of loadValueFromConf
+ * @deprecated
+ * @return bool
*/
public function reloadValueFromConf()
{
- global $conf;
- $this->fieldValue = $conf->global->{$this->confKey};
+ return $this->loadValueFromConf();
}
@@ -652,8 +687,22 @@ class FormSetupItem
*/
public function saveConfValue()
{
+ global $hookmanager;
+
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfValue', $parameters, $this); // Note that $action and $object may have been modified by some hooks
+ if ($reshook < 0) {
+ $this->setErrors($hookmanager->errors);
+ return -1;
+ }
+
+ if ($reshook > 0) {
+ return $reshook;
+ }
+
+
if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
- return call_user_func($this->saveCallBack);
+ return call_user_func($this->saveCallBack, $this);
}
// Modify constant only if key was posted (avoid resetting key to the null value)
@@ -761,6 +810,12 @@ class FormSetupItem
return $this->fieldInputOverride;
}
+ // Set default value
+ if (is_null($this->fieldValue)) {
+ $this->fieldValue = $this->defaultFieldValue;
+ }
+
+
$this->fieldAttr['name'] = $this->confKey;
$this->fieldAttr['id'] = 'setup-'.$this->confKey;
$this->fieldAttr['value'] = $this->fieldValue;
@@ -777,6 +832,8 @@ class FormSetupItem
$out.= $this->generateInputFieldTextarea();
} elseif ($this->type== 'html') {
$out.= $this->generateInputFieldHtml();
+ } elseif ($this->type== 'color') {
+ $out.= $this->generateInputFieldColor();
} elseif ($this->type == 'yesno') {
$out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
@@ -795,14 +852,22 @@ class FormSetupItem
$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
}
} else {
- if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
-
- $out.= ' fieldAttr).' />';
+ $out.= $this->generateInputFieldText();
}
return $out;
}
+ /**
+ * generatec default input field
+ * @return string
+ */
+ public function generateInputFieldText()
+ {
+ if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
+ return ' fieldAttr).' />';
+ }
+
/**
* generate input field for textarea
* @return string
@@ -999,6 +1064,8 @@ class FormSetupItem
$out.= $this->generateOutputFieldSelect();
} elseif ($this->type== 'html') {
$out.= $this->fieldValue;
+ } elseif ($this->type== 'color') {
+ $out.= $this->generateOutputFieldColor();
} elseif ($this->type == 'yesno') {
$out.= ajax_constantonoff($this->confKey);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
@@ -1013,6 +1080,7 @@ class FormSetupItem
}
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) {
+ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$result = $c->fetch($this->fieldValue);
if ($result < 0) {
@@ -1071,6 +1139,22 @@ class FormSetupItem
return $outPut;
}
+ /**
+ * @return string
+ */
+ public function generateOutputFieldColor()
+ {
+ $this->fieldAttr['disabled']=null;
+ return $this->generateInputField();
+ }
+ /**
+ * @return string
+ */
+ public function generateInputFieldColor()
+ {
+ $this->fieldAttr['type']= 'color';
+ return $this->generateInputFieldText();
+ }
/**
* @return string
@@ -1099,6 +1183,16 @@ class FormSetupItem
return $this;
}
+ /**
+ * Set type of input as color
+ * @return self
+ */
+ public function setAsColor()
+ {
+ $this->type = 'color';
+ return $this;
+ }
+
/**
* Set type of input as textarea
* @return self
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index a7cc3a996b4..5600f51f5e2 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -73,6 +73,7 @@ class FormTicket
public $ispublic; // To show information or not into public form
public $withtitletopic;
+ public $withtopicreadonly;
public $withcompany; // affiche liste déroulante company
public $withfromsocid;
public $withfromcontactid;
@@ -84,6 +85,11 @@ class FormTicket
public $withcancel;
+ public $type_code;
+ public $category_code;
+ public $severity_code;
+
+
/**
*
* @var array $substit Substitutions
@@ -113,7 +119,7 @@ class FormTicket
$this->withcompany = $conf->societe->enabled ? 1 : 0;
$this->withfromsocid = 0;
$this->withfromcontactid = 0;
- //$this->withthreadid=0;
+ //$this->withreadid=0;
//$this->withtitletopic='';
$this->withnotifytiersatcreate = 0;
$this->withusercreate = 1;
@@ -280,6 +286,7 @@ class FormTicket
}
// If ticket created from another object
+ $subelement = '';
if (isset($this->param['origin']) && $this->param['originid'] > 0) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $this->param['origin'];
@@ -331,8 +338,8 @@ class FormTicket
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
print '';
} else {
- if ($this->withthreadid > 0) {
- $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withthreadid.' : '.$this->topic_title.'';
+ if ($this->withreadid > 0) {
+ $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.'';
}
print ' ';
print '';
@@ -628,11 +635,11 @@ class FormTicket
print ' ';
- print $form->buttonsSaveCancel((($this->withthreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
+ print $form->buttonsSaveCancel((($this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
/*
print '';
- print '
';
+ print '
';
if ($this->withcancel) {
print " ";
print '
';
@@ -1267,7 +1274,7 @@ class FormTicket
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
foreach ($this->param['fileinit'] as $file) {
- $this->add_attached_files($file, basename($file), dol_mimetype($file));
+ $formmail->add_attached_files($file, basename($file), dol_mimetype($file));
}
}
}
@@ -1365,6 +1372,9 @@ class FormTicket
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
+ $ticketstat = new Ticket($this->db);
+ $res = $ticketstat->fetch('', '', $this->track_id);
+
print '
';
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':''));
print ' ';
@@ -1395,18 +1405,18 @@ class FormTicket
// Subject
print ' '.$langs->trans('Subject').' ';
- print ' ref.'] '.$langs->trans('TicketNewMessage').'" />';
+ print ' ref.'] '.$langs->trans('TicketNewMessage').'" />';
print '';
// Destinataires
print '
'.$langs->trans('MailRecipients').' ';
- $ticketstat = new Ticket($this->db);
- $res = $ticketstat->fetch('', '', $this->track_id);
if ($res) {
// Retrieve email of all contacts (internal and external)
$contacts = $ticketstat->getInfosTicketInternalContact();
$contacts = array_merge($contacts, $ticketstat->getInfosTicketExternalContact());
+ $sendto = array();
+
// Build array to display recipient list
if (is_array($contacts) && count($contacts) > 0) {
foreach ($contacts as $key => $info_sendto) {
@@ -1416,7 +1426,7 @@ class FormTicket
}
}
- if ($ticketstat->origin_email && !in_array($this->dao->origin_email, $sendto)) {
+ if ($ticketstat->origin_email && !in_array($ticketstat->origin_email, $sendto)) {
$sendto[] = dol_escape_htmltag($ticketstat->origin_email).' ('.$langs->trans("TicketEmailOriginIssuer").") ";
}
diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php
index f3d46e09f30..8b74609bfa3 100644
--- a/htdocs/core/class/utils.class.php
+++ b/htdocs/core/class/utils.class.php
@@ -342,7 +342,7 @@ class Utils
$handle = '';
- $lowmemorydump = GETPOSTISSET("lowmemorydump", "alpha") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP');
+ $lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP');
// Start call method to execute dump
$fullcommandcrypted = $command." ".$paramcrypted." 2>&1";
diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php
index ace78c5199a..476b1d5a4da 100644
--- a/htdocs/core/customreports.php
+++ b/htdocs/core/customreports.php
@@ -465,7 +465,7 @@ print '';
$count = 0;
print '';
print '
';
-print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
+print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
print '
';
diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php
index 10f9c021c0d..8d0141e8ca6 100644
--- a/htdocs/core/db/sqlite3.class.php
+++ b/htdocs/core/db/sqlite3.class.php
@@ -38,7 +38,10 @@ class DoliDBSqlite3 extends DoliDB
const LABEL = 'Sqlite3';
//! Version min database
const VERSIONMIN = '3.0.0';
- /** @var SQLite3Result Resultset of last query */
+
+ /**
+ * @var SQLite3Result|boolean Resultset of last query
+ */
private $_results;
const WEEK_MONDAY_FIRST = 1;
@@ -1026,7 +1029,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
- * @return SQLite3Result Resource
+ * @return bool|SQLite3Result Resource
*/
public function DDLDescTable($table, $field = "")
{
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 6b0852e4784..4e972b0be4e 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -272,7 +272,8 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
"cover" => $obj->cover,
"position" => (int) $obj->position,
"acl" => $obj->acl,
- "share" => $obj->share
+ "share" => $obj->share,
+ "description" => $obj->description
);
}
$i++;
@@ -2801,7 +2802,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
- if ($fuser->societe_id > 0) {
+ if ($fuser->socid > 0) {
$original_file = $conf->facture->dir_output.'/payments/private/'.$fuser->id.'/'.$original_file;
} else {
$original_file = $conf->facture->dir_output.'/payments/'.$original_file;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index bca479dd910..b400a4e7c1b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -547,6 +547,9 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
}
} elseif (isset($user->default_values[$relativepathstring]['filters'])) {
foreach ($user->default_values[$relativepathstring]['filters'] as $defkey => $defval) { // $defkey is a querystring like 'a=b&c=d', $defval is key of user
+ if (!empty($_GET['disabledefaultvalues'])) { // If set of default values has been disabled by a request parameter
+ continue;
+ }
$qualified = 0;
if ($defkey != '_noquery_') {
$tmpqueryarraytohave = explode('&', $defkey);
@@ -1581,8 +1584,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
* @param string $disabled Disabled text
* @param string $morecss More CSS
* @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect.
- * Value is 'Name of html component to set with id:Name of html component to set with label'
- * TODO Support this mode, for example when used from the page create a project on thirdparty creation.
+ * Value is 'keyforpopupid:Name_of_html_component_to_set_with id,Name_of_html_component_to_set_with_label'
* @return string HTML component with button
*/
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'button bordertransp', $backtopagejsfields = '')
@@ -1597,10 +1599,16 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
$backtopagejsfieldsid = ''; $backtopagejsfieldslabel = '';
if ($backtopagejsfields) {
- $url .= '&backtopagejsfields='.urlencode($backtopagejsfields);
$tmpbacktopagejsfields = explode(':', $backtopagejsfields);
- $backtopagejsfieldsid = empty($tmpbacktopagejsfields[0]) ? '' : $tmpbacktopagejsfields[0];
- $backtopagejsfieldslabel = empty($tmpbacktopagejsfields[1]) ? '' : $tmpbacktopagejsfields[1];
+ if (empty($tmpbacktopagejsfields[1])) { // If the part 'keyforpopupid:' is missing, we add $name for it.
+ $backtopagejsfields = $name.":".$backtopagejsfields;
+ $tmp2backtopagejsfields = explode(',', $tmpbacktopagejsfields[0]);
+ } else {
+ $tmp2backtopagejsfields = explode(',', $tmpbacktopagejsfields[1]);
+ }
+ $backtopagejsfieldsid = empty($tmp2backtopagejsfields[0]) ? '' : $tmp2backtopagejsfields[0];
+ $backtopagejsfieldslabel = empty($tmp2backtopagejsfields[1]) ? '' : $tmp2backtopagejsfields[1];
+ $url .= '&backtopagejsfields='.urlencode($backtopagejsfields);
}
//print ' ';
@@ -1623,7 +1631,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
width: \'80%\',
title: \''.dol_escape_js($label).'\',
open: function (event, ui) {
- console.log("open popup");
+ console.log("open popup name='.$name.', backtopagejsfields='.$backtopagejsfields.'");
},
close: function (event, ui) {
returnedid = jQuery("#varforreturndialogid'.$name.'").text();
@@ -1772,7 +1780,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out .= '';
if (!empty($links[$i][0])) {
$titletoshow = preg_replace('/<.*$/', '', $links[$i][1]);
- $out .= '
';
+ $out .= ' ';
}
$out .= $links[$i][1];
if (!empty($links[$i][0])) {
@@ -1820,7 +1828,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
if (empty($tabsname)) {
$tabsname = str_replace("@", "", $picto);
}
- $out .= '';
+ $out .= '
';
$out .= '
'; // Do not use "reposition" class in the "More".
$out .= '
';
$out .= $outmore;
diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php
index 788eda15818..a775569407a 100644
--- a/htdocs/core/lib/modulebuilder.lib.php
+++ b/htdocs/core/lib/modulebuilder.lib.php
@@ -128,46 +128,46 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).",";
$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
$texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).",";
- if ($val['noteditable']) {
+ if (!empty($val['noteditable'])) {
$texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
}
- if ($val['default'] || $val['default'] === '0') {
+ if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) {
$texttoinsert .= " 'default'=>'".$val['default']."',";
}
- if ($val['index']) {
+ if (!empty($val['index'])) {
$texttoinsert .= " 'index'=>".$val['index'].",";
}
- if ($val['foreignkey']) {
+ if (!empty($val['foreignkey'])) {
$texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
}
- if ($val['searchall']) {
+ if (!empty($val['searchall'])) {
$texttoinsert .= " 'searchall'=>".$val['searchall'].",";
}
- if ($val['isameasure']) {
+ if (!empty($val['isameasure'])) {
$texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
}
- if ($val['css']) {
+ if (!empty($val['css'])) {
$texttoinsert .= " 'css'=>'".$val['css']."',";
}
- if ($val['cssview']) {
+ if (!empty($val['cssview'])) {
$texttoinsert .= " 'cssview'=>'".$val['cssview']."',";
}
- if ($val['csslist']) {
+ if (!empty($val['csslist'])) {
$texttoinsert .= " 'csslist'=>'".$val['csslist']."',";
}
- if ($val['help']) {
+ if (!empty($val['help'])) {
$texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
}
- if ($val['showoncombobox']) {
+ if (!empty($val['showoncombobox'])) {
$texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
}
- if ($val['disabled']) {
+ if (!empty($val['disabled'])) {
$texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
}
- if ($val['autofocusoncreate']) {
+ if (!empty($val['autofocusoncreate'])) {
$texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
}
- if ($val['arrayofkeyval']) {
+ if (!empty($val['arrayofkeyval'])) {
$texttoinsert .= " 'arrayofkeyval'=>array(";
$i = 0;
foreach ($val['arrayofkeyval'] as $key2 => $val2) {
@@ -179,10 +179,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
}
$texttoinsert .= "),";
}
- if ($val['validate']) {
+ if (!empty($val['validate'])) {
$texttoinsert .= " 'validate'=>'".$val['validate']."',";
}
- if ($val['comment']) {
+ if (!empty($val['comment'])) {
$texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
}
@@ -314,7 +314,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
if ($key == 'entity') {
$texttoinsert .= ' DEFAULT 1';
} else {
- if ($val['default'] != '') {
+ if (!empty($val['default'])) {
if (preg_match('/^null$/i', $val['default'])) {
$texttoinsert .= " DEFAULT NULL";
} elseif (preg_match('/varchar/', $type)) {
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 37223701ff7..a4232095f4b 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -527,102 +527,100 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
if ($mode == 'target' || preg_match('/targetwithdetails/', $mode)) {
if ($usecontact) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
+ if (is_object($targetcontact)) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1));
- if (!empty($targetcontact->address)) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
- } else {
- $companytouseforaddress = $targetcompany;
+ if (!empty($targetcontact->address)) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
+ } else {
+ $companytouseforaddress = $targetcompany;
- // Contact on a thirdparty that is a different thirdparty than the thirdparty of object
- if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
- $targetcontact->fetch_thirdparty();
- $companytouseforaddress = $targetcontact->thirdparty;
+ // Contact on a thirdparty that is a different thirdparty than the thirdparty of object
+ if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) {
+ $targetcontact->fetch_thirdparty();
+ $companytouseforaddress = $targetcontact->thirdparty;
+ }
+
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress));
+ }
+ // Country
+ if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));
+ } elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
}
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress));
- }
- // Country
- if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));
- } elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
- }
-
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
- // Phone
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
- if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
+ // Phone
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
+ if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
+ }
+ if (!empty($targetcontact->phone_pro)) {
+ $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
+ }
+ if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
+ $stringaddress .= " / ";
+ }
+ if (!empty($targetcontact->phone_mobile)) {
+ $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
+ }
}
- if (!empty($targetcontact->phone_pro)) {
- $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
+ // Fax
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
+ if ($targetcontact->fax) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
+ }
}
- if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) {
- $stringaddress .= " / ";
+ // EMail
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
+ if ($targetcontact->email) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
+ }
}
- if (!empty($targetcontact->phone_mobile)) {
- $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
- }
- }
- // Fax
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
- if ($targetcontact->fax) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
- }
- }
- // EMail
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
- if ($targetcontact->email) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
- }
- }
- // Web
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
- if ($targetcontact->url) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
+ // Web
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
+ if ($targetcontact->url) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
+ }
}
}
}
} else {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
- // Country
- if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
- }
+ if (is_object($targetcompany)) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
+ // Country
+ if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
+ }
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
- // Phone
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
- if (!empty($targetcompany->phone) || !empty($targetcompany->phone_mobile)) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/', $mode)) {
+ // Phone
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) {
+ if (!empty($targetcompany->phone)) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": ";
+ }
+ if (!empty($targetcompany->phone)) {
+ $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
+ }
}
- if (!empty($targetcompany->phone)) {
- $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
+ // Fax
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
+ if ($targetcompany->fax) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
+ }
}
- if (!empty($targetcompany->phone) && !empty($targetcompany->phone_mobile)) {
- $stringaddress .= " / ";
+ // EMail
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
+ if ($targetcompany->email) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
+ }
}
- if (!empty($targetcompany->phone_mobile)) {
- $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile);
- }
- }
- // Fax
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) {
- if ($targetcompany->fax) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
- }
- }
- // EMail
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) {
- if ($targetcompany->email) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
- }
- }
- // Web
- if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
- if ($targetcompany->url) {
- $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
+ // Web
+ if (!empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) {
+ if ($targetcompany->url) {
+ $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
+ }
}
}
}
diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php
index 1ee7ff94998..3626b36d7e3 100644
--- a/htdocs/core/modules/action/rapport.pdf.php
+++ b/htdocs/core/modules/action/rapport.pdf.php
@@ -63,6 +63,14 @@ class CommActionRapport
public $marge_basse;
+ public $format;
+
+ public $type;
+
+ public $page_hauteur;
+
+ public $page_largeur;
+
/**
* Constructor
diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
index 7fe684c9da1..247362b41dd 100644
--- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
+++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
@@ -89,7 +89,6 @@ class doc_generic_asset_odt extends ModelePDFAsset
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/asset/modules_asset.php b/htdocs/core/modules/asset/modules_asset.php
index e158b5bdfe9..f7f361a10cc 100644
--- a/htdocs/core/modules/asset/modules_asset.php
+++ b/htdocs/core/modules/asset/modules_asset.php
@@ -37,6 +37,41 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFAsset extends CommonDocGenerator
{
+ /**
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php
index bfa313bad0b..3ab1cdcc193 100644
--- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php
+++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php
@@ -74,7 +74,6 @@ class pdf_ban extends ModeleBankAccountDoc
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; // Display product-service code
// Retrieves transmitter
$this->emetteur = $mysoc;
diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
index 2194358afab..8afafd8c06c 100644
--- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
+++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
@@ -79,7 +79,6 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; //Display product-service code
// Retrieves transmitter
$this->emetteur = $mysoc;
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index c59d1c40ee9..94e0a634328 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -90,7 +90,6 @@ class doc_generic_order_odt extends ModelePDFCommandes
$this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index fa9d83ea926..56ae5f5af7e 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -158,7 +158,6 @@ class pdf_einstein extends ModelePDFCommandes
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index b5f2ee5af43..1a7e28d3bd4 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -163,7 +163,6 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index d673379b32d..23ed4bec34a 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -88,7 +88,6 @@ class doc_generic_contract_odt extends ModelePDFContract
$this->option_tva = 0; // Manage the vat CONTRACT_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
index 085f7bee190..4dbad109cf4 100644
--- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php
+++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
@@ -154,7 +154,6 @@ class pdf_strato extends ModelePDFContract
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 0; // Available in several languages
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
index 65912a8b9a0..9c588fdf55e 100644
--- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
+++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php
@@ -147,7 +147,6 @@ class pdf_storm extends ModelePDFDeliveryOrder
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; // Display product-service code
// Get source company
$this->emetteur = $mysoc;
diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
index 5875814b546..a9537b324f1 100644
--- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
+++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
@@ -146,7 +146,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; // Display product-service code
// Get source company
$this->emetteur = $mysoc;
diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
index a916bcc534f..209acf648d6 100644
--- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
+++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
@@ -90,7 +90,6 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$this->option_tva = 0; // Manage the vat option EXPEDITION_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
index efc061b9e67..a038705ea22 100644
--- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
@@ -120,7 +120,7 @@ class pdf_espadon extends ModelePdfExpedition
*
* @param DoliDB $db Database handler
*/
- public function __construct($db = 0)
+ public function __construct(DoliDB $db)
{
global $conf, $langs, $mysoc;
@@ -642,7 +642,7 @@ class pdf_espadon extends ModelePdfExpedition
if ($this->getColumnStatus('weight')) {
- $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt) ? ' ' : '').$voltxt, array('html'=>1));
+ $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt) ? ' ' : '').$voltxt);
$nexY = max($pdf->GetY(), $nexY);
}
diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
index 9a905422ff1..69105dd31cc 100644
--- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php
@@ -121,7 +121,7 @@ class pdf_merou extends ModelePdfExpedition
*
* @param DoliDB $db Database handler
*/
- public function __construct($db = 0)
+ public function __construct(DoliDB $db)
{
global $conf, $langs, $mysoc;
@@ -584,7 +584,7 @@ class pdf_merou extends ModelePdfExpedition
$origin_id = $object->origin_id;
// Add list of linked elements
- $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1, $hookmanager);
+ $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1);
//$this->Code39($Xoff+43, $Yoff+1, $object->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
//Definition Location of the Company block
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index 94e048382dc..64d8a2c65e6 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -121,7 +121,7 @@ class pdf_rouget extends ModelePdfExpedition
*
* @param DoliDB $db Database handler
*/
- public function __construct($db = 0)
+ public function __construct(DoliDB $db)
{
global $conf, $langs, $mysoc;
diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
index a4e3ab491a5..907688b4878 100644
--- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php
@@ -81,47 +81,20 @@ class pdf_standard extends ModeleExpenseReport
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
/**
* Issuer
* @var Societe
*/
public $emetteur;
+ public $posxpiece;
+ public $posxcomment;
+ public $posxtva;
+ public $posxup;
+ public $posxqty;
+ public $postotalht;
+ public $postotalttc;
+
/**
* Constructor
@@ -155,7 +128,6 @@ class pdf_standard extends ModeleExpenseReport
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php
index c4d74d7b6d2..eee2190033e 100644
--- a/htdocs/core/modules/expensereport/modules_expensereport.php
+++ b/htdocs/core/modules/expensereport/modules_expensereport.php
@@ -28,6 +28,41 @@ abstract class ModeleExpenseReport extends CommonDocGenerator
*/
public $error = '';
+ /**
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index e9b985ee151..07a1e3966a6 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -89,7 +89,6 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 8046347e881..55f96b489e1 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -164,7 +164,6 @@ class pdf_crabe extends ModelePDFFactures
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 1; // Displays if there has been a discount
$this->option_credit_note = 1; // Support credit notes
@@ -874,12 +873,12 @@ class pdf_crabe extends ModelePDFFactures
/**
* Show payments table
*
- * @param TCPDF $pdf Object PDF
- * @param Facture $object Object invoice
- * @param int $posy Position y in PDF
- * @param Translate $outputlangs Object langs for output
- * @param int $heightforfooter height for footer
- * @return int <0 if KO, >0 if OK
+ * @param TCPDF $pdf Object PDF
+ * @param Facture $object Object invoice
+ * @param int $posy Position y in PDF
+ * @param Translate $outputlangs Object langs for output
+ * @param int $heightforfooter Height for footer
+ * @return int <0 if KO, >0 if OK
*/
protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0)
{
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 65e3c0cfc77..70c02ade03e 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -165,7 +165,6 @@ class pdf_sponge extends ModelePDFFactures
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 1; // Displays if there has been a discount
$this->option_credit_note = 1; // Support credit notes
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index 719fb670672..e93e5a3e688 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -146,7 +146,6 @@ class pdf_soleil extends ModelePDFFicheinter
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
index a1647a67953..ce780a0ba58 100644
--- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php
+++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php
@@ -85,7 +85,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
$tooltip .= $langs->trans("GenericMaskCodes5");
$texte .= '
'.$langs->trans("Mask").': ';
- $texte .= ''.$form->textwithpicto(' ', $tooltip, 1, 1).' ';
+ $texte .= ''.$form->textwithpicto(' ', $tooltip, 1, 1).' ';
$texte .= ' ';
$texte .= ' ';
$texte .= '
';
@@ -127,7 +127,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $mask = $conf->global->HOLIDAY_IMMACULATE_MASK;
+ $mask = getDolGlobalString('HOLIDAY_IMMACULATE_MASK');
if (!$mask) {
$this->error = 'NotConfigured';
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index eef7305e1bc..0000189c998 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -826,11 +826,12 @@ class ImportCsv extends ModeleImports
$resql = $this->db->query($sqlSelect);
if ($resql) {
- $res = $this->db->fetch_object($resql);
- if ($resql->num_rows == 1) {
+ $num_rows = $this->db->num_rows($resql);
+ if ($num_rows == 1) {
+ $res = $this->db->fetch_object($resql);
$lastinsertid = $res->rowid;
$last_insert_id_array[$tablename] = $lastinsertid;
- } elseif ($resql->num_rows > 1) {
+ } elseif ($num_rows > 1) {
$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
$this->errors[$error]['type'] = 'SQL';
$error++;
@@ -859,7 +860,7 @@ class ImportCsv extends ModeleImports
$resql = $this->db->query($sqlSelect);
if ($resql) {
$res = $this->db->fetch_object($resql);
- if ($resql->num_rows == 1) {
+ if ($this->db->num_rows($resql) == 1) {
// We have a row referencing this last foreign key, continue with UPDATE.
} else {
// No record found referencing this last foreign key,
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index 65985e6856a..257a9a13c6a 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -869,11 +869,12 @@ class ImportXlsx extends ModeleImports
$resql = $this->db->query($sqlSelect);
if ($resql) {
- $res = $this->db->fetch_object($resql);
- if ($resql->num_rows == 1) {
+ $num_rows = $this->db->num_rows($resql);
+ if ($num_rows == 1) {
+ $res = $this->db->fetch_object($resql);
$lastinsertid = $res->rowid;
$last_insert_id_array[$tablename] = $lastinsertid;
- } elseif ($resql->num_rows > 1) {
+ } elseif ($num_rows > 1) {
$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
$this->errors[$error]['type'] = 'SQL';
$error++;
@@ -902,7 +903,7 @@ class ImportXlsx extends ModeleImports
$resql = $this->db->query($sqlSelect);
if ($resql) {
$res = $this->db->fetch_object($resql);
- if ($resql->num_rows == 1) {
+ if ($this->db->num_rows($resql) == 1) {
// We have a row referencing this last foreign key, continue with UPDATE.
} else {
// No record found referencing this last foreign key,
diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
index 91d2248fb48..fb084f312fe 100644
--- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
+++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
@@ -85,7 +85,6 @@ class doc_generic_member_odt extends ModelePDFMember
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php
index ffd8fde5f1d..cac9047e56e 100644
--- a/htdocs/core/modules/modAgenda.class.php
+++ b/htdocs/core/modules/modAgenda.class.php
@@ -211,8 +211,8 @@ class modAgenda extends DolibarrModules
'url'=>'/comm/action/index.php',
'langs'=>'agenda',
'position'=>86,
- 'perms'=>'$user->rights->agenda->myactions->read',
- 'enabled'=>'$conf->agenda->enabled',
+ 'perms'=>'$user->rights->agenda->myactions->read || $user->rights->resource->read',
+ 'enabled'=>'$conf->agenda->enabled || $conf->resource->enabled',
'target'=>'',
'user'=>2,
);
diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php
index da1fdcbf016..2c59b6b3172 100644
--- a/htdocs/core/modules/modResource.class.php
+++ b/htdocs/core/modules/modResource.class.php
@@ -91,7 +91,7 @@ class modResource extends DolibarrModules
// Dependencies
// List of modules id that must be enabled if this module is enabled
- $this->depends = array();
+ $this->depends = array('modResource');
// List of modules id to disable if this one is disabled
$this->requiredby = array('modPlace');
// Minimum version of PHP required by module
@@ -185,11 +185,11 @@ class modResource extends DolibarrModules
// Menus declaration
$this->menu[$r] = array(
- 'fk_menu'=>'fk_mainmenu=tools',
+ 'fk_menu'=>'fk_mainmenu=agenda',
'type'=>'left',
'titre'=> 'MenuResourceIndex',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth em92"'),
- 'mainmenu'=>'tools',
+ 'mainmenu'=>'agenda',
'leftmenu'=> 'resource',
'url'=> '/resource/list.php',
'langs'=> 'resource',
@@ -201,10 +201,10 @@ class modResource extends DolibarrModules
$r++;
$this->menu[$r++] = array(
- 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus
+ 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus
'type'=> 'left', // Toujours un menu gauche
'titre'=> 'MenuResourceAdd',
- 'mainmenu'=> 'tools',
+ 'mainmenu'=> 'agenda',
'leftmenu'=> 'resource_add',
'url'=> '/resource/card.php?action=create',
'langs'=> 'resource',
@@ -216,10 +216,10 @@ class modResource extends DolibarrModules
);
$this->menu[$r++] = array(
- 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus
+ 'fk_menu'=>'fk_mainmenu=agenda,fk_leftmenu=resource', //On utilise les ancres définis dans le menu parent déclaré au dessus
'type'=> 'left', // Toujours un menu gauche
'titre'=> 'List',
- 'mainmenu'=> 'tools',
+ 'mainmenu'=> 'agenda',
'leftmenu'=> 'resource_list',
'url'=> '/resource/list.php',
'langs'=> 'resource',
diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php
index 6fdf07d0370..a9eb5899fc8 100644
--- a/htdocs/core/modules/modSociete.class.php
+++ b/htdocs/core/modules/modSociete.class.php
@@ -467,7 +467,7 @@ class modSociete extends DolibarrModules
's.nom' => "Name*",
's.name_alias' => "AliasNameShort",
's.parent' => "ParentCompany",
- 's.status' => "Status",
+ 's.status' => "Status*",
's.code_client' => "CustomerCode",
's.code_fournisseur' => "SupplierCode",
's.code_compta' => "CustomerAccountancyCode",
diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php
index 48483066e5e..f597f580b47 100644
--- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php
@@ -52,6 +52,11 @@ class pdf_standard extends ModelePDFMovement
*/
public $description;
+ /**
+ * @var int Save the name of generated file as the main doc when generating a doc with this template
+ */
+ public $update_main_doc_field;
+
/**
* @var string document type
*/
@@ -70,46 +75,25 @@ class pdf_standard extends ModelePDFMovement
public $version = 'dolibarr';
/**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
- /**
- * @var Societe Issuer
+ * Issuer
+ * @var Societe Object that emits
*/
public $emetteur;
+ public $wref;
+ public $posxidref;
+ public $posxdatemouv;
+ public $posxdesc;
+ public $posxlabel;
+ public $posxtva;
+ public $posxqty;
+ public $posxup;
+ public $posxunit;
+ public $posxdiscount;
+ public $postotalht;
+
+
/**
* Constructor
*
@@ -126,7 +110,7 @@ class pdf_standard extends ModelePDFMovement
$this->name = "stdmouvement";
$this->description = $langs->trans("DocumentModelStandardPDF");
- // Page size for A4 format
+ // Dimension page
$this->type = 'pdf';
$formatarray = pdf_getFormat();
$this->page_largeur = $formatarray['width'];
@@ -144,7 +128,7 @@ class pdf_standard extends ModelePDFMovement
// Get source company
$this->emetteur = $mysoc;
- if (!$this->emetteur->country_code) {
+ if (empty($this->emetteur->country_code)) {
$this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
}
@@ -174,11 +158,6 @@ class pdf_standard extends ModelePDFMovement
$this->posxdiscount -= 20;
$this->postotalht -= 20;
}
- $this->tva = array();
- $this->localtax1 = array();
- $this->localtax2 = array();
- $this->atleastoneratenotnull = 0;
- $this->atleastonediscount = 0;
}
@@ -194,10 +173,12 @@ class pdf_standard extends ModelePDFMovement
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
- public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
- global $user, $langs, $conf, $mysoc, $db, $hookmanager;
+ global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
+
+ dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
if (!is_object($outputlangs)) {
$outputlangs = $langs;
@@ -207,7 +188,7 @@ class pdf_standard extends ModelePDFMovement
$outputlangs->charset_output = 'ISO-8859-1';
}
- // Load traductions files required by page
+ // Load traductions files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries"));
/**
@@ -395,19 +376,6 @@ class pdf_standard extends ModelePDFMovement
}
$num = $this->db->num_rows($resql);
-
- $arrayofselected = is_array($toselect) ? $toselect : array();
-
- $i = 0;
- $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
- if ($msid) {
- $texte = $langs->trans('StockMovementForId', $msid);
- } else {
- $texte = $langs->trans("ListOfStockMovements");
- if ($id) {
- $texte .= ' ('.$langs->trans("ForThisWarehouse").')';
- }
- }
}
// Definition of $dir and $file
@@ -492,7 +460,7 @@ class pdf_standard extends ModelePDFMovement
$pdf->useTemplate($tplidx);
}
$pagenb++;
- $this->_pagehead($pdf, $object, 1, $outputlangs);
+ $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0);
@@ -504,7 +472,8 @@ class pdf_standard extends ModelePDFMovement
// Show list of product of the MouvementStock
- $nexY += 5;
+ $nexY = $tab_top - 1;
+
$nexY = $pdf->GetY();
$nexY += 10;
diff --git a/htdocs/core/modules/movement/modules_movement.php b/htdocs/core/modules/movement/modules_movement.php
index 77ff0c42fab..1af966faf22 100644
--- a/htdocs/core/modules/movement/modules_movement.php
+++ b/htdocs/core/modules/movement/modules_movement.php
@@ -35,6 +35,44 @@ abstract class ModelePDFMovement extends CommonDocGenerator
*/
public $error = '';
+ /**
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
+
+ public $option_codestockservice;
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
index 1df69d7ae53..7463ed995d0 100644
--- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
+++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
@@ -89,7 +89,6 @@ class doc_generic_mo_odt extends ModelePDFMo
$this->option_tva = 0; // Manage the vat option
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
index 0927c795749..af37f6bbfcd 100644
--- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
+++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php
@@ -150,7 +150,6 @@ class pdf_vinci extends ModelePDFMo
$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
$this->option_logo = 1; // Display logo
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; //Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
index c1f6769579a..090a45f4b3f 100644
--- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
+++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
@@ -87,7 +87,6 @@ class doc_generic_product_odt extends ModelePDFProduct
$this->option_tva = 0; // Manage the vat option PRODUCT_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php
index 940aa1d4279..ea52b9c3c70 100644
--- a/htdocs/core/modules/product/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php
@@ -68,41 +68,6 @@ class pdf_standard extends ModelePDFProduct
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
/**
* Issuer
* @var Societe
@@ -138,7 +103,6 @@ class pdf_standard extends ModelePDFProduct
$this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
$this->option_logo = 1; // Display logo
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_freetext = 0; // Support add of a personalised text
diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php
index 4b00cbe132e..6c47847ef60 100644
--- a/htdocs/core/modules/product/modules_product.class.php
+++ b/htdocs/core/modules/product/modules_product.class.php
@@ -38,6 +38,41 @@ abstract class ModelePDFProduct extends CommonDocGenerator
*/
public $error = '';
+ /**
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index d653ed760a6..69a7a3f6232 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -124,7 +124,6 @@ class doc_generic_project_odt extends ModelePDFProjects
$this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
index 2df5e28ab9e..cf9e84a3deb 100644
--- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php
@@ -146,7 +146,6 @@ class pdf_baleine extends ModelePDFProjects
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; // Display product-service code
// Get source company
$this->emetteur = $mysoc;
diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
index f71b0cdb6a7..abd05f63651 100644
--- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
@@ -138,6 +138,14 @@ class pdf_beluga extends ModelePDFProjects
*/
public $emetteur;
+ public $posxref;
+ public $posxdate;
+ public $posxsociete;
+ public $posxamountht;
+ public $posxamountttc;
+ public $posstatut;
+
+
/**
* Constructor
*
@@ -174,7 +182,6 @@ class pdf_beluga extends ModelePDFProjects
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; // Display product-service code
// Get source company
$this->emetteur = $mysoc;
@@ -480,7 +487,7 @@ class pdf_beluga extends ModelePDFProjects
}
//var_dump("$key, $tablename, $datefieldname, $dates, $datee");
- $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, $projectField);
+ $elementarray = $object->get_element_list($key, $tablename, $datefieldname, '', '', $projectField);
$num = count($elementarray);
if ($num >= 0) {
@@ -493,7 +500,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
- $selectList = $formproject->select_element($tablename, $project->thirdparty->id, '', -2, $projectField);
+ $selectList = $formproject->select_element($tablename, $object->thirdparty->id, '', -2, $projectField);
$nexY = $pdf->GetY() + 1;
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
@@ -791,8 +798,6 @@ class pdf_beluga extends ModelePDFProjects
*/
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
- global $conf, $mysoc;
-
$heightoftitleline = 10;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -807,24 +812,6 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size);
-
- $pdf->SetXY($this->posxref, $tab_top + 1);
- $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->transnoentities("Tasks"), '', 'L');
-
- $pdf->SetXY($this->posxlabel, $tab_top + 1);
- $pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
-
- $pdf->SetXY($this->posxworkload, $tab_top + 1);
- $pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R');
-
- $pdf->SetXY($this->posxprogress, $tab_top + 1);
- $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R');
-
- $pdf->SetXY($this->posxdatestart, $tab_top + 1);
- $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C');
-
- $pdf->SetXY($this->posxdateend, $tab_top + 1);
- $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
index 2c954e19b7e..cb7430c3011 100644
--- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php
@@ -145,7 +145,6 @@ class pdf_timespent extends ModelePDFProjects
$this->option_logo = 1; // Display logo FAC_PDF_LOGO
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; // Display product-service code
// Get source company
$this->emetteur = $mysoc;
diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
index 7849e46edbe..fc83ab505d2 100644
--- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
+++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
@@ -125,7 +125,6 @@ class doc_generic_task_odt extends ModelePDFTask
$this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 0; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
index 1327c2e27a2..39ffd92ac5e 100644
--- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
+++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
@@ -87,7 +87,6 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$this->option_tva = 0; // Manage the vat option PROPALE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index c6bb975092d..bcfd91fe0f1 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -154,7 +154,6 @@ class pdf_azur extends ModelePDFPropales
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
@@ -1458,9 +1457,10 @@ class pdf_azur extends ModelePDFPropales
* @param Propal $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
+ * @param Translate $outputlangsbis Object lang for output bis
* @return void
*/
- protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
{
global $conf, $langs;
diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
index 8651a9e720f..49db078e39d 100644
--- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
@@ -157,7 +157,6 @@ class pdf_cyan extends ModelePDFPropales
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
index f8fd829591d..3e48aaf18bc 100644
--- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
+++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
@@ -83,7 +83,6 @@ class doc_generic_reception_odt extends ModelePdfReception
$this->option_tva = 0; // Manage the vat option RECEPTION_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
index 9f03abef52c..a9d6bb9f00b 100644
--- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php
+++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
@@ -44,7 +44,7 @@ class pdf_squille extends ModelePdfReception
*
* @param DoliDB $db Database handler
*/
- public function __construct($db = 0)
+ public function __construct(DoliDB $db)
{
global $conf, $langs, $mysoc;
@@ -523,9 +523,9 @@ class pdf_squille extends ModelePdfReception
while ($pagenb < $pageposafter) {
$pdf->setPage($pagenb);
if ($pagenb == 1) {
- $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object);
} else {
- $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pagenb++;
@@ -534,9 +534,9 @@ class pdf_squille extends ModelePdfReception
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
- $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object);
} else {
- $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
// New page
@@ -550,10 +550,10 @@ class pdf_squille extends ModelePdfReception
// Show square
if ($pagenb == 1) {
- $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object);
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
} else {
- $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object);
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
@@ -719,9 +719,10 @@ class pdf_squille extends ModelePdfReception
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
+ * @param Object|NULL $object Object reception to generate
* @return void
*/
- protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $object = null)
{
global $conf;
@@ -767,7 +768,18 @@ class pdf_squille extends ModelePdfReception
$pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxqtytoship, $tab_top + 1);
- $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToReceive"), '', 'C');
+ $statusreceived = Reception::STATUS_CLOSED;
+ if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) {
+ $statusreceived = Reception::STATUS_VALIDATED;
+ }
+ if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) {
+ $statusreceived = Reception::STATUS_CLOSED;
+ }
+ if ($object && $object->statut < $statusreceived) {
+ $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyToReceive'), '', 'C');
+ } else {
+ $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyReceived'), '', 'C');
+ }
}
if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
index 1fb120d4d29..f8733a8a8ff 100644
--- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
+++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
@@ -86,7 +86,6 @@ class doc_generic_stock_odt extends ModelePDFStock
$this->option_tva = 0; // Manage the vat option STOCK_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
index a000cac368b..ecbeccb5a61 100644
--- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php
@@ -70,47 +70,24 @@ class pdf_standard extends ModelePDFStock
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
/**
* Issuer
* @var Societe
*/
public $emetteur;
+ public $wref;
+ public $posxdesc;
+ public $posxlabel;
+ public $posxtva;
+ public $posxqty;
+ public $posxup;
+ public $posxunit;
+ public $posxdiscount;
+ public $postotalht;
+
+ public $tabTitleHeight;
+
/**
* Constructor
@@ -174,12 +151,6 @@ class pdf_standard extends ModelePDFStock
$this->posxdiscount -= 20;
$this->postotalht -= 20;
}
- $this->tva = array();
- $this->tva_array = array();
- $this->localtax1 = array();
- $this->localtax2 = array();
- $this->atleastoneratenotnull = 0;
- $this->atleastonediscount = 0;
$this->tabTitleHeight = 11;
}
diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php
index 2c9f9e82591..73092bb0bf6 100644
--- a/htdocs/core/modules/stock/modules_stock.php
+++ b/htdocs/core/modules/stock/modules_stock.php
@@ -28,6 +28,41 @@ abstract class ModelePDFStock extends CommonDocGenerator
*/
public $error = '';
+ /**
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
index 23a38b961ec..76c0ed56851 100644
--- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php
@@ -150,7 +150,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
// Define column position
@@ -967,13 +966,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/**
* Show payments table
*
- * @param TCPDF $pdf Object PDF
- * @param Object $object Object to show
- * @param int $posy Position y in PDF
- * @param Translate $outputlangs Object langs for output
- * @return int <0 if KO, >0 if OK
+ * @param TCPDF $pdf Object PDF
+ * @param Object $object Object to show
+ * @param int $posy Position y in PDF
+ * @param Translate $outputlangs Object langs for output
+ * @param int $heightforfooter Height for footer
+ * @return int <0 if KO, >0 if OK
*/
- protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
+ protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0)
{
// phpcs:enable
global $conf;
diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
index 68caf286682..a9a8f612578 100644
--- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
@@ -90,8 +90,6 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
$this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
- $this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
index 2be12805685..da8c1f4ac26 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
@@ -152,7 +152,6 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; //Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
index 11ae04993eb..c7dc161330c 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php
@@ -152,7 +152,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
index 003cd999cde..4e1027207a7 100644
--- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
+++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php
@@ -76,47 +76,20 @@ class pdf_standard extends ModelePDFSuppliersPayments
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
/**
* Issuer
* @var Societe
*/
public $emetteur;
+ public $posxdate;
+ public $posxreffacturefourn;
+ public $posxreffacture;
+ public $posxtype;
+ public $posxtotalht;
+ public $posxtva;
+ public $posxtotalttc;
+
/**
* Constructor
diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
index b1b8e999ce9..c5db770bdb4 100644
--- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
+++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php
@@ -27,6 +27,41 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
*/
public $error = '';
+ /**
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
index c79ee188213..82475f7a016 100644
--- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
@@ -88,7 +88,6 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$this->option_tva = 0; // Manage the vat option PROPALE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
index 60b3e6b4922..e64f0ab632d 100644
--- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php
@@ -149,7 +149,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 1; // Display payment mode
$this->option_condreg = 1; // Display payment terms
- $this->option_codeproduitservice = 1; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 1; // Displays if there has been a discount
$this->option_credit_note = 1; // Support credit notes
diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
index 353d35fc182..a46503b6e2a 100644
--- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
+++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
@@ -85,7 +85,6 @@ class doc_generic_user_odt extends ModelePDFUser
$this->option_tva = 0; // Manage the vat option USER_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
index 7ba82f5825e..188cff00216 100644
--- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
+++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
@@ -88,7 +88,6 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$this->option_tva = 0; // Manage the vat option USERGROUP_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index f009b80301e..a3a8e964ee1 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -948,11 +948,14 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
var discount = parseFloat($('option:selected', this).attr('data-discount'));
if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));}
- console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
+ /* var tva_tx = $('option:selected', this).data('tvatx'); */
+
+ console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
jQuery("#price_ht").val(up);
- if (jQuery("#qty").val() < qty)
- {
+ /* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */
+
+ if (jQuery("#qty").val() < qty) {
jQuery("#qty").val(qty);
}
if (jQuery("#remise_percent").val() < discount)
diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
index e13328e0a2a..298ad489764 100644
--- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
+++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
@@ -169,7 +169,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
}
if ($sendto) {
- $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs, $conf);
+ $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
}
}
@@ -240,7 +240,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
unset($linked_contacts);
}
if ($sendto) {
- $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs, $conf);
+ $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs);
}
}
$ok = 1;
diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php
index f41b855e123..2c43cd715a3 100644
--- a/htdocs/delivery/class/delivery.class.php
+++ b/htdocs/delivery/class/delivery.class.php
@@ -528,6 +528,8 @@ class Delivery extends CommonObject
public function create_from_sending($user, $sending_id)
{
// phpcs:enable
+ global $conf;
+
$expedition = new Expedition($this->db);
$result = $expedition->fetch($sending_id);
@@ -772,9 +774,9 @@ class Delivery extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Load lines
+ * Load lines insto $this->lines.
*
- * @return void
+ * @return int <0 if KO, >0 if OK
*/
public function fetch_lines()
{
@@ -840,9 +842,11 @@ class Delivery extends CommonObject
$i++;
}
$this->db->free($resql);
- }
- return $this->lines;
+ return 1;
+ } else {
+ return -1;
+ }
}
@@ -973,7 +977,7 @@ class Delivery extends CommonObject
if ($resultSourceLine) {
$num_lines = $this->db->num_rows($resultSourceLine);
$i = 0;
- $resultArray = array();
+ $array = array();
while ($i < $num_lines) {
$objSourceLine = $this->db->fetch_object($resultSourceLine);
@@ -1133,14 +1137,6 @@ class DeliveryLine extends CommonObjectLine
*/
public $table_element = 'deliverydet';
- // From llx_expeditiondet
- public $qty;
- public $qty_asked;
- public $qty_shipped;
- public $price;
- public $fk_product;
- public $origin_id;
-
/**
* @var string delivery note lines label
*/
@@ -1162,11 +1158,25 @@ class DeliveryLine extends CommonObjectLine
*/
public $libelle;
- public $origin_line_id;
+ // From llx_expeditiondet
+ public $qty;
+ public $qty_asked;
+ public $qty_shipped;
+ public $fk_product;
+ public $product_desc;
+ public $product_type;
public $product_ref;
public $product_label;
+ public $fk_origin_line;
+ public $origin_id;
+
+ public $price;
+
+ public $origin_line_id;
+
+
/**
* Constructor
*
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index ef1557f4f00..508db07c65e 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -1920,7 +1920,7 @@ class EmailCollector extends CommonObject
if (count($pj) > 0) {
$sql = "SELECT rowid as id FROM " . MAIN_DB_PREFIX . "user WHERE email LIKE '%" . $from . "%'";
$resql = $this->db->query($sql);
- if ($resql->num_rows == 0) {
+ if ($this->db->num_rows($resql) == 0) {
$this->errors = 'User Not allowed to add documents';
}
$arrayobject = array(
diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php
index fb608eca8ba..292b55d0dc9 100644
--- a/htdocs/eventorganization/class/conferenceorbooth.class.php
+++ b/htdocs/eventorganization/class/conferenceorbooth.class.php
@@ -106,8 +106,8 @@ class ConferenceOrBooth extends ActionComm
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"Help text", 'showoncombobox'=>'1',),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
- 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
+ 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
index 3dfbb2e1a6c..533c9f4e8c0 100644
--- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php
+++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php
@@ -104,13 +104,13 @@ class ConferenceOrBoothAttendee extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
- 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
+ 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1),
'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',),
- 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
+ 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>3,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>3,),
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 0dec85b2e4f..acb54dde6f3 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -752,7 +752,7 @@ class Expedition extends CommonObject
//var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db);
- $mouvS->origin = dol_clone($this, 1);
+ //$mouvS->origin = dol_clone($this, 1);
$mouvS->setOrigin($this->element, $this->id);
if (empty($obj->edbrowid)) {
diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php
index 53cf3695b12..49ac0af9857 100644
--- a/htdocs/expensereport/class/expensereport_ik.class.php
+++ b/htdocs/expensereport/class/expensereport_ik.class.php
@@ -22,12 +22,12 @@
* \brief File of class to manage expense ik
*/
-require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* Class to manage inventories
*/
-class ExpenseReportIk extends CoreObject
+class ExpenseReportIk extends CommonObject
{
/**
* @var string ID to identify managed object
@@ -68,6 +68,7 @@ class ExpenseReportIk extends CoreObject
*/
public $ikoffset;
+
/**
* Attribute object linked with database
* @var array
@@ -80,17 +81,75 @@ class ExpenseReportIk extends CoreObject
,'ikoffset'=>array('type'=>'double')
);
+
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
- public function __construct(DoliDB &$db)
+ public function __construct(DoliDB $db)
{
- parent::__construct($db);
- parent::init();
+ $this->db = $db;
+ }
- $this->errors = array();
+
+ /**
+ * Create object into database
+ *
+ * @param User $user User that creates
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, Id of created object if OK
+ */
+ public function create(User $user, $notrigger = false)
+ {
+ $resultcreate = $this->createCommon($user, $notrigger);
+
+ //$resultvalidate = $this->validate($user, $notrigger);
+
+ return $resultcreate;
+ }
+
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param int $id Id object
+ * @param string $ref Ref
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ public function fetch($id, $ref = null)
+ {
+ $result = $this->fetchCommon($id, $ref);
+ if ($result > 0 && !empty($this->table_element_line)) {
+ $this->fetchLines();
+ }
+ return $result;
+ }
+
+
+ /**
+ * Update object into database
+ *
+ * @param User $user User that modifies
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function update(User $user, $notrigger = false)
+ {
+ return $this->updateCommon($user, $notrigger);
+ }
+
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function delete(User $user, $notrigger = false)
+ {
+ return $this->deleteCommon($user, $notrigger);
+ //return $this->deleteCommon($user, $notrigger, 1);
}
diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php
index ae89b4b0f51..02bf8b8ce5c 100644
--- a/htdocs/expensereport/class/expensereport_rule.class.php
+++ b/htdocs/expensereport/class/expensereport_rule.class.php
@@ -22,12 +22,12 @@
* \brief File of class to manage expense ik
*/
-require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* Class to manage inventories
*/
-class ExpenseReportRule extends CoreObject
+class ExpenseReportRule extends CommonObject
{
/**
* @var string ID to identify managed object
@@ -125,21 +125,78 @@ class ExpenseReportRule extends CoreObject
,'entity'=>array('type'=>'integer')
);
+
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
- public function __construct(DoliDB &$db)
+ public function __construct(DoliDB $db)
{
- global $conf;
-
- parent::__construct($db);
- parent::init();
-
- $this->errors = array();
+ $this->db = $db;
}
+
+ /**
+ * Create object into database
+ *
+ * @param User $user User that creates
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, Id of created object if OK
+ */
+ public function create(User $user, $notrigger = false)
+ {
+ $resultcreate = $this->createCommon($user, $notrigger);
+
+ //$resultvalidate = $this->validate($user, $notrigger);
+
+ return $resultcreate;
+ }
+
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param int $id Id object
+ * @param string $ref Ref
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ public function fetch($id, $ref = null)
+ {
+ $result = $this->fetchCommon($id, $ref);
+ if ($result > 0 && !empty($this->table_element_line)) {
+ $this->fetchLines();
+ }
+ return $result;
+ }
+
+
+ /**
+ * Update object into database
+ *
+ * @param User $user User that modifies
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function update(User $user, $notrigger = false)
+ {
+ return $this->updateCommon($user, $notrigger);
+ }
+
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function delete(User $user, $notrigger = false)
+ {
+ return $this->deleteCommon($user, $notrigger);
+ //return $this->deleteCommon($user, $notrigger, 1);
+ }
+
+
/**
* Return all rules or filtered by something
*
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index 551957d0a69..24432cb7cf1 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -580,14 +580,14 @@ if ($resql) {
if (!empty($arrayfields['d.date_valid']['checked'])) {
print '
';
//print ' ';
- //$formother->select_year($year_end,'year_end',1, $min_year, $max_year);
+ //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
print ' ';
}
// Date approve
if (!empty($arrayfields['d.date_approve']['checked'])) {
print '
';
//print ' ';
- //$formother->select_year($year_end,'year_end',1, $min_year, $max_year);
+ //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
print ' ';
}
// Amount with no tax
diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php
index 0953d314202..1a289e61e2e 100644
--- a/htdocs/fichinter/card-rec.php
+++ b/htdocs/fichinter/card-rec.php
@@ -166,7 +166,7 @@ if ($action == 'add') {
// on récupère les enregistrements
$object->fetch($id);
-
+ $res = $object->fetch_lines();
// on transfert les données de l'un vers l'autre
if ($object->socid > 0) {
$newinter->socid = $object->socid;
@@ -178,6 +178,7 @@ if ($action == 'add') {
$newinter->entity = $object->entity;
$newinter->duree = $object->duree;
+ $newinter->datei = $object->date;
$newinter->description = $object->description;
$newinter->note_private = $object->note_private;
@@ -194,7 +195,7 @@ if ($action == 'add') {
if ($newfichinterid > 0) {
// Now we add line of details
foreach ($object->lines as $line) {
- $newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, '');
+ $newinter->addline($user, $newfichinterid, $line->desc, $line->datei, $line->duree, '');
}
// on update le nombre d'inter crée à partir du modèle
@@ -737,7 +738,7 @@ if ($action == 'create') {
print '
';
+ print $langs->trans("AddIntervention").'
';
}
if ($user->rights->ficheinter->supprimer) {
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index b5e3a13f3c0..3b175a78c0b 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -39,9 +39,9 @@ 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'=>1, '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'=>1, 'visible'=>-1, 'position'=>20),
- 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
+ '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->projet->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),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
@@ -1349,7 +1349,6 @@ class Fichinter extends CommonObject
$line->fetch_optionals();
$this->lines[$i] = $line;
-
$i++;
}
$this->db->free($resql);
@@ -1420,6 +1419,8 @@ class FichinterLigne extends CommonObjectLine
*/
public $fk_element = 'fk_fichinter';
+
+
/**
* Constructor
*
diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php
index 4488b4643b8..b128bba60f8 100644
--- a/htdocs/fichinter/class/fichinterrec.class.php
+++ b/htdocs/fichinter/class/fichinterrec.class.php
@@ -350,8 +350,8 @@ class FichinterRec extends Fichinter
// phpcs:enable
$this->lines = array();
- $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, ';
- $sql .= ' l.price, l.qty, l.tva_tx, l.remise, 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, ';
$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,';
@@ -370,7 +370,6 @@ class FichinterRec extends Fichinter
$objp = $this->db->fetch_object($result);
$line = new FichinterLigne($this->db);
-
$line->id = $objp->rowid;
$line->label = $objp->custom_label; // Label line
$line->desc = $objp->description; // Description line
@@ -378,7 +377,7 @@ class FichinterRec extends Fichinter
$line->product_ref = $objp->product_ref; // Ref product
$line->product_label = $objp->product_label; // Label product
$line->product_desc = $objp->product_desc; // Description product
- $line->fk_product_type = $objp->fk_product_type; // Type of product
+ $line->fk_product_type = $objp->fk_product_type; // Type in product
$line->qty = $objp->qty;
$line->duree = $objp->duree;
$line->duration = $objp->duree;
@@ -390,8 +389,6 @@ class FichinterRec extends Fichinter
$line->fk_product = $objp->fk_product;
$line->date_start = $objp->date_start;
$line->date_end = $objp->date_end;
- $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;
@@ -401,10 +398,6 @@ class FichinterRec extends Fichinter
$line->special_code = $objp->special_code;
$line->fk_unit = $objp->fk_unit;
- // Ne plus utiliser
- $line->price = $objp->price;
- $line->remise = $objp->remise;
-
$this->lines[$i] = $line;
$i++;
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index b780cbde926..1d0e370355f 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -218,7 +218,7 @@ class CommandeFournisseur extends CommonOrder
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>45),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64),
@@ -243,7 +243,7 @@ class CommandeFournisseur extends CommonOrder
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>3, 'position'=>180),
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>0, 'position'=>190),
- 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>3, 'position'=>200),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>3, 'position'=>200),
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>3, 'position'=>205),
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLocation', 'enabled'=>1, 'visible'=>3, 'position'=>210),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>0, 'position'=>215),
@@ -253,7 +253,7 @@ class CommandeFournisseur extends CommonOrder
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>235),
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>240),
'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>46),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>1, 'notnull'=>1, 'position'=>46),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1),
'tms'=>array('type'=>'datetime', 'label'=>"DateModificationShort", 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501),
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>700),
@@ -3751,9 +3751,6 @@ class CommandeFournisseurLigne extends CommonOrderLine
if (empty($this->rang)) {
$this->rang = 0;
}
- if (empty($this->remise)) {
- $this->remise = 0;
- }
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php
index ab68cd3ecc6..9464c06bd4c 100644
--- a/htdocs/fourn/class/fournisseur.facture-rec.class.php
+++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php
@@ -127,6 +127,13 @@ class FactureFournisseurRec extends CommonInvoice
public $model_pdf;
+ /**
+ * Invoice lines
+ * @var FactureFournisseurLigneRec[]
+ */
+ public $lines = array();
+
+
/* Override fields in CommonObject
public $entity;
public $date_creation;
@@ -174,7 +181,7 @@ class FactureFournisseurRec extends CommonInvoice
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'ref_supplier' =>array('type'=>'varchar(180)', 'label'=>'RefSupplier', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>20),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>30),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40),
'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
@@ -188,8 +195,8 @@ class FactureFournisseurRec extends CommonInvoice
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>210),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
- 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 52d9b19bfaf..0630d2df6a4 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -277,7 +277,7 @@ class FactureFournisseur extends CommonInvoice
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>30),
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
- 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>40),
+ 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>40),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'datef' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>55),
@@ -297,8 +297,8 @@ class FactureFournisseur extends CommonInvoice
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>130),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
'fk_facture_source' =>array('type'=>'integer', 'label'=>'Fk facture source', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
- 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
- 'fk_account' =>array('type'=>'integer', 'label'=>'Account', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
+ 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>145),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'Account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index 287327f2a6a..ce35470d484 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -1974,10 +1974,10 @@ if ($action == 'create') {
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
} else {
- $cond_reglement_id = $societe->cond_reglement_supplier_id;
- $mode_reglement_id = $societe->mode_reglement_supplier_id;
- $transport_mode_id = $societe->transport_mode_supplier_id;
- $fk_account = $societe->fk_account;
+ $cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0;
+ $mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0;
+ $transport_mode_id = !empty($societe->transport_mode_supplier_id) ? $societe->transport_mode_supplier_id : 0;
+ $fk_account = !empty($societe->fk_account) ? $societe->fk_account : 0;
$datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp);
$datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'));
@@ -2004,7 +2004,7 @@ if ($action == 'create') {
print '';
- }
-
+ print $formSetup->generateOutput(true);
print ' ';
+} elseif (!empty($formSetup->items)) {
+ print $formSetup->generateOutput();
+ print '';
} else {
- if ($useFormSetup && (float) DOL_VERSION >= 15) {
- if (!empty($formSetup->items)) {
- print $formSetup->generateOutput();
- }
- } else {
- if (!empty($arrayofparameters)) {
- print '';
- print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
-
- foreach ($arrayofparameters as $constname => $val) {
- if ($val['enabled']==1) {
- $setupnotempty++;
- print '';
- $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
- print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
- print ' ';
-
- if ($val['type'] == 'textarea') {
- print dol_nl2br($conf->global->{$constname});
- } elseif ($val['type']== 'html') {
- print $conf->global->{$constname};
- } elseif ($val['type'] == 'yesno') {
- print ajax_constantonoff($constname);
- } elseif (preg_match('/emailtemplate:/', $val['type'])) {
- include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
- $tmp = explode(':', $val['type']);
-
- $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
- if ($template<0) {
- setEventMessages(null, $formmail->errors, 'errors');
- }
- print $langs->trans($template->label);
- } elseif (preg_match('/category:/', $val['type'])) {
- $c = new Categorie($db);
- $result = $c->fetch($conf->global->{$constname});
- if ($result < 0) {
- setEventMessages(null, $c->errors, 'errors');
- } elseif ($result > 0 ) {
- $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
- $toprint = array();
- foreach ($ways as $way) {
- $toprint[] = 'color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . ' ';
- }
- print '' . implode(' ', $toprint) . ' ';
- }
- } elseif (preg_match('/thirdparty_type/', $val['type'])) {
- if ($conf->global->{$constname}==2) {
- print $langs->trans("Prospect");
- } elseif ($conf->global->{$constname}==3) {
- print $langs->trans("ProspectCustomer");
- } elseif ($conf->global->{$constname}==1) {
- print $langs->trans("Customer");
- } elseif ($conf->global->{$constname}==0) {
- print $langs->trans("NorProspectNorCustomer");
- }
- } elseif ($val['type'] == 'product') {
- $product = new Product($db);
- $resprod = $product->fetch($conf->global->{$constname});
- if ($resprod > 0) {
- print $product->ref;
- } elseif ($resprod < 0) {
- setEventMessages(null, $object->errors, "errors");
- }
- } else {
- print $conf->global->{$constname};
- }
- print ' ';
- }
- }
-
- print '
';
- }
- }
-
- if ($setupnotempty) {
- print '';
- } else {
- print ' '.$langs->trans("NothingToSetup");
- }
+ print ' '.$langs->trans("NothingToSetup");
}
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 245d9726048..a0868fa0580 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -108,8 +108,8 @@ class MyObject extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1),
'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1),
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1),
- 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
- 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
+ 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
+ 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'),
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
index 689503f0dee..ec2d42edf83 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
@@ -89,7 +89,6 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
$this->option_modereg = 0; // Display payment mode
$this->option_condreg = 0; // Display payment terms
- $this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_escompte = 0; // Displays if there has been a discount
$this->option_credit_note = 0; // Support credit notes
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
index 1a435d3763d..b849389d048 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php
@@ -80,41 +80,6 @@ class pdf_standard_myobject extends ModelePDFMyObject
*/
public $version = 'dolibarr';
- /**
- * @var int page_largeur
- */
- public $page_largeur;
-
- /**
- * @var int page_hauteur
- */
- public $page_hauteur;
-
- /**
- * @var array format
- */
- public $format;
-
- /**
- * @var int marge_gauche
- */
- public $marge_gauche;
-
- /**
- * @var int marge_droite
- */
- public $marge_droite;
-
- /**
- * @var int marge_haute
- */
- public $marge_haute;
-
- /**
- * @var int marge_basse
- */
- public $marge_basse;
-
/**
* Issuer
* @var Societe Object that emits
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
index 8f0d86e3823..c2eeb232219 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php
@@ -38,6 +38,42 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
abstract class ModelePDFMyObject extends CommonDocGenerator
{
+ /**
+ * @var int page_largeur
+ */
+ public $page_largeur;
+
+ /**
+ * @var int page_hauteur
+ */
+ public $page_hauteur;
+
+ /**
+ * @var array format
+ */
+ public $format;
+
+ /**
+ * @var int marge_gauche
+ */
+ public $marge_gauche;
+
+ /**
+ * @var int marge_droite
+ */
+ public $marge_droite;
+
+ /**
+ * @var int marge_haute
+ */
+ public $marge_haute;
+
+ /**
+ * @var int marge_basse
+ */
+ public $marge_basse;
+
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 002685415cc..2b38b59b284 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -591,7 +591,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index f9222ad8fc0..e319f86e059 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -420,7 +420,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page
// --------------------------------------------------------------------
-llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
+llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
// Example : Adding jquery code
// print '';
+ print $retstring;
+
+ llxFooter();
+ exit;
+ }
+
if (!empty($backtopage)) {
$backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation
if (preg_match('/\?/', $backtopage)) {
@@ -704,14 +725,8 @@ if (empty($reshook)) {
$url = DOL_URL_ROOT."/fourn/card.php?socid=".$object->id;
}
- // TODO @LDR
- if ($dol_openinpopup && $backtopagejsfields) {
- print 'TODO Set js var of parent with id, then close popup.';
- exit;
- } else {
- header("Location: ".$url);
- exit;
- }
+ header("Location: ".$url);
+ exit;
}
} else {
$db->rollback();
@@ -1293,8 +1308,102 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).' ';
}
print ' global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
+
print ' ';
print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
+ /* Disabled. Must be implenteted by keeping the input text but calling ajax on a keydown of the input and output
+ data of duplicate into a div under the input. We need to keep the widgetForTranslation also for some countries.
+ */
+ /*
+ print ' ';
+ print "\n".'
+ ';
+ */
print ' ';
if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
print ''.$langs->trans('Prefix').' ';
@@ -2989,7 +3098,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$MAXEVENT = 10;
- $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 30f8515e92c..686c301af79 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -504,18 +504,19 @@ class Societe extends CommonObject
/**
* Date of last update
- * @var string
+ * @var integer|string
*/
public $date_modification;
/**
* User that made last update
- * @var string
+ * @var User
*/
public $user_modification;
/**
- * @var integer|string date_creation
+ * Date of creation
+ * @var integer|string
*/
public $date_creation;
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 2ab5a836c51..5f997a37e9c 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -443,7 +443,7 @@ if ($sql_select) {
print '';
print ''; // date
print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle');
- $formother->select_year($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly');
+ print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly');
print ' ';
print '';
print ' ';
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 89dd6f36a8e..91368ec9dc7 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -999,12 +999,8 @@ if ($moreforfilter) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
-if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
-} else {
- $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, 'left'); // This also change content of $arrayfields
-}
- // Show the massaction checkboxes only when this page is not opend from the Extended POS
+$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') {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index bdbf7453c35..e2ac40f8770 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -1683,7 +1683,7 @@ if ($socid && $action == 'editcard' && $permissiontoaddupdatepaymentinformation)
print ''.$langs->trans("ExpiryDate").' ';
print '';
print $formother->select_month($companypaymentmode->exp_date_month, 'exp_date_month', 1);
- print $formother->select_year($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
+ print $formother->selectyear($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
print ' ';
print ''.$langs->trans("CVN").' ';
@@ -1841,7 +1841,7 @@ if ($socid && $action == 'createcard' && $permissiontoaddupdatepaymentinformatio
print ''.$langs->trans("ExpiryDate").' ';
print '';
print $formother->select_month(GETPOST('exp_date_month', 'int'), 'exp_date_month', 1);
- print $formother->select_year(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
+ print $formother->selectyear(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly');
print ' ';
print ''.$langs->trans("CVN").' ';
diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php
index 49db54b444f..d411796aba8 100644
--- a/htdocs/stripe/charge.php
+++ b/htdocs/stripe/charge.php
@@ -268,13 +268,13 @@ if (!$rowid) {
print "\n";
// Date payment
- print ''.dol_print_date($charge->created, '%d/%m/%Y %H:%M')." \n";
+ print ''.dol_print_date($charge->created, 'dayhour')." \n";
// Type
print '';
print $type;
print ' ';
// Amount
- print ''.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))." ";
+ print ''.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))." ";
// Status
print '';
print $status;
diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php
index 34b4ea1dc4f..8631b4ecd5f 100644
--- a/htdocs/stripe/payout.php
+++ b/htdocs/stripe/payout.php
@@ -200,13 +200,13 @@ if (!$rowid) {
//}
//print " \n";
// Date payment
- print ''.dol_print_date($payout->created, '%d/%m/%Y %H:%M')." \n";
+ print ''.dol_print_date($payout->created, 'dayhour')." \n";
// Date payment
- print ''.dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M')." \n";
+ print ''.dol_print_date($payout->arrival_date, 'dayhour')." \n";
// Type
print ''.$payout->description.' ';
// Amount
- print ''.price(($payout->amount) / 100, 0, '', 1, -1, -1, strtoupper($payout->currency))." ";
+ print ''.price(($payout->amount) / 100, 0, '', 1, -1, -1, strtoupper($payout->currency))." ";
// Status
print "";
if ($payout->status == 'paid') {
diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php
index 6bab8459d18..92092ca2ebb 100644
--- a/htdocs/stripe/transaction.php
+++ b/htdocs/stripe/transaction.php
@@ -207,12 +207,12 @@ if (!$rowid) {
//}
//print " \n";
// Date payment
- print ''.dol_print_date($txn->created, '%d/%m/%Y %H:%M')." \n";
+ print ''.dol_print_date($txn->created, 'dayhour')." \n";
// Type
print ''.$txn->type.' ';
// Amount
- print ''.price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency))." ";
- print ''.price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency))." ";
+ print ''.price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency))." ";
+ print ''.price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency))." ";
// Status
print "";
if ($txn->status == 'available') {
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index e755a0bab94..8f0c1d36919 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -331,7 +331,6 @@ class SupplierProposal extends CommonObject
$supplier_proposalligne->subprice = -$remise->amount_ht;
$supplier_proposalligne->fk_product = 0; // Id produit predefini
$supplier_proposalligne->qty = 1;
- $supplier_proposalligne->remise = 0;
$supplier_proposalligne->remise_percent = 0;
$supplier_proposalligne->rang = -1;
$supplier_proposalligne->info_bits = 2;
@@ -3006,9 +3005,6 @@ class SupplierProposalLine extends CommonObjectLine
if (empty($this->rang)) {
$this->rang = 0;
}
- if (empty($this->remise)) {
- $this->remise = 0;
- }
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index eec8ab7d363..6aca4e01a5d 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -1560,7 +1560,7 @@ if ($placeid > 0) {
$htmlforlines .= ' ';
if (!empty($conf->stock->enabled) && !empty($user->rights->stock->mouvement->lire)) {
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
- if (!empty($conf->global->$constantforkey) && $line->fk_product > 0) {
+ if (!empty($conf->global->$constantforkey) && $line->fk_product > 0 && empty($conf->global->TAKEPOS_HIDE_STOCK_ON_LINE)) {
$sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
$sql .= " ".MAIN_DB_PREFIX."product_stock as ps";
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index a2b5619cf17..19abdd3ba9b 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -1573,7 +1573,7 @@ table[summary="list_of_modules"] .fa-cog {
.minheight30 { min-height: 30px; }
.minheight40 { min-height: 40px; }
.titlefieldcreate { width: 20%; }
-.titlefield { /* width: 25%; */ min-width: 250px; }
+.titlefield { /* width: 25%; */ min-width: 250px; width: 25%; }
.titlefieldmiddle { width: 45%; }
.titlefieldmax45 { max-width: 45%; }
.imgmaxwidth180 { max-width: 180px; }
@@ -1882,6 +1882,9 @@ td.showDragHandle {
background: var(--colorbackbody);
padding-bottom: 20px;
}
+.bodyforlist #id-right {
+ padding-bottom: 4px;
+}
/* DOL_XXX For having horizontal scroll into array (like with smartphone) */
@@ -3568,12 +3571,12 @@ tr.liste_titre.box_titre td table td, .bordernooddeven tr td {
div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col {
vertical-align: middle;
}
-div .tdtop {
+div .tdtop:not(.tagtdnote) {
vertical-align: top !important;
/*padding-top: 10px !important;
padding-bottom: 2px !important; */
- padding-top: 6px !important;
- padding-bottom: 4px !important;
+ padding-top: 5px !important;
+ padding-bottom: 0px !important;
}
table.border td, table.bordernooddeven td, div.border div div.tagtd {
@@ -4516,6 +4519,9 @@ table.noborder.boxtable tr td {
a.valignmiddle.dashboardlineindicator {
line-height: 30px;
}
+.height30 {
+ height: 30px !important;
+}
tr.box_titre {
height: 26px;
@@ -5044,9 +5050,10 @@ table.dp {
vertical-align:middle;
cursor: pointer;
}
-.datenowlink
-{
+.datenowlink {
color: var(--colortextlink);
+ font-size: 0.8em;
+ opacity: 0.7;
}
@@ -5330,6 +5337,7 @@ td.cal_other_month {
/* CSS for treeview */
.treeview ul { background-color: transparent !important; margin-bottom: 4px !important; margin-top: 0 !important; padding-top: 2px !important; }
.treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 30px; }
+.treeview li table { min-height: 30px; }
.treeview .hover { color: var(--colortextlink) !important; text-decoration: underline !important; }
.treeview .hitarea { margin-top: 3px; }
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 6ac9bfbf435..261e89c64be 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -1662,7 +1662,7 @@ tr.nobottom td {
.minheight30 { min-height: 30px; }
.minheight40 { min-height: 40px; }
.titlefieldcreate { width: 20%; }
-.titlefield { /* width: 25%; */ min-width: 250px; }
+.titlefield { /* width: 25%; */ min-width: 250px; width: 25%; }
.titlefieldmiddle { width: 50%; }
.imgmaxwidth180 { max-width: 180px; }
.imgmaxheight50 { max-height: 50px; }
@@ -1967,6 +1967,9 @@ td.showDragHandle {
padding-top: 16px;
}
+.bodyforlist #id-right {
+ padding-bottom: 4px;
+}
/* DOL_XXX For having horizontal scroll into array (like with smartphone) */
@@ -4185,7 +4188,7 @@ div.tabBar .noborder {
-webkit-box-shadow: 0px 0px 0px #f4f4f4 !important;
box-shadow: 0px 0px 0px #f4f4f4 !important;
}
-div .tdtop {
+div .tdtop:not(.tagtdnote) {
vertical-align: top !important;
padding-top: 8px !important;
padding-bottom: 0px !important;
@@ -4379,6 +4382,9 @@ span.dashboardlineko {
a.valignmiddle.dashboardlineindicator {
line-height: 30px;
}
+.height30 {
+ height: 30px !important;
+}
tr.box_titre {
height: 26px !important;
@@ -4892,9 +4898,10 @@ table.dp {
vertical-align:middle;
cursor: pointer;
}
-.datenowlink
-{
+.datenowlink {
color: rgb();
+ font-size: 0.8em;
+ opacity: 0.7;
}
.categtextwhite, .treeview .categtextwhite.hover {
@@ -5174,6 +5181,7 @@ td.gtaskname {
/* CSS for treeview */
.treeview ul { background-color: transparent !important; margin-bottom: 4px !important; margin-top: 0 !important; padding-top: 8px !important; }
.treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 30px; }
+.treeview li table { min-height: 30px; }
.treeview .hover { color: var(--colortextlink) !important; text-decoration: underline !important; }
.treeview .hitarea { margin-top: 3px; }
diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php
index 9a4af31014a..76e136c1fd7 100644
--- a/htdocs/ticket/agenda.php
+++ b/htdocs/ticket/agenda.php
@@ -239,7 +239,7 @@ if (!empty($object->id)) {
$messagingUrl = DOL_URL_ROOT.'/ticket/messaging.php?track_id='.$object->track_id;
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
$messagingUrl = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id;
- $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-list-alt imgforviewmode', $messagingUrl, '', 1, array('morecss'=>'btnTitleSelected'));
+ $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1, array('morecss'=>'btnTitleSelected'));
// Show link to add a message (if read and not closed)
$btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 99913e6c997..ce791613bcb 100755
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -205,7 +205,7 @@ if (empty($reshook)) {
$fk_user_assign = GETPOST("fk_user_assign", 'int');
if ($fk_user_assign > 0) {
$object->fk_user_assign = $fk_user_assign;
- $object->fk_statut = $object::STATUS_ASSIGNED;
+ $object->fk_status = $object::STATUS_ASSIGNED;
}
$object->fk_project = $projectid;
@@ -285,7 +285,7 @@ if (empty($reshook)) {
}
}
- if ($action == 'update' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) {
+ if ($action == 'update' && $user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) {
$error = 0;
$ret = $object->fetch(GETPOST('id', 'int'), GETPOST('ref', 'alpha'), GETPOST('track_id', 'alpha'));
@@ -543,7 +543,7 @@ if (empty($reshook)) {
if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
// prevent browser refresh from reopening ticket several times
- if ($object->fk_statut == Ticket::STATUS_CLOSED || $object->fk_statut == Ticket::STATUS_CANCELED) {
+ if ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED) {
$res = $object->setStatut(Ticket::STATUS_ASSIGNED);
if ($res) {
// Log action in ticket logs table
@@ -602,7 +602,7 @@ if (empty($reshook)) {
// Reopen ticket
if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$new_status = GETPOST('new_status', 'int');
- $old_status = $object->fk_statut;
+ $old_status = $object->fk_status;
$res = $object->setStatut($new_status);
if ($res) {
// Log action in ticket logs table
@@ -721,7 +721,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->withcancel = 1;
$formticket->showForm(1, 'create', 0);
- /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_statut < Ticket::STATUS_CLOSED) {
+ /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) {
$formticket = new FormTicket($db);
$head = ticket_prepare_head($object);
@@ -934,7 +934,7 @@ if ($action == 'create' || $action == 'presend') {
// Thirdparty
if (!empty($conf->societe->enabled)) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' ';
- if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
+ if ($action != 'editcustomer' && $object->fk_status < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : ';
}
if ($action == 'editcustomer') {
@@ -1034,7 +1034,7 @@ if ($action == 'create' || $action == 'presend') {
print ' ';
print '';
print $langs->trans("AssignedTo");
- if ($object->fk_statut < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
+ if ($object->fk_status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
print ' '.img_edit($langs->trans('Modify'), '').' ';
}
print '
';
@@ -1045,7 +1045,7 @@ if ($action == 'create' || $action == 'presend') {
}
// Show user list to assignate one if status is "read"
- if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
+ if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_status < 8 && !$user->socid && $user->rights->ticket->write) {
print '