diff --git a/.editorconfig b/.editorconfig index 3e3bd16bb34..7df89a90eb3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,8 +9,6 @@ charset = utf-8 end_of_line = lf insert_final_newline = true -# PHP PSR-2 Coding Standards -# http://www.php-fig.org/psr/psr-2/ [*.php] indent_style = tab indent_size = 4 diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 7c43ab24aef..6dbf39bde26 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -194,22 +194,6 @@ tools: - 'test/*' - 'htdocs/includes/*' paths: { } - - php_changetracking: - enabled: false - bug_patterns: - - '\bfix(?:es|ed)?\b' - feature_patterns: - - '\badd(?:s|ed)?\b' - - '\bimplement(?:s|ed)?\b' - filter: - excluded_paths: - - 'build/*' - - 'dev/*' - - 'doc/*' - - 'test/*' - - 'htdocs/includes/*' - paths: { } # Coding-Style / Bug Detection js_hint: diff --git a/.travis.yml b/.travis.yml index 688d706331d..9958556d42d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -404,6 +404,10 @@ script: php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log + php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log + php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log + php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log + # Enable modules not enabled into original dump php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log echo $? diff --git a/ChangeLog b/ChangeLog index 68cd7695057..20a1748af6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,83 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 11.0.4 compared to 11.0.3 ***** +FIX: #13749 +FIX: #7594 Expense report multi pagebreak +FIX: Access to undeclared static property: Contact::$table_element +FIX: actions on supplier proposal not saved (bad trigger name) +FIX: Add function "completeTabsHead" to "addreplace" type hook. +FIX: All forms must use newToken() +FIX: Another "Access to undeclared static property: Contact::$table_element" && "Societe::$table_element" +FIX: author search supplier proposal list +FIX: A variable was erased by a temporary variable +FIX: Avoid infinite loop when a fetch is inside a compute field. +FIX: Backto link +FIX: Bad position of total in column +FIX: bad value in currency into discount created from down payment +FIX: buyprice extrafield langfile and tooltip +FIX: Buyprice was updated only if min price for this qty had same qty +FIX: Can switch from double to price type for extrafields +FIX: Can use decimal value in virtual products +FIX: child categories only with good entity rights +FIX: cloning of emailing when no content selected +FIX: closing tags +FIX: Combo list of available users to filter on the list of leaves. +FIX: Compatibility with multicompany, bad numerotation of task. +FIX: consistency of price w/wo vat wrong when price entered with tax +FIX: default value of selectMasssAction broken +FIX: draftordered replenish virtual stock +FIX: Error update SQL into stock reception +FIX: expensereport status in generated pdf +FIX: extra date field incorrect check +FIX: Extrafields of type price must be '' and not '0' if not defined +FIX: Foreign currency lost when splitting a discount +FIX: get remain to pay with rounding decimals +FIX: gzip and bzip2 must use option -f +FIX: IHM, unexpected quote +FIX: keep viewstatut for doli 3.5 +FIX: Link missing into email of some notification +FIX: Look and feel v11 +FIX: md stylesheet to be included by external modules like eldy +FIX: missing array option +FIX: missing default accountancy product buy code +FIX: missing fk_bank during export of suppliers invoices +FIX: missing member entity +FIX: missing selectedlines on supplier order but checkbox are displayed +FIX: Missing token and take into account max date when it can. +FIX: model export list must be sorted by label +FIX: multicurrency manage on hidden conf SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL +FIX: Must escape shell +FIX: Must exclude logs and some dirs for compressed backup +FIX: ordered stock already in $stock +FIX: picture migration script from doli 9.0 +FIX: print pictures on shipment docs +FIX: product get purchase prices +FIX: product purchase prices +FIX: Protection when database has a corrupted product id +FIX: remove unused var, $usercancreate can be change by Multicompany +FIX: replenish stock to buy +FIX: Sanitizing menu parameter +FIX: Send email from bulk action of list of thirdparties +FIX: setup of suggested payment mode on proposals and orders +FIX: Several pb in export of documents +FIX: Situation invoice take into account the credit notes. +FIX: some others modules (like subtotal) use other product_type than 0 or 1 AND must not be considered in this report +FIX: sort by default role makes no sense +FIX: sort on company on member list +FIX: TakePOS buying price +FIX: text version of html emailing (removed the body style) +FIX: The "test smtp connectivity" failed on page to setup mass emailing +FIX: Error logs an Orderline::delete error, but this is an Orderline::insert error +FIX: Translation of tooltips of extrafields +FIX: Use getNomURL instead of hard coded link. Fix limit. +FIX: Use of image into free text for PDF if DOL_DATA_DIR is outside of +FIX: viewstatut to search status +FIX: we must export company mail address on contact vcard only if contact email address is empty +FIX: when we filter a list on a view status, we want this filter to be on bookmark that we create +FIX: Wrong Sql on getListOfTowns api method +FIX: wrong user right's name to top menu "commercial" +FIX: XSS Vulnerability reported by Mehmet Kelepçe / Gais Cyber Security ***** ChangeLog for 12.0.0 compared to 11.0.0 ***** For Users: diff --git a/README.md b/README.md index 3f329c678a7..f611f333e6a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions: - [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp) -- DoliDeb for Debian or Ubuntu +- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian - DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia Releases can be downloaded from [official website](https://www.dolibarr.org/). diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c06dc51aec1..24b32dcff91 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -19,7 +19,7 @@ use Term::ANSIColor; # Change this to defined target for option 98 and 99 $PROJECT="dolibarr"; $PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr"; -$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files"; +$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files"; #@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages diff --git a/dev/resources/iso-normes/Accountancy-format_Winfic-eWinfic-WinSisCompta.pdf b/dev/resources/iso-normes/Accountancy-format_Winfic-eWinfic-WinSisCompta.pdf new file mode 100644 index 00000000000..2fbaad04699 Binary files /dev/null and b/dev/resources/iso-normes/Accountancy-format_Winfic-eWinfic-WinSisCompta.pdf differ diff --git a/dev/setup/codesniffer/README b/dev/setup/codesniffer/README index 8a68d8a1140..087fb318f6f 100644 --- a/dev/setup/codesniffer/README +++ b/dev/setup/codesniffer/README @@ -6,6 +6,10 @@ This directory contains ruleset files to use to develop Dolibarr EPR & CRM. To install/upgrade phpcs: > sudo pear upgrade PHP_CodeSniffer +To run phpcs: +> cd dolibarrgitrepo +> phpcs --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 . + Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: * tab value to 4 * path of code sniffer standard to dev/codesniffer diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 10d6e29bbe2..e726df6db7c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -23,25 +23,21 @@ - - 0 - + - + + - - - - + @@ -70,23 +66,12 @@ 0 - - 0 - - + - - - @@ -106,32 +91,39 @@ + + + + 0 - - + + + - - 0 - - - 0 - - @@ -141,7 +133,7 @@ - + @@ -179,7 +171,6 @@ - 0 @@ -196,6 +187,13 @@ + + + + + @@ -205,13 +203,10 @@ - - 0 - - - 0 - - + + + + 0 @@ -223,7 +218,6 @@ - 0 @@ -235,23 +229,16 @@ + - - - - - - 0 - + - - 0 - + 0 @@ -260,66 +247,32 @@ 0 - 0 - 0 - 0 - - - - - - 5 - - - - + 0 - 0 - + - - 0 - - - - 0 - + 0 @@ -352,19 +305,21 @@ - - + 0 - + + 0 + - 0 + 0 - + + 0 @@ -373,27 +328,25 @@ - + 0 - + + 0 - - 0 - + + + - 0 + 0 - - 0 - - - 0 - + + + @@ -402,26 +355,26 @@ 0 + - 0 + 0 - + 0 + - - 0 - + 0 0 - + 0 @@ -432,16 +385,16 @@ + + 0 + - - - - + 0 @@ -452,7 +405,6 @@ 0 - 0 @@ -462,15 +414,17 @@ - - - - - + + + + + + + diff --git a/dev/tools/test/testdiv.php b/dev/tools/test/testdiv.php deleted file mode 100644 index 438df80b69e..00000000000 --- a/dev/tools/test/testdiv.php +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - -Login Dolibarr 3.4.0-alpha - - - - - - - - - - - -
- - - -
- - - - diff --git a/doc/images/background_dolibarr.jpg b/doc/images/background_dolibarr.jpg new file mode 100644 index 00000000000..6c4cc11460d Binary files /dev/null and b/doc/images/background_dolibarr.jpg differ diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index f735a0a0cfc..cf00519e9d7 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -161,7 +161,7 @@ if (empty($reshook)) if ($action == 'disable') { if ($accounting->fetch($id)) { $mode = GETPOST('mode', 'int'); - $result = $accounting->account_desactivate($id, $mode); + $result = $accounting->accountDeactivate($id, $mode); } $action = 'update'; @@ -488,11 +488,11 @@ if ($resql) // Action print ''; if ($user->rights->accounting->chartofaccount) { - print ''; + print ''; print img_edit(); print ''; print ' '; - print ''; + print ''; print img_delete(); print ''; } diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 0ab42d582d1..b31cd23dfa4 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -696,7 +696,7 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; else print ' '; // Delete link diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 500a0d3cbba..1b2733e2045 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -408,7 +408,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory')); $titre = $langs->trans($tablib[$id]); $linkback = ''; -$titlepicto = 'title_setup'; +$titlepicto = 'title_accountancy'; print load_fiche_titre($titre, $linkback, $titlepicto); @@ -806,7 +806,7 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; else print ' '; // Delete link diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 02963557222..006db08fe9c 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -236,6 +236,7 @@ if (!empty($user->admin)) } print ''; + /* Set this option as a hidden option but keep it for some needs. print ''; print ''.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").''; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { @@ -248,6 +249,7 @@ if (!empty($user->admin)) print ''; } print ''; + */ print ''; print ''.$langs->trans("BANK_DISABLE_DIRECT_INPUT").''; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index eccb7450594..e34ce8094dd 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -657,7 +657,7 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; else print ' '; // Delete link diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index c6c76a57621..e32e47b169d 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -362,7 +362,6 @@ if ($result) print ''; print ''; print ''; - print ''; print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print '
'; @@ -412,7 +411,7 @@ if ($result) //print '
'.$buttonsave.'
'; $texte = $langs->trans("ListOfProductsServices"); - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); print '
'; print ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index b2a25b00ce2..4de2be6fcbb 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -55,7 +55,7 @@ $pagenext = $page + 1; //if (! $sortfield) $sortfield="p.date_fin"; //if (! $sortorder) $sortorder="DESC"; - +$show_subgroup = GETPOST('show_subgroup', 'alpha'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); @@ -130,10 +130,11 @@ if (!empty($search_accountancy_code_end)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { - $search_accountancy_code_start = ''; - $search_accountancy_code_end = ''; + $show_subgroup = ''; $search_date_start = ''; $search_date_end = ''; + $search_accountancy_code_start = ''; + $search_accountancy_code_end = ''; $filter = array(); } @@ -223,6 +224,12 @@ if ($action != 'export_csv') $moreforfilter .= $form->selectDate($search_date_start ? $search_date_start : -1, 'date_start', 0, 0, 1, '', 1, 0); $moreforfilter .= $langs->trans('DateEnd').': '; $moreforfilter .= $form->selectDate($search_date_end ? $search_date_end : -1, 'date_end', 0, 0, 1, '', 1, 0); + + $moreforfilter .= ' - '; + $moreforfilter .= $langs->trans('ShowSubtotalByGroup').': '; + $moreforfilter .= ''; + + $moreforfilter .= ''; if (!empty($moreforfilter)) { @@ -289,26 +296,31 @@ if ($action != 'export_csv') } print ''; - // Permet d'afficher le compte comptable - if (empty($displayed_account) || $root_account_description != $displayed_account) + if (!empty($show_subgroup)) { - // Affiche un Sous-Total par compte comptable - if ($displayed_account != "") { - print ''; - print "\n"; + // Show accounting account + if (empty($displayed_account) || $root_account_description != $displayed_account) { + // Show subtotal per accounting account + if ($displayed_account != "") { + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + print ''; + } + + // Show first line of a break + print ''; + print ''; print ''; + + $displayed_account = $root_account_description; + $sous_total_debit = 0; + $sous_total_credit = 0; } - - // Show first line of a break - print ''; - print ''; - print ''; - - $displayed_account = $root_account_description; - $sous_total_debit = 0; - $sous_total_credit = 0; } - // $object->get_compte_racine($line->numero_compte); print ''; @@ -326,12 +338,15 @@ if ($action != 'export_csv') $sous_total_credit += $line->credit; } - print ''; - print "\n"; - print ''; + if (!empty($show_subgroup)) + { + print ''; + print "\n"; + print ''; + } print ''; - print "\n"; + print "\n"; print ''; print "
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_credit - $sous_total_debit)).' 
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_credit - $sous_total_debit)).'
'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'
'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'
'.length_accountg($line->numero_compte).'
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit - $sous_total_credit)).' 
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_debit - $sous_total_credit)).'
'.$langs->trans("AccountBalance").':'.price($total_debit).''.price($total_credit).''.price(price2num($total_debit - $total_credit)).' 
"; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 26476119cca..f8fa0774400 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -438,7 +438,7 @@ if ($action == 'create') print $langs->trans('Docdate'); print ''; if ($action != 'editdate') - print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; + print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).''; print ''; print ''; if ($action == 'editdate') { @@ -462,7 +462,7 @@ if ($action == 'create') print $langs->trans('Codejournal'); print ''; if ($action != 'editjournal') - print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; print ''; print ''; if ($action == 'editjournal') { @@ -486,7 +486,7 @@ if ($action == 'create') print $langs->trans('Piece'); print ''; if ($action != 'editdocref') - print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + print 'piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; print ''; print ''; if ($action == 'editdocref') { @@ -650,8 +650,8 @@ if ($action == 'create') print ''.price($line->credit).''; print ''; - print 'id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">'; - print img_edit(); + print 'id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">'; + print img_edit('', 0, 'class="marginrightonly"'); print '  '; $actiontodelete = 'delete'; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 545ac855b29..2889fbf4ef1 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1039,7 +1039,7 @@ while ($i < min($num, $limit)) } // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 78f29e97595..25f664d955e 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -57,6 +57,12 @@ $search_direction = GETPOST('search_direction', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha'); $search_credit = GETPOST('search_credit', 'alpha'); +$search_lettering_code = GETPOST('search_lettering_code', 'alpha'); +$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha'); + +if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) { + $action = 'delbookkeepingyear'; +} // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -70,6 +76,13 @@ $pagenext = $page + 1; if ($sortorder == "") $sortorder = "ASC"; if ($sortfield == "") $sortfield = "t.doc_date,t.rowid"; +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new BookKeeping($db); +$hookmanager->initHooks(array('bookkeepingbyaccountlist')); + +$formaccounting = new FormAccounting($db); +$form = new Form($db); + if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) { $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; @@ -96,89 +109,167 @@ if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search } } -$object = new BookKeeping($db); +$arrayfields = array( + // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1), + 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), + 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1), + 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), + 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), + 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), + 't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1), + 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), + 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), +); + +if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); /* * Action */ -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers +if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } + +$parameters = array('socid'=>$socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $search_doc_date = ''; - $search_accountancy_code = ''; - $search_accountancy_code_start = ''; - $search_accountancy_code_end = ''; - $search_label_account = ''; - $search_doc_ref = ''; - $search_label_operation = ''; - $search_direction = ''; - $search_ledger_code = ''; - $search_date_start = ''; - $search_date_end = ''; - $search_date_startyear = ''; - $search_date_startmonth = ''; - $search_date_startday = ''; - $search_date_endyear = ''; - $search_date_endmonth = ''; - $search_date_endday = ''; - $search_debit = ''; - $search_credit = ''; + include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; + + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers + { + $search_doc_date = ''; + $search_accountancy_code = ''; + $search_accountancy_code_start = ''; + $search_accountancy_code_end = ''; + $search_label_account = ''; + $search_doc_ref = ''; + $search_label_operation = ''; + $search_direction = ''; + $search_ledger_code = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_date_startyear = ''; + $search_date_startmonth = ''; + $search_date_startday = ''; + $search_date_endyear = ''; + $search_date_endmonth = ''; + $search_date_endday = ''; + $search_debit = ''; + $search_credit = ''; + $search_lettering_code = ''; + $search_not_reconciled = ''; + } + + // Must be after the remove filter action, before the export. + $param = ''; + $filter = array(); + + if (!empty($search_date_start)) { + $filter['t.doc_date>='] = $search_date_start; + $param .= '&search_date_startmonth=' . GETPOST('search_date_startmonth', 'int') . '&search_date_startday=' . GETPOST('search_date_startday', 'int') . '&search_date_startyear=' . GETPOST('search_date_startyear', 'int'); + } + if (!empty($search_date_end)) { + $filter['t.doc_date<='] = $search_date_end; + $param .= '&search_date_endmonth=' . GETPOST('search_date_endmonth', 'int') . '&search_date_endday=' . GETPOST('search_date_endday', 'int') . '&search_date_endyear=' . GETPOST('search_date_endyear', 'int'); + } + if (!empty($search_doc_date)) { + $filter['t.doc_date'] = $search_doc_date; + $param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int'); + } + if (!empty($search_accountancy_code_start)) { + $filter['t.numero_compte>='] = $search_accountancy_code_start; + $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); + } + if (!empty($search_accountancy_code_end)) { + $filter['t.numero_compte<='] = $search_accountancy_code_end; + $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); + } + if (!empty($search_label_account)) { + $filter['t.label_compte'] = $search_label_account; + $param .= '&search_label_compte=' . urlencode($search_label_account); + } + if (!empty($search_doc_ref)) { + $filter['t.doc_ref'] = $search_doc_ref; + $param .= '&search_doc_ref=' . urlencode($search_doc_ref); + } + if (!empty($search_label_operation)) { + $filter['t.label_operation'] = $search_label_operation; + $param .= '&search_label_operation=' . urlencode($search_label_operation); + } + if (!empty($search_direction)) { + $filter['t.sens'] = $search_direction; + $param .= '&search_direction=' . urlencode($search_direction); + } + if (!empty($search_ledger_code)) { + $filter['t.code_journal'] = $search_ledger_code; + $param .= '&search_ledger_code=' . urlencode($search_ledger_code); + } + if (!empty($search_debit)) { + $filter['t.debit'] = $search_debit; + $param .= '&search_debit=' . urlencode($search_debit); + } + if (!empty($search_credit)) { + $filter['t.credit'] = $search_credit; + $param .= '&search_credit=' . urlencode($search_credit); + } + if (!empty($search_lettering_code)) { + $filter['t.lettering_code'] = $search_lettering_code; + $param .= '&search_lettering_code='.urlencode($search_lettering_code); + } + if (!empty($search_not_reconciled)) { + $filter['t.reconciled_option'] = $search_not_reconciled; + $param .= '&search_not_reconciled='.urlencode($search_not_reconciled); + } } -// Must be after the remove filter action, before the export. -$param = ''; -$filter = array(); +if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { + $import_key = GETPOST('importkey', 'alpha'); -if (!empty($search_date_start)) { - $filter['t.doc_date>='] = $search_date_start; - $param .= '&search_date_startmonth='.GETPOST('search_date_startmonth', 'int').'&search_date_startday='.GETPOST('search_date_startday', 'int').'&search_date_startyear='.GETPOST('search_date_startyear', 'int'); -} -if (!empty($search_date_end)) { - $filter['t.doc_date<='] = $search_date_end; - $param .= '&search_date_endmonth='.GETPOST('search_date_endmonth', 'int').'&search_date_endday='.GETPOST('search_date_endday', 'int').'&search_date_endyear='.GETPOST('search_date_endyear', 'int'); -} -if (!empty($search_doc_date)) { - $filter['t.doc_date'] = $search_doc_date; - $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int'); -} -if (!empty($search_accountancy_code_start)) { - $filter['t.numero_compte>='] = $search_accountancy_code_start; - $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start); -} -if (!empty($search_accountancy_code_end)) { - $filter['t.numero_compte<='] = $search_accountancy_code_end; - $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end); -} -if (!empty($search_label_account)) { - $filter['t.label_compte'] = $search_label_account; - $param .= '&search_label_compte='.urlencode($search_label_account); -} -if (!empty($search_doc_ref)) { - $filter['t.doc_ref'] = $search_doc_ref; - $param .= '&search_doc_ref='.urlencode($search_doc_ref); -} -if (!empty($search_label_operation)) { - $filter['t.label_operation'] = $search_label_operation; - $param .= '&search_label_operation='.urlencode($search_label_operation); -} -if (!empty($search_direction)) { - $filter['t.sens'] = $search_direction; - $param .= '&search_direction='.urlencode($search_direction); -} -if (!empty($search_ledger_code)) { - $filter['t.code_journal'] = $search_ledger_code; - $param .= '&search_ledger_code='.urlencode($search_ledger_code); -} -if (!empty($search_debit)) { - $filter['t.debit'] = $search_debit; - $param .= '&search_debit='.urlencode($search_debit); -} -if (!empty($search_credit)) { - $filter['t.credit'] = $search_credit; - $param .= '&search_credit='.urlencode($search_credit); -} + if (!empty($import_key)) { + $result = $object->deleteByImportkey($import_key); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + // Make a redirect to avoid to launch the delete later after a back button + header("Location: listbyaccount.php".($param ? '?'.$param : '')); + exit; + } +} +if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { + $delmonth = GETPOST('delmonth', 'int'); + $delyear = GETPOST('delyear', 'int'); + if ($delyear == -1) { + $delyear = 0; + } + $deljournal = GETPOST('deljournal', 'alpha'); + if ($deljournal == -1) { + $deljournal = 0; + } -if ($action == 'delmouvconfirm') { + if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) + { + $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0)); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + else + { + setEventMessages("RecordDeleted", null, 'mesgs'); + } + + // Make a redirect to avoid to launch the delete later after a back button + header("Location: listbyaccount.php".($param ? '?'.$param : '')); + exit; + } + else + { + setEventMessages("NoRecordDeleted", null, 'warnings'); + } +} +if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) { $mvt_num = GETPOST('mvt_num', 'int'); if (!empty($mvt_num)) { @@ -186,8 +277,13 @@ if ($action == 'delmouvconfirm') { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - Header("Location: listbyaccount.php"); - exit(); + else + { + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + } + + header("Location: listbyaccount.php?noreset=1".($param ? '&'.$param : '')); + exit; } } @@ -229,22 +325,42 @@ if ($action == 'delmouv') { } if ($action == 'delbookkeepingyear') { $form_question = array(); - $delyear = GETPOST('delyear'); + $delyear = GETPOST('delyear', 'int'); + $deljournal = GETPOST('deljournal', 'alpha'); if (empty($delyear)) { $delyear = dol_print_date(dol_now(), '%Y'); } + $month_array = array(); + for ($i = 1; $i <= 12; $i++) { + $month_array[$i] = $langs->trans("Month".sprintf("%02d", $i)); + } $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array'); + $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1); + $form_question['delmonth'] = array( + 'name' => 'delmonth', + 'type' => 'select', + 'label' => $langs->trans('DelMonth'), + 'values' => $month_array, + 'default' => '' + ); $form_question['delyear'] = array( - 'name' => 'delyear', - 'type' => 'select', - 'label' => $langs->trans('DelYear'), - 'values' => $year_array, - 'default' => $delyear + 'name' => 'delyear', + 'type' => 'select', + 'label' => $langs->trans('DelYear'), + 'values' => $year_array, + 'default' => $delyear + ); + $form_question['deljournal'] = array( + 'name' => 'deljournal', + 'type' => 'other', // We don't use select here, the journal_array is already a select html component + 'label' => $langs->trans('DelJournal'), + 'value' => $journal_array, + 'default' => $deljournal ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); print $formconfirm; } @@ -267,53 +383,115 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($l print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit); +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + // Reverse sort order if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc"; else $sortorder = "desc"; -print '
'; -print ''; +$moreforfilter = ''; -print ''; -print ''; -print ''; + +print '
'; +print '
'; -print '
'; -print $langs->trans('From').' '; -print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200'); +// Accountancy account +$moreforfilter .= '
'; +$moreforfilter .= $langs->trans('AccountAccounting').': '; +$moreforfilter .= '
'; +$moreforfilter .= $langs->trans('From').' '; +$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200'); +$moreforfilter .= $langs->trans('to').' '; +$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200'); +$moreforfilter .= '
'; +$moreforfilter .= '
'; + +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + +print '
'; +print $moreforfilter; print '
'; -print '
'; -print $langs->trans('to').' '; -print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200'); -print '
'; -print '
'; + +// Filters lines +print ''; + +// Code journal +if (!empty($arrayfields['t.code_journal']['checked'])) { + print ''; +} +// Date document +if (!empty($arrayfields['t.doc_date']['checked'])) { + print ''; +} +// Movement number +if (!empty($arrayfields['t.piece_num']['checked'])) +{ + print ''; +} +// Ref document +if (!empty($arrayfields['t.doc_ref']['checked'])) { + print ''; +} +// Label operation +if (!empty($arrayfields['t.label_operation']['checked'])) { + print ''; +} +// Debit +if (!empty($arrayfields['t.debit']['checked'])) { + print ''; +} +// Credit +if (!empty($arrayfields['t.credit']['checked'])) { + print ''; +} +// Lettering code +if (!empty($arrayfields['t.lettering_code']['checked'])) +{ + print ''; +} + +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +// Action column print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print "\n"; print ''; -print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']); -print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'right '); -print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); -print_liste_field_titre("Piece", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre("Label"); -print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); -print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); -print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); -print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); +if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); +if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); +if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); +if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -323,7 +501,10 @@ $sous_total_debit = 0; $sous_total_credit = 0; $displayed_account_number = null; // Start with undefined to be able to distinguish with empty +// Loop on record +// -------------------------------------------------------------------- $i = 0; +$totalarray = array(); while ($i < min($num, $limit)) { $line = $object->lines[$i]; @@ -336,18 +517,41 @@ while ($i < min($num, $limit)) // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { - // Affiche un Sous-Total par compte comptable + $colspan = $totalarray['nbfield'] - 3; + $colspanend = $totalarray['nbfield'] - 7; + // Show a subtotal by accounting account if (isset($displayed_account_number)) { - print ''; - print "\n"; - print "\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + // Show balance of last shown account + $balance = $sous_total_debit - $sous_total_credit; + print ''; + print ''; + if ($balance > 0 ) + { + print ''; + print ''; + } + else + { + print ''; + print ''; + } + print ''; print ''; } // Show the break account - $colspan = 9; print ""; - print ''; @@ -357,72 +561,212 @@ while ($i < min($num, $limit)) //if (empty($displayed_account_number)) $displayed_account_number='-'; $sous_total_debit = 0; $sous_total_credit = 0; + + $colspan = 0; } print ''; - print ''; - print ''; - print ''; - // TODO Add a link according to doc_type and fk_doc - print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Document date + if (!empty($arrayfields['t.doc_date']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Piece number + if (!empty($arrayfields['t.piece_num']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Document ref + if (!empty($arrayfields['t.doc_ref']['checked'])) + { + if ($line->doc_type == 'customer_invoice') + { + $langs->loadLangs(array('bills')); + + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $objectstatic = new Facture($db); + $objectstatic->fetch($line->fk_doc); + //$modulepart = 'facture'; + + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } + elseif ($line->doc_type == 'supplier_invoice') + { + $langs->loadLangs(array('bills')); + + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + $objectstatic = new FactureFournisseur($db); + $objectstatic->fetch($line->fk_doc); + //$modulepart = 'invoice_supplier'; + + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); + } + elseif ($line->doc_type == 'expense_report') + { + $langs->loadLangs(array('trips')); + + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + $objectstatic = new ExpenseReport($db); + $objectstatic->fetch($line->fk_doc); + //$modulepart = 'expensereport'; + + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } + else + { + // Other type + } + + print '\n"; + if (!$i) $totalarray['nbfield']++; + } + + // Label operation + if (!empty($arrayfields['t.label_operation']['checked'])) { + // Affiche un lien vers la facture client/fournisseur + $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); + print strlen(length_accounta($line->subledger_account)) == 0 ? '' : ''; + if (!$i) $totalarray['nbfield']++; + } + + // Amount debit + if (!empty($arrayfields['t.debit']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit'; + $totalarray['val']['totaldebit'] += $line->debit; + } + + // Amount credit + if (!empty($arrayfields['t.credit']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; + $totalarray['val']['totalcredit'] += $line->credit; + } + + // Lettering code + if (!empty($arrayfields['t.lettering_code']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Action column + print ''; - - // Affiche un lien vers la facture client/fournisseur - $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); - print strlen(length_accounta($line->subledger_account)) == 0 ? '' : ''; - - - print ''; - print ''; - - $accountingjournal = new AccountingJournal($db); - $result = $accountingjournal->fetch('', $line->code_journal); - $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); - print ''; - - print ''; - print "\n"; + if (!$i) $totalarray['nbfield']++; // Comptabilise le sous-total $sous_total_debit += $line->debit; $sous_total_credit += $line->credit; + print "\n"; + $i++; } // Show sub-total of last shown account +$colspan = $totalarray['nbfield'] - 3; +$colspanend = $totalarray['nbfield'] - 8; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +// Show balance of last shown account +$balance = $sous_total_debit - $sous_total_credit; +print ''; +print ''; +if ($balance > 0 ) +{ + print ''; + print ''; +} +else +{ + print ''; + print ''; +} +print ''; print ''; +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; -// Show total -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; print "
'; + print '
'; + print $langs->trans('From') . ': '; + print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ': '; + print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1); + print '
'; + print '
'; + print ''; + print '
'.$langs->trans("NotReconciled").''; + print '
'; -print $langs->trans('From').': '; -print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1); -print '
'; -print $langs->trans('to').': '; -print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1); -print '
'; -$searchpicto = $form->showFilterAndCheckAddButtons(0); +$searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).'  
'.$langs->trans("TotalForAccount").' '.length_accountg($displayed_account_number).':'.price($sous_total_debit).''.price($sous_total_credit).'
'.$langs->trans("Balance").':'; + print price($sous_total_debit - $sous_total_credit); + print ''; + print price($sous_total_credit - $sous_total_debit); + print '
'; + print ''; if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte); else print ''.$langs->trans("Unknown").''; print '
 '.$line->piece_num.''.dol_print_date($line->doc_date, 'day').''; - //if ($line->doc_type == 'supplier_invoice') - //if ($line->doc_type == 'customer_invoice') - print $line->doc_ref; + // Journal code + if (!empty($arrayfields['t.code_journal']['checked'])) + { + $accountingjournal = new AccountingJournal($db); + $result = $accountingjournal->fetch('', $line->code_journal); + $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); + print ''.$journaltoshow.''.dol_print_date($line->doc_date, 'day').''; + $object->id = $line->id; + $object->piece_num = $line->piece_num; + print $object->getNomUrl(1, '', 0, '', 1); + print ''; + + print ''; + // Picto + Ref + print '
'; + + if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') + { + print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); + print $documentlink; + } else { + print $line->doc_ref; + } + print '
'; + + print "
' . $line->label_operation . '' . $line->label_operation . '
(' . length_accounta($line->subledger_account) . ')
'.($line->debit ? price($line->debit) : '').'' . ($line->credit ? price($line->credit) : '') . ''.$line->lettering_code.''; + if (empty($line->date_export)) { + if ($user->rights->accounting->mouvements->creer) { + print ''.img_edit().''; + } + if ($user->rights->accounting->mouvements->supprimer) { + print ' '.img_delete().''; + } + } print ''.$line->label_operation.''.$line->label_operation.'
('.length_accounta($line->subledger_account).')
'.($line->debit ? price($line->debit) : '').''.($line->credit ? price($line->credit) : '').''.$journaltoshow.''; - print ''.img_edit().' '; - print ''.img_delete().''; - print '
'.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''; -print price($sous_total_debit - $sous_total_credit); -print ''.$langs->trans("TotalForAccount").' '.$accountg.':'.price($sous_total_debit).''.price($sous_total_credit).'
'.$langs->trans("Balance").':'; + print price($sous_total_debit - $sous_total_credit); + print ''; + print price($sous_total_credit - $sous_total_debit); + print '
'.$langs->trans("Total").':'; -print price($total_debit); -print ''; -print price($total_credit); -print '
"; print '
'; +// TODO Replace this with mass delete action +if ($user->rights->accounting->mouvements->supprimer_tous) { + print '
'."\n"; + print ''.$langs->trans("DeleteMvt").''; + print '
'; +} + print ''; // End of page diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 1e641564de4..3bf41e6326f 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -5,11 +5,12 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016-2019 Alexandre Spangaro + * Copyright (C) 2016-2020 Alexandre Spangaro * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017-2019 Frédéric France * Copyright (C) 2017 André Schild + * Copyright (C) 2020 Guillaume Alexandre * * 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 @@ -52,6 +53,7 @@ class AccountancyExport public static $EXPORT_TYPE_SAGE50_SWISS = 45; public static $EXPORT_TYPE_CHARLEMAGNE = 50; public static $EXPORT_TYPE_QUADRATUS = 60; + public static $EXPORT_TYPE_WINFIC = 70; public static $EXPORT_TYPE_OPENCONCERTO = 100; public static $EXPORT_TYPE_LDCOMPTA = 110; public static $EXPORT_TYPE_LDCOMPTA10 = 120; @@ -105,6 +107,7 @@ class AccountancyExport self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'), self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'), self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'), + self::$EXPORT_TYPE_WINFIC => $langs->trans('Modelcsv_winfic'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), @@ -136,6 +139,7 @@ class AccountancyExport self::$EXPORT_TYPE_BOB50 => 'bob50', self::$EXPORT_TYPE_CIEL => 'ciel', self::$EXPORT_TYPE_QUADRATUS => 'quadratus', + self::$EXPORT_TYPE_WINFIC => 'winfic', self::$EXPORT_TYPE_EBP => 'ebp', self::$EXPORT_TYPE_COGILOG => 'cogilog', self::$EXPORT_TYPE_AGIRIS => 'agiris', @@ -184,6 +188,10 @@ class AccountancyExport 'label' => $langs->trans('Modelcsv_quadratus'), 'ACCOUNTING_EXPORT_FORMAT' => 'txt', ), + self::$EXPORT_TYPE_WINFIC => array( + 'label' => $langs->trans('Modelcsv_winfic'), + 'ACCOUNTING_EXPORT_FORMAT' => 'txt', + ), self::$EXPORT_TYPE_EBP => array( 'label' => $langs->trans('Modelcsv_ebp'), ), @@ -246,7 +254,7 @@ class AccountancyExport $filename = 'general_ledger-'.$this->getFormatCode($formatexportset); $type_export = 'general_ledger'; - global $db; // The tpl file use $db + global $db; // The tpl file use $db include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; @@ -269,6 +277,9 @@ class AccountancyExport case self::$EXPORT_TYPE_QUADRATUS : $this->exportQuadratus($TData); break; + case self::$EXPORT_TYPE_WINFIC : + $this->exportWinfic($TData); + break; case self::$EXPORT_TYPE_EBP : $this->exportEbp($TData); break; @@ -548,6 +559,85 @@ class AccountancyExport } } + /** + * Export format : WinFic - eWinfic - WinSis Compta + * + * + * @param array $TData data + * @return void + */ + public function exportWinfic(&$TData) + { + global $conf; + + $end_line = "\r\n"; + + //We should use dol_now function not time however this is wrong date to transfert in accounting + //$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy + //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy + foreach ($TData as $data) { + $code_compta = $data->numero_compte; + if (!empty($data->subledger_account)) + $code_compta = $data->subledger_account; + + $Tab = array(); + //$Tab['type_ligne'] = 'M'; + $Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2); + + //We use invoice date $data->doc_date not $date_ecriture which is the transfert date + //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ? + //$Tab['date_ecriture'] = $date_ecriture; + $Tab['date_operation'] = dol_print_date($data->doc_date, '%d%m%Y'); + + $Tab['folio'] = ' 1'; + + $Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); + + $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); + + $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); + + if($data->sens == 'D'){ + $Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); + + $Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); + } + else{ + $Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); + + $Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); + } + + $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); + + $Tab['lettrage'] = str_repeat(' ', 2); + + $Tab['code_piece'] = str_repeat(' ', 5); + + $Tab['code_stat'] = str_repeat(' ', 4); + + if (!empty($data->date_echeance)) + //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); + $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y'); + else + $Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y'); + + $Tab['monnaie'] = '1'; + + $Tab['filler'] = ' '; + + $Tab['ind_compteur'] = ' '; + + $Tab['quantite'] = '0,000000000'; + + $Tab['code_pointage'] = str_repeat(' ', 2); + + $Tab['end_line'] = $end_line; + + print implode('|', $Tab); + } + } + /** * Export format : EBP @@ -930,7 +1020,7 @@ class AccountancyExport } /** - * Export format : LD Compta version 9 & higher + * Export format : LD Compta version 9 * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf * * @param array $objectLines data diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index a32918cc5bf..bcd17793db1 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -553,24 +553,19 @@ class AccountingAccount extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Account deactivated + * Deactivate an account (for status active or status reconcilable) * * @param int $id Id - * @param int $mode 0=field active, 1=field active_customer_list, 2=field_active_supplier_list + * @param int $mode 0=field active, 1=field reconcilable * @return int <0 if KO, >0 if OK */ - public function account_desactivate($id, $mode = 0) + public function accountDeactivate($id, $mode = 0) { - // phpcs:enable $result = $this->checkUsage(); - if ($mode == 0) - { - $fieldtouse = 'active'; - } - elseif ($mode == 1) + $fieldtouse = 'active'; + if ($mode == 1) { $fieldtouse = 'reconcilable'; } @@ -582,7 +577,7 @@ class AccountingAccount extends CommonObject $sql .= "SET ".$fieldtouse." = '0'"; $sql .= " WHERE rowid = ".$this->db->escape($id); - dol_syslog(get_class($this)."::account_desactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::accountDeactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 43762c2d36a..0162a98394e 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -704,7 +704,7 @@ class BookKeeping extends CommonObject $sql .= ' WHERE 1 = 1'; $sql .= " AND entity IN (".getEntity('accountancy').")"; if (null !== $ref) { - $sql .= ' AND t.ref = '.'\''.$ref.'\''; + $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; } else { $sql .= ' AND t.rowid = '.$id; } diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 7e51160195b..45b0c909016 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2020 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -27,10 +27,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -42,6 +43,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); // Search Getpost +$search_societe = GETPOST('search_societe', 'alpha'); $search_lineid = GETPOST('search_lineid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); $search_invoice = GETPOST('search_invoice', 'alpha'); @@ -89,6 +91,7 @@ $formaccounting = new FormAccounting($db); // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { + $search_societe=''; $search_lineid = ''; $search_ref = ''; $search_invoice = ''; @@ -175,7 +178,7 @@ $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,"; $sql .= " fd.situation_percent,"; $sql .= " co.code as country_code, co.label as country,"; -$sql .= " s.tva_intra"; +$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -193,6 +196,10 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } else { $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")"; } +// Add search filter like +if ($search_societe) { + $sql .= natural_search('s.nom', $search_societe); +} if ($search_lineid) { $sql .= natural_search("fd.rowid", $search_lineid, 1); } @@ -262,6 +269,7 @@ if ($result) { $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($search_societe) $param .= "&search_societe=".urlencode($search_societe); if ($search_invoice) $param .= "&search_invoice=".urlencode($search_invoice); if ($search_ref) $param .= "&search_ref=".urlencode($search_ref); if ($search_label) $param .= "&search_label=".urlencode($search_label); @@ -296,7 +304,7 @@ if ($result) { print ''."\n"; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; + print ''; print ''; print ''; @@ -330,6 +339,7 @@ if ($result) { print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); @@ -337,6 +347,7 @@ if ($result) { print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; + $thirdpartystatic=new Societe($db); $facture_static = new Facture($db); $product_static = new Product($db); @@ -347,6 +358,17 @@ if ($result) { $facture_static->id = $objp->facid; $facture_static->type = $objp->ftype; + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_compta_client = $objp->code_compta_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartystatic->email = $objp->email; + $thirdpartystatic->country_code = $objp->country_code; + $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; $product_static->label = $objp->product_label; @@ -367,7 +389,7 @@ if ($result) { print ''; print ''; + // Thirdparty + print ''; + // Country print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; + print ''; print '\n"; + $thirdpartystatic = new Societe($db); $facture_static = new Facture($db); $product_static = new Product($db); @@ -421,6 +431,17 @@ if ($result) { $objp->code_sell_l = ''; $objp->code_sell_p = ''; + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_compta_client = $objp->code_compta_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartystatic->email = $objp->email; + $thirdpartystatic->country_code = $objp->country_code; + $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; $product_static->type = $objp->type; @@ -558,6 +579,9 @@ if ($result) { print vatrate($objp->tva_tx_line.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')); print ''; + // Thirdparty + print ''; + // Country print ''; // Found accounts - print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 8cc398a00bf..4cd51fb3a63 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -252,6 +252,9 @@ if ($result) { print ''; print ''; print ''; + if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { + print ''; + } print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { + print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); + } + print_liste_field_titre("DateOfLine", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); @@ -299,6 +305,11 @@ if ($result) { // Ref Invoice print ''; + // Date validation + if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { + print ''; + } + print ''; print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index e03c717039f..96eebd49b36 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -42,6 +42,9 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + // Select Box $mesCasesCochees = GETPOST('toselect', 'array'); @@ -183,7 +186,7 @@ if (empty($chartaccountcode)) } // Expense report lines -$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,"; +$sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,"; $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,"; $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,"; $sql .= " aa.rowid as aarowid"; @@ -240,8 +243,8 @@ if ($result) { $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid); if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_month) $param .= '&search_month='.urlencode($search_month); @@ -288,6 +291,9 @@ if ($result) { print ''; print ''; print ''; + if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { + print ''; + } print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { + print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); + } + print_liste_field_titre("DateOfLine", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); @@ -341,6 +350,11 @@ if ($result) { // Ref Expense report print ''; + // Date validation + if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { + print ''; + } + // Date print ''; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index bc0cf66a938..56cf674505b 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -88,7 +88,7 @@ if ($conf->accounting->enabled) } - print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); + print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial); print '
'; // hideobject is to start hidden print "
\n"; @@ -101,13 +101,13 @@ if ($conf->accounting->enabled) // STEPS $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); print "
\n"; print "
\n"; @@ -116,20 +116,20 @@ if ($conf->accounting->enabled) print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; print "
\n"; $step++; - $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''.''; + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print "
\n"; if (!empty($conf->tax->enabled)) { - $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''.''; + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print "
\n"; @@ -145,7 +145,7 @@ if ($conf->accounting->enabled) if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); print "
\n"; } /* @@ -169,7 +169,7 @@ if ($conf->accounting->enabled) }*/ $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); print "
\n"; @@ -186,17 +186,17 @@ if ($conf->accounting->enabled) $langs->loadLangs(array('bills', 'trips')); $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'')."\n"; print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'')."\n"; print "
\n"; if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."\n"; print "
\n"; } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b3d1e6ce7f8..3372105cd85 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -994,7 +994,7 @@ if (empty($action) || $action == 'view') { print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index d0a84c1236c..4be0b133143 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -508,7 +508,7 @@ if (empty($action) || $action == 'view') { } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { print ''; } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index dd7dc1ca9e1..42bff74097f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -740,7 +740,7 @@ if (empty($action) || $action == 'view') { print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print ''; } @@ -936,7 +936,7 @@ if (empty($action) || $action == 'view') { $accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined') { - print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'.''; + print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'; } else print $accountoshow; print ""; @@ -959,15 +959,15 @@ if (empty($action) || $action == 'view') { foreach ($tabother[$key] as $k => $mt) { if ($mt) { print '
'; - print ""; + print ''; print ""; print ""; // Account - print "'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 80603106cb3..c3c9f45ed5a 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -677,7 +677,7 @@ if (empty($action) || $action == 'view') { print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { print ''; } @@ -874,7 +874,7 @@ if (empty($action) || $action == 'view') { $accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined') { - print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'.''; + print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'; } else print $accountoshow; print ""; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 6d1a0ccd610..f3a4b255f3e 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2020 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -27,12 +27,13 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -44,6 +45,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); // Search Getpost +$search_societe = GETPOST('search_societe', 'alpha'); $search_lineid = GETPOST('search_lineid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); $search_invoice = GETPOST('search_invoice', 'alpha'); @@ -91,6 +93,7 @@ $formaccounting = new FormAccounting($db); // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { + $search_societe = ''; $search_lineid = ''; $search_ref = ''; $search_invoice = ''; @@ -177,7 +180,7 @@ $sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.t $sql .= " aa.label, aa.account_number, "; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,"; $sql .= " co.code as country_code, co.label as country,"; -$sql .= " s.tva_intra"; +$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -188,6 +191,10 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_fact $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; +// Add search filter like +if ($search_societe) { + $sql .= natural_search('s.nom', $search_societe); +} if ($search_lineid) { $sql .= natural_search("l.rowid", $search_lineid, 1); } @@ -264,6 +271,7 @@ if ($result) { $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($search_societe) $param .= "&search_societe=" . urlencode($search_societe); if ($search_invoice) $param .= "&search_invoice=".urlencode($search_invoice); if ($search_ref) $param .= "&search_ref=".urlencode($search_ref); if ($search_label) $param .= "&search_label=".urlencode($search_label); @@ -300,7 +308,7 @@ if ($result) { // We add search filter print '
'; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; + print ''; print ''; print ''; @@ -334,6 +343,7 @@ if ($result) { print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); @@ -341,6 +351,7 @@ if ($result) { print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; + $thirdpartystatic = new Societe($db); $facturefournisseur_static = new FactureFournisseur($db); $product_static = new ProductFournisseur($db); @@ -352,6 +363,17 @@ if ($result) { $facturefournisseur_static->ref = $objp->ref; $facturefournisseur_static->id = $objp->facid; + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_compta_client = $objp->code_compta_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartystatic->email = $objp->email; + $thirdpartystatic->country_code = $objp->country_code; + $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; $product_static->label = $objp->product_label; @@ -376,7 +398,7 @@ if ($result) { print ''; // Description @@ -390,6 +412,10 @@ if ($result) { print ''; + // Thirdparty + print ''; + + // Country print ''; print ''; print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index ce354c789f3..6ef942bea89 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -27,12 +27,13 @@ */ require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -49,6 +50,7 @@ $toselect = GETPOST('toselect', 'array'); $mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost +$search_societe = GETPOST('search_societe', 'alpha'); $search_lineid = GETPOST('search_lineid', 'int'); $search_invoice = GETPOST('search_invoice', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha'); @@ -116,6 +118,7 @@ if (empty($reshook)) // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers { + $search_societe=''; $search_lineid = ''; $search_ref = ''; $search_invoice = ''; @@ -216,7 +219,7 @@ $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as co $sql .= " p.tosell as status, p.tobuy as status_buy,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql .= " co.code as country_code, co.label as country_label,"; -$sql .= " s.tva_intra"; +$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -231,6 +234,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; // Add search filter like +if ($search_societe) { + $sql .= natural_search('s.nom', $search_societe); +} if ($search_lineid) { $sql .= natural_search("l.rowid", $search_lineid, 1); } @@ -314,6 +320,7 @@ if ($result) { $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($search_societe) $param.='&search_societe='.urlencode($search_societe); if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid); if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_month) $param .= '&search_month='.urlencode($search_month); @@ -364,7 +371,7 @@ if ($result) { // We add search filter print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; + print ''; print '\n"; + $thirdpartystatic=new Societe($db); $facturefourn_static = new FactureFournisseur($db); $product_static = new Product($db); @@ -424,6 +434,17 @@ if ($result) { $objp->code_buy_l = ''; $objp->code_buy_p = ''; + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_compta_client = $objp->code_compta_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartystatic->email = $objp->email; + $thirdpartystatic->country_code = $objp->country_code; + $product_static->ref = $objp->product_ref; $product_static->id = $objp->product_id; $product_static->type = $objp->type; @@ -543,6 +564,9 @@ if ($result) { print vatrate($objp->tva_tx_line.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')); print ''; + // Thirdparty + print ''; + // Country print ''; // Found accounts - print ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index dd2593329e0..55504a547c2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -60,6 +60,9 @@ class Adherent extends CommonObject */ public $ismultientitymanaged = 1; + public $picto = 'member'; + + public $mesgs; /** diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 46733575c36..4af80ab4a63 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -183,20 +183,14 @@ class AdherentType extends CommonObject $sql2 .= " SET "; $sql2 .= " label='".$this->db->escape($this->label)."',"; $sql2 .= " description='".$this->db->escape($this->description)."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->other)."'"; - } $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email"; - } $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',"; $sql2 .= " '".$this->db->escape($this->description)."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->other)."'"; - } $sql2 .= ")"; } dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key); @@ -219,20 +213,14 @@ class AdherentType extends CommonObject $sql2 .= " SET "; $sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->multilangs["$key"]["other"])."'"; - } $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email"; - } $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'"; - } $sql2 .= ")"; } diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 44fcb397ddc..6d069386592 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -1,9 +1,9 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -22,7 +22,7 @@ /** * \file htdocs/adherents/index.php * \ingroup member - * \brief Page accueil module adherents + * \brief Home page of membership module */ require '../main.inc.php'; @@ -339,7 +339,7 @@ if ($resql) $staticmember->ref = $staticmember->getFullName($langs); $statictype->id = $obj->typeid; $statictype->label = $obj->label; - print ''; + print ''; print ''; print ''; print ''; @@ -399,12 +399,12 @@ if ($resql) $staticmember->name = $obj->company; } $staticmember->ref = $staticmember->getFullName($langs); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; //print ''; - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7ed417750a7..6cb34192845 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -877,7 +877,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index faba2c50ac2..d2fd59b8ce5 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -521,7 +521,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 10bfa13d1ce..c5b196146d5 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -81,8 +81,10 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) } if ($action == 'set') { + $getDefaultFilter = GETPOST('AGENDA_DEFAULT_FILTER_TYPE'); + $defaultfilter = (is_array($getDefaultFilter)) ? implode(',', $getDefaultFilter) : $getDefaultFilter; dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); } @@ -377,7 +379,12 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index d4664a13de1..f33a3ea6f93 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -693,7 +693,7 @@ print '
'; // Sales taxes (VAT, IRPF, ...) -print load_fiche_titre($langs->trans("TypeOfSaleTaxes")); +print load_fiche_titre($langs->trans("TypeOfSaleTaxes"), '', 'object_payment'); print '
'; if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { @@ -310,8 +318,9 @@ if ($result) { print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1); //print ''; print '
'; if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($product_static->id > 0 && $objp->product_label) print '
'; - if ($objp->product_label) print $objp->product_label; + if ($objp->product_label) print ''.$objp->product_label.''; print '
'; @@ -380,6 +402,9 @@ if ($result) { print ''.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'' . $thirdpartystatic->getNomUrl(1, 'customer') . ''; if ($objp->country_code) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9dbb846370c..1d93a0fea17 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2019 Alexandre Spangaro + * Copyright (C) 2013-2020 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -27,12 +27,13 @@ */ require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -49,6 +50,7 @@ $toselect = GETPOST('toselect', 'array'); $mesCasesCochees = GETPOST('toselect', 'array'); // Search Getpost +$search_societe = GETPOST('search_societe', 'alpha'); $search_lineid = GETPOST('search_lineid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); $search_invoice = GETPOST('search_invoice', 'alpha'); @@ -112,6 +114,7 @@ if (empty($reshook)) // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers { + $search_societe=''; $search_lineid = ''; $search_ref = ''; $search_invoice = ''; @@ -212,7 +215,7 @@ $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as co $sql .= " p.tosell as status, p.tobuy as status_buy,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql .= " co.code as country_code, co.label as country_label,"; -$sql .= " s.tva_intra"; +$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -227,6 +230,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; // Add search filter like +if ($search_societe) { + $sql .= natural_search('s.nom', $search_societe); +} if ($search_lineid) { $sql .= natural_search("l.rowid", $search_lineid, 1); } @@ -314,6 +320,7 @@ if ($result) { $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid); if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_month) $param .= '&search_month='.urlencode($search_month); @@ -363,7 +370,7 @@ if ($result) { // We add search filter print '
'; if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { @@ -377,6 +384,7 @@ if ($result) { print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1); //print ''; @@ -399,6 +407,7 @@ if ($result) { print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); @@ -408,6 +417,7 @@ if ($result) { print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "
' . $thirdpartystatic->getNomUrl(1, 'customer') . ''; $labelcountry = ($objp->country_code && ($langs->trans("Country".$objp->country_code) != "Country".$objp->country_code)) ? $langs->trans("Country".$objp->country_code) : $objp->country_label; @@ -567,12 +591,12 @@ if ($result) { print ''.$objp->tva_intra.''; + print ''; $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); - $s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("NotDefined")); + $s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); if ($objp->product_id > 0) { @@ -583,7 +607,7 @@ if ($result) { elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT"); elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); - $s .= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p)); + $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } print '
'; if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; @@ -272,7 +275,10 @@ if ($result) { print '
'.$expensereport_static->getNomUrl(1).''.dol_print_date($db->jdate($objp->date_valid), 'day').''.dol_print_date($db->jdate($objp->date), 'day').''.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'
'; if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; @@ -308,7 +314,10 @@ if ($result) { print '
'.$expensereport_static->getNomUrl(1).''.dol_print_date($db->jdate($objp->date_valid), 'day').''.dol_print_date($db->jdate($objp->date), 'day').'
".$date."".$invoicestatic->getNomUrl(1).""; + print ''; $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') + if ($accountoshow == '' || $accountoshow == 'NotDefined') { - print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'.''; + print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'; } else print $accountoshow; print '
'; @@ -312,8 +320,9 @@ if ($result) { print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1); // print ''; print '
'; if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($product_static->id > 0 && $objp->product_label) print '
'; - if ($objp->product_label) print $objp->product_label; + if ($objp->product_label) print ''.$objp->product_label.''; print '
'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'' . $thirdpartystatic->getNomUrl(1, 'supplier') . ''; if ($objp->country_code) { @@ -400,7 +426,7 @@ if ($result) { print ''.$objp->tva_intra.''; - print $codecompta.' '; + print $codecompta.' '; print img_edit(); print '
'; @@ -376,6 +383,7 @@ if ($result) { print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1); //print ''; @@ -399,6 +407,7 @@ if ($result) { print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); @@ -408,6 +417,7 @@ if ($result) { print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "
' . $thirdpartystatic->getNomUrl(1, 'supplier') . ''; $labelcountry = ($objp->country_code && ($langs->trans("Country".$objp->country_code) != "Country".$objp->country_code)) ? $langs->trans("Country".$objp->country_code) : $objp->country_label; @@ -553,12 +577,12 @@ if ($result) { print ''.$objp->tva_intra.''; + print ''; $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); - $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("NotDefined")); + $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); if ($objp->product_id > 0) { @@ -567,7 +591,7 @@ if ($result) { $shelp = ''; if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); - $s .= (empty($objp->code_buy_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_buy_p)); + $s .= (empty($objp->code_buy_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_buy_p)); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } print ''.$staticmember->getNomUrl(1, 32).''.$staticmember->getNomUrl(1, 32).''.$statictype->getNomUrl(1, 32).''.dol_print_date($db->jdate($obj->datem), 'dayhour').''.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 3).''.$subscriptionstatic->getNomUrl(1).''.$staticmember->getNomUrl(1, 32, 'subscription').''.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).''.$subscriptionstatic->getNomUrl(1).''.$staticmember->getNomUrl(1, 32, 'subscription').''.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).''.price($obj->subscription).''.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).''.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').''.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').'
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; -$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1); +$multiselect = 0; +if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { + // We use an option here because it adds bugs when used on agenda page "peruser" and "list" + $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); +} +$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect); print '
'; print ''; diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index cdfa15d9069..3ccc2a213ac 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -5,6 +5,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2013-2017 Philippe Grand * Copyright (C) 2014 Marcos García + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -83,6 +84,20 @@ if ($action == 'update') } } + $report_include_varpay = GETPOST('ACCOUNTING_REPORTS_INCLUDE_VARPAY', 'alpha'); + if (!empty($report_include_varpay)) + if ($report_include_varpay == 'yes') + if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', 1, 'chaine', 0, '', $conf->entity)) $error++; + if ($report_include_varpay == 'no') + if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', $conf->entity)) $error++; + + $report_include_loan = GETPOST('ACCOUNTING_REPORTS_INCLUDE_LOAN', 'alpha'); + if (!empty($report_include_loan)) + if ($report_include_loan == 'yes') + if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', 1, 'chaine', 0, '', $conf->entity)) $error++; + if ($report_include_loan == 'no') + if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', $conf->entity)) $error++; + if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -158,6 +173,20 @@ foreach ($list as $key) print ''; } +// Option to include various payment in results +print ''."\n"; +print ''."\n"; +print ''; + +// Option to include loan in results +print ''."\n"; +print ''."\n"; +print ''; + print "
'."\n"; +print $form->selectyesno('ACCOUNTING_REPORTS_INCLUDE_VARPAY', (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY))); +print '
'."\n"; +print $form->selectyesno('ACCOUNTING_REPORTS_INCLUDE_LOAN', (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN))); +print '
\n"; print '

'; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 9f3accfe549..bc22a2020fb 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -328,10 +328,10 @@ if ($conf->use_javascript_ajax) { print '
'; print '
'; - print ''; + print ''; print '
'; print '
'; - print ''; + print ''; print '
'; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7d12ffca433..cce441c4052 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -503,7 +503,7 @@ $tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[35] = array(); $tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange')); -$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode")); +$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc')); $tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc')); // List of check for fields (NOT USED YET) @@ -644,6 +644,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'color' && empty($_POST['color'])) continue; if ($value == 'formula' && empty($_POST['formula'])) continue; + if ($value == 'dayrule' && empty($_POST['dayrule'])) continue; if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position' if ((!isset($_POST[$value]) || $_POST[$value] == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking')) // Fields that are not mandatory @@ -1718,7 +1719,7 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; else print ' '; // Delete link diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index 8d1122417b5..7c25e9d33a5 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -1,6 +1,7 @@ . * Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); * it under the terms of the GNU General Public License as published bypliance with the License. @@ -17,6 +18,9 @@ */ if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', 1); +} /** diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 251322ea798..a229f3c985d 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -213,19 +213,17 @@ class Dolistore { $cat = $this->categories[$i]; if ($cat->is_root_category == 1 && $parent == 0) { - $html .= '
  • '.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.'

    '; - $html .= self::get_categories($cat->id); - $html .= "
  • \n"; + $html .= '
  • description->language[$this->lang - 1])).'">'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.'

    '; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau $select = ($cat->id == $this->categorie) ? ' selected' : ''; - $html .= '
  • '.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; - $html .= self::get_categories($cat->id); - $html .= "
  • \n"; - } else { + $html .= '
  • description->language[$this->lang - 1])).'" '; + $html .= '>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; } } @@ -250,11 +248,8 @@ class Dolistore // phpcs:enable global $langs, $conf; $html = ""; - $parity = "pair"; $last_month = time() - (30 * 24 * 60 * 60); foreach ($this->products as $product) { - $parity = ($parity == "impair") ? 'pair' : 'impair'; - // check new product ? $newapp = ''; if ($last_month < strtotime($product->date_add)) { @@ -269,8 +264,8 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; - $images = ''. - ''; + $images = ''; + $images .= ''; } else { $images = ''; } @@ -308,16 +303,16 @@ class Dolistore //.'
    '.$langs->trans("SeeInMarkerPlace").' //output template - $html .= ' + $html .= '
    '.$newapp.$images.'

    '.$product->name->language[$this->lang - 1] .'
    '.$version.'

    - '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang - 1].' - '.$product->description->language[$this->lang - 1].' - '.$price.' - - '.$download_link.' - '; + '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang - 1].''; + // do not load if display none + //$html .= ''.$product->description->language[$this->lang - 1].''; + $html .= ''.$price.''; + $html .= ''.$download_link.''; + $html .= ''; } return $html; } diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 74592ff777a..80161eaadc6 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -592,7 +592,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); //var_dump($htmltext); - print $form->textwithpicto('', $htmltext); + print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt'); print ''; print ''; print ''; @@ -643,7 +643,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Delete print ''; - print ''.img_edit().''; + print ''.img_edit().''; print ' '.img_delete().''; print ''; print ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index d2c52da585b..f180cdf10cf 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -476,7 +476,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index af1c7c88698..d076e77bf44 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -368,20 +368,20 @@ foreach ($dirmodels as $reldir) { if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); + $name = substr($file, 4, dol_strlen($file) - 16); + $classname = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; $module = new $classname($db); - $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + $modulequalified = 1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; if ($modulequalified) { print ''; - print (empty($module->name)?$name:$module->name); + print (empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) print $module->info($langs); else print $module->description; diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index cc2edb550a0..8aa1a425778 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -240,9 +240,9 @@ dol_syslog("select rss boxes", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { - $boxlist = InfoBox::listBoxes($db, 'activated', -1, null); - $num = $db->num_rows($resql); - $i = 0; + $boxlist = InfoBox::listBoxes($db, 'activated', -1, null); + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { @@ -271,19 +271,19 @@ if ($resql) print ''; print ''; print ''; - print ""."\n"; + print ''."\n"; print ''; print "".$langs->trans("Title").""; print "global->$keyrsstitle)."\">"; - print ""."\n"; + print ''."\n"; print ''; print "".$langs->trans("URL").""; print "global->$keyrssurl)."\">"; - print ""."\n"; + print ''."\n"; print ''; @@ -301,7 +301,7 @@ if ($resql) print '
    '; } print ""; - print ""."\n"; + print ''."\n"; // Logo if ($result > 0 && empty($rss->error)) @@ -315,7 +315,7 @@ if ($resql) if ($imageurl) print ''; else print $langs->trans("None"); print ''; - print ""."\n"; + print ''."\n"; } // Active @@ -323,11 +323,11 @@ if ($resql) print ''; print ''.$langs->trans('WidgetEnabled').''; print ''.yn($active).''; - print ""."\n"; + print ''."\n"; print ''."\n"; - print ""."\n"; + print "\n"; $i++; } @@ -350,9 +350,9 @@ $db->close(); */ function _isInBoxList($idrss, array $boxlist) { - foreach($boxlist as $box) + foreach ($boxlist as $box) { - if($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false) + if ($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false) { return true; } diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index ce327cc5187..223045db2e9 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'other', 'bills')); -if (! $user->admin) accessforbidden(); +if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); -$type='invoice'; +$type = 'invoice'; /* @@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; * View */ -$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); llxHeader( "", $langs->trans("BillsSetup"), 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura' ); -$form=new Form($db); +$form = new Form($db); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup'); $head = invoice_admin_prepare_head(); @@ -106,12 +106,12 @@ $arrayAvailableType = array( ); $selected = array(); $implodeglue = '+'; -if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){ +if (!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})) { $selected = explode('+', $conf->global->{$confkey}); } -$curentInput = (empty($inputCount)?1:($inputCount+1)); -$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1); +$curentInput = (empty($inputCount) ? 1 : ($inputCount + 1)); +$formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1); _printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType); //_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation')); @@ -126,7 +126,7 @@ $metas = array( _printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas); // Conditions paiements -$inputCount = empty($inputCount)?1:($inputCount+1); +$inputCount = empty($inputCount) ? 1 : ($inputCount + 1); print ''; print ''.$langs->trans('PaymentConditionsShortRetainedWarranty').''; print ' '; @@ -178,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '') global $langs; print ''; - print ''.($title?$title:$langs->trans($confkey)); + print ''.($title ? $title : $langs->trans($confkey)); if (!empty($desc)) { print '
    '.$langs->trans($desc).''; } @@ -206,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra { global $langs, $conf, $db, $inputCount; - $inputCount = empty($inputCount)?1:($inputCount+1); - $form=new Form($db); + $inputCount = empty($inputCount) ? 1 : ($inputCount + 1); + $form = new Form($db); $defaultMetas = array( 'name' => 'value'.$inputCount ); - if ($type!='textarea') { + if ($type != 'textarea') { $defaultMetas['type'] = 'text'; $defaultMetas['value'] = $conf->global->{$confkey}; } @@ -229,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra print ''; if (!empty($help)) { - print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, '')); + print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, '')); } else { - print $title?$title:$langs->trans($confkey); + print $title ? $title : $langs->trans($confkey); } if (!empty($desc)) { @@ -244,12 +244,12 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra print ''; print ''; - if ($type=='textarea') { + if ($type == 'textarea') { print ''; - }elseif($type=='input'){ + }elseif ($type == 'input') { print ''; } - else{ + else { // custom print $type; } diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index ab67974c920..1b088f0c2b9 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -122,6 +122,10 @@ if ($action == 'update') if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity); + $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array())))); + if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity); + else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity); + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity); @@ -160,7 +164,6 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities @@ -278,8 +281,10 @@ print ''; // Disable javascript and ajax print ''.$langs->trans("DisableJavascript").''; print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); +print '     '.$langs->trans("DisableJavascriptNote").''; +print ''; +print ''; print ''; -print ' '; print ''; // Max size of lists @@ -392,6 +397,13 @@ print ''.$langs->trans("LoginPage print ' '; print ''; +// Hide helpcenter link on login page +print ''.$langs->trans("DisableLinkToHelpCenter").''; +print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0); +print ''; +print ' '; +print ''; + // Message on login page $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); complete_substitutions_array($substitutionarray, $langs); @@ -407,13 +419,6 @@ $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf $doleditor->Create(); print ''."\n"; -// Hide helpcenter link on login page -print ''.$langs->trans("DisableLinkToHelpCenter").''; -print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK) ? $conf->global->MAIN_HELPCENTER_DISABLELINK : 0, 1); -print ''; -print ' '; -print ''; - // Background print ''; print '
    '; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 1a55fbc04ee..1a27d61e55d 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -67,12 +67,12 @@ if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) } } -print ''; -print $langs->trans("SetupDescription1"); +print ''; +print $langs->trans("SetupDescription1").' '; print $langs->trans("AreaForAdminOnly").' '; print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules")); -print ''; print "

    "; +print '
    '; print '
    '; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index cc8a92f819b..37d1f903b4a 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -536,7 +536,7 @@ $errors = $hookmanager->errors; // Line to enter new values (input fields) -print ""; +print ''; if (empty($reshook)) { @@ -976,12 +976,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf, $langs, $user, $db; global $form; - global $region_id; - global $elementList, $sourceList, $localtax_typeList; - global $bc; + global $elementList, $sourceList; $formadmin = new FormAdmin($db); - $formcompany = new FormCompany($db); foreach ($fieldlist as $field => $value) { diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index cc83e019833..97f0246ac88 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -277,8 +277,8 @@ print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; @@ -325,6 +325,22 @@ if ($conf->use_javascript_ajax) if (!empty($menu['langs'])) $langs->load($menu['langs']); $titre = $langs->trans($menu['titre']); + $entry = '
    '.$langs->trans("TreeMenuPersonalized").'
    '; + $entry .= '   '.$titre.''; + $entry .= ''; + $entry .= ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $entry .= ''.img_edit_add('default').' '; + $entry .= ''.img_delete('default').' '; + $entry .= '     '; + $entry .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $entry .= '
    '; + + $buttons = ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $buttons .= ''.img_edit_add('default').' '; + $buttons .= ''.img_delete('default').' '; + $buttons .= '     '; + $buttons .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $data[] = array( 'rowid'=>$menu['rowid'], 'module'=>$menu['module'], @@ -335,20 +351,8 @@ if ($conf->use_javascript_ajax) 'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'], 'position'=>$menu['position'], - 'entry'=>'
    '. - '   '.$titre.''. - ''. - ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default').' '. - ''.img_delete('default').' '. - '     '. - ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''. - '
    ', - 'buttons'=>''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default').' '. - ''.img_delete('default').' '. - '     '. - ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").'' + 'entry'=>$entry, + 'buttons'=>$buttons ); $i++; } diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 339b98be44a..d5bf12f1061 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -387,7 +387,7 @@ if ($mode == 'feature') $filedata = dol_buildpath($moduledir.'/sql/data.sql'); if (dol_is_file($filedata)) { - $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql'.')'; + $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)'; } else $text .= $langs->trans("No"); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 926a4c34f70..c0f1991835b 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -412,11 +412,13 @@ foreach ($modulesdir as $dir) } $familyposition = $familyinfo[$familykey]['position']; - if ($external) + $listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other'); + if ($external && ! in_array($familykey, $listOfOfficialModuleGroups)) { - // TODO Find a solution so modules with their own family are always at end - //var_dump($familyposition); - //$familyposition += 100; + // If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups). + if (is_numeric($familyposition)) { + $familyposition = sprintf("%03d", (int) $familyposition + 100); + } } $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number @@ -678,7 +680,9 @@ if ($mode == 'common' || $mode == 'commonkanban') if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"'); if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"'); if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"'); - $versiontrans .= $objMod->getVersion(1); + if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { + $versiontrans .= $objMod->getVersion(1); + } // Define imginfo $imginfo = "info"; diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 99643401386..ba92aa1ec21 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -34,10 +34,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Noti $langs->loadLangs(array('admin', 'other', 'orders', 'propal', 'bills', 'errors', 'mails')); // Security check -if (!$user->admin) - accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} $action = GETPOST('action', 'aZ09'); +$error = 0; /* @@ -45,27 +47,48 @@ $action = GETPOST('action', 'aZ09'); */ // Action to update or add a constant -if ($action == 'update' || $action == 'add') +if ($action == 'settemplates') { - $constlineid = GETPOST('rowid', 'int'); - $constname=GETPOST('constname', 'alpha'); + $db->begin(); - $constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue')); - $consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype')); - $constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote')); - - $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype]; - - $res=dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) + if (!$error && is_array($_POST)) { + $reg = array(); + foreach ($_POST as $key => $val) + { + if (!preg_match('/^constvalue_(.*)_TEMPLATE/', $key, $reg)) continue; + + $triggername = $reg[1]; + $constvalue = GETPOST($key, 'alpha'); + $consttype = 'emailtemplate:xxx'; + $tmparray=explode(':', $constvalue); + if (! empty($tmparray[0]) && ! empty($tmparray[1])) { + $constvalue = $tmparray[0]; + $consttype = 'emailtemplate:'.$tmparray[1]; + //var_dump($constvalue); + //var_dump($consttype); + $res = dolibarr_set_const($db, $triggername.'_TEMPLATE', $constvalue, $consttype, 0, '', $conf->entity); + if ($res < 0) { + $error++; + break; + } + } else { + $res = dolibarr_del_const($db, $triggername.'_TEMPLATE', $conf->entity); + } + } + } + + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -74,12 +97,31 @@ if ($action == 'setvalue' && $user->admin) { $db->begin(); - $result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", GETPOST("email_from", "none"), 'chaine', 0, '', $conf->entity); if ($result < 0) $error++; + + if (!$error) + { + $db->commit(); + + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +if ($action == 'setfixednotif' && $user->admin) +{ + $db->begin(); + if (!$error && is_array($_POST)) { - //var_dump($_POST); $reg = array(); foreach ($_POST as $key => $val) { @@ -101,7 +143,7 @@ if ($action == 'setvalue' && $user->admin) } elseif (preg_match('/^NOTIF_(.*)_new_key/', $key, $reg)) { - // Add a new entry + // Add a new entry $newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount')); $newval = GETPOST($shortkey.'_key'); } @@ -168,9 +210,18 @@ print ''; print ''; print ''; +print '
    '; + +print ''; + + print '

    '; +print '
    '; +print ''; +print ''; + // Notification per contacts $title = $langs->trans("ListOfNotificationsPerUser"); if (!empty($conf->societe->enabled)) $title = $langs->trans("ListOfNotificationsPerUserOrContact"); @@ -183,7 +234,7 @@ $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // Editing global variables not related to a specific theme - $constantes=array(); + $constantes = array(); foreach ($listofnotifiedevents as $notifiedevent) { $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; @@ -210,8 +261,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label); } - $helptext=''; - form_constantes($constantes, 0, $helptext); + $helptext = ''; + form_constantes($constantes, 2, $helptext); } else { print ''; print ''; @@ -248,14 +299,18 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print '
    '; } -print '
    '; -print '* '.$langs->trans("GoOntoUserCardToAddMore").'
    '; -if (!empty($conf->societe->enabled)) print '** '.$langs->trans("GoOntoContactCardToAddMore").'
    '; +print '
    '; + +print ''; + -print '
    '; print '

    '; +print '
    '; +print ''; +print ''; + print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', ''); print ''; @@ -265,7 +320,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; foreach ($listofnotifiedevents as $notifiedevent) @@ -333,6 +388,12 @@ foreach ($listofnotifiedevents as $notifiedevent) } print '
    '.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("FixedEmailTarget").''.$langs->trans("Threshold").''.'
    '; +print '
    '; +print '* '.$langs->trans("GoOntoUserCardToAddMore").'
    '; +if (!empty($conf->societe->enabled)) print '** '.$langs->trans("GoOntoContactCardToAddMore").'
    '; + +print '
    '; + print '
    '; print '
    '; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index e740150e1d5..a5b494b62e2 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -70,11 +71,12 @@ if ($action == 'setmod') if ($action == 'setparams') { $freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS', 'none'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $freetext, 'chaine', 0, '', $conf->entity); - if (!$res > 0) $error++; + $res = dolibarr_set_const($db, "PAYMENTS_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity); + if (!$res > 0) $error++; + if ($error) { setEventMessages($langs->trans("Error"), null, 'errors'); @@ -253,6 +255,14 @@ print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $co print ''; print "\n"; +// Allow to group payments by mod in rapports +print ''; +print $langs->trans("GroupPaymentsByModOnReports"); +print ''; +print $form->selectyesno("PAYMENTS_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_REPORT_GROUP_BY_MOD, 1); +print ''; +print "\n"; + print ''; print '
    '; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index f016c305a15..d9d61673c5e 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -168,9 +168,9 @@ elseif ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') exit; } -if ($action == 'maj_pattern') +if ($action == 'updatepattern') { - $pattern = GETPOST("pattern"); + $pattern = GETPOST("pattern", "alpha"); $explodePattern = explode(';', $pattern); $patternInError = false; @@ -184,6 +184,7 @@ if ($action == 'maj_pattern') if (!$patternInError) { dolibarr_set_const($db, "USER_PASSWORD_PATTERN", $pattern, 'chaine', 0, '', $conf->entity); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: security.php"); exit; } @@ -336,11 +337,9 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") { print ''; print '
    '; - print ''; - print ''; - print '
    '; + print '
    '; print ''.$langs->trans("Save").''; - print '
    '; + print ''; print '

    '; print ''."\n"; $out .= ''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index da51589b8ac..d0f102a4e78 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -39,7 +39,7 @@ function bank_prepare_head(Account $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/compta/bank/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("BankAccount"); $head[$h][2] = 'bankname'; $h++; @@ -211,7 +211,7 @@ function various_payment_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("VariousPayment"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index e0945f9a029..e900e6ff424 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -40,7 +40,7 @@ function categories_prepare_head(Categorie $object, $type) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Category"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 25061e60f9c..4b0a2d5b131 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -46,7 +46,7 @@ function societe_prepare_head(Societe $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/societe/card.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("ThirdParty"); $head[$h][2] = 'card'; $h++; @@ -174,7 +174,7 @@ function societe_prepare_head(Societe $object) } // Related items - if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled)) + if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; @@ -367,7 +367,7 @@ function societe_prepare_head2($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/societe/card.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("ThirdParty"); $head[$h][2] = 'company'; $h++; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 8edc81d7ee7..1589809dd6b 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -38,7 +38,7 @@ function contact_prepare_head(Contact $object) $head = array(); $head[$tab][0] = DOL_URL_ROOT.'/contact/card.php?id='.$object->id; - $head[$tab][1] = $langs->trans("Card"); + $head[$tab][1] = $langs->trans("Contact"); $head[$tab][2] = 'card'; $tab++; @@ -59,7 +59,7 @@ function contact_prepare_head(Contact $object) $tab++; // Related items - if (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled)) + if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id; $head[$tab][1] = $langs->trans("Referers"); diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index 8128a449cfd..33ad0a85229 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -107,7 +107,7 @@ function dol_print_cron_urls() print ''.$langs->trans("FileToLaunchCronJobs").':
    '; - $file = '/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; + $file = '/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; print '
    \n"; print '
    '; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index cff2670061e..b44d7260e97 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -896,6 +896,7 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, if ($timestampStart < $timestampEnd) { $numdays = num_between_day($timestampStart, $timestampEnd, $lastday); + $numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday); $nbOpenDay = ($numdays - $numholidays); if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = ($nbOpenDay * 24); @@ -903,7 +904,14 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, } elseif ($timestampStart == $timestampEnd) { + $numholidays = 0; + if ($lastday) { + $numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday); + if ($numholidays == 1) return 0; + } + $nbOpenDay = $lastday; + if ($inhour == 1) $nbOpenDay = ($nbOpenDay * 24); return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); } diff --git a/htdocs/core/lib/donation.lib.php b/htdocs/core/lib/donation.lib.php index b2280657481..425dd05fbb5 100644 --- a/htdocs/core/lib/donation.lib.php +++ b/htdocs/core/lib/donation.lib.php @@ -68,7 +68,7 @@ function donation_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/don/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Donation"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/ecm.lib.php b/htdocs/core/lib/ecm.lib.php index 4dbb418855a..3d14f14a7df 100644 --- a/htdocs/core/lib/ecm.lib.php +++ b/htdocs/core/lib/ecm.lib.php @@ -81,14 +81,14 @@ function ecm_prepare_head($object, $module = 'ecm', $section = '') if ($module == 'ecm') { $head[$h][0] = DOL_URL_ROOT.'/ecm/dir_card.php?section='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Directory"); $head[$h][2] = 'card'; $h++; } else { $head[$h][0] = DOL_URL_ROOT.'/ecm/dir_card.php?section='.$section.'&module='.$module; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Directory"); $head[$h][2] = 'card'; $h++; } @@ -109,7 +109,7 @@ function ecm_file_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/ecm/file_card.php?section='.$object->section_id.'&urlfile='.urlencode($object->label); - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("File"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index 2767af2e792..4c54ca09e31 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -35,7 +35,7 @@ function expensereport_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/expensereport/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("ExpenseReport"); $head[$h][2] = 'card'; $h++; @@ -94,7 +94,7 @@ function payment_expensereport_prepare_head(PaymentExpenseReport $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("ExpenseReport"); $head[$h][2] = 'payment'; $h++; diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 8d0809f9768..260bbf980f8 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -42,7 +42,7 @@ function fichinter_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/fichinter/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Intervention"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 9746c1047b8..dbea182fb9b 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -720,10 +720,11 @@ function dol_copy($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1) * @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0666' * @param int $overwriteifexists Overwrite file if exists (1 by default) * @param array $arrayreplacement Array to use to replace filenames with another one during the copy (works only on file names, not on directory names). + * @param int $excludesubdir 0=Do not exclude subdirectories, 1=Exclude subdirectories, 2=Exclude subdirectories if name is not a 2 chars (used for country codes subdirectories). * @return int <0 if error, 0 if nothing done (all files already exists and overwriteifexists=0), >0 if OK * @see dol_copy() */ -function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement = null) +function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement = null, $excludesubdir = 0) { global $conf; @@ -759,8 +760,19 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep { if (is_dir($ossrcfile."/".$file)) { - //var_dump("xxx dolCopyDir $srcfile/$file, $destfile/$file, $newmask, $overwriteifexists"); - $tmpresult = dolCopyDir($srcfile."/".$file, $destfile."/".$file, $newmask, $overwriteifexists, $arrayreplacement); + if (empty($excludesubdir) || ($excludesubdir == 2 && strlen($file) == 2)) { + $newfile = $file; + // Replace destination filename with a new one + if (is_array($arrayreplacement)) + { + foreach ($arrayreplacement as $key => $val) + { + $newfile = str_replace($key, $val, $newfile); + } + } + //var_dump("xxx dolCopyDir $srcfile/$file, $destfile/$file, $newmask, $overwriteifexists"); + $tmpresult = dolCopyDir($srcfile."/".$file, $destfile."/".$newfile, $newmask, $overwriteifexists, $arrayreplacement, $excludesubdir); + } } else { @@ -960,18 +972,18 @@ function dol_unescapefile($filename) */ function dolCheckVirus($src_file) { - global $conf, $db; + global $conf; if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { if (!class_exists('AntiVir')) { require_once DOL_DOCUMENT_ROOT.'/core/class/antivir.class.php'; } - $antivir = new AntiVir($db); + $antivir=new AntiVir($db); $result = $antivir->dol_avscan_file($src_file); if ($result < 0) // If virus or error, we stop here { - $reterrors = $antivir->errors; + $reterrors=$antivir->errors; return $reterrors; } } @@ -1853,6 +1865,7 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = '' if (empty($fileoutput)) $fileoutput = $fileinput.".".$ext; $count = $image->getNumberImages(); + if (!dol_is_file($fileoutput) || is_writeable($fileoutput)) { try { @@ -2419,7 +2432,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file = $conf->agenda->dir_output.'/'.$original_file; } // Wrapping for categories - elseif ($modulepart == 'category' && !empty($conf->categorie->dir_output)) + elseif ($modulepart == 'category' && !empty($conf->categorie->multidir_output[$entity])) { if (empty($entity) || empty($conf->categorie->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); if ($fuser->rights->categorie->{$lire}) $accessallowed = 1; @@ -2489,7 +2502,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Wrapping for third parties - elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->dir_output)) + elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->multidir_output[$entity])) { if (empty($entity) || empty($conf->societe->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); if ($fuser->rights->societe->{$lire} || preg_match('/^specimen/i', $original_file)) @@ -2501,7 +2514,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Wrapping for contact - elseif ($modulepart == 'contact' && !empty($conf->societe->dir_output)) + elseif ($modulepart == 'contact' && !empty($conf->societe->multidir_output[$entity])) { if (empty($entity) || empty($conf->societe->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); if ($fuser->rights->societe->{$lire}) @@ -2519,7 +2532,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; + $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('invoice').")"; } // Wrapping for mass actions elseif ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) @@ -2632,7 +2645,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; + $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('propal').")"; } // Wrapping pour les commandes @@ -2643,7 +2656,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->commande->multidir_output[$entity].'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; + $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('order').")"; } // Wrapping pour les projets diff --git a/htdocs/core/lib/fiscalyear.lib.php b/htdocs/core/lib/fiscalyear.lib.php index f54772c2339..8bd3ff55624 100644 --- a/htdocs/core/lib/fiscalyear.lib.php +++ b/htdocs/core/lib/fiscalyear.lib.php @@ -35,7 +35,7 @@ function fiscalyear_prepare_head(Fiscalyear $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("FiscalPeriod"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 507ef0fef08..c2cad773af6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1078,6 +1078,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = // If syslog module enabled if (empty($conf->syslog->enabled)) return; + // Check if we are into execution of code of a website + if (defined('USEEXTERNALSERVER') && ! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { + global $website, $websitekey; + if (is_object($website) && ! empty($website->ref)) $suffixinfilename.='_website_'.$website->ref; + elseif (! empty($websitekey)) $suffixinfilename.='_website_'.$websitekey; + } + if ($ident < 0) { foreach ($conf->loghandlers as $loghandlerinstance) @@ -3141,33 +3148,37 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', - 'address', 'bank_account', 'barcode', 'bank', 'bookmark', 'bom', 'building', 'cash-register', 'check', 'close_title', 'company', 'contact', 'cubes', + 'accountancy', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building', + 'cash-register', 'category', 'check', 'close_title', 'company', 'contact', 'contract', 'cubes', 'delete', 'dolly', 'dollyrevert', 'edit', 'ellipsis-h', 'external-link-alt', 'external-link-square-alt', - 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help', 'language', 'list', 'listlight', 'lot', - 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'stock', - 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bom', - 'object_category', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder', + 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help', + 'intervention', 'label', 'language', 'list', 'listlight', 'lot', + 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', + 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom', + 'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', - 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_dynamicprice', - 'object_holiday', 'object_hrm', 'object_intervention', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', - 'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', 'object_supplier_proposal', 'object_service', 'object_stock', - 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', - 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_other', - 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', - 'off', 'on', - 'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'resize', 'service', 'stats', 'trip', - 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', + 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice', + 'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_label', + 'object_margin', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', + 'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', + 'object_other', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', + 'object_shipment', 'object_supplier_invoice', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', + 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', + 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', + 'off', 'on', 'order', + 'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip', + 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', - 'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'preview', 'project', 'projectpub', 'hrm', 'members', 'ticket', 'generic', - 'error', 'warning', + 'home', 'companies', 'products', 'commercial', 'invoicing', 'preview', 'project', 'projectpub', 'supplier_invoice', 'hrm', 'members', 'ticket', 'generic', + 'error', 'warning', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda' ) )) { $fakey = $pictowithouttext; $facolor = ''; $fasize = ''; $fa = 'fas'; - if (in_array($pictowithouttext, array('object_generic', 'note', 'off', 'on', 'object_bookmark', 'bookmark'))) { + if (in_array($pictowithouttext, array('object_generic', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) { $fa = 'far'; } if (in_array($pictowithouttext, array('skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp'))) { @@ -3177,30 +3188,33 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $pictowithouttext = str_replace('object_', '', $pictowithouttext); $arrayconvpictotofa = array( - 'account'=>'university', 'action'=>'calendar-alt', 'address'=> 'address-book', 'bank_account'=>'university', 'bom'=>'cubes', - 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'dynamicprice'=>'hand-holding-usd', - 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', + 'account'=>'university', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'address'=> 'address-book', + 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billd'=>'file-medical', 'bom'=>'cubes', + 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd', + 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', - 'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', + 'hrm'=>'umbrella-beach', 'margin'=>'calculator', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', 'email'=>'at', 'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'info-circle', - 'generic'=>'file', 'holiday'=>'umbrella-beach', 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users', + 'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group', + 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users', 'sign-out'=>'sign-out-alt', 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', - 'intervention'=>'ambulance', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', + 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature', - 'resize'=>'crop', 'supplier_proposal'=>'file-signature', + 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', 'resource'=>'laptop-house', - 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'technic'=>'cogs', 'ticket'=>'ticket-alt', + 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', - 'uparrow'=>'mail-forward', - 'jabber'=>'comment-o' + 'uparrow'=>'mail-forward', 'vcard'=>'address-card', + 'jabber'=>'comment-o', + 'website'=>'globe-americas' ); if ($pictowithouttext == 'off') { $fakey = 'fa-square'; @@ -3248,18 +3262,22 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ // Add CSS $arrayconvpictotomorcess = array( - 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'cash-register'=>'bg-infobox-bank_account', - 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', + 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'accountancy'=>'bg-infobox-bank_account', + 'bank_account'=>'bg-infobox-bank_account', 'bill'=>'bg-infobox-commande', 'billa'=>'bg-infobox-commande', 'billd'=>'bg-infobox-commande', + 'cash-register'=>'bg-infobox-bank_account', 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', 'conversation'=>'bg-infobox-contrat', + 'donation'=>'bg-infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', 'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat', 'multicurrency'=>'bg-infobox-bank_account', 'members'=>'bg-infobox-adherent', 'member'=>'bg-infobox-adherent', 'money-bill-alt'=>'bg-infobox-bank_account', 'order'=>'bg-infobox-commande', 'user'=>'bg-infobox-adherent', 'users'=>'bg-infobox-adherent', 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', - 'holiday'=>'bg-infobox-holiday', + 'holiday'=>'bg-infobox-holiday', 'invoice'=>'bg-infobox-commande', 'payment'=>'bg-infobox-bank_account', 'poll'=>'bg-infobox-adherent', 'project'=>'bg-infobox-project', 'projecttask'=>'bg-infobox-project', 'propal'=>'bg-infobox-propal', - 'resource'=>'bg-infobox-action', 'supplier_proposal'=>'bg-infobox-supplier_proposal', - 'ticket'=>'bg-infobox-contrat', 'title_hrm'=>'bg-infobox-holiday', 'trip'=>'bg-infobox-expensereport', 'title_agenda'=>'bg-infobox-action', + 'resource'=>'bg-infobox-action', + 'supplier_invoice'=>'bg-infobox-order_supplier', 'supplier_order'=>'bg-infobox-order_supplier', 'supplier_proposal'=>'bg-infobox-supplier_proposal', + 'ticket'=>'bg-infobox-contrat', 'title_accountancy'=>'bg-infobox-bank_account', 'title_hrm'=>'bg-infobox-holiday', 'trip'=>'bg-infobox-expensereport', 'title_agenda'=>'bg-infobox-action', + //'title_setup'=>'bg-infobox-action', 'tools'=>'bg-infobox-action', 'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode' ); if (!empty($arrayconvpictotomorcess[$pictowithouttext])) { @@ -3275,7 +3293,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'other'=>'#ddd', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba', - 'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'globe-americas'=>'#aaa' + 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'globe-americas'=>'#aaa', + 'website'=>'#304' ); if (isset($arrayconvpictotocolor[$pictowithouttext])) { $facolor = $arrayconvpictotocolor[$pictowithouttext]; @@ -4506,15 +4525,17 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be } if ($page > 0) { - print ''; + print ''; } if ($betweenarrows) { + print ''; print $betweenarrows; + print ''; } if ($nextpage > 0) { - print ''; + print ''; } if ($afterarrows) { @@ -5773,7 +5794,8 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8') /** - * Replace CRLF in string with a HTML BR tag + * Replace CRLF in string with a HTML BR tag. + * WARNING: The content after operation contains some HTML tags (the
    ) so be sure to also have encode the special chars of stringtoencode into HTML before. * * @param string $stringtoencode String to encode * @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br @@ -6027,7 +6049,7 @@ function dol_textishtml($msg, $option = 0) * * @param string $text1 Text 1 * @param string $text2 Text 2 - * @param bool $forxml false=Use
    instead of \n if html content detected, true=Use
    instead of \n if html content detected + * @param bool $forxml true=Use
    instead of
    if we have to add a br tag * @param bool $invert invert order of description lines (we often use config MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION in this parameter) * @return string Text 1 + new line + Text2 * @see dol_textishtml() @@ -6042,9 +6064,9 @@ function dol_concatdesc($text1, $text2, $forxml = false, $invert = false) } $ret = ''; - $ret .= (!dol_textishtml($text1) && dol_textishtml($text2)) ?dol_nl2br($text1, 0, $forxml) : $text1; + $ret .= (!dol_textishtml($text1) && dol_textishtml($text2)) ? dol_nl2br(dol_escape_htmltag($text1, 0, 1, '', 1), 0, $forxml) : $text1; $ret .= (!empty($text1) && !empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2)) ? ($forxml ? "
    \n" : "
    \n") : "\n") : ""; - $ret .= (dol_textishtml($text1) && !dol_textishtml($text2)) ?dol_nl2br($text2, 0, $forxml) : $text2; + $ret .= (dol_textishtml($text1) && !dol_textishtml($text2)) ? dol_nl2br(dol_escape_htmltag($text2, 0, 1, '', 1), 0, $forxml) : $text2; return $ret; } @@ -6342,6 +6364,17 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; + if ($extrafields->attribute_type[$key] == 'date') { + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = dol_print_date($object->array_options['options_' . $key], 'day'); + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_LOCALE__'] = dol_print_date($object->array_options['options_' . $key], 'day', 'tzserver', $outputlangs); + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_RFC__'] = dol_print_date($object->array_options['options_' . $key], 'dayrfc'); + } elseif ($extrafields->attribute_type[$key] == 'datetime') { + $datetime = $object->array_options['options_'.$key]; + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = ($datetime != "0000-00-00 00:00:00" ? dol_print_date($datetime, 'dayhour') : ''); + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_LOCALE__'] = ($datetime != "0000-00-00 00:00:00" ? dol_print_date($datetime, 'dayhour', 'tzserver', $outputlangs) : ''); + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_DAY_LOCALE__'] = ($datetime != "0000-00-00 00:00:00" ? dol_print_date($datetime, 'day', 'tzserver', $outputlangs) : ''); + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_RFC__'] = ($datetime != "0000-00-00 00:00:00" ? dol_print_date($datetime, 'dayhourrfc') : ''); + } } } } @@ -6514,7 +6547,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null) if (dol_textishtml($text, 1)) $msgishtml = 1; $keyfound = $reg[1]; - if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****'; + if (preg_match('/(_pass|_pw|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****'; else $newval = empty($conf->global->$keyfound) ? '' : $conf->global->$keyfound; $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml ?dol_htmlentitiesbr($newval) : $newval, $text); } @@ -8595,11 +8628,8 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u } $class = 'btnTitle'; + if ($iconClass == 'fa fa-plus-circle') $class .= ' btnTitlePlus'; - // hidden conf keep during button transition TODO: remove this block - if (!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)) { - $class = 'butActionNew'; - } if (!empty($params['morecss'])) $class .= ' '.$params['morecss']; $attr = array( @@ -8614,11 +8644,6 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u if ($status <= 0) { $attr['class'] .= ' refused'; - // hidden conf keep during button transition TODO: remove this block - if (!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)) { - $attr['class'] = 'butActionNewRefused'; - } - $attr['href'] = ''; if ($status == -1) { // disable @@ -8670,18 +8695,12 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $tag = (empty($attr['href']) ? 'span' : 'a'); - $button = '<'.$tag.' '.$compiledAttributes.' >'; + $button = ''; + $button .= '<'.$tag.' '.$compiledAttributes.' >'; $button .= ''; $button .= ''.$label.''; $button .= ''; - // hidden conf keep during button transition TODO: remove this block - if (!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)) { - $button = '<'.$tag.' '.$compiledAttributes.' >'.$label.''; - $button .= ''; - $button .= ''; - } - return $button; } diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index 987895c27d8..bb114b6a62e 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -35,7 +35,7 @@ function holiday_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/holiday/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Holiday"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/hrm.lib.php b/htdocs/core/lib/hrm.lib.php index 83eafa2548f..3b336fee8d3 100644 --- a/htdocs/core/lib/hrm.lib.php +++ b/htdocs/core/lib/hrm.lib.php @@ -37,7 +37,7 @@ function establishment_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Establishment"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index d6993845488..815060c8022 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -38,7 +38,7 @@ function member_prepare_head(Adherent $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/adherents/card.php?rowid='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Member"); $head[$h][2] = 'general'; $h++; @@ -124,7 +124,7 @@ function member_type_prepare_head(AdherentType $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/adherents/type.php?rowid='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("MemberType"); $head[$h][2] = 'card'; $h++; @@ -276,7 +276,7 @@ function subscription_prepare_head(Subscription $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Subscription"); $head[$h][2] = 'general'; $h++; diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index ba1ed6bb8a0..a301ac40a2b 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -42,24 +42,24 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l function dol_setcache($memoryid, $data) { global $conf; - $result=0; + $result = 0; // Using a memcached server - if (! empty($conf->memcached->enabled) && class_exists('Memcached')) + if (!empty($conf->memcached->enabled) && class_exists('Memcached')) { global $dolmemcache; - if (empty($dolmemcache) || ! is_object($dolmemcache)) + if (empty($dolmemcache) || !is_object($dolmemcache)) { - $dolmemcache=new Memcached(); - $tmparray=explode(':', $conf->global->MEMCACHED_SERVER); - $result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); - if (! $result) return -1; + $dolmemcache = new Memcached(); + $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); + if (!$result) return -1; } - $memoryid=session_name().'_'.$memoryid; + $memoryid = session_name().'_'.$memoryid; //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); - $dolmemcache->add($memoryid, $data); // This fails if key already exists - $rescode=$dolmemcache->getResultCode(); + $dolmemcache->add($memoryid, $data); // This fails if key already exists + $rescode = $dolmemcache->getResultCode(); if ($rescode == 0) { return count($data); @@ -69,20 +69,20 @@ function dol_setcache($memoryid, $data) return -$rescode; } } - elseif (! empty($conf->memcached->enabled) && class_exists('Memcache')) + elseif (!empty($conf->memcached->enabled) && class_exists('Memcache')) { global $dolmemcache; - if (empty($dolmemcache) || ! is_object($dolmemcache)) + if (empty($dolmemcache) || !is_object($dolmemcache)) { - $dolmemcache=new Memcache(); - $tmparray=explode(':', $conf->global->MEMCACHED_SERVER); - $result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); - if (! $result) return -1; + $dolmemcache = new Memcache(); + $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $result = $dolmemcache->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); + if (!$result) return -1; } - $memoryid=session_name().'_'.$memoryid; + $memoryid = session_name().'_'.$memoryid; //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); - $result=$dolmemcache->add($memoryid, $data); // This fails if key already exists + $result = $dolmemcache->add($memoryid, $data); // This fails if key already exists if ($result) { return count($data); @@ -112,22 +112,22 @@ function dol_getcache($memoryid) global $conf; // Using a memcached server - if (! empty($conf->memcached->enabled) && class_exists('Memcached')) + if (!empty($conf->memcached->enabled) && class_exists('Memcached')) { global $m; - if (empty($m) || ! is_object($m)) + if (empty($m) || !is_object($m)) { - $m=new Memcached(); - $tmparray=explode(':', $conf->global->MEMCACHED_SERVER); - $result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); - if (! $result) return -1; + $m = new Memcached(); + $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); + if (!$result) return -1; } - $memoryid=session_name().'_'.$memoryid; + $memoryid = session_name().'_'.$memoryid; //$m->setOption(Memcached::OPT_COMPRESSION, false); //print "Get memoryid=".$memoryid; - $data=$m->get($memoryid); - $rescode=$m->getResultCode(); + $data = $m->get($memoryid); + $rescode = $m->getResultCode(); //print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n
    "; //var_dump($data); if ($rescode == 0) @@ -139,20 +139,20 @@ function dol_getcache($memoryid) return -$rescode; } } - elseif (! empty($conf->memcached->enabled) && class_exists('Memcache')) + elseif (!empty($conf->memcached->enabled) && class_exists('Memcache')) { global $m; - if (empty($m) || ! is_object($m)) + if (empty($m) || !is_object($m)) { - $m=new Memcache(); - $tmparray=explode(':', $conf->global->MEMCACHED_SERVER); - $result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211); - if (! $result) return -1; + $m = new Memcache(); + $tmparray = explode(':', $conf->global->MEMCACHED_SERVER); + $result = $m->addServer($tmparray[0], $tmparray[1] ? $tmparray[1] : 11211); + if (!$result) return -1; } - $memoryid=session_name().'_'.$memoryid; + $memoryid = session_name().'_'.$memoryid; //$m->setOption(Memcached::OPT_COMPRESSION, false); - $data=$m->get($memoryid); + $data = $m->get($memoryid); //print "memoryid=".$memoryid." - rescode=".$rescode." - data=".count($data)."\n
    "; //var_dump($data); if ($data) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 80aed36f674..d031984552e 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -34,7 +34,7 @@ function payment_prepare_head(Paiement $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Payment"); $head[$h][2] = 'payment'; $h++; @@ -69,7 +69,7 @@ function payment_supplier_prepare_head(Paiement $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Payment"); $head[$h][2] = 'payment'; $h++; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d31baf70b69..63789a18e62 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -914,7 +914,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // // become // - $newfreetext = preg_replace('/()/', '\1'.'file:/'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext); + $newfreetext = preg_replace('/()/', '\1file:/'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext); $line .= $outputlangs->convToOutputCharset($newfreetext); } diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index eca43aef3f6..a404e19184e 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -40,7 +40,7 @@ function prelevement_prepare_head(BonPrelevement $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("WithdrawalsReceipts"); $head[$h][2] = 'prelevement'; $h++; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 79d77e0268f..43acb16ba2a 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -41,7 +41,7 @@ function product_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT."/product/card.php?id=".$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("ProductOrService"); $head[$h][2] = 'card'; $h++; @@ -55,7 +55,7 @@ function product_prepare_head($object) if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase { - if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire) || (!empty($conf->margin->enabled) && $user->rights->margin->liretous) ) { @@ -216,7 +216,7 @@ function productlot_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT."/product/stock/productlot_card.php?id=".$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Lot"); $head[$h][2] = 'card'; $h++; @@ -353,6 +353,24 @@ function show_stats_for_company($product, $socid) print ''.$langs->trans("TotalQuantity").''; print ''; + // MO + if (!empty($conf->mrp->enabled) && $user->rights->mrp->read) + { + $nblines++; + //$ret = $product->load_stats_mo($socid); + if ($ret < 0) dol_print_error($db); + $langs->load("orders"); + print ''; + print ''.img_object('', 'mrp').' '.$langs->trans("MO").''; + print ''; + print $product->stats_mo['suppliers']; + print ''; + print $product->stats_mo['nb']; + print ''; + print $product->stats_mo['qty']; + print ''; + print ''; + } // Customer proposals if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { @@ -379,7 +397,7 @@ function show_stats_for_company($product, $socid) if ($ret < 0) dol_print_error($db); $langs->load("propal"); print ''; - print ''.img_object('', 'propal').' '.$langs->trans("SupplierProposals").''; + print ''.img_object('', 'supplier_proposal').' '.$langs->trans("SupplierProposals").''; print ''; print $product->stats_proposal_supplier['suppliers']; print ''; @@ -408,14 +426,14 @@ function show_stats_for_company($product, $socid) print ''; } // Supplier orders - if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $nblines++; $ret = $product->load_stats_commande_fournisseur($socid); if ($ret < 0) dol_print_error($db); $langs->load("orders"); print ''; - print ''.img_object('', 'order').' '.$langs->trans("SuppliersOrders").''; + print ''.img_object('', 'supplier_order').' '.$langs->trans("SuppliersOrders").''; print ''; print $product->stats_commande_fournisseur['suppliers']; print ''; @@ -425,24 +443,6 @@ function show_stats_for_company($product, $socid) print ''; print ''; } - // MO - if (!empty($conf->mrp->enabled) && $user->rights->mrp->read) - { - $nblines++; - //$ret = $product->load_stats_mo($socid); - if ($ret < 0) dol_print_error($db); - $langs->load("orders"); - print ''; - print ''.img_object('', 'mrp').' '.$langs->trans("MO").''; - print ''; - print $product->stats_mo['suppliers']; - print ''; - print $product->stats_mo['nb']; - print ''; - print $product->stats_mo['qty']; - print ''; - print ''; - } // Customer invoices if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { @@ -462,14 +462,14 @@ function show_stats_for_company($product, $socid) print ''; } // Supplier invoices - if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $nblines++; $ret = $product->load_stats_facture_fournisseur($socid); if ($ret < 0) dol_print_error($db); $langs->load("bills"); print ''; - print ''.img_object('', 'bill').' '.$langs->trans("SuppliersInvoices").''; + print ''.img_object('', 'supplier_invoice').' '.$langs->trans("SuppliersInvoices").''; print ''; print $product->stats_facture_fournisseur['suppliers']; print ''; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 428d976ab6d..bf60968387a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -87,7 +87,8 @@ function project_prepare_head($object) $h++; } - if (!empty($conf->fournisseur->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) + || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) { @@ -167,7 +168,7 @@ function task_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : ''); - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Project"); $head[$h][2] = 'task_task'; $h++; @@ -642,7 +643,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($source == 'internal') $c = new User($db); else $c = new Contact($db); $c->fetch($contacttask['id']); - print $c->getNomUrl(1).' ('.$contacttask['libelle'].')'.'
    '; + print $c->getNomUrl(1).' ('.$contacttask['libelle'].')
    '; } } } @@ -2225,10 +2226,10 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print ''; print ''; - print $projectstatic->getNomUrl(1); + print $projectstatic->getNomUrl(1, '', 0, '', '-', 0 , -1, 'nowraponall'); if (!in_array('projectlabel', $hiddenfields)) print '
    '.dol_trunc($objp->title, 24).''; print ''; - print ''; + print ''; if ($objp->fk_soc > 0) { $thirdpartystatic->id = $objp->fk_soc; @@ -2241,7 +2242,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { if (!in_array('prospectionstatus', $hiddenfields)) { - print ''; + print ''; // Because color of prospection status has no meaning yet, it is used if hidden constant is set if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 0e2328bc7e7..5a94e025097 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -34,7 +34,7 @@ function salaries_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/salaries/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("SalaryPayment"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 6749f32ffbe..03f1525eb91 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -192,6 +192,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if ($features == 'mo') $features = 'mrp'; if ($features == 'member') $features = 'adherent'; if ($features == 'subscription') { $features = 'adherent'; $feature2 = 'cotisation'; }; + if ($features == 'websitepage') $features = 'website'; // Get more permissions checks from hooks $parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select); diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 34dd845cdfa..ad1e6304d03 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -415,7 +415,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') //var_dump($expedition->linkedObjects); $receiving = ''; - if (count($expedition->linkedObjects['delivery']) > 0) $receiving = reset($expedition->linkedObjects['delivery']); // Take first link + if (!empty($expedition->linkedObjects['delivery'])) $receiving = reset($expedition->linkedObjects['delivery']); // Take first link if (!empty($receiving)) { diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index 988c7a2d78c..0b9deb7779b 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -35,7 +35,7 @@ function stock_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Warehouse"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index 8a883ceef91..d04fa5f77ef 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -43,6 +43,14 @@ function takepos_prepare_head() $head[$h][2] = 'receipt'; $h++; + if ($conf->global->TAKEPOS_BAR_RESTAURANT) + { + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/bar.php'; + $head[$h][1] = $langs->trans("BarRestaurant"); + $head[$h][2] = 'bar'; + $h++; + } + $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); for ($i = 1; $i <= $numterminals; $i++) { diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index e12531b3846..cf6607e6960 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -78,7 +78,7 @@ function ticket_prepare_head($object) $h = 0; $head = array(); $head[$h][0] = DOL_URL_ROOT.'/ticket/card.php?action=view&track_id='.$object->track_id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Ticket"); $head[$h][2] = 'tabTicket'; $h++; @@ -230,8 +230,8 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$mysoc->logo); $width = 150; - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; } } } @@ -254,7 +254,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ } print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } @@ -709,7 +709,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no $out .= $histo[$key]['id']; $out .= ' '; } else { - $out .= $actionstatic->getNomUrl(1, -1).' '; + $out .= $actionstatic->getNomUrl(1, -1, 'valignmiddle').' '; } //if ($user->rights->agenda->allactions->read || $actionstatic->authorid == $user->id) diff --git a/htdocs/core/lib/trip.lib.php b/htdocs/core/lib/trip.lib.php index ec8c6a6858f..cdc7360fbf8 100644 --- a/htdocs/core/lib/trip.lib.php +++ b/htdocs/core/lib/trip.lib.php @@ -35,7 +35,7 @@ function trip_prepare_head(Deplacement $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("Trip"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 5b7c923001b..9ac9383e516 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -359,7 +359,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print $form->textwithpicto($langs->trans("DefaultSkin"), $langs->trans("ThemeDir").' : '.$dirthemestring); print ''; print ''; - $url = 'https://www.dolistore.com/4-skins'; + $url = 'https://www.dolistore.com/9-skins'; print ''; print $langs->trans('DownloadMoreSkins'); print ''; @@ -502,9 +502,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -549,9 +548,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': ffffff) '; + print '   '.$langs->trans("Default").': ffffff '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -597,9 +595,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -645,9 +642,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -671,9 +667,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; @@ -698,9 +693,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': '.$default.') '; // $colorbacktitle1 in CSS + print '   '.$langs->trans("Default").': '.$default.' '; // $colorbacktitle1 in CSS print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; @@ -725,7 +719,33 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); + print ''; + + print ''; + } + + // TextTitleLinkColor + if ($foruserprofile) + { + } + else + { + $default=(empty($colortexttitlelink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlelink))); + + print ''; + print ''.$langs->trans("BackgroundTableTitleTextlinkColor").''; + print ''; + if ($edit) + { + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', 'formcolor', 1).' '; + } + else + { + print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default")); + } + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; @@ -754,9 +774,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -782,9 +801,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -835,9 +853,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print $langs->trans("Default"); } } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -881,9 +898,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; } @@ -927,9 +943,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -959,7 +974,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' ('.$langs->trans("ForcedByGlobalSetup").')'; } } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc")); print ''; print ''; @@ -979,7 +994,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   wspan class="opacitymedium">'.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc")); print ''; print ''; @@ -1018,7 +1033,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print yn(0); } } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc")); print ''; print ''; diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 2dcabbcafaa..1075a91ebc0 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -219,10 +219,13 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') { global $db, $langs, $conf, $user; global $dolibarr_main_url_root, $dolibarr_main_data_root; + global $includehtmlcontentopened; $nbrep = 0; - dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').')'); + dol_syslog("dolWebsiteOutput start - contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').' includehtmlcontentopened='.$includehtmlcontentopened); + + //print $containerid.' '.$content; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -259,6 +262,8 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') // Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL: ...href="....php" (we discard param ?...) $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep); // Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL + // Warning: we may replace twice if href="..." was inside an include (dolWebsiteOutput called by include and the by final page), that's why + // at end we replace the '!~!~!~' only if we are in final parent page. $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php\?([^#\"<>]*)(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2&\3\4"', $content, -1, $nbrep); // Replace relative link without .php like /xxx#aaa or /xxx with dolibarr URL: ...href="....php" $content = preg_replace('/(href=")\/?([a-zA-Z0-9\-_#]+)(\"|\?)/', '\1!~!~!~'.DOL_URL_ROOT.'/public/website/index.php?website='.$website->ref.'&pageref=\2\3', $content, -1, $nbrep); @@ -291,8 +296,10 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content); $content = str_replace('href="!~!~!~/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content); - // Remove the protection tag !~!~!~ - $content = str_replace('!~!~!~', '', $content); + // Remove the protection tag !~!~!~, but only if this is the parent page and not an include + if (empty($includehtmlcontentopened)) { + $content = str_replace('!~!~!~', '', $content); + } } else // REPLACEMENT OF LINKS When page called from virtual host { @@ -352,7 +359,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content); - if (! empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) { + if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) { $content = str_replace(']*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/ @@ -520,7 +530,7 @@ function includeContainer($containerref) $tmpoutput = ob_get_contents(); ob_end_clean(); - print "\n".''."\n"; + print "\n".''."\n"; print preg_replace(array('/^.*]*>/ims', '/<\/body>.*$/ims'), array('', ''), $tmpoutput); if (!$res) @@ -533,14 +543,15 @@ function includeContainer($containerref) /** * Return HTML content to add structured data for an article, news or Blog Post. + * Use the json-ld format. * - * @param string $type 'blogpost', 'product', 'software'... + * @param string $type 'blogpost', 'product', 'software', 'organization', ... * @param array $data Array of data parameters for structured data * @return string HTML content */ function getStructuredData($type, $data = array()) { - global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers. + global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs, $pagelangs; // Very important. Required to have var available when running inluded containers. if ($type == 'software') { @@ -551,7 +562,7 @@ function getStructuredData($type, $data = array()) "@type": "SoftwareApplication", "name": "'.dol_escape_json($data['name']).'", "operatingSystem": "'.dol_escape_json($data['os']).'", - "applicationCategory": "https://schema.org/GameApplication", + "applicationCategory": "https://schema.org/'.$data['applicationCategory'].'", "aggregateRating": { "@type": "AggregateRating", "ratingValue": "'.$data['ratingvalue'].'", @@ -565,6 +576,44 @@ function getStructuredData($type, $data = array()) }'."\n"; $ret .= ''."\n"; } + elseif ($type == 'organization') + { + $companyname = $mysoc->name; + $url = $mysoc->url; + + $ret = ''."\n"; + $ret .= ''."\n"; + } elseif ($type == 'blogpost') { if (!empty($websitepage->author_alias)) @@ -581,7 +630,7 @@ function getStructuredData($type, $data = array()) $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); - $image = str_replace('__WEBSITE_KEY__', $website->ref, $image); + $image = 'medias/'.str_replace('__WEBSITE_KEY__', $website->ref, $image); $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); @@ -598,6 +647,7 @@ function getStructuredData($type, $data = array()) "image": [ "'.dol_escape_json($image).'" ], + "dateCreated": "'.dol_print_date($websitepage->date_creation, 'dayhourrfc').'", "datePublished": "'.dol_print_date($websitepage->date_creation, 'dayhourrfc').'", "dateModified": "'.dol_print_date($websitepage->date_modification, 'dayhourrfc').'", "author": { @@ -609,11 +659,22 @@ function getStructuredData($type, $data = array()) "name": "'.dol_escape_json($companyname).'", "logo": { "@type": "ImageObject", - "url": "/viewimage.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo).'" + "url": "/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo).'" } - }, - "description": "'.dol_escape_json($description).'" - }'."\n"; + },'."\n"; + if ($websitepage->keywords) { + $ret .= '"keywords": ['; + $i = 0; + $arrayofkeywords = explode(',', $websitepage->keywords); + foreach($arrayofkeywords as $keyword) { + $ret.= '"'.dol_escape_json($keyword).'"'; + $i++; + if ($i < count($arrayofkeywords)) $ret .= ', '; + } + $ret .= '],'."\n"; + } + $ret .= '"description": "'.dol_escape_json($description).'"'; + $ret .= "\n".'}'."\n"; $ret .= ''."\n"; } } @@ -720,9 +781,10 @@ function getSocialNetworkSharingLinks() * @param int $max Max number of answers * @param string $sortfield Sort Fields * @param string $sortorder Sort order ('DESC' or 'ASC') + * @param string $langcode Language code ('' or 'en', 'fr', 'es', ...) * @return string HTML content */ -function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC') +function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '') { global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers. @@ -764,6 +826,9 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so { $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page'; $sql .= " WHERE fk_website = ".$website->id; + if ($langcode) { + $sql .= " AND lang ='".$db->escape($langcode)."'"; + } if ($type) { $tmparrayoftype = explode(',', $type); $typestring = ''; diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index b2b5ef06abf..ce1f27b49fc 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -39,7 +39,10 @@ function dolSaveMasterFile($filemaster) $mastercontent = ''."\n"; $result = file_put_contents($filemaster, $mastercontent); if (!empty($conf->global->MAIN_UMASK)) @@ -133,7 +136,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n"; $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; - $tplcontent .= "} // Not already loaded"."\n"; + $tplcontent .= "} // Not already loaded\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent .= "ob_start();\n"; @@ -193,7 +196,9 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) else dol_print_error($db); } // Add canonical reference - $tplcontent .= ''."\n"; + if ($object->virtualhost) { + $tplcontent .= ''."\n"; + } // Add manifest.json on homepage $tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n"; $tplcontent .= ''."\n"; @@ -212,7 +217,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= 'id.');'."\n"; - $tplcontent .= "// END PHP ?>"."\n"; + $tplcontent .= "// END PHP ?>\n"; //var_dump($filetpl);exit; $result = file_put_contents($filetpl, $tplcontent); diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 4a85c595223..440f1147cbf 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -251,7 +251,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); - fwrite($calfileh, "STATUS:CONFIRMED"."\n"); + fwrite($calfileh, "STATUS:CONFIRMED\n"); if (!empty($transparency)) { @@ -295,7 +295,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n"); - fwrite($calfileh, "STATUS:CONFIRMED"."\n"); + fwrite($calfileh, "STATUS:CONFIRMED\n"); fwrite($calfileh, "CATEGORIES:".$category."\n"); fwrite($calfileh, "LOCATION:".$location."\n"); fwrite($calfileh, "TRANSP:OPAQUE\n"); @@ -381,7 +381,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt $url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY); } - fwrite($fichier, ""."\n"); + fwrite($fichier, "\n"); foreach ($events_array as $key => $event) { @@ -480,9 +480,9 @@ function format_cal($format, $string) if ($format === "ical") { // Replace new lines chars by "\n" - $newstring = preg_replace("/"."\r\n"."/i", "\\n", $newstring); - $newstring = preg_replace("/"."\n\r"."/i", "\\n", $newstring); - $newstring = preg_replace("/"."\n"."/i", "\\n", $newstring); + $newstring = preg_replace("/\r\n/i", "\\n", $newstring); + $newstring = preg_replace("/\n\r/i", "\\n", $newstring); + $newstring = preg_replace("/\n/i", "\\n", $newstring); // Must not exceed 75 char. Cut with "\r\n"+Space $newstring = calEncode($newstring); @@ -586,7 +586,7 @@ function quotedPrintEncode($str, $forcal = 0) if ((strlen($newpara) + strlen($char)) >= 76) { // New line with carray-return (CR) and line-feed (LF) - $out .= $newpara."="."\r\n"; + $out .= $newpara."=\r\n"; // extra space for cal if ($forcal) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index f9951561f3e..ede2a9f94d3 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -9,15 +9,16 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__; -- table llx_menu -- insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || $conf->fournisseur->enabled || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 52, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|asset', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->asset->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire || $user->rights->asset->read', '', 2, 54, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); -insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); +insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 19, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('hrm|holiday|deplacement|expensereport', '$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled', 15__+MAX_llx_menu__, __HANDLER__, 'top', 'hrm', '', 0, '/hrm/index.php?mainmenu=hrm&leftmenu=', 'HRM', -1, 'holiday', '$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire', '', 0, 80, __ENTITY__); -- Home - Dashboard @@ -76,8 +77,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?mainmenu=companies&leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?mainmenu=companies&leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?mainmenu=companies&type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); @@ -88,14 +89,14 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?mainmenu=companies&leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); -- Third parties - Category customer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category supplier -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); -- Third parties - Category contact insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 670__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?mainmenu=companies&leftmenu=cat&type=4', 'ContactCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); @@ -159,10 +160,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); -- Commercial - Supplier's proposals -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'commercial', '', 1600__+MAX_llx_menu__, '/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', 'SupplierProposalNew', 1, 'supplier_proposal', '$user->rights->supplier_proposal->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'commercial', '', 1600__+MAX_llx_menu__, '/supplier_proposal/list.php?leftmenu=supplier_proposals', 'List', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1610__+MAX_llx_menu__, 'commercial', '', 1600__+MAX_llx_menu__, '/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', 'Statistics', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1650__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1651__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals', 'SupplierProposalNew', 1, 'supplier_proposal', '$user->rights->supplier_proposal->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1652__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/supplier_proposal/list.php?leftmenu=supplier_proposals', 'List', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1653__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier', 'Statistics', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 2, __ENTITY__); -- Commercial - Supplier's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?mainmenu=commercial&leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?mainmenu=commercial&action=create&leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__); @@ -269,9 +270,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->facture->enabled && $leftmenu=="accountancy_dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 4, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $leftmenu=="accountancy_dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); @@ -347,6 +348,16 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && !$conf->global->PROJECT_HIDE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?mainmenu=project&leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); +-- BOM +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5400__+MAX_llx_menu__, 'mrp', 'bom', 16__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'MenuBOM', 1, 'mrp', '$user->rights->bom->read', '', 0, 20, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5401__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_card.php?mainmenu=mrp&leftmenu=bom&action=create', 'NewBOM', 2, 'mrp', '$user->rights->bom->write', '', 0, 21, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5403__+MAX_llx_menu__, 'mrp', '', 5400__+MAX_llx_menu__, '/bom/bom_list.php?mainmenu=mrp&leftmenu=bom', 'List', 2, 'mrp', '$user->rights->bom->read', '', 0, 22, __ENTITY__); +-- MRP +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5450__+MAX_llx_menu__, 'mrp', 'mrp', 16__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'MenuMRP', 1, 'mrp', '$user->rights->mrp->read', '', 0, 20, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5451__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_card.php?mainmenu=mrp&leftmenu=mrp&action=create', 'NewMO', 2, 'mrp', '$user->rights->mrp->write', '', 0, 21, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->bom->enabled', __HANDLER__, 'left', 5453__+MAX_llx_menu__, 'mrp', '', 5450__+MAX_llx_menu__, '/mrp/mo_list.php?mainmenu=mrp&leftmenu=mrp', 'List', 2, 'mrp', '$user->rights->mrp->read', '', 0, 22, __ENTITY__); + + -- Project - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?mainmenu=project&leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?mainmenu=project&action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index dc67d44f937..4b4a4c54151 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -29,11 +29,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; * Core function to output top menu auguria * * @param DoliDB $db Database handler - * @param string $atarget Target + * @param string $atarget Target (Example: '' or '_top') * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) * @param Menu $menu Object Menu to return back list of menu entries - * @param int $noout Disable output (Initialise &$menu only). + * @param int $noout 1=Disable output (Initialise &$menu only). * @param string $mode 'top', 'topnb', 'left', 'jmobile' * @return int 0 */ @@ -131,27 +131,38 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout { //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); $mysoc->logo_squarred_mini = (empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); + + $logoContainerAdditionalClass = 'backgroundforcompanylogo'; + if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)) { + $logoContainerAdditionalClass = ''; + } + if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); } + /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo_squarred_alpha.png'; + $logoContainerAdditionalClass = ''; } + $title = $langs->trans("GoIntoSetupToChangeLogo"); print "\n".''."\n"; - print_start_menu_entry_auguria('companylogo', 'class="tmenu tmenucompanylogo"', 1); + print_start_menu_entry_auguria('companylogo', 'class="tmenu tmenucompanylogo nohover"', 1); - print ''."\n"; + print ''."\n"; print_end_menu_entry_auguria(4); } if (empty($noout)) { - foreach ($menu->liste as $menuval) - { + foreach ($menu->liste as $menuval) { print_start_menu_entry_auguria($menuval['idsel'], $menuval['classname'], $menuval['enabled']); print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget)); print_end_menu_entry_auguria($menuval['enabled']); @@ -216,8 +227,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla { global $langs; - if ($showmode == 1) - { + if ($showmode == 1) { print ''; print '
    '; print '
    '; @@ -226,9 +236,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla print $text; print ''; print ''; - } - elseif ($showmode == 2) - { + } elseif ($showmode == 2) { print '
    '; print ''; print ''; @@ -356,7 +364,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account { - $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy'); + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy', 10); // Multi journal $sql = "SELECT rowid, code, label, nature"; @@ -380,13 +388,13 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $nature = ''; // Must match array $sourceList defined into journals_list.php - if ($objp->nature == 2 && !empty($conf->facture->enabled)) $nature = "sells"; - if ($objp->nature == 3 && !empty($conf->fournisseur->enabled)) $nature = "purchases"; - if ($objp->nature == 4 && !empty($conf->banque->enabled)) $nature = "bank"; - if ($objp->nature == 5 && !empty($conf->expensereport->enabled)) $nature = "expensereports"; - if ($objp->nature == 1) $nature = "various"; - if ($objp->nature == 8) $nature = "inventory"; - if ($objp->nature == 9) $nature = "hasnew"; + if ($objp->nature == 2 && ! empty($conf->facture->enabled)) $nature="sells"; + if ($objp->nature == 3 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))) $nature="purchases"; + if ($objp->nature == 4 && ! empty($conf->banque->enabled)) $nature="bank"; + if ($objp->nature == 5 && ! empty($conf->expensereport->enabled)) $nature="expensereports"; + if ($objp->nature == 1) $nature="various"; + if ($objp->nature == 8) $nature="inventory"; + if ($objp->nature == 9) $nature="hasnew"; // To enable when page exists if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) @@ -411,36 +419,6 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t } else dol_print_error($db); $db->free($resql); - - /* - $sql = "SELECT rowid, label, accountancy_journal"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql.= " WHERE entity = ".$conf->entity; - $sql.= " AND clos = 0"; - $sql.= " ORDER BY label"; - - $resql = $db->query($sql); - if ($resql) - { - $numr = $db->num_rows($resql); - $i = 0; - - if ($numr > 0) - while ($i < $numr) - { - $objp = $db->fetch_object($resql); - $newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid, $langs->trans("Journal").' - '.$objp->label, 1, $user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal'); - $i++; - } - } - else dol_print_error($db); - $db->free($resql); - - // Add other journal - $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal'); - $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal'); - $newmenu->add("/accountancy/journal/expensereportsjournal.php?leftmenu=journal",$langs->trans("ExpenseReportsJournal"),1,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal'); - */ } if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 0b08dce9beb..2a67d43c1e3 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -119,7 +119,7 @@ class MenuManager /** - * Show menu + * Show menu. * Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called. * * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index dba6dd2f4a4..3f539260856 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -120,7 +120,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled'=> ((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) ) - || !empty($conf->fournisseur->enabled) + || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) ), 'perms'=> (!empty($user->rights->societe->lire) || !empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur' @@ -227,19 +227,21 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $tmpentry = array( 'enabled'=>(!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || - !empty($conf->supplier_order->enabled) || - !empty($conf->supplier_proposal->enabled) || - !empty($conf->contrat->enabled) || + !empty($conf->fournisseur->enabled) || + !empty($conf->supplier_proposal->enabled) || + !empty($conf->supplier_order->enabled) || + !empty($conf->contrat->enabled) || !empty($conf->ficheinter->enabled) ) ? 1 : 0, 'perms'=>(!empty($user->rights->propal->lire) || !empty($user->rights->commande->lire) || - !empty($user->rights->supplier_order->lire) || + !empty($user->rights->fournisseur->lire) || !empty($user->rights->supplier_proposal->lire) || + !empty($user->rights->supplier_order->lire) || !empty($user->rights->contrat->lire) || !empty($user->rights->ficheinter->lire) ), - 'module'=>'propal|commande|supplier_order|supplier_proposal|contrat|ficheinter' + 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' ); $onlysupplierorder = !empty($user->rights->fournisseur->commande->lire) && @@ -306,8 +308,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Bank $tmpentry = array( 'enabled'=>(!empty($conf->banque->enabled) || !empty($conf->prelevement->enabled)), - 'perms'=>(!empty($user->rights->banque->lire) || !empty($user->rights->prelevement->lire)), - 'module'=>'banque|prelevement' + 'perms'=>(!empty($user->rights->banque->lire) || !empty($user->rights->prelevement->lire) || !empty($user->rights->paymentbybanktransfer->read)), + 'module'=>'banque|prelevement|paymentbybanktransfer' ); $menu_arr[] = array( 'name' => 'Bank', @@ -848,7 +850,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Suppliers - if (!empty($conf->societe->enabled) && (!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled))) + if (!empty($conf->societe->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) { $langs->load("suppliers"); $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, ($user->rights->fournisseur->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers'); @@ -868,7 +870,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } // Categories suppliers - if (!empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); } @@ -880,7 +882,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); - if (!empty($conf->fournisseur->enabled)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); @@ -1211,7 +1213,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if (!empty($conf->banque->enabled)) { $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70); } - if (!empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled)) { + if (!empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))) { $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80); } if (!empty($conf->tax->enabled)) { @@ -1285,7 +1287,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Must match array $sourceList defined into journals_list.php if ($objp->nature == 2 && !empty($conf->facture->enabled)) $nature = "sells"; - if ($objp->nature == 3 && !empty($conf->fournisseur->enabled)) $nature = "purchases"; + if ($objp->nature == 3 && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))) $nature = "purchases"; if ($objp->nature == 4 && !empty($conf->banque->enabled)) $nature = "bank"; if ($objp->nature == 5 && !empty($conf->expensereport->enabled)) $nature = "expensereports"; if ($objp->nature == 1) $nature = "various"; @@ -1447,7 +1449,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type'); if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) { - $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->configurer); + $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->setup_advance)); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read); } } @@ -1462,7 +1464,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Load translation files required by the page $langs->loadLangs(array("withdrawals", "banks", "bills", "categories")); - // Bank-Caisse + // Bank-Cash account if (!empty($conf->banque->enabled)) { $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank'); @@ -1482,14 +1484,12 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags'); } - // Prelevements + // Direct debit order if (!empty($conf->prelevement->enabled)) { $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("StandingOrders"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { - //$newmenu->add("/compta/prelevement/demandes.php?status=0&mainmenu=bank",$langs->trans("StandingOrderToProcess"),1,$user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); $newmenu->add("/compta/prelevement/bons.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); @@ -1501,7 +1501,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } } - // Gestion cheques + // Bank transfer order + if (!empty($conf->paymentbybanktransfer->enabled)) + { + $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer'); + + if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { + $newmenu->add("/compta/paymentbybanktransfer/create.php?mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create); + + $newmenu->add("/compta/paymentbybanktransfer/bons.php?mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/paymentbybanktransfer/list.php?mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/paymentbybanktransfer/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/paymentbybanktransfer/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read); + } + } + + // Management of checks if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && !empty($conf->banque->enabled) && (!empty($conf->facture->enabled) || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) { $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks'); @@ -1905,40 +1920,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu); //var_dump($newmenu->liste); // - // We update newmenu for special dynamic menus - if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account - { - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - - $sql = "SELECT rowid, label, courant, rappro"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql .= " WHERE entity = ".$conf->entity; - $sql .= " AND clos = 0"; - $sql .= " ORDER BY label"; - - $resql = $db->query($sql); - if ($resql) - { - $numr = $db->num_rows($resql); - $i = 0; - - if ($numr > 0) $newmenu->add('/compta/bank/list.php', $langs->trans("BankAccounts"), 0, $user->rights->banque->lire); - - while ($i < $numr) - { - $objp = $db->fetch_object($resql); - $newmenu->add('/compta/bank/card.php?id='.$objp->rowid, $objp->label, 1, $user->rights->banque->lire); - if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate - { - $newmenu->add('/compta/bank/bankentries_list.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0', $langs->trans("Conciliate"), 2, $user->rights->banque->consolidate); - } - $i++; - } - } - else dol_print_error($db); - $db->free($resql); - } - if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP { $MAXFTP = 20; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 96c334a1de7..5276a509ae5 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -308,8 +308,6 @@ class MenuManager $lastlevel2[$val2['level']] = 'greyed'; } } - //var_dump($val2['level']); - //var_dump($lastlevel2); print $val2['titre']; if ($relurl2) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index cd3fe7922ee..24811ad854d 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2279,7 +2279,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($this))); print ' -
    +
    '; @@ -2295,9 +2295,17 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it { print img_object($alttext, 'generic', 'class="inline-block valignmiddle"'); } - print 'getVersion(1).'">'; - print $this->getVersion(1); - print ''; + + $version = $this->getVersion(0); + $versiontrans = ''; + if (preg_match('/development/i', $version)) $versiontrans .= 'warning'; + if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning'; + if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning'; + if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { + print 'getVersion(1).'">'; + print $this->getVersion(1); + print ''; + } /*print ''; print '
    '; @@ -2313,8 +2321,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it print '
    - '.$this->getName().' - '.nl2br($this->getDesc()).''; + '.$this->getName().' + '.nl2br($this->getDesc()).''; /*print 'getVersion(1).'">'; print $this->getVersion(1); diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index b8b458c4b2a..1fb4e33a6c6 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -174,7 +174,7 @@ class CommActionRapport $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right - $nbpage = $this->_pages($pdf, $outputlangs); // Write content + $nbpage = $this->_pages($pdf, $outputlangs); // Write content if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 0ce2f2bbbb2..23868eef643 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -227,14 +227,14 @@ class pdf_sepamandate extends ModeleBankAccountDoc $posY += 2; $pdf->SetXY($this->marge_gauche, $posY); - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").')'.' : '.$object->rum, 0, 'L'); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").') : '.$object->rum, 0, 'L'); $posY = $pdf->GetY(); $posY += 2; $pdf->SetXY($this->marge_gauche, $posY); $ics = ''; if (!empty($conf->global->PRELEVEMENT_ICS)) $ics = $conf->global->PRELEVEMENT_ICS; - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").')'.' : '.$ics, 0, 'L'); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").') : '.$ics, 0, 'L'); $posY = $pdf->GetY(); $posY += 1; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 1a8f13ea1af..2e0733f1ba2 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -214,14 +214,14 @@ class pdf_rouget extends ModelePdfExpedition $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; + $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } else { - $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index cf6bc12b9a1..3a66a8ae961 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -354,12 +354,12 @@ class pdf_standard extends ModeleExpenseReport // Loop on each lines $i = 0; while ($i < $nblines) { - $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage + $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); if (empty($showpricebeforepagebreak)) { - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. } else { $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. } @@ -385,8 +385,8 @@ class pdf_standard extends ModeleExpenseReport $pdf->setPage($pageposafter + 1); $showpricebeforepagebreak = 1; $nexY = $tab_top_newpage; - $nexY += ($pdf->getFontSize() * 1.3); // Passe espace entre les lignes - $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage + $nexY += ($pdf->getFontSize() * 1.3); // Passe espace entre les lignes + $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index dcb6cc33a96..cf91ec4806c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -356,7 +356,7 @@ class pdf_crabe extends ModelePDFFactures if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); // Set certificate - $cert=empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; // If use has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; @@ -372,7 +372,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info); } - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // Set $this->atleastonediscount if you have at least one discount for ($i = 0; $i < $nblines; $i++) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 85392dd21fa..de32e84d43a 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -462,39 +462,39 @@ class ImportCsv extends ModeleImports $errorforthistable++; $error++; }*/ - $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. + $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label - if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') + if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') { $param_array = array('', '', $newval); call_user_func_array(array($classinstance, $method), $param_array); } - $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]=$classinstance->id; + $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id; //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; if ($classinstance->id != '') // id may be 0, it is a found value { - $newval=$classinstance->id; + $newval = $classinstance->id; } else { - if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); - elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); - else $this->errors[$error]['lib']='ErrorBadDefinitionOfImportProfile'; - $this->errors[$error]['type']='FOREIGNKEY'; + if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); + elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); + else $this->errors[$error]['lib'] = 'ErrorBadDefinitionOfImportProfile'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; $errorforthistable++; $error++; } } } } - elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeandlabel') + elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeandlabel') { - $isidorref='id'; - if (! is_numeric($newval) && $newval != '' && ! preg_match('/^id:/i', $newval)) $isidorref='ref'; - $newval=preg_replace('/^(id|ref):/i', '', $newval); + $isidorref = 'id'; + if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref'; + $newval = preg_replace('/^(id|ref):/i', '', $newval); if ($isidorref == 'ref') { $file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']); diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index f2fc9af2f9e..911a4bbd5b9 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -50,7 +50,7 @@ class modAdherent extends DolibarrModules $this->numero = 310; $this->family = "hr"; - $this->module_position = '55'; + $this->module_position = '06'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Management of members of a foundation or association"; diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index 1efeec1ff43..c11cf34d257 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -69,7 +69,7 @@ class modAsset extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto = 'generic'; + $this->picto = 'accounting'; // Defined all module parts (triggers, login, substitutions, menus, css, etc...) // for default path (eg: /asset/core/xxxxx) (0=disable, 1=enable) @@ -103,7 +103,7 @@ class modAsset extends DolibarrModules // 1=>array('ASSETS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); $this->const = array( - 1=>array('ASSET_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + //1=>array('ASSET_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) ); @@ -200,7 +200,7 @@ class modAsset extends DolibarrModules $this->rights[$r][1] = 'Setup types of asset'; // Permission label $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'advanced_configurer'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) + $this->rights[$r][4] = 'setup_advance'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) // Menus diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index b51ac199ff5..822ebd81e03 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -143,6 +143,7 @@ class modBanque extends DolibarrModules //-------- $r = 0; + // Bank lines $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'Ecritures bancaires et releves'; @@ -174,6 +175,7 @@ class modBanque extends DolibarrModules $this->export_sql_end[$r] .= ' AND ba.entity IN ('.getEntity('bank_account').')'; $this->export_sql_order[$r] = ' ORDER BY b.datev, b.num_releve'; + // $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'Bordereaux remise Chq/Fact'; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 61a4dd67d5c..4f0c1e04307 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -120,7 +120,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r] = 'category_'.$r; $this->export_label[$r] = 'CatSupList'; $this->export_icon[$r] = 'category'; - $this->export_enabled[$r] = '$conf->fournisseur->enabled'; + $this->export_enabled[$r] = '!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); $this->export_fields_array[$r] = array( 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", @@ -423,7 +423,7 @@ class modCategorie extends DolibarrModules ); $typeexample = ""; if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; } - if ($conf->fournisseur->enabled) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; } + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; } if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; } if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; } $this->import_examplevalues_array[$r] = array( @@ -491,7 +491,7 @@ class modCategorie extends DolibarrModules $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_socpeople'=>"123"); } - if (!empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { // Suppliers $r++; diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php index 5190c8c4d72..345a292cb92 100644 --- a/htdocs/core/modules/modCollab.class.php +++ b/htdocs/core/modules/modCollab.class.php @@ -55,7 +55,7 @@ class modCollab extends DolibarrModules // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. - $this->picto = 'globe'; + $this->picto = 'website'; // Data directories to create when module is enabled $this->dirs = array("/collab/temp"); diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index c548b18fffb..5c9ca314bef 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -51,7 +51,7 @@ class modCommande extends DolibarrModules $this->numero = 25; $this->family = "crm"; - $this->module_position = '23'; + $this->module_position = '11'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Gestion des commandes clients"; diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 7aadc941180..d3b1c56b054 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -47,7 +47,7 @@ class modContrat extends DolibarrModules $this->numero = 54; $this->family = "crm"; - $this->module_position = '35'; + $this->module_position = '41'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Gestion des contrats de services"; diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index 003fd61b578..88b7400cc36 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -54,7 +54,7 @@ class modDon extends DolibarrModules $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of png file (without png) used for this module. // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. - $this->picto = 'bill'; + $this->picto = 'donation'; // Data directories to create when module is enabled $this->dirs = array("/don/temp"); diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php index cba555391d7..ce8ea9436e8 100644 --- a/htdocs/core/modules/modEmailCollector.class.php +++ b/htdocs/core/modules/modEmailCollector.class.php @@ -282,8 +282,10 @@ class modEmailCollector extends DolibarrModules $tmpresql = $this->db->query($tmpsql); if ($tmpresql) { if ($this->db->num_rows($tmpresql) == 0) { + $descriptionA1 = 'This collector will scan your mailbox to find emails that match some rules and create automatically a ticket (Module Ticket must be enabled) with the email informations. You can use this collector if you provide some support by email, so your ticket request will be automatically generated.'; + $descriptionA1 .= ' If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.'; $sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', 'This collector will scan your mailbox to find emails that match some rules and create automatically a ticket (Module Ticket must be enabled) with the email informations. You can use this collector if you provide some support by email, so your ticket request will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', '".$this->db->escape($descriptionA1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleA3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)"; @@ -301,8 +303,9 @@ class modEmailCollector extends DolibarrModules $tmpresql = $this->db->query($tmpsql); if ($tmpresql) { if ($this->db->num_rows($tmpresql) == 0) { + $descriptionB1 = 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event with the email response will be recorded at the good place (Module Agenda must be enabled). For example, if your send a commercial proposal, order or invoice by email and your customer answers your email, the system will automatically find the answer and add it into your ERP.'; $sqlforexampleB1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event with the email response will be recorded at the good place (Module Agenda must be enabled). For example, if your send a commercial proposal, order or invoice by email and your customer answers your email, the system will automatically find the answer and add it into your ERP.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', '".$this->db->escape($descriptionB1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleB2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleB2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity."), 'withtrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleB3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)"; @@ -317,8 +320,11 @@ class modEmailCollector extends DolibarrModules $tmpresql = $this->db->query($tmpsql); if ($tmpresql) { if ($this->db->num_rows($tmpresql) == 0) { + $descriptionC1 = "This collector will scan your mailbox to find emails that match some rules and create automatically a lead (Module Project must be enabled) with the email informations. You can use this collector if you want to follow your lead using the module Project (1 lead = 1 project), so your leads will be automatically generated."; + $descriptionC1 .= " If the collector Collect_Responses is also enabled, when you send an email from your leads, proposals or any other object, you may also see answers of your customers or partners directly on the application.
    "; + $descriptionC1 .= "Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can't be found in database (new customer), the lead will be attached to the thirdparty with ID 1."; $sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', 'This collector will scan your mailbox to find emails that match some rules and create automatically a lead (Module Project must be enabled) with the email informations. You can use this collector if you want to follow your lead using the module Project (1 lead = 1 project), so your leads will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from your leads, proposals or any other object, you may also see answers of your customers or partners directly on the application.
    Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can''t be found in database (new customer), the lead will be attached to the thirdparty with ID 1.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', '".$this->db->escape($descriptionC1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)"; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 2dbd7195154..5043e2c2d28 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -48,7 +48,7 @@ class modFacture extends DolibarrModules $this->numero = 30; $this->family = "financial"; - $this->module_position = '10'; + $this->module_position = '11'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Gestion des factures"; diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 02f4e11cd5d..624311c74f0 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -347,7 +347,10 @@ class modFournisseur extends DolibarrModules case 'sellist': $tmp = ''; $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp = array_shift(array_keys($tmpparam['options'])); + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $var = array_keys($tmpparam['options']); + $tmp = array_shift($var); + } if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp; break; } diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php index 2ad05c19fe9..78ed97cd295 100644 --- a/htdocs/core/modules/modLabel.class.php +++ b/htdocs/core/modules/modLabel.class.php @@ -51,17 +51,17 @@ class modLabel extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'development'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->picto='generic'; + $this->picto = 'generic'; // Data directories to create when module is enabled $this->dirs = array("/label/temp"); // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled - $this->requiredby = array(); // List of module ids to disable if this one is disabled - $this->conflictwith = array(); // List of module class names as string this module is in conflict with - $this->phpmin = array(5,4); // Minimum version of PHP required by module + $this->hidden = false; // A condition to hide module + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled + $this->requiredby = array(); // List of module ids to disable if this one is disabled + $this->conflictwith = array(); // List of module class names as string this module is in conflict with + $this->phpmin = array(5, 4); // Minimum version of PHP required by module // Config pages // $this->config_page_url = array("label.php"); diff --git a/htdocs/core/modules/modPaymentByBankTransfer.class.php b/htdocs/core/modules/modPaymentByBankTransfer.class.php new file mode 100644 index 00000000000..d68274e2dee --- /dev/null +++ b/htdocs/core/modules/modPaymentByBankTransfer.class.php @@ -0,0 +1,148 @@ + + * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2011 Juanjo Menent + * + * 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 . + */ + +/** + * \defgroup paymentbybanktransfer Module paymentbybanktransfer + * \brief Module to manage payment by bank transfer + * \file htdocs/core/modules/modPaymentByBankTransfer.class.php + * \ingroup paymentbybanktransfer + * \brief File to describe and activate the module PaymentByBankTransfer + */ + +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; + + +/** + * Class to describe and enable module of payment by Bank transfer + */ +class modPaymentByBankTransfer extends DolibarrModules +{ + + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf; + + $this->db = $db; + $this->numero = 56; + + $this->family = "financial"; + $this->module_position = '52'; + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) + $this->name = preg_replace('/^mod/i', '', get_class($this)); + $this->description = "Management of payment by bank transfer"; + + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; + + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Name of png file (without png) used for this module + $this->picto = 'payment'; + + // Data directories to create when module is enabled + $this->dirs = array("/paymentbybanktransfer/temp", "/paymentbybanktransfer/receipts"); + + // Dependencies + $this->hidden = false; // A condition to hide module + $this->depends = array("modFournisseur", "modBanque"); // List of module class names as string that must be enabled if this module is enabled + $this->requiredby = array(); // List of module ids to disable if this one is disabled + $this->conflictwith = array(); // List of module class names as string this module is in conflict with + $this->phpmin = array(5, 4); // Minimum version of PHP required by module + + // Config pages + $this->config_page_url = array("paymentbybanktransfer.php"); + + // Constants + $this->const = array(); + $r = 0; + + /*$this->const[$r][0] = "BANK_ADDON_PDF"; + $this->const[$r][1] = "chaine"; + $this->const[$r][2] = "sepamandate"; + $this->const[$r][3] = 'Name of manager to generate SEPA mandate'; + $this->const[$r][4] = 0; + $r++;*/ + + + // Boxes + $this->boxes = array(); + + // Permissions + $this->rights = array(); + $this->rights_class = 'paymentbybanktransfer'; + $r = 0; + $r++; + $this->rights[$r][0] = 561; + $this->rights[$r][1] = 'Read bank transfer payment orders'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'read'; + + $r++; + $this->rights[$r][0] = 562; + $this->rights[$r][1] = 'Create/modify a bank transfer payment order'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'create'; + + $r++; + $this->rights[$r][0] = 563; + $this->rights[$r][1] = 'Send/Transmit bank transfer payment order'; + $this->rights[$r][2] = 'a'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'send'; + + $r++; + $this->rights[$r][0] = 564; + $this->rights[$r][1] = 'Record Debits/Rejects of bank transfer payment order'; + $this->rights[$r][2] = 'a'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'debit'; + + // Menus + //------- + $this->menu = 1; // This module add menu entries. They are coded into menu manager. + } + + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + global $conf; + + // Permissions + $this->remove($options); + + $sql = array(); + + return $this->_init($sql, $options); + } +} diff --git a/htdocs/core/modules/modPrelevement.class.php b/htdocs/core/modules/modPrelevement.class.php index 4eb1ce3a171..00259fec22c 100644 --- a/htdocs/core/modules/modPrelevement.class.php +++ b/htdocs/core/modules/modPrelevement.class.php @@ -20,17 +20,17 @@ /** * \defgroup prelevement Module prelevement - * \brief Module de gestion des prelevements bancaires + * \brief Module to manage Direct debit orders * \file htdocs/core/modules/modPrelevement.class.php * \ingroup prelevement - * \brief Fichier de description et activation du module Prelevement + * \brief File to describe and enable the module Prelevement */ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** - * Class to describe and enable module Prelevement + * Class to describe and enable module of payment by Direct Debit */ class modPrelevement extends DolibarrModules { @@ -51,7 +51,7 @@ class modPrelevement extends DolibarrModules $this->module_position = '52'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); - $this->description = "Gestion des Prelevements"; + $this->description = "Management of Direct Debit orders"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; @@ -124,15 +124,6 @@ class modPrelevement extends DolibarrModules $this->rights[$r][4] = 'bons'; $this->rights[$r][5] = 'credit'; - /* - $this->rights[2][0] = 154; - $this->rights[2][1] = 'Setup withdraw account'; - $this->rights[2][2] = 'w'; - $this->rights[2][3] = 0; - $this->rights[2][4] = 'bons'; - $this->rights[2][5] = 'configurer'; - */ - // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 1f9bdb0f37d..007e92e4277 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -49,7 +49,7 @@ class modPropale extends DolibarrModules $this->numero = 20; $this->family = "crm"; - $this->module_position = '22'; + $this->module_position = '10'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Gestion des propositions commerciales"; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index 47f62a21b08..818c090dcc0 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -135,11 +135,13 @@ class modReceiptPrinter extends DolibarrModules global $conf, $langs; // Clean before activation $this->remove($options); + + $templateexample = '\r\n\r\n\r\n\r\n\r\nFacture \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n'; $sql = array( "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;", "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;", "DELETE FROM ".MAIN_DB_PREFIX."printer_receipt_template WHERE name = '".$langs->trans('Example')."';", - "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Example')."', '\r\n\r\n\r\n\r\n\r\nFacture \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', 1);", + "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Example')."', '".$templateexample."', 1);", ); return $this->_init($sql, $options); } diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index 637afae049d..c09915febb8 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -197,7 +197,8 @@ class modReception extends DolibarrModules $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', 'co.code'=>'company', 's.fk_pays'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.siret'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', - 'c.rowid'=>"reception", 'c.ref'=>"reception", 'c.ref_supplier'=>"reception", 'c.fk_soc'=>"reception", 'c.date_creation'=>"reception", 'c.date_delivery'=>"reception", 'c.tracking_number'=>'reception', 'c.height'=>"reception", 'c.width'=>"reception", 'c.size'=>'reception', 'c.size_units'=>'reception', 'c.weight'=>"reception", 'c.weight_units'=>'reception', 'c.fk_statut'=>"reception", 'c.note_public'=>"reception", 'ed.rowid'=>'reception_line', 'ed.comment'=>'reception_line', 'ed.qty'=>"reception_line", + 'c.rowid'=>"reception", 'c.ref'=>"reception", 'c.ref_supplier'=>"reception", 'c.fk_soc'=>"reception", 'c.date_creation'=>"reception", 'c.date_delivery'=>"reception", 'c.tracking_number'=>'reception', 'c.height'=>"reception", 'c.width'=>"reception", 'c.size'=>'reception', 'c.size_units'=>'reception', 'c.weight'=>"reception", 'c.weight_units'=>'reception', 'c.fk_statut'=>"reception", 'c.note_public'=>"reception", + 'ed.rowid'=>'reception_line', 'ed.comment'=>'reception_line', 'ed.qty'=>"reception_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product', 'p.weight'=>'product', 'p.weight_units'=>'product', 'p.volume'=>'product', 'p.volume_units'=>'product' ); if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r] += array('sp.rowid'=>'contact', 'sp.lastname'=>'contact', 'sp.firstname'=>'contact', 'sp.note_public'=>'contact'); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 7d64a1a7499..a9be157d126 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -451,7 +451,7 @@ class modSociete extends DolibarrModules 's.fk_multicurrency' => 'MulticurrencyUsed', 's.multicurrency_code' => 'MulticurrencyCurrency' ); - if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level']='PriceLevel'; + if (!empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel'; // Add extra fields $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 8c0f92b8db1..4dd1a740278 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -48,7 +48,7 @@ class modStock extends DolibarrModules $this->numero = 52; $this->family = "products"; - $this->module_position = '40'; + $this->module_position = '39'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Gestion des stocks"; diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 1fc755455de..0b5e54e9637 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -122,7 +122,12 @@ class modTicket extends DolibarrModules 'langs' => 'ticket', 'tabname' => array(MAIN_DB_PREFIX."c_ticket_type", MAIN_DB_PREFIX."c_ticket_severity", MAIN_DB_PREFIX."c_ticket_category", MAIN_DB_PREFIX."c_ticket_resolution"), 'tablib' => array("TicketDictType", "TicketDictSeverity", "TicketDictCategory", "TicketDictResolution"), - 'tabsql' => array('SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_category as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f'), + 'tabsql' => array( + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_category as f', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f' + ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"), 'tabfieldvalue' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"), diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index 3e3b4bae374..60cc93b5d39 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -55,7 +55,7 @@ class modWebsite extends DolibarrModules // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. - $this->picto = 'globe'; + $this->picto = 'website'; // Data directories to create when module is enabled $this->dirs = array("/website/temp"); diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 5031b4079e4..80bc9f7ce0a 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -61,6 +61,9 @@ abstract class ModelePDFProduct extends CommonDocGenerator } } +/** + * Class template for classes of numbering product + */ abstract class ModeleProductCode { /** @@ -97,7 +100,6 @@ abstract class ModeleProductCode */ public function getExample($langs) { - $langs->load("bills"); return $langs->trans("NoExample"); } 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 9cfc52fc1de..542ea728f84 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 @@ -41,8 +41,8 @@ if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/p if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; @@ -1008,13 +1008,13 @@ class doc_generic_project_odt extends ModelePDFProjects 'title' => "ListSupplierOrdersAssociatedProject", 'table' => 'commande_fournisseur', 'class' => 'CommandeFournisseur', - 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire + 'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire ), 'invoice_supplier' => array( 'title' => "ListSupplierInvoicesAssociatedProject", 'table' => 'facture_fourn', 'class' => 'FactureFournisseur', - 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire + 'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire ), 'contract' => array( 'title' => "ListContractAssociatedProject", diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 707609767f5..4044676461e 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -34,17 +34,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; -if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -if (!empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; -if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -if (!empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; -if (!empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; +require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; 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 8a38450697f..9b7b15a884d 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 @@ -130,7 +130,7 @@ class doc_generic_task_odt extends ModelePDFTask public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') { // phpcs:enable - global $conf; + global $conf, $extrafields; $resarray = array( $array_key.'_id'=>$object->id, @@ -150,11 +150,6 @@ class doc_generic_task_odt extends ModelePDFTask // Retrieve extrafields if (is_array($object->array_options) && count($object->array_options)) { - $extrafieldkey = $object->element; - - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $extrafields->fetch_name_optionals_label($extrafieldkey, true); $object->fetch_optionals(); $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); @@ -167,16 +162,17 @@ class doc_generic_task_odt extends ModelePDFTask /** * Define array with couple substitution key => substitution value * - * @param array $task Task Object + * @param Task $task Task Object * @param Translate $outputlangs Lang object to use for output + * @param string $array_key Name of the key for return array * @return array Return a substitution array */ - public function get_substitutionarray_tasks($task, $outputlangs) + public function get_substitutionarray_tasks($task, $outputlangs, $array_key = 'task') { // phpcs:enable - global $conf; + global $conf, $extrafields; - return array( + $resarray = array( 'task_ref'=>$task->ref, 'task_fk_project'=>$task->fk_project, 'task_projectref'=>$task->projectref, @@ -184,7 +180,10 @@ class doc_generic_task_odt extends ModelePDFTask 'task_label'=>$task->label, 'task_description'=>$task->description, 'task_fk_parent'=>$task->fk_parent, - 'task_duration'=>$task->duration, + 'task_duration'=>$task->duration_effective, + 'task_duration_formated'=>convertSecondToTime($task->duration_effective, 'allhourmin'), + 'task_planned_workload'=>$task->planned_workload, + 'task_planned_workload_formated'=>convertSecondToTime($task->planned_workload, 'allhourmin'), 'task_progress'=>$task->progress, 'task_public'=>$task->public, 'task_date_start'=>dol_print_date($task->date_start, 'day'), @@ -192,6 +191,16 @@ class doc_generic_task_odt extends ModelePDFTask 'task_note_private'=>$task->note_private, 'task_note_public'=>$task->note_public ); + + // Retrieve extrafields + if (is_array($task->array_options) && count($task->array_options)) + { + $task->fetch_optionals(); + + $resarray = $this->fill_substitutionarray_with_extrafields($task, $resarray, $extrafields, $array_key, $outputlangs); + } + + return $resarray; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -474,7 +483,6 @@ class doc_generic_task_odt extends ModelePDFTask if (!file_exists($dir)) { - print '$dir'.$dir; if (dol_mkdir($dir) < 0) { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 2377e537606..103d0fdffba 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville * Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2015-2018 Charlene BENKE + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -207,7 +208,11 @@ class pdf_paiement $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if (!empty($socid)) $sql .= " AND s.rowid = ".$socid; - $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; + // If global param PAYMENTS_REPORT_GROUP_BY_MOD is set, payement are ordered by paiement_code + if (!empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) + $sql .= " ORDER BY paiement_code ASC, p.datep ASC, pf.fk_paiement ASC"; + else + $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; break; case "fourn": $sql = "SELECT p.datep as dp, f.ref as ref"; @@ -237,7 +242,11 @@ class pdf_paiement $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if (!empty($socid)) $sql .= " AND s.rowid = ".$socid; - $sql .= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC"; + // If global param PAYMENTS_FOURN_REPORT_GROUP_BY_MOD is set, payement fourn are ordered by paiement_code + if (!empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD)) + $sql .= " ORDER BY paiement_code ASC, p.datep ASC, pf.fk_paiementfourn ASC"; + else + $sql .= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC"; break; } @@ -425,7 +434,7 @@ class pdf_paiement public function Body(&$pdf, $page, $lines, $outputlangs) { // phpcs:enable - global $langs; + global $langs, $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); $pdf->SetFont('', '', $default_font_size - 1); @@ -435,6 +444,11 @@ class pdf_paiement $pdf->SetFillColor(220, 220, 220); $yp = 0; $numlines = count($lines); + if (($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) + { + $mod = $lines[0][2]; + $total_mod = 0; + } for ($j = 0; $j < $numlines; $j++) { $i = $j; @@ -450,8 +464,17 @@ class pdf_paiement { if ($yp > $this->tab_height - 15) { - $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $langs->transnoentities('SubTotal')." : ".price($total_page), 0, 'R', 0); + $pdf->SetFillColor(255, 255, 255); + $pdf->Rect($this->marge_gauche + 1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite - 3, $this->line_height, 'F', array(), array()); + $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); + $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); + $pdf->SetFont('', 'B', $default_font_size - 1); + $pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('SubTotal')." : ", 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount - 1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount + 1, $this->line_height, price($total_page), 0, 'R', 1); + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetFillColor(220, 220, 220); $page++; $pdf->AddPage(); $this->_pagehead($pdf, $page, 0, $outputlangs); @@ -474,6 +497,7 @@ class pdf_paiement $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][4], 0, 'R', 1); $yp = $yp + 5; $total_page += $lines[$j][9]; + if (($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) $total_mod += $lines[$j][9]; } // Invoice number @@ -497,9 +521,44 @@ class pdf_paiement { $oldprowid = $lines[$j][7]; } + + // Add line to add total by payment mode if mode reglement for nex line change + if ((($this->doc_type == 'client' && !empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) || ($this->doc_type == 'fourn' && !empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD))) && ($mod != $lines[$j + 1][2])) + { + $pdf->SetFillColor(245, 245, 245); + $pdf->Rect($this->marge_gauche + 1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite - 3, $this->line_height, 'F', array(), array()); + $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); + $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); + $pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp); + $pdf->SetFont('', 'I', $default_font_size - 1); + $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('Total').' '.$mod." : ", 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount - 1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount + 1, $this->line_height, price($total_mod), 0, 'R', 1); + $pdf->SetFont('', '', $default_font_size - 1); + $mod = $lines[$j + 1][2]; + $total_mod = 0; + $yp = $yp + 5; + if ($yp > $this->tab_height - 5) + { + $page++; + $pdf->AddPage(); + $this->_pagehead($pdf, $page, 0, $outputlangs); + $pdf->SetFont('', '', $default_font_size - 1); + $yp = 0; + } + $pdf->SetFillColor(220, 220, 220); + } } $total += $total_page; - $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $langs->transnoentities('Total')." : ".price($total), 0, 'R', 0); + $pdf->SetFillColor(255, 255, 255); + $pdf->Rect($this->marge_gauche + 1, $this->tab_top + 10 + $yp, $this->posxpaymentamount - $this->marge_droite - 3, $this->line_height, 'F', array(), array()); + $pdf->line($this->marge_gauche, $this->tab_top + 10 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 10 + $yp, array('dash'=>1)); + $pdf->line($this->marge_gauche, $this->tab_top + 15 + $yp, $this->page_largeur - $this->marge_droite, $this->tab_top + 15 + $yp); + $pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp); + $pdf->SetFont('', 'B'); + $pdf->MultiCell($this->posxpaymentamount - 2 - $this->marge_droite, $this->line_height, $langs->transnoentities('Total')." : ", 0, 'R', 1); + $pdf->SetXY($this->posxpaymentamount - 1, $this->tab_top + 10 + $yp); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount + 1, $this->line_height, price($total), 0, 'R', 1); + $pdf->SetFillColor(220, 220, 220); } } diff --git a/htdocs/core/tools.php b/htdocs/core/tools.php index 348417dd345..accb8eeed00 100644 --- a/htdocs/core/tools.php +++ b/htdocs/core/tools.php @@ -46,7 +46,7 @@ $text = $langs->trans("Tools"); print load_fiche_titre($text, '', 'wrench'); // Show description of content -print '
    '.$langs->trans("ToolsDesc").'


    '; +print '
    '.$langs->trans("ToolsDesc").'


    '; // Show logo diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index d0eaaec25f2..80a7cac7de3 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -194,6 +194,8 @@ elseif (($type == 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($ // Define list of possible type transition $typewecanchangeinto = array( 'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'), + 'double'=>array('double', 'price'), + 'price'=>array('double', 'price'), 'text'=>array('text', 'html'), 'html'=>array('text', 'html'), 'password'=>array('password', 'varchar'), @@ -202,6 +204,7 @@ $typewecanchangeinto = array( 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'select'=>array('varchar', 'phone', 'mail', 'url', 'select') ); + if (in_array($type, array_keys($typewecanchangeinto))) { $newarray = array(); diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 544e78d1a8a..23727e4ad97 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -459,7 +459,8 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { // Standard Extrafield feature if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - $elementype = Contact::$table_element; + $contactstatic = new Contact($db); + $elementype = $contactstatic->table_element; // fetch optionals attributes and labels dol_include_once('/core/class/extrafields.class.php'); $extrafields = new ExtraFields($db); @@ -485,9 +486,9 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { print ''; print '
    '.$langs->trans("AdvTgtStartDt").''; - print $form->selectDate('', 'options_'.$key.'_st_dt'.'_cnct'); + print $form->selectDate('', 'options_'.$key.'_st_dt_cnct'); print ''.$langs->trans("AdvTgtEndDt").''; - print $form->selectDate('', 'options_'.$key.'_end_dt'.'_cnct'); + print $form->selectDate('', 'options_'.$key.'_end_dt_cnct'); print '
    '; print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); diff --git a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php index 6595223083e..4f435bb2106 100644 --- a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php +++ b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php @@ -53,7 +53,7 @@ $(document).ready(function(){ }); - var $dialog = $('') + var $dialog = $('
    ') .load( page + " #tablelines", function() { $("#" + formId + " #tablelines").prop("id", "ajaxloaded_tablelines"); // change id attribute diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 97612645b7d..32f6e67cb00 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -70,14 +70,14 @@ if ($action == 'delete') ); } -$formfile=new FormFile($db); +$formfile = new FormFile($db); // We define var to enable the feature to add prefix of uploaded files. // Caller of this include can make // $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; if (!isset($savingdocmask) || !empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) { - $savingdocmask=''; + $savingdocmask = ''; if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) { //var_dump($modulepart); if (in_array($modulepart, array( diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index b53bb6276b1..03d487ee0c0 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -36,7 +36,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ elseif ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1')) { $mode_search = 0; - if (in_array($typ, array('int', 'double', 'real'))) $mode_search = 1; // Search on a numeric + if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index e6cbad245d9..198a3910747 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -52,8 +52,12 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] { $lastseparatorkeyfound = ''; $extrafields_collapse_num = ''; + $extrafields_collapse_num_old = ''; + $i = 0; foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { + $i++; + // Discard if extrafield is a hidden field on form $enabled = 1; @@ -65,6 +69,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] { $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); } + $perms = 1; if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) { @@ -87,6 +92,8 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] $value = $object->array_options["options_".$key]; //var_dump($key.' - '.$value); } + + // Print line tr of extra field if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { $extrafields_collapse_num = ''; @@ -109,13 +116,20 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] } else { - print ''; + print ''; + $extrafields_collapse_num_old = $extrafields_collapse_num; print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; if ($object->statut == Holiday::STATUS_REFUSED) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index daa5a37b51b..42faecc5588 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -1,9 +1,9 @@ - * Copyright (C) 2013-2018 Laurent Destailleur + * Copyright (C) 2013-2020 Laurent Destailleur * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Frédéric France * * 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 @@ -475,7 +475,7 @@ if ($resql) $include = ''; - if (!empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see all + if (empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see only its hierarchyl print '
    '; print '
    attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; print '">'; if (!empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); @@ -161,6 +175,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); $value = isset($_POST["options_".$key]) ? dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]) : $datenotinstring; } + //TODO Improve element and rights detection if ($action == 'edit_extras' && $permok && GETPOST('attribute', 'none') == $key) { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 5fc268013c6..0fb1aff011d 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -813,7 +813,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) jQuery("#prod_entry_mode_free").prop('checked',true).change(); jQuery("#prod_entry_mode_predef").prop('checked',false).change(); jQuery("#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val(''); - jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show(); + jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_fourn_ref, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show(); jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show(); jQuery("#fournprice_predef").hide(); } @@ -825,11 +825,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT)) { ?> jQuery("#price_ht").val('').show(); jQuery("#multicurrency_price_ht").val('').show(); + jQuery("#title_up_ht, #title_up_ht_currency").show(); jQuery("#price_ht").val('').hide(); jQuery("#multicurrency_price_ht").val('').hide(); + jQuery("#title_up_ht, #title_up_ht_currency").hide(); - jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); + jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_fourn_ref, #title_vat, #title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#buying_price").show(); jQuery('#trlinefordates, .divlinefordates').show(); diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 28b6c6f0dbd..8849020b885 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -284,7 +284,7 @@ if ($line->special_code == 3) { ?> { $tooltiponprice = $langs->transcountry("TotalHT", $mysoc->country_code).'='.price($line->total_ht); $tooltiponprice .= '
    '.$langs->transcountry("TotalVAT", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_tva); - if (! $senderissupplier && is_object($object->thirdparty)) { + if (!$senderissupplier && is_object($object->thirdparty)) { if ($object->thirdparty->useLocalTax(1)) { if (price2num($line->total_localtax1)) $tooltiponprice .= '
    '.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.price($line->total_localtax1); else $tooltiponprice .= '
    '.$langs->transcountry("TotalLT1", ($senderissupplier ? $object->thirdparty->country_code : $mysoc->country_code)).'='.$langs->trans("NotUsedForThisCustomer").''; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index ab12b48aa08..63ff6a8a0a7 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -40,6 +40,7 @@ if (!empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax = 1; $php_self = $_SERVER['PHP_SELF']; $php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''; +$php_self = str_replace('action=validatenewpassword', '', $php_self); $titleofpage = $langs->trans('SendNewPassword'); diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index 27138e6099f..e6c2df36ee1 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** * Class of triggers for stripe module */ -class InterfaceStripe +class InterfaceStripe extends DolibarrTriggers { /** * @var DoliDB Database handler. diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index b90da632fac..5c618b089a3 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -19,7 +19,7 @@ /** * \file htdocs/core/website.inc.php * \brief Common file loaded by all website pages (after master.inc.php). It set the new object $weblangs, using parameter 'l'. - * This file is included in top of all container pages. + * This file is included in top of all container pages and is run only when a web page is called. * The global variable $websitekey must be defined. */ @@ -27,17 +27,24 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; +// Detection browser (copy of code from main.inc.php) +if (isset($_SERVER["HTTP_USER_AGENT"]) && is_object($conf) && empty($conf->browser->name)) +{ + $tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]); + $conf->browser->name = $tmp['browsername']; + $conf->browser->os = $tmp['browseros']; + $conf->browser->version = $tmp['browserversion']; + $conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' + //var_dump($conf->browser); + + if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover = 1; +} // Define $website if (!is_object($website)) { $website = new Website($db); $website->fetch(0, $websitekey); } -// Define $weblangs -if (!is_object($weblangs)) -{ - $weblangs = dol_clone($langs); // TODO Use an object lang from a language set into $website object instead of backoffice -} // Define $websitepage if we have $websitepagefile defined if (!$pageid && !empty($websitepagefile)) { @@ -48,10 +55,22 @@ if (!is_object($websitepage)) { $websitepage = new WebsitePage($db); } +// Define $weblangs +if (!is_object($weblangs)) +{ + $weblangs = new Translate('', $conf); +} +if (!is_object($pagelangs)) +{ + $pagelangs = new Translate('', $conf); +} if ($pageid > 0) { $websitepage->fetch($pageid); + $weblangs->setDefaultLang(GETPOSTISSET('lang') ? GETPOST('lang', 'aZ09') : (empty($_COOKIE['weblangs-shortcode']) ? 'auto' : $_COOKIE['weblangs-shortcode'])); + $pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang); + if (!defined('USEDOLIBARREDITOR') && in_array($websitepage->type_container, array('menu', 'other'))) { $weblangs->load("website"); diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 3ef5a12d720..74c254d395f 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -117,15 +117,15 @@ class ActionsDatapolicy $object->state_id = ''; $object->skype = ''; $object->country_id = ''; - $object->note_private = $object->note_private . '
    ' . $langs->trans('ANONYMISER_AT', dol_print_date(time())); + $object->note_private = $object->note_private.'
    '.$langs->trans('ANONYMISER_AT', dol_print_date(time())); if ($object->update($object->id, $user, 0)) { // On supprime les contacts associé - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "socpeople WHERE fk_soc = " . $object->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$object->id; $this->db->query($sql); setEventMessages($langs->trans('ANONYMISER_SUCCESS'), array()); - header('Location:' . $_SERVER["PHP_SELF"] . "?socid=" . $object->id); + header('Location:'.$_SERVER["PHP_SELF"]."?socid=".$object->id); } } } elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'datapolicy_portabilite') { @@ -394,40 +394,40 @@ class ActionsDatapolicy if ($parameters['currentcontext'] == 'thirdpartycard') { if (GETPOST('action') == 'create' || GETPOST('action') == 'edit' || GETPOST('action') == '') { $jsscript .= ''; } elseif (GETPOST('action') == 'confirm_delete' && GETPOST('confirm') == 'yes' && GETPOST('socid') > 0) { // La suppression n'a pas été possible - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); // On vérifie si il est utilisé if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $form = new Form($this->db); - echo $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); + echo $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); } } if (GETPOST('socid')) { - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $jsscript .= ''; } } diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 13598015688..409df1362e9 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -470,15 +470,15 @@ class DataPolicyCron { $sql = sprintf($params['sql'], (int) $conf->entity, (int) $conf->global->$key, (int) $conf->global->$key); - $resql = $db->query($sql); + $resql = $this->db->query($sql); - if ($resql && $db->num_rows($resql) > 0) + if ($resql && $this->db->num_rows($resql) > 0) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $i = 0; require_once $params['file']; - $object = new $params['class']($db); + $object = new $params['class']($this->db); while ($i < $num && !$error) { diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index ce3157414f5..18b8bc8b07c 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -82,7 +82,7 @@ $tmpDir = $conf->dav->multidir_output[$entity]; // We need root dir, not a dir t // Authentication callback function -$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function($username, $password) { +$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) { global $user; global $conf; global $dolibarr_main_authentication, $dolibarr_auto_user; diff --git a/htdocs/debugbar/class/autoloader.php b/htdocs/debugbar/class/autoloader.php index a68ace2c3c0..1d5c85c975d 100644 --- a/htdocs/debugbar/class/autoloader.php +++ b/htdocs/debugbar/class/autoloader.php @@ -4,7 +4,7 @@ * Simple autoloader, so we don't need Composer just for this. */ -spl_autoload_register(function($class) { +spl_autoload_register(function ($class) { if (preg_match('/^DebugBar/', $class) || preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) { $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; //var_dump($class.' - '.file_exists($file).' - '.$file); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 4eb6123b305..505d2fbed29 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -318,7 +318,7 @@ if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if ($action == 'create') { - print load_fiche_titre($langs->trans("AddDonation"), '', 'invoicing'); + print load_fiche_titre($langs->trans("AddDonation"), '', 'object_donation'); print '
    '; print ''; @@ -500,7 +500,7 @@ if (!empty($id) && $action == 'edit') print ''; - dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic'); + dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation'); print ''; @@ -629,7 +629,7 @@ if (!empty($id) && $action != 'edit') $hselected = 'card'; $head = donation_prepare_head($object); - dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic'); + dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'donation'); // Print form confirm print $formconfirm; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 102d7e58685..59c293e6386 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -60,7 +60,7 @@ class Don extends CommonObject /** * @var string String with name of icon for object don. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'generic'; + public $picto = 'donation'; /** * @var string Date of the donation @@ -916,22 +916,36 @@ class Don extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $notooltip 1=Disable tooltip - * @return string Chaine avec URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @param int $notooltip 1=Disable tooltip + * @param string $moretitle Add more text to title tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string Chaine avec URL */ - public function getNomUrl($withpicto = 0, $notooltip = 0) + public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle = '', $save_lastsearch_value = -1) { - global $langs; + global $conf, $langs; + + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $result = ''; - $label = $langs->trans("ShowDonation").': '.$this->id; + $label = ''.$langs->trans("Donation").''; + if (!empty($this->id)) { + $label .= '
    '.$langs->trans('Ref').': '.$this->id; + } + if ($moretitle) $label .= ' - '.$moretitle; - $linkstart = ''; + $url = DOL_URL_ROOT.'/don/card.php?id='.$this->id; + + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + + $linkstart = ''; $linkend = ''; $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto != 2) $result .= $this->ref; $result .= $linkend; diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index ee8156c229e..64644d18971 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -55,11 +55,17 @@ class PaymentDonation extends CommonObject public $fk_donation; public $datec = ''; + public $tms = ''; + public $datep = ''; - public $amount; // Total amount of payment - public $amounts = array(); // Array of amounts + + public $amount; // Total amount of payment + + public $amounts = array(); // Array of amounts + public $typepayment; + public $num_payment; /** @@ -121,14 +127,14 @@ class PaymentDonation extends CommonObject } // Clean parameters - if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation; - if (isset($this->amount)) $this->amount = trim($this->amount); + if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation; + if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepayment)) $this->fk_typepayment = trim($this->fk_typepayment); - if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); - if (isset($this->note_public)) $this->note_public = trim($this->note_public); - if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; - if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; - if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); + if (isset($this->note_public)) $this->note_public = trim($this->note_public); + if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; + if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; + if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; $totalamount = 0; foreach ($this->amounts as $key => $value) // How payment is dispatch @@ -228,26 +234,26 @@ class PaymentDonation extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; - $this->fk_donation = $obj->fk_donation; - $this->datec = $this->db->jdate($obj->datec); - $this->tms = $this->db->jdate($obj->tms); - $this->datep = $this->db->jdate($obj->datep); - $this->amount = $obj->amount; + $this->fk_donation = $obj->fk_donation; + $this->datec = $this->db->jdate($obj->datec); + $this->tms = $this->db->jdate($obj->tms); + $this->datep = $this->db->jdate($obj->datep); + $this->amount = $obj->amount; $this->fk_typepayment = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; - $this->note_public = $obj->note_public; - $this->fk_bank = $obj->fk_bank; - $this->fk_user_creat = $obj->fk_user_creat; - $this->fk_user_modif = $obj->fk_user_modif; + $this->num_payment = $obj->num_payment; + $this->note_public = $obj->note_public; + $this->fk_bank = $obj->fk_bank; + $this->fk_user_creat = $obj->fk_user_creat; + $this->fk_user_modif = $obj->fk_user_modif; - $this->type_code = $obj->type_code; + $this->type_code = $obj->type_code; $this->type_label = $obj->type_label; $this->bank_account = $obj->fk_account; - $this->bank_line = $obj->fk_bank; + $this->bank_line = $obj->fk_bank; } $this->db->free($resql); diff --git a/htdocs/don/document.php b/htdocs/don/document.php index dcb245e3e85..f2994b95577 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -104,7 +104,7 @@ if ($object->id) $head = donation_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'generic'); + dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'donation'); // Build file list diff --git a/htdocs/don/index.php b/htdocs/don/index.php index 3f74cfa53a1..d8df1f910fc 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -85,7 +85,7 @@ if ($result) dol_print_error($db); } -print load_fiche_titre($langs->trans("DonationsArea"), '', 'invoicing'); +print load_fiche_titre($langs->trans("DonationsArea"), '', 'object_donation'); print '
    '; diff --git a/htdocs/don/info.php b/htdocs/don/info.php index cff4aceae79..170c577dc00 100644 --- a/htdocs/don/info.php +++ b/htdocs/don/info.php @@ -67,7 +67,7 @@ $object->info($id); $head = donation_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'generic'); +dol_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'donation'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index cd0d0539f8f..65ec24b1458 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -77,17 +77,17 @@ $fieldstosearchall = array( 'd.firstname'=>'Firstname', ); + /* * View */ +$donationstatic = new Don($db); $form = new Form($db); if (!empty($conf->projet->enabled)) $projectstatic = new Project($db); llxHeader('', $langs->trans("Donations"), 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones'); -$donationstatic = new Don($db); - // Genere requete de liste des dons $sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,"; $sql .= " d.amount, d.fk_statut as status,"; @@ -163,7 +163,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_donation', 0, $newcardbutton, '', $limit, 0, 0, 1); if ($search_all) { diff --git a/htdocs/don/note.php b/htdocs/don/note.php index 08b8c05b520..111ea2399a3 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -83,7 +83,7 @@ if ($id > 0 || !empty($ref)) $head = donation_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'generic'); + dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'donation'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 0017f0a8556..e1784dc4b8b 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -122,7 +122,7 @@ $form = new Form($db); $h = 0; $head[$h][0] = DOL_URL_ROOT.'/don/payment/card.php?id='.$id; -$head[$h][1] = $langs->trans("Card"); +$head[$h][1] = $langs->trans("DonationPayment"); $hselected = $h; $h++; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 0c7c4c4cebb..6921b8aabd6 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -772,7 +772,6 @@ class EcmFiles extends CommonObject if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $result = ''; - $companylink = ''; $label = ''.$langs->trans("MyModule").''; $label .= '
    '; @@ -867,6 +866,9 @@ class EcmFiles extends CommonObject } +/** + * Class of an index line of a document + */ class EcmfilesLine { /** diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 11cf2477720..bf1a4e26de7 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -100,8 +100,9 @@ class EmailCollector extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector'), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1), - 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>100, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'), - 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), + 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com'), + 'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)'), + 'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'), 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'), 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'), //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105), @@ -173,6 +174,7 @@ class EmailCollector extends CommonObject public $host; + public $hostcharset; public $login; public $password; public $source_directory; @@ -935,8 +937,8 @@ class EmailCollector extends CommonObject } imap_errors(); // Clear stack of errors. - // $conf->global->MAIL_PREFIX_FOR_EMAIL_ID must be defined $host = dol_getprefix('email'); + //$host = '123456'; // Define the IMAP search string // See https://tools.ietf.org/html/rfc3501#section-6.4.4 for IMAPv4 (PHP not yet compatible) @@ -985,9 +987,10 @@ class EmailCollector extends CommonObject $nbemailprocessed = 0; $nbemailok = 0; $nbactiondone = 0; + $charset = ($this->hostcharset ? $this->hostcharset : "UTF-8"); // Scan IMAP inbox - $arrayofemail = imap_search($connection, $search, null, "UTF-8"); + $arrayofemail = imap_search($connection, $search, null, $charset); if ($arrayofemail === false) { // Nothing found or search string not understood @@ -1078,6 +1081,7 @@ class EmailCollector extends CommonObject dol_syslog("Start of loop on email", LOG_INFO, 1); + $i = 0; foreach ($arrayofemail as $imapemail) { if ($nbemailprocessed > 1000) @@ -1085,12 +1089,17 @@ class EmailCollector extends CommonObject break; // Do not process more than 1000 email per launch (this is a different protection than maxnbcollectedpercollect } + $i++; + $header = imap_fetchheader($connection, $imapemail, 0); + $header = preg_replace('/\r\n\s+/m', ' ', $header); // When a header line is on several lines, merge lines $matches = array(); preg_match_all('/([^: ]+): (.+?(?:\r\n\s(?:.+?))*)\r\n/m', $header, $matches); $headers = array_combine($matches[1], $matches[2]); //var_dump($headers); + dol_syslog("** Process email ".$i." References: ".$headers['References']); + // If there is a filter on trackid if ($searchfilterdoltrackid > 0) { @@ -1126,13 +1135,16 @@ class EmailCollector extends CommonObject // GET Email meta datas $overview = imap_fetch_overview($connection, $imapemail, 0); - dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); + dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); // Decode $overview[0]->subject according to RFC2047 // Can use also imap_mime_header_decode($str) // Can use also mb_decode_mimeheader($str) // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') - if (function_exists('imap_mime_header_decode')) { + if (function_exists('iconv_mime_decode')) { + $overview[0]->subject = iconv_mime_decode($overview[0]->subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); + } + elseif (function_exists('imap_mime_header_decode')) { $elements = imap_mime_header_decode($overview[0]->subject); $newstring = ''; if (!empty($elements)) { @@ -1146,6 +1158,8 @@ class EmailCollector extends CommonObject elseif (function_exists('mb_decode_mimeheader')) { $overview[0]->subject = mb_decode_mimeheader($overview[0]->subject); } + // Removed emojis + $overview[0]->subject = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $overview[0]->subject); // Parse IMAP email structure global $htmlmsg, $plainmsg, $charset, $attachments; @@ -1153,6 +1167,9 @@ class EmailCollector extends CommonObject //$htmlmsg,$plainmsg,$charset,$attachments $messagetext = $plainmsg ? $plainmsg : dol_string_nohtmltag($htmlmsg, 0); + // Removed emojis + $messagetext = preg_replace('/[\x{10000}-\x{10FFFF}]/u', "\xEF\xBF\xBD", $messagetext); + /*var_dump($plainmsg); var_dump($htmlmsg); var_dump($messagetext);*/ diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index 089545e8d7e..fe4a5f1b19c 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -26,7 +26,7 @@ * Prepare array of tabs for EmailCollector * * @param EmailCollector $object EmailCollector - * @return array Array of tabs + * @return array Array of tabs */ function emailcollectorPrepareHead($object) { @@ -38,7 +38,7 @@ function emailcollectorPrepareHead($object) $head = array(); $head[$h][0] = dol_buildpath("/admin/emailcollector_card.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans("Card"); + $head[$h][1] = $langs->trans("EmailCollector"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 655ba8f060f..95b6f6208a5 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -12,6 +12,7 @@ * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2016 Yasser Carreón * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Lenin Rivas * * 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 @@ -461,6 +462,20 @@ if (empty($reshook)) } } + elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->expedition->supprimer) + { + $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); + $result = $object->cancel(0, $also_update_stock); + if ($result > 0) + { + $result = $object->setStatut(-1); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); @@ -960,8 +975,9 @@ if ($action == 'create') $langs->load("projects"); print '
    '; print ''; print ''; } @@ -1689,7 +1705,7 @@ elseif ($id || $ref) $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('ValidateSending'), $text, 'confirm_valid', '', 0, 1); } // Confirm cancelation - if ($action == 'annuler') + if ($action == 'cancel') { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('CancelSending'), $langs->trans("ConfirmCancelSending", $object->ref), 'confirm_cancel', '', 0, 1); } @@ -2278,7 +2294,7 @@ elseif ($id || $ref) { print ''; // Qty to ship or shipped - print ''; + print ''; // Batch number managment if ($lines[$i]->entrepot_id == 0) { @@ -2291,7 +2307,7 @@ elseif ($id || $ref) // add a 0 qty lot row to be able to add a lot print ''; // Qty to ship or shipped - print ''; + print ''; // Batch number managment print ''; print ''; @@ -2305,7 +2321,7 @@ elseif ($id || $ref) print ''; print ''; // Qty to ship or shipped - print ''; + print ''; // Warehouse source print ''; // Batch number managment @@ -2319,7 +2335,7 @@ elseif ($id || $ref) { print ''; // Qty to ship or shipped - print ''; + print ''; // Warehouse source print ''; // Batch number managment @@ -2338,11 +2354,11 @@ elseif ($id || $ref) print ''; print ''; // Qty to ship or shipped - print ''; + print ''; // Warehouse source - print ''; + print ''; // Batch number managment - print ''; + print ''; print ''; } } @@ -2575,6 +2591,16 @@ elseif ($id || $ref) } } + // Cancel + if ($object->statut == Expedition::STATUS_VALIDATED) + { + if ($user->rights->expedition->supprimer) + { + print ''.$langs->trans("Cancel").''; + } + } + + // Delete if ($user->rights->expedition->supprimer) { print ''.$langs->trans("Delete").''; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e1c24106e09..1ccfe9944f7 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Lenin Rivas * * 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 @@ -175,6 +176,10 @@ class Expedition extends CommonObject */ const STATUS_CLOSED = 2; + /** + * Canceled status + */ + const STATUS_CANCELED = -1; /** @@ -534,7 +539,7 @@ class Expedition extends CommonObject // Check parameters if (empty($id) && empty($ref) && empty($ref_ext)) return -1; - $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed"; + $sql = "SELECT e.rowid, e.entity, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed"; $sql .= ", e.date_valid"; $sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; $sql .= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery"; @@ -563,6 +568,7 @@ class Expedition extends CommonObject $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; + $this->entity = $obj->entity; $this->ref = $obj->ref; $this->socid = $obj->socid; $this->ref_customer = $obj->ref_customer; @@ -1046,7 +1052,7 @@ class Expedition extends CommonObject } } $line->entrepot_id = $linebatch->entrepot_id; - $line->origin_line_id = $dbatch['ix_l']; // deprecated + $line->origin_line_id = $dbatch['ix_l']; // deprecated $line->fk_origin_line = $dbatch['ix_l']; $line->qty = $dbatch['qty']; $line->detail_batch = $tab; @@ -1166,6 +1172,226 @@ class Expedition extends CommonObject } } + + /** + * Cancel shipment. + * + * @param int $notrigger Disable triggers + * @param bool $also_update_stock true if the stock should be increased back (false by default) + * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO + */ + public function cancel($notrigger = 0, $also_update_stock = false) + { + global $conf, $langs, $user; + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php'; + + $error=0; + $this->error=''; + + $this->db->begin(); + + // Add a protection to refuse deleting if shipment has at least one delivery + $this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment + if (count($this->linkedObjectsIds) > 0) + { + $this->error='ErrorThereIsSomeDeliveries'; + $error++; + } + + if (! $error) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('SHIPPING_CANCEL', $user); + if ($result < 0) { $error++; } + // End call triggers + } + } + + // Stock control + if (! $error && $conf->stock->enabled && + (($conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) || + ($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE && $this->statut == self::STATUS_CLOSED && $also_update_stock))) + { + require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; + + $langs->load("agenda"); + + // Loop on each product line to add a stock movement and delete features + $sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.rowid as expeditiondet_id"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd,"; + $sql .= " ".MAIN_DB_PREFIX."expeditiondet as ed"; + $sql .= " WHERE ed.fk_expedition = ".$this->id; + $sql .= " AND cd.rowid = ed.fk_origin_line"; + + dol_syslog(get_class($this)."::delete select details", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $cpt = $this->db->num_rows($resql); + for ($i = 0; $i < $cpt; $i++) + { + dol_syslog(get_class($this)."::delete movement index ".$i); + $obj = $this->db->fetch_object($resql); + + $mouvS = new MouvementStock($this->db); + // we do not log origin because it will be deleted + $mouvS->origin = null; + // get lot/serial + $lotArray = null; + if ($conf->productbatch->enabled) + { + $lotArray = ExpeditionLineBatch::fetchAll($this->db, $obj->expeditiondet_id); + if (!is_array($lotArray)) + { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } + } + if (empty($lotArray)) { + // no lot/serial + // We increment stock of product (and sub-products) + // We use warehouse selected for each line + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref)); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) + { + $error++; $this->errors = $this->errors + $mouvS->errors; + break; + } + } + else + { + // We increment stock of batches + // We use warehouse selected for each line + foreach ($lotArray as $lot) + { + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentCanceledInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) + { + $error++; $this->errors = $this->errors + $mouvS->errors; + break; + } + } + if ($error) break; // break for loop incase of error + } + } + } + else + { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } + } + + // delete batch expedition line + if (!$error && $conf->productbatch->enabled) + { + if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) + { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); + } + } + + + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; + $sql .= " WHERE fk_expedition = ".$this->id; + + if ($this->db->query($sql)) + { + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + + // No delete expedition + if (!$error) + { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition"; + $sql .= " WHERE rowid = ".$this->id; + + if ($this->db->query($sql)) + { + if (!empty($this->origin) && $this->origin_id > 0) + { + $this->fetch_origin(); + $origin = $this->origin; + if ($this->$origin->statut == Commande::STATUS_SHIPMENTONPROCESS) // If order source of shipment is "shipment in progress" + { + // Check if there is no more shipment. If not, we can move back status of order to "validated" instead of "shipment in progress" + $this->$origin->loadExpeditions(); + //var_dump($this->$origin->expeditions);exit; + if (count($this->$origin->expeditions) <= 0) + { + $this->$origin->setStatut(Commande::STATUS_VALIDATED); + } + } + } + + if (!$error) + { + $this->db->commit(); + + // We delete PDFs + $ref = dol_sanitizeFileName($this->ref); + if (!empty($conf->expedition->dir_output)) + { + $dir = $conf->expedition->dir_output.'/sending/'.$ref; + $file = $dir.'/'.$ref.'.pdf'; + if (file_exists($file)) + { + if (!dol_delete_file($file)) + { + return 0; + } + } + if (file_exists($dir)) + { + if (!dol_delete_dir_recursive($dir)) + { + $this->error = $langs->trans("ErrorCanNotDeleteDir", $dir); + return 0; + } + } + } + + return 1; + } + else + { + $this->db->rollback(); + return -1; + } + } + else + { + $this->error = $this->db->lasterror()." - sql=$sql"; + $this->db->rollback(); + return -3; + } + } + else + { + $this->error = $this->db->lasterror()." - sql=$sql"; + $this->db->rollback(); + return -2; + }//*/ + } + else + { + $this->error = $this->db->lasterror()." - sql=$sql"; + $this->db->rollback(); + return -1; + } + } + else + { + $this->db->rollback(); + return -1; + } + } + /** * Delete shipment. * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) @@ -1289,15 +1515,23 @@ class Expedition extends CommonObject if (!$error) { + $main = MAIN_DB_PREFIX.'expeditiondet'; + $ef = $main."_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".$this->id.")"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; $sql .= " WHERE fk_expedition = ".$this->id; - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { // Delete linked object $res = $this->deleteObjectLinked(); if ($res < 0) $error++; + // delete extrafields + $res = $this->deleteExtraFields(); + if ($res < 0) $error++; + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition"; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 52c69f960cc..999bde3fb32 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -733,7 +733,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index fd582ac0a1e..2a0f804b196 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2330,7 +2330,7 @@ else print ''; if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { - print '   -   '.''.$langs->trans("AttachTheNewLineToTheDocument"); + print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; } @@ -2478,7 +2478,7 @@ else print ''; if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { - print '   -   '.''.$langs->trans("AttachTheNewLineToTheDocument"); + print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index f872f05ae47..70d8a3d9b59 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1049,7 +1049,7 @@ class ExpenseReport extends CommonObject $deplig = new ExpenseReportLine($this->db); $deplig->rowid = $objp->rowid; - $deplig->id = $objp->id; + $deplig->id = $objp->rowid; $deplig->comments = $objp->comments; $deplig->qty = $objp->qty; $deplig->value_unit = $objp->value_unit; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index bf2e1ee696f..07f0e332276 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -760,7 +760,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 7b0ad3180ec..b5b259f2430 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -224,7 +224,7 @@ if ($action == 'add') { * View */ -llxHeader('', $langs->trans("RepeatableInterventional"), 'ch-fichinter.html#s-fac-fichinter-rec'); +llxHeader('', $langs->trans("RepeatableIntervention"), 'ch-fichinter.html#s-fac-fichinter-rec'); $form = new Form($db); $companystatic = new Societe($db); @@ -245,7 +245,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray[' * Create mode */ if ($action == 'create') { - print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'fichinter'); + print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'intervention'); $object = new Fichinter($db); // Source invoice //$object = new Managementfichinter($db); // Source invoice @@ -429,7 +429,7 @@ if ($action == 'create') { dol_print_error('', "Error, no fichinter ".$object->id); } } elseif ($action == 'selsocforcreatefrommodel') { - print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'commercial'); + print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'intervention'); dol_fiche_head(''); print ''; @@ -764,20 +764,10 @@ if ($action == 'create') { $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - print_barre_liste( - $langs->trans("RepeatableInterventional"), - $page, - $_SERVER['PHP_SELF'], - "&socid=$socid", - $sortfield, - $sortorder, - '', - $num, - '', - 'commercial' - ); - print $langs->trans("ToCreateAPredefinedInterventional").'

    '; + print_barre_liste($langs->trans("RepeatableIntervention"), $page, $_SERVER['PHP_SELF'], "&socid=$socid", $sortfield, $sortorder, '', $num, '', 'intervention'); + + print ''.$langs->trans("ToCreateAPredefinedIntervention").'

    '; $i = 0; print '
    '.$langs->trans("Project").''; + print img_picto('', 'project'); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">'.$langs->trans("AddProject").''; + print ' id).'">'; print '
    '.''.'
    '.''.''.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).'
    '.''.''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'
    '.''.''.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'
    '.''.''.''.'
    '; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 20f25a1207b..28878443518 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -825,7 +825,7 @@ if ($action == 'create') $soc = new Societe($db); - print load_fiche_titre($langs->trans("AddIntervention"), '', 'commercial'); + print load_fiche_titre($langs->trans("AddIntervention"), '', 'intervention'); dol_htmloutput_mesg($mesg); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 502eb5ccb69..1f14d8aa4c8 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -992,6 +992,16 @@ class Fichinter extends CommonObject } } + if (!$error) + { + $main = MAIN_DB_PREFIX.'fichinterdet'; + $ef = $main."_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = ".$this->id.")"; + + $resql = $this->db->query($sql); + if (!$resql) $error++; + } + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet"; @@ -1735,6 +1745,13 @@ class FichinterLigne extends CommonObjectLine dol_syslog(get_class($this)."::deleteline lineid=".$this->id); $this->db->begin(); + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + $this->db->rollback(); + return -1; + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->id; $resql = $this->db->query($sql); diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index c371be369f3..1ee24997e87 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -62,7 +62,7 @@ $help_url = "EN:ModuleFichinters|FR:Module_Fiche_Interventions|ES:Módulo_FichaI llxHeader("", $langs->trans("Interventions"), $help_url); -print load_fiche_titre($langs->trans("InterventionsArea"), '', 'commercial'); +print load_fiche_titre($langs->trans("InterventionsArea"), '', 'intervention'); print '
    '; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 7e9dd073925..64a3c3812bb 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -566,7 +566,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 9e133f8c5de..0ca948312c6 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -65,7 +65,7 @@ $dir = $conf->ficheinter->dir_temp; llxHeader('', $title); -print load_fiche_titre($title, '', 'commercial'); +print load_fiche_titre($title, '', 'intervention'); dol_mkdir($dir); diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 0780154118e..b70419de5f4 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('EURO')) define('EURO', chr(128)); diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 5f872b09bae..6470b7db313 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -295,7 +295,7 @@ if ($object->id > 0) print ''; print ''; - if (!empty($conf->fournisseur->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) { print '
    '; print '\n"; + $paymentfournstatic = new PaiementFourn($db); + $i = 0; $totalarray = array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); + $paymentfournstatic->id = $objp->pid; + $paymentfournstatic->ref = $objp->ref; + $paymentfournstatic->datepaye = $objp->dp; + print ''; // Ref payment - print ''; + print ''; if (!$i) $totalarray['nbfield']++; // Date diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index 3e9326a94bf..9f38c4c4f9e 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Maxime DEMAREST * * 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 @@ -24,6 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/rapport/pdf_paiement_fourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->loadLangs(array('bills')); @@ -86,12 +88,13 @@ if ($action == 'builddoc') */ $formother = new FormOther($db); +$formfile = new FormFile($db); $titre = ($year ? $langs->trans("PaymentsReportsForYear", $year) : $langs->trans("PaymentsReports")); llxHeader('', $titre); -print load_fiche_titre($titre, '', 'invoicing'); +print load_fiche_titre($titre, '', 'supplier_invoice'); // Formulaire de generation print ''; @@ -157,13 +160,14 @@ if ($year) { $tfile = $dir.'/'.$year.'/'.$file; $relativepath = $year.'/'.$file; - print ''.''; + print ''; print ''; print ''; } } closedir($handle); } + print '
    '; @@ -378,7 +378,7 @@ if ($object->id > 0) if ($link) $boxstat .= ''; } - if ($conf->fournisseur->enabled) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { // Box proposals $tmp = $object->getOutstandingOrders('supplier'); @@ -396,7 +396,7 @@ if ($object->id > 0) if ($link) $boxstat .= ''; } - if ($conf->fournisseur->enabled) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $tmp = $object->getOutstandingBills('supplier'); $outstandingOpened = $tmp['opened']; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 139d87162c6..1f20965fab3 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -490,16 +490,16 @@ class SupplierInvoices extends DolibarrApi */ public function getLines($id) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->invoice->fetch_lines(); @@ -522,16 +522,16 @@ class SupplierInvoices extends DolibarrApi */ public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -586,16 +586,16 @@ class SupplierInvoices extends DolibarrApi */ public function putLine($id, $lineid, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -647,20 +647,20 @@ class SupplierInvoices extends DolibarrApi */ public function deleteLine($id, $lineid) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if(empty($lineid)) { + if (empty($lineid)) { throw new RestException(400, 'Line ID is mandatory'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c95e403a24c..19060b9a393 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -65,7 +65,7 @@ class CommandeFournisseur extends CommonOrder /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'order'; + public $picto = 'supplier_order'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -2035,6 +2035,17 @@ class CommandeFournisseur extends CommonOrder // End call triggers } + $main = MAIN_DB_PREFIX.'commande_fournisseurdet'; + $ef = $main."_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = ".$this->id.")"; + dol_syslog(get_class($this)."::delete extrafields lines", LOG_DEBUG); + if (!$this->db->query($sql)) + { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); + $error++; + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (!$this->db->query($sql)) @@ -3189,7 +3200,7 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; - if (!empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; @@ -3771,6 +3782,14 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->db->begin(); + // extrafields + $result = $this->deleteExtraFields(); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 041958448fa..19ea5880346 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -211,9 +211,9 @@ class CommandeFournisseurDispatch extends CommonObject } // Create extrafields - if (! $error) + if (!$error) { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) $error++; } @@ -292,6 +292,7 @@ class CommandeFournisseurDispatch extends CommonObject $this->batch = $obj->batch; $this->eatby = $this->db->jdate($obj->eatby); $this->sellby = $this->db->jdate($obj->sellby); + $this->fetch_optionals(); } $this->db->free($resql); @@ -428,6 +429,16 @@ class CommandeFournisseurDispatch extends CommonObject } } + // Remove extrafields + if (!$error) { + $result = $this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR); + } + } + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; @@ -678,6 +689,7 @@ class CommandeFournisseurDispatch extends CommonObject $line->batch = $obj->batch; $line->eatby = $this->db->jdate($obj->eatby); $line->sellby = $this->db->jdate($obj->sellby); + $line->fetch_optionals(); $this->lines[$line->id] = $line; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8bbee47a2cd..52d1b9bf326 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -66,7 +66,7 @@ class FactureFournisseur extends CommonInvoice /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'bill'; + public $picto = 'supplier_invoice'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -977,9 +977,9 @@ class FactureFournisseur extends CommonInvoice } } - if (! $error) + if (!$error) { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -1180,10 +1180,14 @@ class FactureFournisseur extends CommonInvoice if (!$error) { + $main = MAIN_DB_PREFIX.'facture_fourn_det'; + $ef = $main."_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture_fourn = $rowid)"; + $resqlef = $this->db->query($sqlef); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';'; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) + if ($resqlef && $resql) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE rowid = '.$rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); @@ -2034,7 +2038,7 @@ class FactureFournisseur extends CommonInvoice $this->errors[] = $line->error; } else { // Update total price into invoice record - $res = $this->update_price('', 'auto'); + $res = $this->update_price('', 'auto', 0, $this->thirdparty); } return $res; @@ -2351,7 +2355,7 @@ class FactureFournisseur extends CommonInvoice if ($this->type == self::TYPE_CREDIT_NOTE) $picto .= 'a'; // Credit note if ($this->type == self::TYPE_DEPOSIT) $picto .= 'd'; // Deposit invoice - $label = ''.$langs->trans("ShowSupplierInvoice").''; + $label = ''.$langs->trans("SupplierInvoice").''; if (!empty($this->ref)) $label .= '
    '.$langs->trans('Ref').': '.$this->ref; if (!empty($this->ref_supplier)) @@ -2674,6 +2678,7 @@ class FactureFournisseur extends CommonInvoice if ($result < 0) { $this->error = $object->error; + $this->errors = $object->errors; $error++; } @@ -3145,9 +3150,9 @@ class SupplierInvoiceLine extends CommonObjectLine $this->deleteObjectLinked(); // Remove extrafields - if (! $error) + if (!$error) { - $result=$this->deleteExtraFields(); + $result = $this->deleteExtraFields(); if ($result < 0) { $error++; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index ace596b6bb4..a95aefede0f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -67,6 +67,8 @@ class PaiementFourn extends Paiement */ public $type_code; + + /** * Constructor * @@ -583,13 +585,14 @@ class PaiementFourn extends Paiement $result = ''; $text = $this->ref; // Sometimes ref contains label + $reg = array(); if (preg_match('/^\((.*)\)$/i', $text, $reg)) { // Label generique car entre parentheses. On l'affiche en le traduisant if ($reg[1] == 'paiement') $reg[1] = 'Payment'; $text = $langs->trans($reg[1]); } - $label = ''.$langs->trans("ShowPayment").'
    '; + $label = ''.$langs->trans("Payment").'
    '; $label .= ''.$langs->trans("Ref").': '.$text; if ($this->datepaye ? $this->datepaye : $this->date) $label .= '
    '.$langs->trans("Date").': '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index f2ab694e352..0cd823304ee 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1465,7 +1465,7 @@ llxHeader('', $langs->trans("Order"), $help_url); $now = dol_now(); if ($action == 'create') { - print load_fiche_titre($langs->trans('NewOrderSupplier')); + print load_fiche_titre($langs->trans('NewOrderSupplier'), '', 'supplier_order'); dol_htmloutput_events(); diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index c12d74e7045..c0272d58a03 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -54,7 +54,7 @@ $commandestatic = new CommandeFournisseur($db); $userstatic = new User($db); $formfile = new FormFile($db); -print load_fiche_titre($langs->trans("SuppliersOrdersArea"), '', 'commercial'); +print load_fiche_titre($langs->trans("SuppliersOrdersArea"), '', 'supplier_order'); print '
    '; diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 3605c2b5751..f41e9e3fece 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -40,6 +40,17 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) $sortfield = 'a.datep,a.id'; +if (!$sortorder) $sortorder = 'DESC,DESC'; + if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); @@ -212,12 +223,12 @@ if (!empty($object->id)) //show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode); // List of done actions - //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); + //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder); // List of all actions $filters = array(); $filters['search_agenda_label'] = $search_agenda_label; - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } // End of page diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index f1f64b996a5..acd79212052 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -675,7 +675,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendOrderRef"; $modelmail = "order_supplier_send"; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 0b63356480c..6e8f259bc01 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1695,7 +1695,7 @@ if ($action == 'create') { $facturestatic = new FactureFournisseur($db); - print load_fiche_titre($langs->trans('NewBill')); + print load_fiche_titre($langs->trans('NewBill'), '', 'supplier_invoice'); dol_htmloutput_events(); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 1c636cf116d..e3f331757ba 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -525,7 +525,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("BillsSuppliers").($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("BillsSuppliers").($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_invoice', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendBillRef"; $modelmail = "invoice_supplier_send"; @@ -1226,7 +1226,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 45d9c8ef967..e26357bd4ca 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -822,7 +822,7 @@ if (empty($action) || $action == 'list') if (!$sortorder) $sortorder = 'DESC'; if (!$sortfield) $sortfield = 'p.datep'; - $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,'; + $sql = 'SELECT p.rowid as pid, p.ref, p.datep as dp, p.amount as pamount, p.num_paiement,'; $sql .= ' s.rowid as socid, s.nom as name,'; $sql .= ' c.code as paiement_type, c.libelle as paiement_libelle,'; $sql .= ' ba.rowid as bid, ba.label,'; @@ -897,7 +897,7 @@ if (empty($action) || $action == 'list') print ''; print ''; - print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit, 0, 0, 1); + print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'supplier_invoice', 0, '', '', $limit, 0, 0, 1); $moreforfilter = ''; @@ -972,16 +972,24 @@ if (empty($action) || $action == 'list') print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "
    '.img_object($langs->trans('ShowPayment'), 'payment').' '.$objp->pid.''; + print $paymentfournstatic->getNomUrl(1); + print '
    '.img_pdf().' '.$file.'
    '.img_pdf().' '.$file.''.$formfile->showPreview($file, 'facture_fournisseur', 'payments/'.$relativepath, 0).''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
    '; } } diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 813d573d27e..31638abf848 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -97,7 +97,7 @@ else // Draft orders -if (!empty($conf->fournisseur->enabled)) +if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) { $langs->load("orders"); @@ -154,7 +154,7 @@ if (!empty($conf->fournisseur->enabled)) } // Draft invoices -if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $sql = "SELECT ff.ref_supplier, ff.rowid, ff.total_ttc, ff.type"; $sql .= ", s.nom as name, s.rowid as socid"; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index 2cd52bfeb77..8cda5a20d98 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -65,7 +65,7 @@ if ($socid > 0) dol_banner_tab($societe, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); dol_fiche_end(); - if (!empty($conf->fournisseur->enabled) && $user->rights->facture->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->facture->lire) { // Invoice list print load_fiche_titre($langs->trans("SupplierPreview")); @@ -77,7 +77,7 @@ if ($socid > 0) $sql .= " u.login, u.rowid as userid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; - $sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany + $sql .= " AND f.entity IN (".getEntity("facture_fourn").")"; // Recognition of the entity attributed to this invoice for Multicompany $sql .= " AND f.fk_user_valid = u.rowid"; $sql .= " ORDER BY f.datef DESC"; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index d2701381bbd..c5554a40fb1 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1291,7 +1291,9 @@ else if ($includesunday) $htmlhelp .= '
    '.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday")); print $form->textwithpicto($langs->trans('NbUseDaysCP'), $htmlhelp); print '
    '.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).''; + print num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); + print '
    '."\n"; @@ -487,7 +487,7 @@ if ($resql) if (!empty($arrayfields['cp.ref']['checked'])) { print ''; } @@ -743,7 +743,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index ba33ecbbdb3..e31266f755c 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -77,7 +77,7 @@ $childids[] = $user->id; llxHeader('', $langs->trans('HRMArea')); -print load_fiche_titre($langs->trans("HRMArea"), '', 'hrm'); +print load_fiche_titre($langs->trans("HRMArea"), '', 'user'); if (!empty($setupcompanynotcomplete)) diff --git a/htdocs/index.php b/htdocs/index.php index 850a6c3a932..7f6e462839b 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2015 Marcos García @@ -125,228 +125,195 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) if (empty($reshook)) { + // Cle array returned by the method load_state_board for each line + $keys = array( + 'users', + 'members', + 'expensereports', + 'holidays', + 'customers', + 'prospects', + 'suppliers', + 'contacts', + 'products', + 'services', + 'projects', + 'proposals', + 'orders', + 'invoices', + 'donations', + 'supplier_proposals', + 'supplier_orders', + 'supplier_invoices', + 'contracts', + 'interventions', + 'ticket' + ); + // Condition to be checked for each display line dashboard $conditions = array( - $user->rights->user->user->lire, - !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), - !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), - !empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), - !empty($conf->societe->enabled) && $user->rights->societe->contact->lire, - !empty($conf->adherent->enabled) && $user->rights->adherent->lire, - !empty($conf->product->enabled) && $user->rights->produit->lire, - !empty($conf->service->enabled) && $user->rights->service->lire, - !empty($conf->propal->enabled) && $user->rights->propale->lire, - !empty($conf->commande->enabled) && $user->rights->commande->lire, - !empty($conf->facture->enabled) && $user->rights->facture->lire, - !empty($conf->contrat->enabled) && $user->rights->contrat->lire, - !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire, - !empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), - !empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), - !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), - !empty($conf->projet->enabled) && $user->rights->projet->lire, - !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, - !empty($conf->holiday->enabled) && $user->rights->holiday->read, - !empty($conf->don->enabled) && $user->rights->don->lire, - !empty($conf->ticket->enabled) && $user->rights->ticket->read + 'users' => $user->rights->user->user->lire, + 'members' => !empty($conf->adherent->enabled) && $user->rights->adherent->lire, + 'customers' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), + 'prospects' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), + 'suppliers' => !empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), + 'contacts' => !empty($conf->societe->enabled) && $user->rights->societe->contact->lire, + 'services' => !empty($conf->product->enabled) && $user->rights->produit->lire, + 'services' => !empty($conf->service->enabled) && $user->rights->service->lire, + 'proposals' => !empty($conf->propal->enabled) && $user->rights->propale->lire, + 'orders' => !empty($conf->commande->enabled) && $user->rights->commande->lire, + 'invoices' => !empty($conf->facture->enabled) && $user->rights->facture->lire, + 'donations' => !empty($conf->don->enabled) && $user->rights->don->lire, + 'contracts' => !empty($conf->contrat->enabled) && $user->rights->contrat->lire, + 'interventions' => !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire, + 'supplier_orders' => !empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), + 'supplier_invoices' => !empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), + 'supplier_proposals' => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), + 'projects' => !empty($conf->projet->enabled) && $user->rights->projet->lire, + 'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, + 'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read, + 'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read ); // Class file containing the method load_state_board for each line $includes = array( - DOL_DOCUMENT_ROOT."/user/class/user.class.php", - DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", - DOL_DOCUMENT_ROOT."/societe/class/client.class.php", - DOL_DOCUMENT_ROOT."/societe/class/client.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", - DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", - DOL_DOCUMENT_ROOT."/product/class/product.class.php", - DOL_DOCUMENT_ROOT."/product/class/product.class.php", - DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", - DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", - DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", - DOL_DOCUMENT_ROOT."/don/class/don.class.php", - DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", - DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", - DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", - DOL_DOCUMENT_ROOT."/projet/class/project.class.php", - DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", - DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", - DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php" + 'users' => DOL_DOCUMENT_ROOT."/user/class/user.class.php", + 'members' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", + 'customers' => DOL_DOCUMENT_ROOT."/societe/class/client.class.php", + 'prospects' => DOL_DOCUMENT_ROOT."/societe/class/client.class.php", + 'suppliers' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", + 'contacts' => DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", + 'products' => DOL_DOCUMENT_ROOT."/product/class/product.class.php", + 'services' => DOL_DOCUMENT_ROOT."/product/class/product.class.php", + 'proposals' => DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", + 'orders' => DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", + 'invoices' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", + 'donations' => DOL_DOCUMENT_ROOT."/don/class/don.class.php", + 'contracts' => DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", + 'interventions' => DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", + 'supplier_orders' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", + 'supplier_invoices' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", + 'supplier_proposals' => DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", + 'projects' => DOL_DOCUMENT_ROOT."/projet/class/project.class.php", + 'expensereports' => DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", + 'holidays' => DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", + 'ticket' => DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php" ); // Name class containing the method load_state_board for each line $classes = array( - 'User', - 'Adherent', - 'Client', - 'Client', - 'Fournisseur', - 'Contact', - 'Product', - 'Product', - 'Propal', - 'Commande', - 'Facture', - 'Don', - 'Contrat', - 'Fichinter', - 'CommandeFournisseur', - 'FactureFournisseur', - 'SupplierProposal', - 'Project', - 'ExpenseReport', - 'Holiday', - 'Ticket', - ); - // Cle array returned by the method load_state_board for each line - $keys = array( - 'users', - 'members', - 'customers', - 'prospects', - 'suppliers', - 'contacts', - 'products', - 'services', - 'proposals', - 'orders', - 'invoices', - 'donations', - 'contracts', - 'interventions', - 'supplier_orders', - 'supplier_invoices', - 'askprice', - 'projects', - 'expensereports', - 'holidays', - 'ticket' - ); - // Dashboard Icon lines - $icons = array( - 'user', - 'user', - 'company', - 'company', - 'company', - 'contact', - 'product', - 'service', - 'propal', - 'order', - 'bill', - 'generic', - 'contract', - 'intervention', - 'order', - 'bill', - 'propal', - 'project', - 'trip', - 'holiday', - 'ticket', + 'users' => 'User', + 'members' => 'Adherent', + 'customers' => 'Client', + 'prospects' => 'Client', + 'suppliers' => 'Fournisseur', + 'contacts' => 'Contact', + 'products' => 'Product', + 'services' => 'ProductService', + 'proposals' => 'Propal', + 'orders' => 'Commande', + 'invoices' => 'Facture', + 'donations' => 'Don', + 'contracts' => 'Contrat', + 'interventions' => 'Fichinter', + 'supplier_orders' => 'CommandeFournisseur', + 'supplier_invoices' => 'FactureFournisseur', + 'supplier_proposals' => 'SupplierProposal', + 'projects' => 'Project', + 'expensereports' => 'ExpenseReport', + 'holidays' => 'Holiday', + 'ticket' => 'Ticket', ); // Translation keyword $titres = array( - "Users", - "Members", - "ThirdPartyCustomersStats", - "ThirdPartyProspectsStats", - "Suppliers", - "Contacts", - "Products", - "Services", - "CommercialProposalsShort", - "CustomersOrders", - "BillsCustomers", - "Donations", - "Contracts", - "Interventions", - "SuppliersOrders", - "SuppliersInvoices", - "SupplierProposalShort", - "Projects", - "ExpenseReports", - "Holidays", - "Ticket", + 'users' => "Users", + 'members' => "Members", + 'customers' => "ThirdPartyCustomersStats", + 'prospects' => "ThirdPartyProspectsStats", + 'suppliers' => "Suppliers", + 'contacts' => "Contacts", + 'products' => "Products", + 'services' => "Services", + 'proposals' => "CommercialProposalsShort", + 'orders' => "CustomersOrders", + 'invoices' => "BillsCustomers", + 'donations' => "Donations", + 'contracts' => "Contracts", + 'interventions' => "Interventions", + 'supplier_orders' => "SuppliersOrders", + 'supplier_invoices' => "SuppliersInvoices", + 'supplier_proposals' => "SupplierProposalShort", + 'projects' => "Projects", + 'expensereports' => "ExpenseReports", + 'holidays' => "Holidays", + 'ticket' => "Ticket", ); // Dashboard Link lines $links = array( - DOL_URL_ROOT.'/user/list.php', - DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', - DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies', - DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies', - DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', - DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', - DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', - DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', - DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', - DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders', - DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', - DOL_URL_ROOT.'/don/list.php?leftmenu=donations', - DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts', - DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', - DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers', - DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', - DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=', - DOL_URL_ROOT.'/projet/list.php?mainmenu=project', - DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', - DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', - DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket' + 'users' => DOL_URL_ROOT.'/user/list.php', + 'members' => DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', + 'customers' => DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies', + 'prospects' => DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies', + 'suppliers' => DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', + 'contacts' => DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', + 'products' => DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', + 'services' => DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', + 'proposals' => DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', + 'orders' => DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders', + 'invoices' => DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', + 'donations' => DOL_URL_ROOT.'/don/list.php?leftmenu=donations', + 'contracts' => DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts', + 'interventions' => DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', + 'supplier_orders' => DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers', + 'supplier_invoices' => DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', + 'supplier_proposals' => DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=', + 'projects' => DOL_URL_ROOT.'/projet/list.php?mainmenu=project', + 'expensereports' => DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', + 'holidays' => DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', + 'ticket' => DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket' ); // Translation lang files $langfile = array( - "users", - "members", - "companies", - "prospects", - "suppliers", - "companies", - "products", - "products", - "propal", - "orders", - "bills", - "donations", - "contracts", - "interventions", - "bills", - "bills", - "supplier_proposal", - "projects", - "trips", - "holiday", - "ticket" + 'customers' => "companies", + 'contacts' => "companies", + 'services' => "products", + 'proposals' => "propal", + 'invoices' => "bills", + 'supplier_orders' => "orders", + 'supplier_invoices' => "bills", + 'supplier_proposals' => 'supplier_proposal', + 'expensereports' => "trips", + 'holidays' => "holiday", ); // Loop and displays each line of table $boardloaded = array(); - foreach ($keys as $key => $val) + foreach ($keys as $val) { - if ($conditions[$key]) + if ($conditions[$val]) { $boxstatItem = ''; - $classe = $classes[$key]; + $class = $classes[$val]; // Search in cache if load_state_board is already realized - if (!isset($boardloaded[$classe]) || !is_object($boardloaded[$classe])) + if (!isset($boardloaded[$class]) || !is_object($boardloaded[$class])) { - include_once $includes[$key]; // Loading a class cost around 1Mb + include_once $includes[$val]; // Loading a class cost around 1Mb - $board = new $classe($db); + $board = new $class($db); $board->load_state_board($user); - $boardloaded[$classe] = $board; + $boardloaded[$class] = $board; } else { - $board = $boardloaded[$classe]; + $board = $boardloaded[$class]; } - if (!empty($langfile[$key])) $langs->load($langfile[$key]); - $text = $langs->trans($titres[$key]); - $boxstatItem .= ''; + $langs->load(empty($langfile[$val]) ? $val : $langfile[$val]); + + $text = $langs->trans($titres[$val]); + $boxstatItem .= ''; $boxstatItem .= '
    '; $boxstatItem .= ''.$text.'
    '; - $boxstatItem .= ''.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).''; + $boxstatItem .= ''.img_object("", $board->picto, 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).''; $boxstatItem .= '
    '; $boxstatItem .= '
    '; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 95e3082cb56..408f4b2a1a8 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -479,7 +479,8 @@ else array('from'=>'8.0.0', 'to'=>'9.0.0'), array('from'=>'9.0.0', 'to'=>'10.0.0'), array('from'=>'10.0.0', 'to'=>'11.0.0'), - array('from'=>'11.0.0', 'to'=>'12.0.0') + array('from'=>'11.0.0', 'to'=>'12.0.0'), + array('from'=>'12.0.0', 'to'=>'13.0.0') ); $count = 0; diff --git a/htdocs/install/default.css b/htdocs/install/default.css index f0e51caecab..f363789c129 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -53,7 +53,7 @@ div.titre { } span.titre { - font-weight: bold; + /* font-weight: bold; */ background: #FFFFFF; color: rgb(0,113,121); border: 1px solid #bbb; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index bc4b562711b..2a7a8963e9f 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -582,3 +582,14 @@ create table llx_commande_fournisseur_dispatch_extrafields ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object); + +create table llx_facturedet_rec_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, -- object id + import_key varchar(14) -- import key +)ENGINE=innodb; + +ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafields (fk_object); + diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 4b87b4b9ce3..7daf41a05d3 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -30,6 +30,9 @@ -- Missing in v11 +UPDATE llx_c_units set scale = 3600 where code = 'H' and unit_type = 'time'; +UPDATE llx_c_units set scale = 86400 where code = 'D' and unit_type = 'time'; + create table llx_commande_fournisseur_dispatch_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, @@ -51,6 +54,15 @@ create table llx_c_shipment_package_type entity integer DEFAULT 1 NOT NULL -- Multi company id )ENGINE=innodb; +create table llx_facturedet_rec_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, -- object id + import_key varchar(14) -- import key +)ENGINE=innodb; + +ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafields (fk_object); -- For v12 @@ -261,4 +273,17 @@ ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer; ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid); ---Dictionary of package type because filename in V11 was incomplete + +-- VMYSQL4.3 ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN fk_facture INTEGER NULL; +-- VPGSQL8.2 ALTER TABLE llx_prelevement_facture_demande ALTER COLUMN fk_facture DROP NOT NULL; +ALTER TABLE llx_prelevement_facture_demande ADD COLUMN fk_facture_fourn INTEGER NULL; + +-- VMYSQL4.3 ALTER TABLE llx_prelevement_facture MODIFY COLUMN fk_facture INTEGER NULL; +-- VPGSQL8.2 ALTER TABLE llx_prelevement_facture ALTER COLUMN fk_facture DROP NOT NULL; +ALTER TABLE llx_prelevement_facture ADD COLUMN fk_facture_fourn INTEGER NULL; + +ALTER TABLE llx_menu MODIFY COLUMN module varchar(255); + +UPDATE llx_actioncomm SET fk_action = 50 where fk_action = 40 AND code = 'TICKET_MSG'; + +ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN hostcharset varchar(16) DEFAULT 'UTF-8'; diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql new file mode 100644 index 00000000000..782516353b2 --- /dev/null +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -0,0 +1,36 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 13.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. + + +-- Missing in v12 + + +-- For v13 + +ALTER TABLE llx_website ADD COLUMN position integer DEFAULT 0; diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 61f4dc544ba..b7fe131c3f9 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -200,7 +200,7 @@ CREATE TABLE llx_emailcollector_emailcollectorfilter( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, fk_emailcollector INTEGER NOT NULL, type varchar(128) NOT NULL, - rulevalue varchar(255) NULL, + rulevalue varchar(128) NULL, date_creation datetime NOT NULL, tms timestamp NOT NULL, fk_user_creat integer NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql index 10f3e4f8b9b..87581f418e8 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql @@ -21,7 +21,8 @@ CREATE TABLE llx_emailcollector_emailcollector( ref varchar(128) NOT NULL, label varchar(255), description text, - host varchar(255), + host varchar(255), + hostcharset varchar(16) DEFAULT 'UTF-8', login varchar(128), password varchar(128), source_directory varchar(255) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_menu.sql b/htdocs/install/mysql/tables/llx_menu.sql index 59bb96297d7..cb279cb5c56 100644 --- a/htdocs/install/mysql/tables/llx_menu.sql +++ b/htdocs/install/mysql/tables/llx_menu.sql @@ -25,7 +25,7 @@ CREATE TABLE llx_menu rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, menu_handler varchar(16) NOT NULL, -- Menu handler name entity integer DEFAULT 1 NOT NULL, -- Multi company id - module varchar(64), -- Module name if record is added by a module + module varchar(255), -- Module name if record is added by a module type varchar(4) NOT NULL, -- Menu top or left mainmenu varchar(100) NOT NULL, -- Name family/module for top menu (home, companies, ...) leftmenu varchar(100) NULL, -- Name family/module for left menu (setup, info, ...) diff --git a/htdocs/install/mysql/tables/llx_prelevement_bons.sql b/htdocs/install/mysql/tables/llx_prelevement_bons.sql index 2a8fd114440..e7e0b9a89f1 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_bons.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_bons.sql @@ -18,10 +18,10 @@ -- =================================================================== -- --- Bons de prelevement +-- Direct debit or credit orders -- --- statut 1 : transmis a la banque --- statut 2 : credite +-- statut 1 : sent to the bank +-- statut 2 : paid -- create table llx_prelevement_bons ( diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture.sql b/htdocs/install/mysql/tables/llx_prelevement_facture.sql index 2524f854a9c..dbe2cb85f84 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_facture.sql @@ -19,7 +19,8 @@ create table llx_prelevement_facture ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_facture integer NOT NULL, + fk_facture integer NULL, + fk_facture_foun integer NULL, fk_prelevement_lignes integer NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql b/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql index b1f625de872..4e1f37c6d3f 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql @@ -21,7 +21,8 @@ create table llx_prelevement_facture_demande ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, - fk_facture integer NOT NULL, + fk_facture integer NULL, + fk_facture_fourn integer NULL, sourcetype varchar(32), amount double(24,8) NOT NULL, date_demande datetime NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 743d4ec9ca8..717052f795c 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -35,6 +35,7 @@ CREATE TABLE llx_website fk_user_creat integer, fk_user_modif integer, date_creation datetime, + position integer DEFAULT 0, tms timestamp, import_key varchar(14) -- import key ) ENGINE=innodb; diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index d129fbeb1e4..034741c7c7e 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1440,9 +1440,9 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { exit; } while ($obj_dispatch = $db->fetch_object($resql_dispatch)) { - $sql_line = 'SELECT line.rowid, line.qty FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet AS line' - . ' WHERE line.fk_commande = '.$obj_dispatch->fk_commande - . ' AND line.fk_product = '.$obj_dispatch->fk_product; + $sql_line = 'SELECT line.rowid, line.qty FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet AS line'; + $sql_line .= ' WHERE line.fk_commande = '.$obj_dispatch->fk_commande; + $sql_line .= ' AND line.fk_product = '.$obj_dispatch->fk_product; $resql_line = $db->query($sql_line); // s’il y a plusieurs lignes avec le même produit sur cette commande fournisseur, @@ -1465,9 +1465,9 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { } $qty_for_line = min($remaining_qty, $obj_line->qty); if ($first_iteration) { - $sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch' - . ' SET fk_commandefourndet = '.$obj_line->rowid.', qty = '.$qty_for_line - . ' WHERE rowid = '.$obj_dispatch->rowid; + $sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $sql_attach .= ' SET fk_commandefourndet = '.$obj_line->rowid.', qty = '.$qty_for_line; + $sql_attach .= ' WHERE rowid = '.$obj_dispatch->rowid; $first_iteration = false; } else { $sql_attach_values = array( @@ -1487,9 +1487,9 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { ); $sql_attach_values = join(', ', $sql_attach_values); - $sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch' - . ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)' - . ' VALUES ('.$sql_attach_values.')'; + $sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $sql_attach .= ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'; + $sql_attach .= ' VALUES ('.$sql_attach_values.')'; } if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed') diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 9d81bca42ce..a5e6b9d3377 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -566,21 +566,21 @@ if (!$error && $db->connected && $action == "set") $error++; } - if (! $error) + if (!$error) { if ($db->connected) { $resultbis = 1; // Create user - $result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + $result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); // Create user bis if ($databasefortest == 'mysql') { - if (! in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) + if (!in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) { - $resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + $resultbis = $db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); } } diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 1609035e415..b74594ce8da 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -384,10 +384,10 @@ if ($action == "set" && $success) print "
    "; - print $langs->trans("YouNeedToPersonalizeSetup")."

    "; + print $langs->trans("YouNeedToPersonalizeSetup")."


    "; print ''; } else @@ -399,7 +399,7 @@ if ($action == "set" && $success) print "
    "; print ''; } } @@ -435,7 +435,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action)) print "

    "; print '
    '; } else @@ -447,7 +447,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action)) print "
    "; print ''; } } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 70f4bb32d19..765a8796a76 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1,4 +1,6 @@ * Copyright (C) 2005-2018 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin @@ -498,7 +500,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ migrate_reload_modules($db, $langs, $conf, $listofmodule); // Reload menus (this must be always and only into last targeted version) - migrate_reload_menu($db, $langs, $conf, $versionto); + migrate_reload_menu($db, $langs, $conf); } // Can force activation of some module during migration with parameter 'enablemodules=MAIN_MODULE_XXX,MAIN_MODULE_YYY,...' @@ -1185,8 +1187,13 @@ function migrate_contracts_date1($db, $langs, $conf) print '
    '; } -/* - * Mise a jour date contrat avec date min effective mise en service si inferieur +/** + * Update contracts with date min real if service date is lower + * + * @param DoliDB $db Database handler + * @param Translate $langs Language + * @param Conf $conf Conf + * @return void */ function migrate_contracts_date2($db, $langs, $conf) { @@ -3624,10 +3631,9 @@ function migrate_mode_reglement($db, $langs, $conf) * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf - * @param string $versionto Version target * @return void */ -function migrate_clean_association($db, $langs, $conf, $versionto) +function migrate_clean_association($db, $langs, $conf) { $result = $db->DDLDescTable(MAIN_DB_PREFIX."categorie_association"); if ($result) // result defined for version 3.2 or - @@ -4834,10 +4840,9 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf - * @param string $versionto Version target * @return void */ -function migrate_reload_menu($db, $langs, $conf, $versionto) +function migrate_reload_menu($db, $langs, $conf) { global $conf; dolibarr_install_syslog("upgrade2::migrate_reload_menu"); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index ba34d38f36e..b8ce37a0956 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -121,6 +121,7 @@ InvoiceLinesDone=Bound lines of invoices ExpenseReportLines=Lines of expense reports to bind ExpenseReportLinesDone=Bound lines of expense reports IntoAccount=Bind line with the accounting account +TotalForAccount=Total for accounting account Ventilate=Bind @@ -233,8 +234,10 @@ ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Third-party unkno ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Third-party account not defined or third party unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service +OpeningBalance=Opening balance ShowOpeningBalance=Show opening balance HideOpeningBalance=Hide opening balance +ShowSubtotalByGroup=Show subtotal by group Pcgtype=Group of account PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report. @@ -314,12 +317,13 @@ Modelcsv_quadratus=Export for Quadratus QuadraCompta Modelcsv_ebp=Export for EBP Modelcsv_cogilog=Export for Cogilog Modelcsv_agiris=Export for Agiris -Modelcsv_LDCompta=Export for LD Compta (v9 & higher) (Test) +Modelcsv_LDCompta=Export for LD Compta (v9) (Test) Modelcsv_LDCompta10=Export for LD Compta (v10 & higher) Modelcsv_openconcerto=Export for OpenConcerto (Test) Modelcsv_configurable=Export CSV Configurable Modelcsv_FEC=Export FEC Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland +Modelcsv_winfic=Export Winfic - eWinfic - WinSis Compta ChartofaccountsId=Chart of accounts Id ## Tools - Init accounting account on product / service diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 58e5cecf39d..fef27b5b7de 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -40,6 +40,7 @@ WebUserGroup=Web server user/group NoSessionFound=Your PHP configuration seems to not allow listing of active sessions. The directory used to save sessions (%s) may be protected (for example by OS permissions or by PHP directive open_basedir). DBStoringCharset=Database charset to store data DBSortingCharset=Database charset to sort data +HostCharset=Host charset ClientCharset=Client charset ClientSortingCharset=Client collation WarningModuleNotActive=Module %s must be enabled @@ -94,7 +95,7 @@ NextValueForInvoices=Next value (invoices) NextValueForCreditNotes=Next value (credit notes) NextValueForDeposit=Next value (down payment) NextValueForReplacements=Next value (replacements) -MustBeLowerThanPHPLimit=Note: your PHP configuration currently limits the maximum filesize for upload to %s %s, irrespective of the value of this parameter +MustBeLowerThanPHPLimit=Note: your PHP configuration currently limits the maximum filesize for upload to %s %s, irrespective of the value of this parameter NoMaxSizeByPHPLimit=Note: No limit is set in your PHP configuration MaxSizeForUploadedFiles=Maximum size for uploaded files (0 to disallow any upload) UseCaptchaCode=Use graphical code (CAPTCHA) on login page @@ -427,7 +428,7 @@ ExtrafieldCheckBox=Checkboxes ExtrafieldCheckBoxFromList=Checkboxes from table ExtrafieldLink=Link to an object ComputedFormula=Computed field -ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $object.
    WARNING: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.
    Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

    Example of formula:
    $object->id < 10 ? round($object->id / 2, 2): ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

    Example to reload object
    (($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id: ($obj->rowid ? $obj->rowid: $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1'

    Other example of formula to force load of object and its parent object:
    (($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found' +ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $object.
    WARNING: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.
    Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

    Example of formula:
    $object->id < 10 ? round($object->id / 2, 2): ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

    Example to reload object
    (($reloadedobj = new Societe($db)) && ($reloadedobj->fetchNoCompute($obj->id ? $obj->id: ($obj->rowid ? $obj->rowid: $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1'

    Other example of formula to force load of object and its parent object:
    (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found' Computedpersistent=Store computed field ComputedpersistentDesc=Computed extra fields will be stored in the database, however, the value will only be recalculated when the object of this field is changed. If the computed field depends on other objects or global data this value might be wrong!! ExtrafieldParamHelpPassword=Leaving this field blank means this value will be stored without encryption (field must be only hidden with star on screen).
    Set 'auto' to use the default encryption rule to save password into database (then value read will be the hash only, no way to retrieve original value) @@ -540,8 +541,8 @@ Module54Name=Contracts/Subscriptions Module54Desc=Management of contracts (services or recurring subscriptions) Module55Name=Barcodes Module55Desc=Barcode management -Module56Name=Telephony -Module56Desc=Telephony integration +Module56Name=Payment by bank transfer +Module56Desc=Management of payment by bank transfer orders. It includes generation of SEPA file for European countries. Module57Name=Bank Direct Debit payments Module57Desc=Management of Direct Debit payment orders. It includes generation of SEPA file for European countries. Module58Name=ClickToDial @@ -1015,7 +1016,7 @@ LocalTax2IsUsedDescES=The IRPF rate by default when creating prospects, invoices LocalTax2IsNotUsedDescES=By default the proposed IRPF is 0. End of rule. LocalTax2IsUsedExampleES=In Spain, freelancers and independent professionals who provide services and companies who have chosen the tax system of modules. LocalTax2IsNotUsedExampleES=In Spain they are businesses not subject to tax system of modules. -RevenueStampDesc=The "tax stamp" or "revenue stamp" is a fixed tax you per invoice (It does not depend on amount of invoice). It can also be a percent tax but using the second or third type of tax is better for percent taxes as tax stamps des not provide any reporting. Only few countries uses this type of tax. +RevenueStampDesc=The "tax stamp" or "revenue stamp" is a fixed tax you per invoice (It does not depend on amount of invoice). It can also be a percent tax but using the second or third type of tax is better for percent taxes as tax stamps does not provide any reporting. Only few countries uses this type of tax. UseRevenueStamp=Use a tax stamp UseRevenueStampExample=The value of tax stamp is defined by default into the setup of dictionaries (%s - %s - %s) CalcLocaltax=Reports on local taxes @@ -1144,6 +1145,7 @@ AvailableModules=Available app/modules ToActivateModule=To activate modules, go on setup Area (Home->Setup->Modules). SessionTimeOut=Time out for session SessionExplanation=This number guarantees that the session will never expire before this delay, if the session cleaner is done by Internal PHP session cleaner (and nothing else). Internal PHP session cleaner does not guarantee that the session will expire after this delay. It will expire, after this delay, and when the session cleaner is run, so every %s/%s access, but only during access made by other sessions (if value is 0, it means clearing of session is done only by an external process).
    Note: on some servers with an external session cleaning mechanism (cron under debian, ubuntu ...), the sessions can be destroyed after a period defined by an external setup, no matter what the value entered here is. +SessionsPurgedByExternalSystem=Sessions on this server seems to be cleaned by an external mechanism (cron under debian, ubuntu ...), probably every %s seconds (= value of parameter session.gc_maxlifetime), so changing the value here has no effect. You must ask the server administrator to change session delay. TriggersAvailable=Available triggers TriggersDesc=Triggers are files that will modify the behavior of Dolibarr workflow once copied into the directory htdocs/core/triggers. They realize new actions, activated on Dolibarr events (new company creation, invoice validation, ...). TriggerDisabledByName=Triggers in this file are disabled by the -NORUN suffix in their name. @@ -1272,6 +1274,7 @@ RuleForGeneratedPasswords=Rules to generate and validate passwords DisableForgetPasswordLinkOnLogonPage=Do not show the "Password Forgotten" link on the Login page UsersSetup=Users module setup UserMailRequired=Email required to create a new user +UserHideInactive=Hide inactive users from all combo lists of users (Not recommended: this may means you won't be able to filter or search on old users on some pages) UsersDocModules=Document templates for documents generated from user record GroupsDocModules=Document templates for documents generated from a group record ##### HRM setup ##### @@ -1803,6 +1806,7 @@ TopMenuDisableImages=Hide images in Top menu LeftMenuBackgroundColor=Background color for Left menu BackgroundTableTitleColor=Background color for Table title line BackgroundTableTitleTextColor=Text color for Table title line +BackgroundTableTitleTextlinkColor=Text color for Table title link line BackgroundTableLineOddColor=Background color for odd table lines BackgroundTableLineEvenColor=Background color for even table lines MinimumNoticePeriod=Minimum notice period (Your leave request must be done before this delay) @@ -1936,7 +1940,7 @@ WithoutDolTrackingID=Dolibarr Reference not found in Message ID FormatZip=Zip MainMenuCode=Menu entry code (mainmenu) ECMAutoTree=Show automatic ECM tree -OperationParamDesc=Define values to use for action, or how to extract values. For example:
    objproperty1=SET:abc
    objproperty1=SET:a value with replacement of __objproperty1__
    objproperty3=SETIFEMPTY:abc
    objproperty4=EXTRACT:HEADER:X-Myheaderkey.*[^\s]+(.*)
    options_myextrafield=EXTRACT:SUBJECT:([^\s]*)
    object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)

    Use a ; char as separator to extract or set several properties. +OperationParamDesc=Define the values to use for the object of the action, or how to extract values. For example:
    objproperty1=SET:the value to set
    objproperty2=SET:a value with replacement of __objproperty1__
    objproperty3=SETIFEMPTY:value used if objproperty3 is not already defined
    objproperty4=EXTRACT:HEADER:X-Myheaderkey:\s*([^\s]*)
    options_myextrafield1=EXTRACT:SUBJECT:([^\n]*)
    object.objproperty5=EXTRACT:BODY:My company name is\s([^\s]*)

    Use a ; char as separator to extract or set several properties. OpeningHours=Opening hours OpeningHoursDesc=Enter here the regular opening hours of your company. ResourceSetup=Configuration of Resource module @@ -1995,3 +1999,5 @@ PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book. RssNote=Note: Each RSS feed definition provides a widget that you must enable to have it available in dashboard JumpToBoxes=Jump to Setup -> Widgets +MeasuringUnitTypeDesc=Use here a value like "size", "surface", "volume", "weight", "time" +MeasuringScaleDesc=The scale is the number of places you have to move the decimal part to match the default reference unit. For "time" unit type, it is the number of seconds. Values between 80 and 99 are reserved values. diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index e54239e9fb2..48bd2b81c2e 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -37,6 +37,8 @@ IbanValid=BAN valid IbanNotValid=BAN not valid StandingOrders=Direct Debit orders StandingOrder=Direct debit order +PaymentByBankTransfers=Payments by bank transfer +PaymentByBankTransfer=Payment by bank transfer AccountStatement=Account statement AccountStatementShort=Statement AccountStatements=Account statements diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ab26114d905..276fd94374d 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -209,13 +209,6 @@ NumberOfBillsByMonth=No. of invoices per month AmountOfBills=Amount of invoices AmountOfBillsHT=Amount of invoices (net of tax) AmountOfBillsByMonthHT=Amount of invoices by month (net of tax) -ShowSocialContribution=Show social/fiscal tax -ShowBill=Show invoice -ShowInvoice=Show invoice -ShowInvoiceReplace=Show replacing invoice -ShowInvoiceAvoir=Show credit note -ShowInvoiceDeposit=Show down payment invoice -ShowInvoiceSituation=Show situation invoice UseSituationInvoices=Allow situation invoice UseSituationInvoicesCreditNote=Allow situation invoice credit note Retainedwarranty=Retained warranty @@ -233,7 +226,6 @@ setretainedwarranty=Set retained warranty setretainedwarrantyDateLimit=Set retained warranty date limit RetainedWarrantyDateLimit=Retained warranty date limit RetainedWarrantyNeed100Percent=The situation invoice need to be at 100%% progress to be displayed on PDF -ShowPayment=Show payment AlreadyPaid=Already paid AlreadyPaidBack=Already paid back AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and down payments) @@ -251,6 +243,8 @@ SendBillRef=Submission of invoice %s SendReminderBillRef=Submission of invoice %s (reminder) StandingOrders=Direct debit orders StandingOrder=Direct debit order +PaymentByBankTransfers=Payments by bank transfer +PaymentByBankTransfer=Payment by bank transfer NoDraftBills=No draft invoices NoOtherDraftBills=No other draft invoices NoDraftInvoices=No draft invoices @@ -393,6 +387,7 @@ GeneratedFromTemplate=Generated from template invoice %s WarningInvoiceDateInFuture=Warning, the invoice date is higher than current date WarningInvoiceDateTooFarInFuture=Warning, the invoice date is too far from current date ViewAvailableGlobalDiscounts=View available discounts +GroupPaymentsByModOnReports=Group payments by mode on reports # PaymentConditions Statut=Status PaymentConditionShortRECEP=Due Upon Receipt diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index f2bc989b953..52c2004c1c7 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -95,7 +95,7 @@ PrintMethod=Print method ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. ByTerminal=By terminal TakeposNumpadUsePaymentIcon=Use payment icon on numpad -CashDeskRefNumberingModules=Numbering module for cash desk +CashDeskRefNumberingModules=Numbering module for POS sales CashDeskGenericMaskCodes6 =
    {TN} tag is used to add the terminal number TakeposGroupSameProduct=Group same products lines StartAParallelSale=Start a new parallel sale @@ -105,4 +105,6 @@ CashReport=Cash report MainPrinterToUse=Main printer to use OrderPrinterToUse=Order printer to use MainTemplateToUse=Main template to use -OrderTemplateToUse=Order template to use \ No newline at end of file +OrderTemplateToUse=Order template to use +BarRestaurant=Bar Restaurant +AutoOrder=Customer auto order \ No newline at end of file diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index f8b3d0354e2..1a9208bcf85 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -19,7 +19,6 @@ ProspectionArea=Prospection area IdThirdParty=Id third party IdCompany=Company Id IdContact=Contact Id -Contacts=Contacts/Addresses ThirdPartyContacts=Third-party contacts ThirdPartyContact=Third-party contact/address Company=Company @@ -298,7 +297,8 @@ AddContact=Create contact AddContactAddress=Create contact/address EditContact=Edit contact EditContactAddress=Edit contact/address -Contact=Contact +Contact=Contact/Address +Contacts=Contacts/Addresses ContactId=Contact id ContactsAddresses=Contacts/Addresses FromContactName=Name: @@ -325,7 +325,8 @@ CompanyDeleted=Company "%s" deleted from database. ListOfContacts=List of contacts/addresses ListOfContactsAddresses=List of contacts/addresses ListOfThirdParties=List of Third Parties -ShowContact=Show contact +ShowCompany=Third Party +ShowContact=Contact-Address ContactsAllShort=All (No filter) ContactType=Contact type ContactForOrders=Order's contact diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 6cd046c5607..8a8c837ac87 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -262,3 +262,5 @@ RulesPurchaseTurnoverIn=- It includes all the effective payments of invoices don RulesPurchaseTurnoverTotalPurchaseJournal=It includes all debit lines from the purchase journal. ReportPurchaseTurnover=Purchase turnover invoiced ReportPurchaseTurnoverCollected=Purchase turnover collected +IncludeVarpaysInResults = Include various payments in reports +IncludeLoansInResults = Include loans in reports diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index a810c61c8f4..de4bdf68f03 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -7,7 +7,6 @@ AddDonation=Create a donation NewDonation=New donation DeleteADonation=Delete a donation ConfirmDeleteADonation=Are you sure you want to delete this donation? -ShowDonation=Show donation PublicDonation=Public donation DonationsArea=Donations area DonationStatusPromiseNotValidated=Draft promise diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index e65b966ea09..e5936f8246e 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -41,9 +41,7 @@ InterventionsArea=Interventions area DraftFichinter=Draft interventions LastModifiedInterventions=Latest %s modified interventions FichinterToProcess=Interventions to process -##### Types de contacts ##### TypeContact_fichinter_external_CUSTOMER=Following-up customer contact -# Modele numérotation PrintProductsOnFichinter=Print also lines of type "product" (not only services) on intervention card PrintProductsOnFichinterDetails=interventions generated from orders UseServicesDurationOnFichinter=Use services duration for interventions generated from orders @@ -53,7 +51,6 @@ InterventionStatistics=Statistics of interventions NbOfinterventions=No. of intervention cards NumberOfInterventionsByMonth=No. of intervention cards by month (date of validation) AmountOfInteventionNotIncludedByDefault=Amount of intervention is not included by default into profit (in most cases, timesheets are used to count time spent). Add option PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT to 1 into home-setup-other to include them. -##### Exports ##### InterId=Intervention id InterRef=Intervention ref. InterDateCreation=Date creation intervention @@ -65,3 +62,5 @@ InterLineId=Line id intervention InterLineDate=Line date intervention InterLineDuration=Line duration intervention InterLineDesc=Line description intervention +RepeatableIntervention=Template of intervention +ToCreateAPredefinedIntervention=To create a predefined or recurring intervention, create a common intervention and convert it into intervention template diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7cb9b21791a..8c992bf91ca 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -426,6 +426,7 @@ Modules=Modules/Applications Option=Option List=List FullList=Full list +FullConversation=Full conversation Statistics=Statistics OtherStatistics=Other statistics Status=Status @@ -953,12 +954,13 @@ SearchIntoMembers=Members SearchIntoUsers=Users SearchIntoProductsOrServices=Products or services SearchIntoProjects=Projects +SearchIntoMO=Manufacturing Orders SearchIntoTasks=Tasks SearchIntoCustomerInvoices=Customer invoices SearchIntoSupplierInvoices=Vendor invoices SearchIntoCustomerOrders=Sales orders SearchIntoSupplierOrders=Purchase orders -SearchIntoCustomerProposals=Customer proposals +SearchIntoCustomerProposals=Commercial proposals SearchIntoSupplierProposals=Vendor proposals SearchIntoInterventions=Interventions SearchIntoContracts=Contracts diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index b815cf997cc..b89e1fb0a38 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -27,7 +27,7 @@ DangerZone=Danger zone BuildPackage=Build package BuildPackageDesc=You can generate a zip package of your application so your are ready to distribute it on any Dolibarr. You can also distribute it or sell it on marketplace like DoliStore.com. BuildDocumentation=Build documentation -ModuleIsNotActive=This module is not activated yet. Go to %s to make it live or click here: +ModuleIsNotActive=This module is not activated yet. Go to %s to make it live or click here ModuleIsLive=This module has been activated. Any change may break a current live feature. DescriptionLong=Long description EditorName=Name of editor @@ -83,7 +83,7 @@ ListOfDictionariesEntries=List of dictionaries entries ListOfPermissionsDefined=List of defined permissions SeeExamples=See examples here EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION) -VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example:
    preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
    ($user->rights->holiday->define_holiday ? 1 : 0) +VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update).

    Using a negative value means field is not shown by default on list but can be selected for viewing).

    It can be an expression, for example:
    preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
    ($user->rights->holiday->define_holiday ? 1 : 0) DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.
    Currently, known compatibles PDF models are : eratosthene (order), espadon (ship), sponge (invoices), cyan (propal/quotation), cornas (supplier order)

    For document :
    0 = not displayed
    1 = display
    2 = display only if not empty

    For document lines :
    0 = not displayed
    1 = displayed in a column
    3 = display in line description column after the description
    4 = display in description column after the description only if not empty DisplayOnPdf=Display on PDF IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index cdc0e6b3c95..bb42bff3c87 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -255,7 +255,7 @@ ServiceToUseOnLines=Service to use on lines InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project ProjectBillTimeDescription=Check if you enter timesheet on tasks of project AND you plan to generate invoice(s) from the timesheet to bill the customer of the project (do not check if you plan to create invoice that is not based on entered timesheets). Note: To generate invoice, go on tab 'Time spent' of the project and select lines to include. ProjectFollowOpportunity=Follow opportunity -ProjectFollowTasks=Follow tasks +ProjectFollowTasks=Follow tasks or time spent Usage=Usage UsageOpportunity=Usage: Opportunity UsageTasks=Usage: Tasks diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index aea4e7676e4..9b75a2ff37e 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -78,6 +78,7 @@ UserWillBeExternalUser=Created user will be an external user (because linked to IdPhoneCaller=Id phone caller NewUserCreated=User %s created NewUserPassword=Password change for %s +NewPasswordValidated=Your new password have been validated and must be used now to login. EventUserModified=User %s modified UserDisabled=User %s disabled UserEnabled=User %s activated diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index f4d88b0d606..2c555b40c20 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -57,7 +57,7 @@ NoPageYet=No pages yet YouCanCreatePageOrImportTemplate=You can create a new page or import a full website template SyntaxHelp=Help on specific syntax tips YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor. -YouCanEditHtmlSource=
    You can include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $db, $mysoc, $user, $website, $websitepage, $weblangs.

    You can also include content of another Page/Container with the following syntax:
    <?php includeContainer('alias_of_container_to_include'); ?>

    You can make a redirect to another Page/Container with the following syntax (Note: do not output any content before a redirect):
    <?php redirectToContainer('alias_of_container_to_redirect_to'); ?>

    To add a link to another page, use the syntax:
    <a href="alias_of_page_to_link_to.php">mylink<a>

    To include a link to download a file stored into the documents directory, use the document.php wrapper:
    Example, for a file into documents/ecm (need to be logged), syntax is:
    <a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext">
    For a file into documents/medias (open directory for public access), syntax is:
    <a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext">
    For a file shared with a share link (open access using the sharing hash key of file), syntax is:
    <a href="/document.php?hashp=publicsharekeyoffile">

    To include an image stored into the documents directory, use the viewimage.php wrapper:
    Example, for an image into documents/medias (open directory for public access), syntax is:
    <img src="/viewimage.php?modulepart=medias&file=[relative_dir/]filename.ext">

    More examples of HTML or dynamic code available on the wiki documentation
    . +YouCanEditHtmlSource=
    You can include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $db, $mysoc, $user, $website, $websitepage, $weblangs, $pagelangs.

    You can also include content of another Page/Container with the following syntax:
    <?php includeContainer('alias_of_container_to_include'); ?>

    You can make a redirect to another Page/Container with the following syntax (Note: do not output any content before a redirect):
    <?php redirectToContainer('alias_of_container_to_redirect_to'); ?>

    To add a link to another page, use the syntax:
    <a href="alias_of_page_to_link_to.php">mylink<a>

    To include a link to download a file stored into the documents directory, use the document.php wrapper:
    Example, for a file into documents/ecm (need to be logged), syntax is:
    <a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext">
    For a file into documents/medias (open directory for public access), syntax is:
    <a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext">
    For a file shared with a share link (open access using the sharing hash key of file), syntax is:
    <a href="/document.php?hashp=publicsharekeyoffile">

    To include an image stored into the documents directory, use the viewimage.php wrapper:
    Example, for an image into documents/medias (open directory for public access), syntax is:
    <img src="/viewimage.php?modulepart=medias&file=[relative_dir/]filename.ext">

    More examples of HTML or dynamic code available on the wiki documentation
    . ClonePage=Clone page/container CloneSite=Clone site SiteAdded=Website added diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index b1d6e30e329..ad51b045a37 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -4,9 +4,13 @@ SuppliersStandingOrdersArea=Direct credit payment orders area StandingOrdersPayment=Direct debit payment orders StandingOrderPayment=Direct debit payment order NewStandingOrder=New direct debit order +NewPaymentByBankTransfer=New payment by bank transfer StandingOrderToProcess=To process +PaymentByBankTransferReceipts=Bank transfer orders +PaymentByBankTransferLines=Bank transfer order lines WithdrawalsReceipts=Direct debit orders WithdrawalReceipt=Direct debit order +LatestBankTransferReceipts=Latest %s bank transfer orders LastWithdrawalReceipts=Latest %s direct debit files WithdrawalsLines=Direct debit order lines RequestStandingOrderToTreat=Request for direct debit payment order to process @@ -14,10 +18,12 @@ RequestStandingOrderTreated=Request for direct debit payment order processed NotPossibleForThisStatusOfWithdrawReceiptORLine=Not yet possible. Withdraw status must be set to 'credited' before declaring reject on specific lines. NbOfInvoiceToWithdraw=No. of qualified invoice with waiting direct debit order NbOfInvoiceToWithdrawWithInfo=No. of customer invoice with direct debit payment orders having defined bank account information +SupplierInvoiceWaitingWithdraw=Vendor invoice waiting for payment by bank transfer InvoiceWaitingWithdraw=Invoice waiting for direct debit AmountToWithdraw=Amount to withdraw WithdrawsRefused=Direct debit refused NoInvoiceToWithdraw=No customer invoice with open 'Direct debit requests' is waiting. Go on tab '%s' on invoice card to make a request. +NoSupplierInvoiceToWithdraw=No supplier invoice with open 'Direct credit requests' is waiting. Go on tab '%s' on invoice card to make a request. ResponsibleUser=User Responsible WithdrawalsSetup=Direct debit payment setup WithdrawStatistics=Direct debit payment statistics diff --git a/htdocs/langs/es_AR/main.lang b/htdocs/langs/es_AR/main.lang index 1451ea1c508..a48f7399746 100644 --- a/htdocs/langs/es_AR/main.lang +++ b/htdocs/langs/es_AR/main.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - main DIRECTION=ltr -FONTFORPDF=helvética +FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 6363b8b710d..172153852e3 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1272,6 +1272,7 @@ RuleForGeneratedPasswords=Règle pour la génération des mots de passe proposé DisableForgetPasswordLinkOnLogonPage=Cacher le lien "Mot de passe oublié" sur la page de connexion UsersSetup=Configuration du module utilisateurs UserMailRequired=Email requis pour créer un nouvel utilisateur +UserHideInactive=Cacher les utilisateurs inactifs UsersDocModules=Modèles de documents pour les documents générés à partir de la fiche utilisateur GroupsDocModules=Modèles de documents pour les documents générés à partir de la fiche d'un groupe ##### HRM setup ##### @@ -1803,6 +1804,7 @@ TopMenuDisableImages=Cacher les images du menu principal LeftMenuBackgroundColor=Couleur de fond pour le menu Gauche BackgroundTableTitleColor=Couleur de fond pour la ligne de titres des liste/tableaux BackgroundTableTitleTextColor=Couleur du texte pour la ligne de titre des tableaux +BackgroundTableTitleTextlinkColor=Couleur du texte pour la ligne de titre lien des tableaux BackgroundTableLineOddColor=Couleur de fond pour les lignes impaires des tables BackgroundTableLineEvenColor=Couleur de fond pour les lignes paires des tales MinimumNoticePeriod=Période de préavis minimum (Votre demande de congé doit être faite avant ce délai) diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 6ad3faba02d..92a0da802d1 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -393,6 +393,7 @@ GeneratedFromTemplate=Généré à partir du modèle de facture %s WarningInvoiceDateInFuture=Attention, la date de facturation est antérieur à la date actuelle WarningInvoiceDateTooFarInFuture=Attention, la date de facturation est trop éloignée de la date actuelle ViewAvailableGlobalDiscounts=Voir les remises disponibles +GroupPaymentsByModOnReports=Grouper les paiements par mode sur les rapports # PaymentConditions Statut=État PaymentConditionShortRECEP=A réception diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index c60c79513c5..d4c59754898 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -262,3 +262,5 @@ RulesPurchaseTurnoverIn=- It includes all the effective payments of invoices don RulesPurchaseTurnoverTotalPurchaseJournal=It includes all debit lines from the purchase journal. ReportPurchaseTurnover=Purchase turnover invoiced ReportPurchaseTurnoverCollected=Purchase turnover collected +IncludeVarpaysInResults = Inclure les payments divers dans les rapports +IncludeLoansInResults = Inclure les emprunts dans les rapports diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 81a8d5e9df7..56b12321bb2 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -475,7 +475,7 @@ if ($id > 0) print '
    '; print '
    '; - print '
    '; - print ''; + print ''; print '
    '; + print '
    '; // Capital if ($action == 'edit') diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 485d48dc443..ce152317710 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -507,25 +507,39 @@ class PaymentLoan extends CommonObject /** * Return clicable name (with eventually a picto) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=No picto - * @param int $maxlen Max length label - * @return string Chaine with URL + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=No picto + * @param int $maxlen Max length label + * @param int $notooltip 1=Disable tooltip + * @param string $moretitle Add more text to title tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL */ - public function getNomUrl($withpicto = 0, $maxlen = 0) + public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $moretitle = '', $save_lastsearch_value = -1) { - global $langs; + global $langs, $conf; + + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $result = ''; - - if (!empty($this->id)) - { - $link = ''; - $linkend = ''; - - if ($withpicto) $result .= ($link.img_object($langs->trans("ShowPayment").': '.$this->ref, 'payment').$linkend.' '); - if ($withpicto && $withpicto != 2) $result .= ' '; - if ($withpicto != 2) $result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend; + $label = ''.$langs->trans("Loan").''; + if (!empty($this->id)) { + $label .= '
    '.$langs->trans('Ref').': '.$this->id; } + if ($moretitle) $label .= ' - '.$moretitle; + + $url = DOL_URL_ROOT.'/loan/payment/card.php?id='.$this->id; + + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + + $linkstart = ''; + $linkend = ''; + + $result .= $linkstart; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= $this->ref; + $result .= $linkend; return $result; } diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 4798366d087..b739b81ca54 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -122,7 +122,7 @@ $form = new Form($db); $h = 0; $head[$h][0] = DOL_URL_ROOT.'/loan/payment/card.php?id='.$id; -$head[$h][1] = $langs->trans("Card"); +$head[$h][1] = $langs->trans("PaymentLoan"); $hselected = $h; $h++; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 86dd2f128e3..49c48e34ec1 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -317,7 +317,7 @@ if (!defined('NOLOGIN') && !defined('NOIPCHECK') && !empty($dolibarr_main_restri // Loading of additional presentation includes if (!defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) -if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory +require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory // If install or upgrade process not done or not completely finished, we call the install page. if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) @@ -2026,7 +2026,7 @@ function top_menu_search() $defaultAction = ''; $buttonList = '
    '; print ''; -print ''; -print ''."\n"; +print ''; +print ''."\n"; print ''."\n"; print ''; -$form = new Form($db); - // GLOBAL DISCOUNT MANAGEMENT print ''; print ''; @@ -162,7 +162,7 @@ print ''; // DISPLAY MARGIN RATES print ''; print ''; -print ''; // DISPLAY MARK RATES print ''; print ''; -print ''; print ''; print ''; -print ''; } - if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { print ''; // Qty to receive or received - print ''; + print ''; // Warehouse source print ''; // Batch number managment @@ -1878,11 +1878,11 @@ elseif ($id || $ref) print ''; print ''; // Qty to receive or received - print ''; + print ''; // Warehouse source - print ''; + print ''; // Batch number managment - print ''; + print ''; print ''; } } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 2bb34859a6b..a95d6217c1c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -306,9 +306,9 @@ class Reception extends CommonObject } // Create extrafields - if (! $error) + if (!$error) { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) $error++; } @@ -750,8 +750,13 @@ class Reception extends CommonObject } // extrafields + $line->array_options = $supplierorderline->array_options; if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) - $line->array_options = $array_options; + { + foreach ($array_options as $key => $value) { + $line->array_options[$key] = $value; + } + } $line->fk_product = $fk_product; $line->fk_commande = $supplierorderline->fk_commande; @@ -925,10 +930,14 @@ class Reception extends CommonObject if (!$error) { + $main = MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $ef = $main."_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_reception = ".$this->id.")"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch"; $sql .= " WHERE fk_reception = ".$this->id; - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { // Delete linked object $res = $this->deleteObjectLinked(); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 4bb80f34753..c6cfcd5264c 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -884,7 +884,7 @@ if ($resql) include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 4cda97b39d1..1b4223e1fff 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -871,10 +871,12 @@ class Dolresource extends CommonObject return $resources; } - /* + /** * Return an int number of resources linked to the element * - * @return int + * @param string $element Element type + * @param int $element_id Element id + * @return int Nb of resources loaded */ public function fetchElementResources($element, $element_id) { diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 3c0bb36116e..4836ed1a0f1 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -74,9 +74,10 @@ class FormResource * @param string $filterkey Filter on key value * @param int $outputmode 0=HTML select string, 1=Array, 2=without form tag * @param int $limit Limit number of answers + * @param string $morecss More css * @return string HTML string with */ - public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20) + public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20, $morecss = '') { // phpcs:enable global $conf, $user, $langs; @@ -100,10 +101,12 @@ class FormResource { //$minLength = (is_numeric($conf->global->RESOURCE_USE_SEARCH_TO_SELECT)?$conf->global->RESOURCE_USE_SEARCH_TO_SELECT:2); $out .= ajax_combobox($htmlname, $event, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT); + } else { + $out .= ajax_combobox($htmlname); } // Construct $out and $outarray - $out .= ''."\n"; if ($showempty) $out .= ''."\n"; $num = 0; @@ -136,7 +139,6 @@ class FormResource } } $out .= ''."\n"; - $out .= ajax_combobox($htmlname); if ($outputmode != 2) { diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index fd89ba5dd2d..fd6e7a3ec95 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -58,7 +58,7 @@ $optioncss = GETPOST('optioncss', 'alpha'); $filtre = GETPOST("filtre", 'none'); -if (! GETPOST('typeid', 'int')) +if (!GETPOST('typeid', 'int')) { $newfiltre = str_replace('filtre=', '', $filtre); $filterarray = explode('-', $newfiltre); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8800bd887a1..681d4a37fc9 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1331,7 +1331,7 @@ else // Country print ''; @@ -1354,16 +1354,16 @@ else // Phone / Fax print ''; - print ''; + print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning').' '; if ($conf->browser->layout == 'phone') print ''; print ''; - print ''; + print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning_fax').' '; // Email / Web print ''; - print ''; + print ''; print ''; - print ''; + print ''; if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -1380,42 +1380,6 @@ else } } - // if (! empty($conf->socialnetworks->enabled)) - // { - // // Skype - // if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) - // { - // print ''; - // print ''; - // } - // // Twitter - // if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) - // { - // print ''; - // print ''; - // } - // // Facebook - // if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - // { - // print ''; - // print ''; - // } - // // LinkedIn - // if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) - // { - // print ''; - // print ''; - // } - // } - // Prof ids $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); while ($i <= 6) @@ -1432,12 +1396,12 @@ else print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print ''; - if (($j % 2) == 1) print ''; + if (($j % $NBCOLS) == ($NBCOLS - 1)) print ''; $j++; } $i++; } - if ($j % 2 == 1) print ''; + if ($NBCOLS > 1 && ($j % 2 == 1)) print ''; // Vat is used print ''; @@ -1483,7 +1447,9 @@ else { print ''; + if ($conf->browser->layout == 'phone') print ''; + print ''; } @@ -1501,13 +1467,13 @@ else } // Type - Size - print ''; if ($conf->browser->layout == 'phone') print ''; - print ''; @@ -1883,6 +1849,7 @@ else print ''; + if ($conf->browser->layout == 'phone') print ''; print '
    '.$langs->trans("Description").''.$langs->trans("Value").''.$langs->trans("MemberMainOptions").''.$langs->trans("Value").''.$langs->trans("Description").'
    '.$langs->trans("DisplayMarginRates").''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARGIN_RATES'); @@ -185,7 +185,7 @@ print '
    '.$langs->trans("DisplayMarkRates").''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARK_RATES'); @@ -208,7 +208,7 @@ print '
    '.$langs->trans("ForceBuyingPriceIfNull").''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('ForceBuyingPriceIfNull'); diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 547c3595383..ecb8a3ce764 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -105,7 +105,7 @@ if ($socid > 0) print '
    '; print $langs->trans('SupplierCode').''; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 5b90f2a8f98..d813c3b291b 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -180,8 +180,10 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql'); + dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.key.sql'); dol_delete_file($destdir.'/img/object_myobject.png'); dol_delete_file($destdir.'/class/myobject.class.php'); + dol_delete_dir($destdir.'/class'); dol_delete_dir($destdir.'/sql'); } @@ -2122,7 +2124,7 @@ elseif (!empty($module)) print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("LanguageFile").' : '; if (!is_array($dicts) || empty($dicts)) print ''.$langs->trans("NoDictionaries").''; @@ -2867,7 +2869,7 @@ elseif (!empty($module)) print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; @@ -3007,7 +3009,7 @@ elseif (!empty($module)) print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; @@ -3099,12 +3101,13 @@ elseif (!empty($module)) print ''.$langs->trans("HooksDefDesc").'
    '; print '
    '; - print ''; + print ''; print ''; } else @@ -3279,7 +3294,7 @@ elseif (!empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''; + print ''; print ''; } else @@ -3335,7 +3350,7 @@ elseif (!empty($module)) $pathtofile = $widget['relpath']; print ''; print ''; } @@ -3473,7 +3488,7 @@ elseif (!empty($module)) print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; @@ -3602,7 +3617,7 @@ elseif (!empty($module)) if (preg_match('/\.md$/i', $spec['name'])) $format = 'markdown'; print ''; + print ''; print ''; print ''; } @@ -3657,7 +3672,7 @@ elseif (!empty($module)) // HTML print ' '.$langs->trans("PathToModuleDocumentation", "HTML").' : '; - if (!dol_is_file($outputfiledoc)) print ''.$langs->trans("FileNotYetGenerated").''; + if (!dol_is_file($outputfiledoc)) print ''.$langs->trans("FileNotYetGenerated").''; else { print ''; print ''; @@ -3670,7 +3685,7 @@ elseif (!empty($module)) // PDF print ' '.$langs->trans("PathToModuleDocumentation", "PDF").' : '; - if (!dol_is_file($outputfiledocpdf)) print ''.$langs->trans("FileNotYetGenerated").''; + if (!dol_is_file($outputfiledocpdf)) print ''.$langs->trans("FileNotYetGenerated").''; else { print ''; print ''; @@ -3744,7 +3759,7 @@ elseif (!empty($module)) print '
    '; print ' '.$langs->trans("PathToModulePackage").' : '; - if (!dol_is_file($outputfilezip)) print ''.$langs->trans("FileNotYetGenerated").''; + if (!dol_is_file($outputfilezip)) print ''.$langs->trans("FileNotYetGenerated").''; else { $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; print '
    '.$outputfilezip.''; diff --git a/htdocs/modulebuilder/template/.editorconfig b/htdocs/modulebuilder/template/.editorconfig index 3c4bd7d679d..57184034691 100644 --- a/htdocs/modulebuilder/template/.editorconfig +++ b/htdocs/modulebuilder/template/.editorconfig @@ -2,18 +2,18 @@ # top-most EditorConfig file root = true + # Unix-style newlines with a newline ending every file [*] charset = utf-8 end_of_line = lf insert_final_newline = true -# PHP PSR-2 Coding Standards -# http://www.php-fig.org/psr/psr-2/ [*.php] -indent_style = space +indent_style = tab indent_size = 4 trim_trailing_whitespace = true +insert_final_newline = true [*.js] indent_style = tab [*.css] diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php index 91dae82343b..10bca2e8b9a 100644 --- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php @@ -28,284 +28,284 @@ */ class ActionsMyModule { - /** - * @var DoliDB Database handler. - */ - public $db; + /** + * @var DoliDB Database handler. + */ + public $db; - /** - * @var string Error code (or message) - */ - public $error = ''; + /** + * @var string Error code (or message) + */ + public $error = ''; - /** - * @var array Errors - */ - public $errors = array(); + /** + * @var array Errors + */ + public $errors = array(); - /** - * @var array Hook results. Propagated to $hookmanager->resArray for later reuse - */ - public $results = array(); + /** + * @var array Hook results. Propagated to $hookmanager->resArray for later reuse + */ + public $results = array(); - /** - * @var string String displayed by executeHook() immediately after return - */ - public $resprints; + /** + * @var string String displayed by executeHook() immediately after return + */ + public $resprints; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } - /** - * Execute action - * - * @param array $parameters Array of parameters - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action 'add', 'update', 'view' - * @return int <0 if KO, - * =0 if OK but we want to process standard actions too, - * >0 if OK and we want to replace standard actions. - */ - public function getNomUrl($parameters, &$object, &$action) - { - global $db, $langs, $conf, $user; - $this->resprints = ''; - return 0; - } + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + public function getNomUrl($parameters, &$object, &$action) + { + global $db, $langs, $conf, $user; + $this->resprints = ''; + return 0; + } - /** - * Overloading the doActions function : replacing the parent's function with the one below - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function doActions($parameters, &$object, &$action, $hookmanager) - { - global $conf, $user, $langs; + /** + * Overloading the doActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function doActions($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; - $error = 0; // Error counter + $error = 0; // Error counter - /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' - { - // Do what you want here... - // You can for example call global vars like $fieldstosearchall to overwrite them, or update database depending on $action and $_POST values. - } + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' + { + // Do what you want here... + // You can for example call global vars like $fieldstosearchall to overwrite them, or update database depending on $action and $_POST values. + } - if (!$error) { - $this->results = array('myreturn' => 999); - $this->resprints = 'A text to show'; - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; - } - } + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } - /** - * Overloading the doMassActions function : replacing the parent's function with the one below - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function doMassActions($parameters, &$object, &$action, $hookmanager) - { - global $conf, $user, $langs; + /** + * Overloading the doMassActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function doMassActions($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; - $error = 0; // Error counter + $error = 0; // Error counter - /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' - { - foreach ($parameters['toselect'] as $objectid) - { - // Do action on each object id - } - } + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' + { + foreach ($parameters['toselect'] as $objectid) + { + // Do action on each object id + } + } - if (!$error) { - $this->results = array('myreturn' => 999); - $this->resprints = 'A text to show'; - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; - } - } + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } - /** - * Overloading the addMoreMassActions function : replacing the parent's function with the one below - * - * @param array $parameters Hook metadatas (context, etc...) - * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function addMoreMassActions($parameters, &$object, &$action, $hookmanager) - { - global $conf, $user, $langs; + /** + * Overloading the addMoreMassActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function addMoreMassActions($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; - $error = 0; // Error counter + $error = 0; // Error counter - /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' - { - $this->resprints = ''; - } + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' + { + $this->resprints = ''; + } - if (!$error) { - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; - } - } + if (!$error) { + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } - /** - * Execute action - * - * @param array $parameters Array of parameters - * @param Object $object Object output on PDF - * @param string $action 'add', 'update', 'view' - * @return int <0 if KO, - * =0 if OK but we want to process standard actions too, - * >0 if OK and we want to replace standard actions. - */ - public function beforePDFCreation($parameters, &$object, &$action) - { - global $conf, $user, $langs; - global $hookmanager; + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param Object $object Object output on PDF + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + public function beforePDFCreation($parameters, &$object, &$action) + { + global $conf, $user, $langs; + global $hookmanager; - $outputlangs = $langs; + $outputlangs = $langs; - $ret = 0; $deltemp = array(); - dol_syslog(get_class($this).'::executeHooks action='.$action); + $ret = 0; $deltemp = array(); + dol_syslog(get_class($this).'::executeHooks action='.$action); - /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' - { - } + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' + { + } - return $ret; - } + return $ret; + } - /** - * Execute action - * - * @param array $parameters Array of parameters - * @param Object $pdfhandler PDF builder handler - * @param string $action 'add', 'update', 'view' - * @return int <0 if KO, - * =0 if OK but we want to process standard actions too, - * >0 if OK and we want to replace standard actions. - */ - public function afterPDFCreation($parameters, &$pdfhandler, &$action) - { - global $conf, $user, $langs; - global $hookmanager; + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param Object $pdfhandler PDF builder handler + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + public function afterPDFCreation($parameters, &$pdfhandler, &$action) + { + global $conf, $user, $langs; + global $hookmanager; - $outputlangs = $langs; + $outputlangs = $langs; - $ret = 0; $deltemp = array(); - dol_syslog(get_class($this).'::executeHooks action='.$action); + $ret = 0; $deltemp = array(); + dol_syslog(get_class($this).'::executeHooks action='.$action); - /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' - { - } + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' + { + } - return $ret; - } + return $ret; + } - /** - * Overloading the loadDataForCustomReports function : returns data to complete the customreport tool - * - * @param array $parameters Hook metadatas (context, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int < 0 on error, 0 on success, 1 to replace standard code - */ - public function loadDataForCustomReports($parameters, &$action, $hookmanager) - { - global $conf, $user, $langs; + /** + * Overloading the loadDataForCustomReports function : returns data to complete the customreport tool + * + * @param array $parameters Hook metadatas (context, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function loadDataForCustomReports($parameters, &$action, $hookmanager) + { + global $conf, $user, $langs; - $langs->load("mymodule@mymodule"); + $langs->load("mymodule@mymodule"); - $this->results = array(); + $this->results = array(); - $head = array(); - $h = 0; + $head = array(); + $h = 0; - if ($parameters['tabfamily'] == 'mymodule') { - $head[$h][0] = dol_buildpath('/module/index.php', 1); - $head[$h][1] = $langs->trans("Home"); - $head[$h][2] = 'home'; - $h++; + if ($parameters['tabfamily'] == 'mymodule') { + $head[$h][0] = dol_buildpath('/module/index.php', 1); + $head[$h][1] = $langs->trans("Home"); + $head[$h][2] = 'home'; + $h++; - $this->results['title'] = $langs->trans("MyModule"); - $this->results['picto'] = 'mymodule@mymodule'; - } + $this->results['title'] = $langs->trans("MyModule"); + $this->results['picto'] = 'mymodule@mymodule'; + } - $head[$h][0] = 'customreports.php?objecttype='.$parameters['objecttype'].(empty($parameters['tabfamily']) ? '' : '&tabfamily='.$parameters['tabfamily']); - $head[$h][1] = $langs->trans("CustomReports"); - $head[$h][2] = 'customreports'; + $head[$h][0] = 'customreports.php?objecttype='.$parameters['objecttype'].(empty($parameters['tabfamily']) ? '' : '&tabfamily='.$parameters['tabfamily']); + $head[$h][1] = $langs->trans("CustomReports"); + $head[$h][2] = 'customreports'; - $this->results['head'] = $head; + $this->results['head'] = $head; - return 1; - } + return 1; + } - /** - * Overloading the restrictedArea function : check permission on an object - * - * @param array $parameters Hook metadatas (context, etc...) - * @param string $action Current action (if set). Generally create or edit or null - * @param HookManager $hookmanager Hook manager propagated to allow calling another hook - * @return int <0 if KO, - * =0 if OK but we want to process standard actions too, - * >0 if OK and we want to replace standard actions. - */ - public function restrictedArea($parameters, &$action, $hookmanager) - { - global $user; + /** + * Overloading the restrictedArea function : check permission on an object + * + * @param array $parameters Hook metadatas (context, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + public function restrictedArea($parameters, &$action, $hookmanager) + { + global $user; - if ($parameters['features'] == 'myobject') { - if ($user->rights->mymodule->myobject->read) { - $this->results['result'] = 1; - return 1; - } else { - $this->results['result'] = 0; - return 1; - } - } + if ($parameters['features'] == 'myobject') { + if ($user->rights->mymodule->myobject->read) { + $this->results['result'] = 1; + return 1; + } else { + $this->results['result'] = 0; + return 1; + } + } - return 0; - } + return 0; + } - /* Add here any other hooked methods... */ + /* Add here any other hooked methods... */ } diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 8477e3efdf6..f84210b9198 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -36,338 +36,338 @@ dol_include_once('/mymodule/class/myobject.class.php'); */ class MyModuleApi extends DolibarrApi { - /** - * @var MyObject $myobject {@type MyObject} - */ - public $myobject; + /** + * @var MyObject $myobject {@type MyObject} + */ + public $myobject; - /** - * Constructor - * - * @url GET / - * - */ - public function __construct() - { - global $db, $conf; - $this->db = $db; - $this->myobject = new MyObject($this->db); - } + /** + * Constructor + * + * @url GET / + * + */ + public function __construct() + { + global $db, $conf; + $this->db = $db; + $this->myobject = new MyObject($this->db); + } - /** - * Get properties of a myobject object - * - * Return an array with myobject informations - * - * @param int $id ID of myobject - * @return array|mixed data without useless information - * - * @url GET myobjects/{id} - * - * @throws RestException - */ - public function get($id) - { - if (!DolibarrApiAccess::$user->rights->mymodule->read) { - throw new RestException(401); - } + /** + * Get properties of a myobject object + * + * Return an array with myobject informations + * + * @param int $id ID of myobject + * @return array|mixed data without useless information + * + * @url GET myobjects/{id} + * + * @throws RestException + */ + public function get($id) + { + if (!DolibarrApiAccess::$user->rights->mymodule->read) { + throw new RestException(401); + } - $result = $this->myobject->fetch($id); - if (!$result) { - throw new RestException(404, 'MyObject not found'); - } + $result = $this->myobject->fetch($id); + if (!$result) { + throw new RestException(404, 'MyObject not found'); + } - if (!DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id, 'mymodule_myobject')) { - throw new RestException(401, 'Access to instance id='.$this->myobject->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); - } + if (!DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id, 'mymodule_myobject')) { + throw new RestException(401, 'Access to instance id='.$this->myobject->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); + } - return $this->_cleanObjectDatas($this->myobject); - } + return $this->_cleanObjectDatas($this->myobject); + } - /** - * List myobjects - * - * Get a list of myobjects - * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @return array Array of order objects - * - * @throws RestException - * - * @url GET /myobjects/ - */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') - { - global $db, $conf; + /** + * List myobjects + * + * Get a list of myobjects + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of order objects + * + * @throws RestException + * + * @url GET /myobjects/ + */ + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { + global $db, $conf; - $obj_ret = array(); - $tmpobject = new MyObject($db); + $obj_ret = array(); + $tmpobject = new MyObject($db); - if (!DolibarrApiAccess::$user->rights->bbb->read) { - throw new RestException(401); - } + if (!DolibarrApiAccess::$user->rights->bbb->read) { + throw new RestException(401); + } - $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; + $socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : ''; - $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object + $restrictonsocid = 0; // Set to 1 if there is a field socid in table of object - // If the internal user must only see his customers, force searching by him - $search_sale = 0; - if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + // If the internal user must only see his customers, force searching by him + $search_sale = 0; + if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; - $sql = "SELECT t.rowid"; - if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) - $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t"; + $sql = "SELECT t.rowid"; + if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t"; - if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale - $sql .= " WHERE 1 = 1"; + if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + $sql .= " WHERE 1 = 1"; - // Example of use $mode - //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; - //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; + // Example of use $mode + //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; + //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; - if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity('myobject').')'; - if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc"; - if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid; - if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - // Insert sale filter - if ($restrictonsocid && $search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; - } - if ($sqlfilters) - { - if (!DolibarrApi::_checkFilters($sqlfilters)) { - throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); - } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; - $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; - } + if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity('myobject').')'; + if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc"; + if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid; + if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($restrictonsocid && $search_sale > 0) { + $sql .= " AND sc.fk_user = ".$search_sale; + } + if ($sqlfilters) + { + if (!DolibarrApi::_checkFilters($sqlfilters)) { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } - $sql .= $db->order($sortfield, $sortorder); - if ($limit) { - if ($page < 0) { - $page = 0; - } - $offset = $limit * $page; + $sql .= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; - $sql .= $db->plimit($limit + 1, $offset); - } + $sql .= $db->plimit($limit + 1, $offset); + } - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - while ($i < $num) - { - $obj = $db->fetch_object($result); - $myobject_static = new MyObject($db); - if ($myobject_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($myobject_static); - } - $i++; - } - } - else { - throw new RestException(503, 'Error when retrieving myobject list: '.$db->lasterror()); - } - if (!count($obj_ret)) { - throw new RestException(404, 'No myobject found'); - } - return $obj_ret; - } + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < $num) + { + $obj = $db->fetch_object($result); + $myobject_static = new MyObject($db); + if ($myobject_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($myobject_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieving myobject list: '.$db->lasterror()); + } + if (!count($obj_ret)) { + throw new RestException(404, 'No myobject found'); + } + return $obj_ret; + } - /** - * Create myobject object - * - * @param array $request_data Request datas - * @return int ID of myobject - * - * @throws RestException - * - * @url POST myobjects/ - */ - public function post($request_data = null) - { - if (!DolibarrApiAccess::$user->rights->mymodule->write) { - throw new RestException(401); - } - // Check mandatory fields - $result = $this->_validate($request_data); + /** + * Create myobject object + * + * @param array $request_data Request datas + * @return int ID of myobject + * + * @throws RestException + * + * @url POST myobjects/ + */ + public function post($request_data = null) + { + if (!DolibarrApiAccess::$user->rights->mymodule->write) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); - foreach ($request_data as $field => $value) { - $this->myobject->$field = $value; - } - if (!$this->myobject->create(DolibarrApiAccess::$user)) { - throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors)); - } - return $this->myobject->id; - } + foreach ($request_data as $field => $value) { + $this->myobject->$field = $value; + } + if (!$this->myobject->create(DolibarrApiAccess::$user)) { + throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors)); + } + return $this->myobject->id; + } - /** - * Update myobject - * - * @param int $id Id of myobject to update - * @param array $request_data Datas - * @return int - * - * @throws RestException - * - * @url PUT myobjects/{id} - */ - public function put($id, $request_data = null) - { - if (!DolibarrApiAccess::$user->rights->mymodule->write) { - throw new RestException(401); - } + /** + * Update myobject + * + * @param int $id Id of myobject to update + * @param array $request_data Datas + * @return int + * + * @throws RestException + * + * @url PUT myobjects/{id} + */ + public function put($id, $request_data = null) + { + if (!DolibarrApiAccess::$user->rights->mymodule->write) { + throw new RestException(401); + } - $result = $this->myobject->fetch($id); - if (!$result) { - throw new RestException(404, 'MyObject not found'); - } + $result = $this->myobject->fetch($id); + if (!$result) { + throw new RestException(404, 'MyObject not found'); + } - if (!DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id, 'mymodule_myobject')) { - throw new RestException(401, 'Access to instance id='.$this->myobject->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); - } + if (!DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id, 'mymodule_myobject')) { + throw new RestException(401, 'Access to instance id='.$this->myobject->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); + } - foreach ($request_data as $field => $value) { - if ($field == 'id') continue; - $this->myobject->$field = $value; - } + foreach ($request_data as $field => $value) { + if ($field == 'id') continue; + $this->myobject->$field = $value; + } - if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0) - { - return $this->get($id); - } - else - { - throw new RestException(500, $this->myobject->error); - } - } + if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0) + { + return $this->get($id); + } + else + { + throw new RestException(500, $this->myobject->error); + } + } - /** - * Delete myobject - * - * @param int $id MyObject ID - * @return array - * - * @throws RestException - * - * @url DELETE myobjects/{id} - */ - public function delete($id) - { - if (!DolibarrApiAccess::$user->rights->mymodule->delete) { - throw new RestException(401); - } - $result = $this->myobject->fetch($id); - if (!$result) { - throw new RestException(404, 'MyObject not found'); - } + /** + * Delete myobject + * + * @param int $id MyObject ID + * @return array + * + * @throws RestException + * + * @url DELETE myobjects/{id} + */ + public function delete($id) + { + if (!DolibarrApiAccess::$user->rights->mymodule->delete) { + throw new RestException(401); + } + $result = $this->myobject->fetch($id); + if (!$result) { + throw new RestException(404, 'MyObject not found'); + } - if (!DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id, 'mymodule_myobject')) { - throw new RestException(401, 'Access to instance id='.$this->myobject->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); - } + if (!DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id, 'mymodule_myobject')) { + throw new RestException(401, 'Access to instance id='.$this->myobject->id.' of object not allowed for login '.DolibarrApiAccess::$user->login); + } - if (!$this->myobject->delete(DolibarrApiAccess::$user)) - { - throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error); - } + if (!$this->myobject->delete(DolibarrApiAccess::$user)) + { + throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error); + } - return array( - 'success' => array( - 'code' => 200, - 'message' => 'MyObject deleted' - ) - ); - } + return array( + 'success' => array( + 'code' => 200, + 'message' => 'MyObject deleted' + ) + ); + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore - /** - * Clean sensible object datas - * - * @param object $object Object to clean - * @return array Array of cleaned object properties - */ - protected function _cleanObjectDatas($object) - { - // phpcs:enable - $object = parent::_cleanObjectDatas($object); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + protected function _cleanObjectDatas($object) + { + // phpcs:enable + $object = parent::_cleanObjectDatas($object); - unset($object->rowid); - unset($object->canvas); + unset($object->rowid); + unset($object->canvas); - /*unset($object->name); - unset($object->lastname); - unset($object->firstname); - unset($object->civility_id); - unset($object->statut); - unset($object->state); - unset($object->state_id); - unset($object->state_code); - unset($object->region); - unset($object->region_code); - unset($object->country); - unset($object->country_id); - unset($object->country_code); - unset($object->barcode_type); - unset($object->barcode_type_code); - unset($object->barcode_type_label); - unset($object->barcode_type_coder); - unset($object->total_ht); - unset($object->total_tva); - unset($object->total_localtax1); - unset($object->total_localtax2); - unset($object->total_ttc); - unset($object->fk_account); - unset($object->comments); - unset($object->note); - unset($object->mode_reglement_id); - unset($object->cond_reglement_id); - unset($object->cond_reglement); - unset($object->shipping_method_id); - unset($object->fk_incoterms); - unset($object->label_incoterms); - unset($object->location_incoterms); + /*unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->civility_id); + unset($object->statut); + unset($object->state); + unset($object->state_id); + unset($object->state_code); + unset($object->region); + unset($object->region_code); + unset($object->country); + unset($object->country_id); + unset($object->country_code); + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder); + unset($object->total_ht); + unset($object->total_tva); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); + unset($object->fk_account); + unset($object->comments); + unset($object->note); + unset($object->mode_reglement_id); + unset($object->cond_reglement_id); + unset($object->cond_reglement); + unset($object->shipping_method_id); + unset($object->fk_incoterms); + unset($object->label_incoterms); + unset($object->location_incoterms); */ - // If object has lines, remove $db property - if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) { - $nboflines = count($object->lines); - for ($i = 0; $i < $nboflines; $i++) - { - $this->_cleanObjectDatas($object->lines[$i]); + // If object has lines, remove $db property + if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) { + $nboflines = count($object->lines); + for ($i = 0; $i < $nboflines; $i++) + { + $this->_cleanObjectDatas($object->lines[$i]); - unset($object->lines[$i]->lines); - unset($object->lines[$i]->note); - } - } + unset($object->lines[$i]->lines); + unset($object->lines[$i]->note); + } + } - return $object; - } + return $object; + } - /** - * Validate fields before create or update object - * - * @param array $data Array of data to validate - * @return array - * - * @throws RestException - */ - private function _validate($data) - { - $myobject = array(); - foreach ($this->myobject->fields as $field => $propfield) { - if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) continue; // Not a mandatory field - if (!isset($data[$field])) - throw new RestException(400, "$field field missing"); - $myobject[$field] = $data[$field]; - } - return $myobject; - } + /** + * Validate fields before create or update object + * + * @param array $data Array of data to validate + * @return array + * + * @throws RestException + */ + private function _validate($data) + { + $myobject = array(); + foreach ($this->myobject->fields as $field => $propfield) { + if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) continue; // Not a mandatory field + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $myobject[$field] = $data[$field]; + } + return $myobject; + } } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 656483d8f18..2070bedf568 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -90,16 +90,16 @@ class MyObject extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. - */ + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), - 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), - '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'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), + 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), + 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), + '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'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), @@ -112,7 +112,7 @@ class MyObject extends CommonObject //'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled')), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled')), ); /** @@ -131,13 +131,13 @@ class MyObject extends CommonObject public $entity; /** - * @var string label - */ - public $label; + * @var string label + */ + public $label; - /** - * @var string amount - */ + /** + * @var string amount + */ public $amount; /** @@ -146,28 +146,28 @@ class MyObject extends CommonObject public $status; /** - * @var integer|string date_creation - */ + * @var integer|string date_creation + */ public $date_creation; /** - * @var integer tms - */ + * @var integer tms + */ public $tms; /** - * @var int ID - */ + * @var int ID + */ public $fk_user_creat; /** - * @var int ID - */ + * @var int ID + */ public $fk_user_modif; /** - * @var string import_key - */ + * @var string import_key + */ public $import_key; // END MODULEBUILDER PROPERTIES @@ -273,86 +273,86 @@ class MyObject extends CommonObject public function createFromClone(User $user, $fromid) { global $langs, $extrafields; - $error = 0; + $error = 0; - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__, LOG_DEBUG); - $object = new self($this->db); + $object = new self($this->db); - $this->db->begin(); + $this->db->begin(); - // Load source object - $result = $object->fetchCommon($fromid); - if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); + // Load source object + $result = $object->fetchCommon($fromid); + if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); - // get lines so they will be clone - //foreach($this->lines as $line) - // $line->fetch_optionals(); + // get lines so they will be clone + //foreach($this->lines as $line) + // $line->fetch_optionals(); - // Reset some properties - unset($object->id); - unset($object->fk_user_creat); - unset($object->import_key); + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); - // Clear fields - $object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default']; - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; - $object->status = self::STATUS_DRAFT; - // ... - // Clear extrafields that are unique - if (is_array($object->array_options) && count($object->array_options) > 0) - { - $extrafields->fetch_name_optionals_label($this->table_element); - foreach ($object->array_options as $key => $option) - { - $shortkey = preg_replace('/options_/', '', $key); - if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) - { - //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; - unset($object->array_options[$key]); - } - } - } + // Clear fields + $object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default']; + $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; + $object->status = self::STATUS_DRAFT; + // ... + // Clear extrafields that are unique + if (is_array($object->array_options) && count($object->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->table_element); + foreach ($object->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($object->array_options[$key]); + } + } + } - // Create clone + // Create clone $object->context['createfromclone'] = 'createfromclone'; - $result = $object->createCommon($user); - if ($result < 0) { - $error++; - $this->error = $object->error; - $this->errors = $object->errors; - } + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } - if (!$error) - { - // copy internal contacts - if ($this->copy_linked_contact($object, 'internal') < 0) - { - $error++; - } - } + if (!$error) + { + // copy internal contacts + if ($this->copy_linked_contact($object, 'internal') < 0) + { + $error++; + } + } - if (!$error) - { - // copy external contacts if same company - if (property_exists($this, 'socid') && $this->socid == $object->socid) - { - if ($this->copy_linked_contact($object, 'external') < 0) - $error++; - } - } + if (!$error) + { + // copy external contacts if same company + if (property_exists($this, 'socid') && $this->socid == $object->socid) + { + if ($this->copy_linked_contact($object, 'external') < 0) + $error++; + } + } - unset($object->context['createfromclone']); + unset($object->context['createfromclone']); - // End - if (!$error) { - $this->db->commit(); - return $object; - } else { - $this->db->rollback(); - return -1; - } + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } } /** @@ -439,10 +439,10 @@ class MyObject extends CommonObject $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; - while ($i < min($limit, $num)) + $i = 0; + while ($i < ($limit ? min($limit, $num) : $num)) { - $obj = $this->db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); $record = new self($this->db); $record->setVarsFromFetchObj($obj); @@ -714,53 +714,53 @@ class MyObject extends CommonObject return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MYOBJECT_REOPEN'); } - /** - * Return a link to the object card (with optionaly the picto) - * - * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param string $option On what the link point to ('nolink', ...) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string String with URL - */ - public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { - global $conf, $langs, $hookmanager; + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $conf, $langs, $hookmanager; - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - $result = ''; + $result = ''; - $label = ''.$langs->trans("MyObject").''; - $label .= '
    '; - $label .= ''.$langs->trans('Ref').': '.$this->ref; - if (isset($this->status)) { - $label .= '
    '.$langs->trans("Status").": ".$this->getLibStatut(5); - } + $label = ''.$langs->trans("MyObject").''; + $label .= '
    '; + $label .= ''.$langs->trans('Ref').': '.$this->ref; + if (isset($this->status)) { + $label .= '
    '.$langs->trans("Status").": ".$this->getLibStatut(5); + } - $url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id; + $url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id; - if ($option != 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; - } + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + } - $linkclose = ''; - if (empty($notooltip)) - { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label = $langs->trans("ShowMyObject"); - $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + $linkclose = ''; + if (empty($notooltip)) + { + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label = $langs->trans("ShowMyObject"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } + else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -810,7 +810,7 @@ class MyObject extends CommonObject else $result .= $hookmanager->resPrint; return $result; - } + } /** * Return label of the status @@ -823,7 +823,7 @@ class MyObject extends CommonObject return $this->LibStatut($this->status, $mode); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the status * @@ -924,22 +924,22 @@ class MyObject extends CommonObject */ public function getLinesArray() { - $this->lines = array(); + $this->lines = array(); - $objectline = new MyObjectLine($this->db); - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_myobject = '.$this->id)); + $objectline = new MyObjectLine($this->db); + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_myobject = '.$this->id)); - if (is_numeric($result)) - { - $this->error = $this->error; - $this->errors = $this->errors; - return $result; - } - else - { - $this->lines = $result; - return $this->lines; - } + if (is_numeric($result)) + { + $this->error = $this->error; + $this->errors = $this->errors; + return $result; + } + else + { + $this->lines = $result; + return $this->lines; + } } /** @@ -1047,10 +1047,10 @@ class MyObject extends CommonObject /** * Action executed by scheduler * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' + * Use public function doScheduledJob($param1, $param2, ...) to get parameters * * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) */ - //public function doScheduledJob($param1, $param2, ...) public function doScheduledJob() { global $conf, $langs; diff --git a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php index dcdf94c8666..482455e103d 100644 --- a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php +++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php @@ -194,18 +194,18 @@ class mymodulewidget1 extends ModeleBoxes ); } - /** - * Method to show box. Called by Dolibarr eatch time it wants to display the box. - * - * @param array $head Array with properties of box title - * @param array $contents Array with properties of box lines - * @param int $nooutput No print, only return string - * @return void - */ - public function showBox($head = null, $contents = null, $nooutput = 0) - { - // You may make your own code here… - // … or use the parent's class function using the provided head and contents templates - parent::showBox($this->info_box_head, $this->info_box_contents); - } + /** + * Method to show box. Called by Dolibarr eatch time it wants to display the box. + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return void + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + // You may make your own code here… + // … or use the parent's class function using the provided head and contents templates + parent::showBox($this->info_box_head, $this->info_box_contents); + } } diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index b6aa0399447..39b325924fc 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -17,189 +17,189 @@ dol_include_once("/mymodule/class/myobject.class.php"); */ class mailing_mailinglist_mymodule_myobject extends MailingTargets { - // CHANGE THIS: Put here a name not already used - public $name = 'mailinglist_mymodule_myobject'; - // CHANGE THIS: Put here a description of your selector module - public $desc = 'My object emailing target selector'; - // CHANGE THIS: Set to 1 if selector is available for admin users only - public $require_admin = 0; + // CHANGE THIS: Put here a name not already used + public $name = 'mailinglist_mymodule_myobject'; + // CHANGE THIS: Put here a description of your selector module + public $desc = 'My object emailing target selector'; + // CHANGE THIS: Set to 1 if selector is available for admin users only + public $require_admin = 0; - public $enabled = 0; - public $require_module = array(); + public $enabled = 0; + public $require_module = array(); - /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png - */ - public $picto = 'mymodule@mymodule'; + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = 'mymodule@mymodule'; - /** - * @var DoliDB Database handler. - */ - public $db; + /** + * @var DoliDB Database handler. + */ + public $db; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - global $conf; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf; - $this->db = $db; - if (is_array($conf->modules)) - { - $this->enabled = in_array('mymodule', $conf->modules) ? 1 : 0; - } - } + $this->db = $db; + if (is_array($conf->modules)) + { + $this->enabled = in_array('mymodule', $conf->modules) ? 1 : 0; + } + } - /** - * Affiche formulaire de filtre qui apparait dans page de selection des destinataires de mailings - * - * @return string Retourne zone select - */ - public function formFilter() - { - global $langs; - $langs->load("members"); + /** + * Affiche formulaire de filtre qui apparait dans page de selection des destinataires de mailings + * + * @return string Retourne zone select + */ + public function formFilter() + { + global $langs; + $langs->load("members"); - $form = new Form($this->db); + $form = new Form($this->db); - $arraystatus = array(1=>'Option 1', 2=>'Option 2'); + $arraystatus = array(1=>'Option 1', 2=>'Option 2'); - $s = ''; - $s .= $langs->trans("Status").': '; - $s .= ''; - $s .= '
    '; + $s = ''; + $s .= $langs->trans("Status").': '; + $s .= ''; + $s .= '
    '; - return $s; - } + return $s; + } - /** - * Renvoie url lien vers fiche de la source du destinataire du mailing - * - * @param int $id ID - * @return string Url lien - */ - public function url($id) - { - return '
    '.img_object('', "generic").''; - } + /** + * Renvoie url lien vers fiche de la source du destinataire du mailing + * + * @param int $id ID + * @return string Url lien + */ + public function url($id) + { + return ''.img_object('', "generic").''; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * This is the main function that returns the array of emails - * - * @param int $mailing_id Id of emailing - * @return int <0 if error, number of emails added if ok - */ - public function add_to_target($mailing_id) - { - // phpcs:enable - $target = array(); - $j = 0; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * This is the main function that returns the array of emails + * + * @param int $mailing_id Id of emailing + * @return int <0 if error, number of emails added if ok + */ + public function add_to_target($mailing_id) + { + // phpcs:enable + $target = array(); + $j = 0; - $sql = " select rowid as id, email, firstname, lastname, plan, partner"; - $sql .= " from ".MAIN_DB_PREFIX."myobject"; - $sql .= " where email IS NOT NULL AND email != ''"; - if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') $sql .= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'"; - $sql .= " ORDER BY email"; + $sql = " select rowid as id, email, firstname, lastname, plan, partner"; + $sql .= " from ".MAIN_DB_PREFIX."myobject"; + $sql .= " where email IS NOT NULL AND email != ''"; + if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') $sql .= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'"; + $sql .= " ORDER BY email"; - // Stocke destinataires dans target - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows($result); - $i = 0; + // Stocke destinataires dans target + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; - dol_syslog("mailinglist_mymodule_myobject.modules.php: mailing ".$num." targets found"); + dol_syslog("mailinglist_mymodule_myobject.modules.php: mailing ".$num." targets found"); - $old = ''; - while ($i < $num) - { - $obj = $this->db->fetch_object($result); - if ($old <> $obj->email) - { - $target[$j] = array( - 'email' => $obj->email, - 'name' => $obj->lastname, - 'id' => $obj->id, - 'firstname' => $obj->firstname, - 'other' => $obj->plan.';'.$obj->partner, - 'source_url' => $this->url($obj->id), - 'source_id' => $obj->id, - 'source_type' => 'dolicloud' - ); - $old = $obj->email; - $j++; - } + $old = ''; + while ($i < $num) + { + $obj = $this->db->fetch_object($result); + if ($old <> $obj->email) + { + $target[$j] = array( + 'email' => $obj->email, + 'name' => $obj->lastname, + 'id' => $obj->id, + 'firstname' => $obj->firstname, + 'other' => $obj->plan.';'.$obj->partner, + 'source_url' => $this->url($obj->id), + 'source_id' => $obj->id, + 'source_type' => 'dolicloud' + ); + $old = $obj->email; + $j++; + } - $i++; - } - } - else - { - dol_syslog($this->db->error()); - $this->error = $this->db->error(); - return -1; - } + $i++; + } + } + else + { + dol_syslog($this->db->error()); + $this->error = $this->db->error(); + return -1; + } - // You must fill the $target array with record like this - // $target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0'); - // ... - // $target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n'); + // You must fill the $target array with record like this + // $target[0]=array('email'=>'email_0','name'=>'name_0','firstname'=>'firstname_0'); + // ... + // $target[n]=array('email'=>'email_n','name'=>'name_n','firstname'=>'firstname_n'); - // Example: $target[0]=array('email'=>'myemail@mydomain.com','name'=>'Doe','firstname'=>'John'); + // Example: $target[0]=array('email'=>'myemail@mydomain.com','name'=>'Doe','firstname'=>'John'); - // ----- Your code end here ----- + // ----- Your code end here ----- - return parent::addTargetsToDatabase($mailing_id, $target); - } + return parent::addTargetsToDatabase($mailing_id, $target); + } - /** - * On the main mailing area, there is a box with statistics. - * If you want to add a line in this report you must provide an - * array of SQL request that returns two field: - * One called "label", One called "nb". - * - * @return array - */ - public function getSqlArrayForStats() - { - // CHANGE THIS: Optionnal + /** + * On the main mailing area, there is a box with statistics. + * If you want to add a line in this report you must provide an + * array of SQL request that returns two field: + * One called "label", One called "nb". + * + * @return array + */ + public function getSqlArrayForStats() + { + // CHANGE THIS: Optionnal - //var $statssql=array(); - //$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL"; + //var $statssql=array(); + //$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL"; - return array(); - } + return array(); + } - /** - * Return here number of distinct emails returned by your selector. - * For example if this selector is used to extract 500 different - * emails from a text file, this function must return 500. - * - * @param string $filter Filter - * @param string $option Options - * @return int Nb of recipients or -1 if KO - */ - public function getNbOfRecipients($filter = 1, $option = '') - { - $a = parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); + /** + * Return here number of distinct emails returned by your selector. + * For example if this selector is used to extract 500 different + * emails from a text file, this function must return 500. + * + * @param string $filter Filter + * @param string $option Options + * @return int Nb of recipients or -1 if KO + */ + public function getNbOfRecipients($filter = 1, $option = '') + { + $a = parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); - if ($a < 0) return -1; - return $a; - } + if ($a < 0) return -1; + return $a; + } } diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index ba956e46af9..21ede6bfd58 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -33,419 +33,419 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modMyModule extends DolibarrModules { - /** - * Constructor. Define names, constants, directories, boxes, permissions - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - global $langs, $conf; - $this->db = $db; + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $langs, $conf; + $this->db = $db; - // Id for module (must be unique). - // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). - $this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module - // Key text used to identify module (for permissions, menus, etc...) - $this->rights_class = 'mymodule'; - // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' - // It is used to group modules by family in module setup page - $this->family = "other"; - // Module position in the family on 2 digits ('01', '10', '20', ...) - $this->module_position = '90'; - // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) - //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); - // Module label (no space allowed), used if translation string 'ModuleMyModuleName' not found (MyModule is name of module). - $this->name = preg_replace('/^mod/i', '', get_class($this)); - // Module description, used if translation string 'ModuleMyModuleDesc' not found (MyModule is name of module). - $this->description = "MyModuleDescription"; - // Used only if file README.md and README-LL.md not found. - $this->descriptionlong = "MyModule description (Long)"; - $this->editor_name = 'Editor name'; - $this->editor_url = 'https://www.example.com'; - // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' - $this->version = '1.0'; - // Url to the file with your last numberversion of this module - //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; + // Id for module (must be unique). + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). + $this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'mymodule'; + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' + // It is used to group modules by family in module setup page + $this->family = "other"; + // Module position in the family on 2 digits ('01', '10', '20', ...) + $this->module_position = '90'; + // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) + //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); + // Module label (no space allowed), used if translation string 'ModuleMyModuleName' not found (MyModule is name of module). + $this->name = preg_replace('/^mod/i', '', get_class($this)); + // Module description, used if translation string 'ModuleMyModuleDesc' not found (MyModule is name of module). + $this->description = "MyModuleDescription"; + // Used only if file README.md and README-LL.md not found. + $this->descriptionlong = "MyModule description (Long)"; + $this->editor_name = 'Editor name'; + $this->editor_url = 'https://www.example.com'; + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' + $this->version = '1.0'; + // Url to the file with your last numberversion of this module + //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - // Name of image file used for this module. - // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' - // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto = 'generic'; - // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) - $this->module_parts = array( - // Set this to 1 if module has its own trigger directory (core/triggers) - 'triggers' => 0, - // Set this to 1 if module has its own login method file (core/login) - 'login' => 0, - // Set this to 1 if module has its own substitution function file (core/substitutions) - 'substitutions' => 0, - // Set this to 1 if module has its own menus handler directory (core/menus) - 'menus' => 0, - // Set this to 1 if module overwrite template dir (core/tpl) - 'tpl' => 0, - // Set this to 1 if module has its own barcode directory (core/modules/barcode) - 'barcode' => 0, - // Set this to 1 if module has its own models directory (core/modules/xxx) - 'models' => 0, - // Set this to 1 if module has its own theme directory (theme) - 'theme' => 0, - // Set this to relative path of css file if module has its own css file - 'css' => array( - // '/mymodule/css/mymodule.css.php', - ), - // Set this to relative path of js file if module must load a js on all pages - 'js' => array( - // '/mymodule/js/mymodule.js.php', - ), - // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all' - 'hooks' => array( - // 'data' => array( - // 'hookcontext1', - // 'hookcontext2', - // ), - // 'entity' => '0', - ), - // Set this to 1 if features of module are opened to external users - 'moduleforexternal' => 0, - ); - // Data directories to create when module is enabled. - // Example: this->dirs = array("/mymodule/temp","/mymodule/subdir"); - $this->dirs = array("/mymodule/temp"); - // Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module. - $this->config_page_url = array("setup.php@mymodule"); - // Dependencies - // A condition to hide module - $this->hidden = false; - // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) - $this->depends = array(); - $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) - $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) - $this->langfiles = array("mymodule@mymodule"); - $this->phpmin = array(5, 5); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) - //$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice'); - //$this->always_enabled = true; // If true, can't be disabled + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Name of image file used for this module. + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + $this->picto = 'generic'; + // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) + $this->module_parts = array( + // Set this to 1 if module has its own trigger directory (core/triggers) + 'triggers' => 0, + // Set this to 1 if module has its own login method file (core/login) + 'login' => 0, + // Set this to 1 if module has its own substitution function file (core/substitutions) + 'substitutions' => 0, + // Set this to 1 if module has its own menus handler directory (core/menus) + 'menus' => 0, + // Set this to 1 if module overwrite template dir (core/tpl) + 'tpl' => 0, + // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'barcode' => 0, + // Set this to 1 if module has its own models directory (core/modules/xxx) + 'models' => 0, + // Set this to 1 if module has its own theme directory (theme) + 'theme' => 0, + // Set this to relative path of css file if module has its own css file + 'css' => array( + // '/mymodule/css/mymodule.css.php', + ), + // Set this to relative path of js file if module must load a js on all pages + 'js' => array( + // '/mymodule/js/mymodule.js.php', + ), + // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all' + 'hooks' => array( + // 'data' => array( + // 'hookcontext1', + // 'hookcontext2', + // ), + // 'entity' => '0', + ), + // Set this to 1 if features of module are opened to external users + 'moduleforexternal' => 0, + ); + // Data directories to create when module is enabled. + // Example: this->dirs = array("/mymodule/temp","/mymodule/subdir"); + $this->dirs = array("/mymodule/temp"); + // Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module. + $this->config_page_url = array("setup.php@mymodule"); + // Dependencies + // A condition to hide module + $this->hidden = false; + // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + $this->depends = array(); + $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) + $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) + $this->langfiles = array("mymodule@mymodule"); + $this->phpmin = array(5, 5); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + //$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice'); + //$this->always_enabled = true; // If true, can't be disabled - // Constants - // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) - // Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), - // 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) - // ); - $this->const = array( - // 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) - ); + // Constants + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), + // 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) + // ); + $this->const = array( + // 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + ); - // Some keys to add into the overwriting translation tables - /*$this->overwrite_translation = array( - 'en_US:ParentCompany'=>'Parent company or reseller', - 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' - )*/ + // Some keys to add into the overwriting translation tables + /*$this->overwrite_translation = array( + 'en_US:ParentCompany'=>'Parent company or reseller', + 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' + )*/ - if (!isset($conf->mymodule) || !isset($conf->mymodule->enabled)) { - $conf->mymodule = new stdClass(); - $conf->mymodule->enabled = 0; - } + if (!isset($conf->mymodule) || !isset($conf->mymodule->enabled)) { + $conf->mymodule = new stdClass(); + $conf->mymodule->enabled = 0; + } - // Array to add new pages in new tabs - $this->tabs = array(); - // Example: - // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. - // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname - // - // Where objecttype can be - // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) - // 'contact' to add a tab in contact view - // 'contract' to add a tab in contract view - // 'group' to add a tab in group view - // 'intervention' to add a tab in intervention view - // 'invoice' to add a tab in customer invoice view - // 'invoice_supplier' to add a tab in supplier invoice view - // 'member' to add a tab in fundation member view - // 'opensurveypoll' to add a tab in opensurvey poll view - // 'order' to add a tab in customer order view - // 'order_supplier' to add a tab in supplier order view - // 'payment' to add a tab in payment view - // 'payment_supplier' to add a tab in supplier payment view - // 'product' to add a tab in product view - // 'propal' to add a tab in propal view - // 'project' to add a tab in project view - // 'stock' to add a tab in stock view - // 'thirdparty' to add a tab in third party view - // 'user' to add a tab in user view + // Array to add new pages in new tabs + $this->tabs = array(); + // Example: + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // + // Where objecttype can be + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) + // 'contact' to add a tab in contact view + // 'contract' to add a tab in contract view + // 'group' to add a tab in group view + // 'intervention' to add a tab in intervention view + // 'invoice' to add a tab in customer invoice view + // 'invoice_supplier' to add a tab in supplier invoice view + // 'member' to add a tab in fundation member view + // 'opensurveypoll' to add a tab in opensurvey poll view + // 'order' to add a tab in customer order view + // 'order_supplier' to add a tab in supplier order view + // 'payment' to add a tab in payment view + // 'payment_supplier' to add a tab in supplier payment view + // 'product' to add a tab in product view + // 'propal' to add a tab in propal view + // 'project' to add a tab in project view + // 'stock' to add a tab in stock view + // 'thirdparty' to add a tab in third party view + // 'user' to add a tab in user view - // Dictionaries - $this->dictionaries = array(); - /* Example: - $this->dictionaries=array( - 'langs'=>'mymodule@mymodule', - // List of tables we want to see into dictonnary editor - 'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"), - // Label of tables - 'tablib'=>array("Table1", "Table2", "Table3"), - // Request to select fields - 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), - // Sort order - 'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"), - // List of fields (result of select to show dictionary) - 'tabfield'=>array("code,label", "code,label", "code,label"), - // List of fields (list of fields to edit a record) - 'tabfieldvalue'=>array("code,label", "code,label", "code,label"), - // List of fields (list of fields for insert) - 'tabfieldinsert'=>array("code,label", "code,label", "code,label"), - // Name of columns with primary key (try to always name it 'rowid') - 'tabrowid'=>array("rowid", "rowid", "rowid"), - // Condition to show each dictionary - 'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled) - ); - */ + // Dictionaries + $this->dictionaries = array(); + /* Example: + $this->dictionaries=array( + 'langs'=>'mymodule@mymodule', + // List of tables we want to see into dictonnary editor + 'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"), + // Label of tables + 'tablib'=>array("Table1", "Table2", "Table3"), + // Request to select fields + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), + // Sort order + 'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"), + // List of fields (result of select to show dictionary) + 'tabfield'=>array("code,label", "code,label", "code,label"), + // List of fields (list of fields to edit a record) + 'tabfieldvalue'=>array("code,label", "code,label", "code,label"), + // List of fields (list of fields for insert) + 'tabfieldinsert'=>array("code,label", "code,label", "code,label"), + // Name of columns with primary key (try to always name it 'rowid') + 'tabrowid'=>array("rowid", "rowid", "rowid"), + // Condition to show each dictionary + 'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled) + ); + */ - // Boxes/Widgets - // Add here list of php file(s) stored in mymodule/core/boxes that contains a class to show a widget. - $this->boxes = array( - // 0 => array( - // 'file' => 'mymodulewidget1.php@mymodule', - // 'note' => 'Widget provided by MyModule', - // 'enabledbydefaulton' => 'Home', - // ), - // ... - ); + // Boxes/Widgets + // Add here list of php file(s) stored in mymodule/core/boxes that contains a class to show a widget. + $this->boxes = array( + // 0 => array( + // 'file' => 'mymodulewidget1.php@mymodule', + // 'note' => 'Widget provided by MyModule', + // 'enabledbydefaulton' => 'Home', + // ), + // ... + ); - // Cronjobs (List of cron jobs entries to add when module is enabled) - // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week - $this->cronjobs = array( - // 0 => array( - // 'label' => 'MyJob label', - // 'jobtype' => 'method', - // 'class' => '/mymodule/class/myobject.class.php', - // 'objectname' => 'MyObject', - // 'method' => 'doScheduledJob', - // 'parameters' => '', - // 'comment' => 'Comment', - // 'frequency' => 2, - // 'unitfrequency' => 3600, - // 'status' => 0, - // 'test' => '$conf->mymodule->enabled', - // 'priority' => 50, - // ), - ); - // Example: $this->cronjobs=array( - // 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mymodule->enabled', 'priority'=>50), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mymodule->enabled', 'priority'=>50) - // ); + // Cronjobs (List of cron jobs entries to add when module is enabled) + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week + $this->cronjobs = array( + // 0 => array( + // 'label' => 'MyJob label', + // 'jobtype' => 'method', + // 'class' => '/mymodule/class/myobject.class.php', + // 'objectname' => 'MyObject', + // 'method' => 'doScheduledJob', + // 'parameters' => '', + // 'comment' => 'Comment', + // 'frequency' => 2, + // 'unitfrequency' => 3600, + // 'status' => 0, + // 'test' => '$conf->mymodule->enabled', + // 'priority' => 50, + // ), + ); + // Example: $this->cronjobs=array( + // 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mymodule->enabled', 'priority'=>50), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mymodule->enabled', 'priority'=>50) + // ); - // Permissions provided by this module - $this->rights = array(); - $r = 0; - // Add here entries to declare new permissions - /* BEGIN MODULEBUILDER PERMISSIONS */ - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read objects of MyModule'; // Permission label - $this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/Update objects of MyModule'; // Permission label - $this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label - $this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) - $r++; - /* END MODULEBUILDER PERMISSIONS */ + // Permissions provided by this module + $this->rights = array(); + $r = 0; + // Add here entries to declare new permissions + /* BEGIN MODULEBUILDER PERMISSIONS */ + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read objects of MyModule'; // Permission label + $this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update objects of MyModule'; // Permission label + $this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label + $this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2) + $r++; + /* END MODULEBUILDER PERMISSIONS */ - // Main menu entries to add - $this->menu = array(); - $r = 0; - // Add here entries to declare new menus - /* BEGIN MODULEBUILDER TOPMENU */ - $this->menu[$r++] = array( - 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'top', // This is a Top menu entry - 'titre'=>'MyModule', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'', - 'url'=>'/mymodule/mymoduleindex.php', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000 + $r, - 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - ); - /* END MODULEBUILDER TOPMENU */ - /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Top menu entry - 'titre'=>'MyObject', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'myobject', - 'url'=>'/mymodule/mymoduleindex.php', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'List MyObject', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject_list', - 'url'=>'/mymodule/myobject_list.php', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'New MyObject', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject_new', - 'url'=>'/mymodule/myobject_page.php?action=create', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->mymodule->myobject->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - ); - END MODULEBUILDER LEFTMENU MYOBJECT */ + // Main menu entries to add + $this->menu = array(); + $r = 0; + // Add here entries to declare new menus + /* BEGIN MODULEBUILDER TOPMENU */ + $this->menu[$r++] = array( + 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'top', // This is a Top menu entry + 'titre'=>'MyModule', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'', + 'url'=>'/mymodule/mymoduleindex.php', + 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000 + $r, + 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + /* END MODULEBUILDER TOPMENU */ + /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Top menu entry + 'titre'=>'MyObject', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'myobject', + 'url'=>'/mymodule/mymoduleindex.php', + 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. + 'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'List MyObject', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'mymodule_myobject_list', + 'url'=>'/mymodule/myobject_list.php', + 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'New MyObject', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'mymodule_myobject_new', + 'url'=>'/mymodule/myobject_page.php?action=create', + 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'$user->rights->mymodule->myobject->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + END MODULEBUILDER LEFTMENU MYOBJECT */ - // Exports profiles provided by this module - $r = 1; - /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ - /* - $langs->load("mymodule@mymodule"); - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='myobject@mymodule'; - // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array - $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; - include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; - //unset($this->export_fields_array[$r]['t.fieldtoremove']); - //$keyforclass = 'MyObjectLine'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobjectline@mymodule'; $keyforalias='tl'; + // Exports profiles provided by this module + $r = 1; + /* BEGIN MODULEBUILDER EXPORT MYOBJECT */ + /* + $langs->load("mymodule@mymodule"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='myobject@mymodule'; + // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array + $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; + //unset($this->export_fields_array[$r]['t.fieldtoremove']); + //$keyforclass = 'MyObjectLine'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobjectline@mymodule'; $keyforalias='tl'; //include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - //$keyforselect='myobjectline'; $keyforaliasextra='extraline'; $keyforelement='myobjectline@mymodule'; - //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - //$this->export_dependencies_array[$r] = array('myobjectline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) - //$this->export_special_array[$r] = array('t.field'=>'...'); - //$this->export_examplevalues_array[$r] = array('t.field'=>'Example'); - //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp'); - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t'; - //$this->export_sql_end[$r] =' LEFT JOIN '.MAIN_DB_PREFIX.'myobject_line as tl ON tl.fk_myobject = t.rowid'; - $this->export_sql_end[$r] .=' WHERE 1 = 1'; - $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')'; - $r++; */ - /* END MODULEBUILDER EXPORT MYOBJECT */ + $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$keyforselect='myobjectline'; $keyforaliasextra='extraline'; $keyforelement='myobjectline@mymodule'; + //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$this->export_dependencies_array[$r] = array('myobjectline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + //$this->export_special_array[$r] = array('t.field'=>'...'); + //$this->export_examplevalues_array[$r] = array('t.field'=>'Example'); + //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp'); + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t'; + //$this->export_sql_end[$r] =' LEFT JOIN '.MAIN_DB_PREFIX.'myobject_line as tl ON tl.fk_myobject = t.rowid'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')'; + $r++; */ + /* END MODULEBUILDER EXPORT MYOBJECT */ - // Imports profiles provided by this module - $r = 1; - /* BEGIN MODULEBUILDER IMPORT MYOBJECT */ - /* - $langs->load("mymodule@mymodule"); - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='myobject@mymodule'; - $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; - include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t'; - $this->export_sql_end[$r] .=' WHERE 1 = 1'; - $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')'; - $r++; */ - /* END MODULEBUILDER IMPORT MYOBJECT */ - } + // Imports profiles provided by this module + $r = 1; + /* BEGIN MODULEBUILDER IMPORT MYOBJECT */ + /* + $langs->load("mymodule@mymodule"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='myobject@mymodule'; + $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')'; + $r++; */ + /* END MODULEBUILDER IMPORT MYOBJECT */ + } - /** - * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. - * It also creates data directories - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO - */ - public function init($options = '') - { - global $conf, $langs; + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + global $conf, $langs; - $result = $this->_load_tables('/mymodule/sql/'); - if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + $result = $this->_load_tables('/mymodule/sql/'); + if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') - // Create extrafields during init - //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - //$extrafields = new ExtraFields($this->db); - //$result1=$extrafields->addExtraField('mymodule_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); - //$result2=$extrafields->addExtraField('mymodule_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); - //$result3=$extrafields->addExtraField('mymodule_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); - //$result4=$extrafields->addExtraField('mymodule_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); - //$result5=$extrafields->addExtraField('mymodule_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); + // Create extrafields during init + //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + //$extrafields = new ExtraFields($this->db); + //$result1=$extrafields->addExtraField('mymodule_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); + //$result2=$extrafields->addExtraField('mymodule_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); + //$result3=$extrafields->addExtraField('mymodule_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); + //$result4=$extrafields->addExtraField('mymodule_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); + //$result5=$extrafields->addExtraField('mymodule_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mymodule@mymodule', '$conf->mymodule->enabled'); - // Permissions - $this->remove($options); + // Permissions + $this->remove($options); - $sql = array(); + $sql = array(); - // ODT template - /* - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule'; - $dest=$dirodt.'/template_myobjects.odt'; + // ODT template + /* + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; + $dirodt=DOL_DATA_ROOT.'/doctemplates/mymodule'; + $dest=$dirodt.'/template_myobjects.odt'; - if (file_exists($src) && ! file_exists($dest)) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); - if ($result < 0) - { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); - return 0; - } - } + if (file_exists($src) && ! file_exists($dest)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_mkdir($dirodt); + $result=dol_copy($src, $dest, 0, 0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + return 0; + } + } - $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'mymodule' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','mymodule',".$conf->entity.")" - ); - */ + $sql = array( + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'mymodule' AND entity = ".$conf->entity, + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','mymodule',".$conf->entity.")" + ); + */ - return $this->_init($sql, $options); - } + return $this->_init($sql, $options); + } - /** - * Function called when module is disabled. - * Remove from database constants, boxes and permissions from Dolibarr database. - * Data directories are not deleted - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO - */ - public function remove($options = '') - { - $sql = array(); - return $this->_remove($sql, $options); - } + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') + { + $sql = array(); + return $this->_remove($sql, $options); + } } 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 22be3dee4ed..98c2c94bc7b 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 @@ -47,14 +47,14 @@ class doc_generic_myobject_odt extends ModelePDFMyObject public $emetteur; /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.5 = array(5, 5) - */ + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.5 = array(5, 5) + */ public $phpmin = array(5, 5); /** - * @var string Dolibarr version of the loaded document - */ + * @var string Dolibarr version of the loaded document + */ public $version = 'dolibarr'; @@ -63,12 +63,12 @@ class doc_generic_myobject_odt extends ModelePDFMyObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct($db) { global $conf, $langs, $mysoc; // Load translation files required by the page - $langs->loadLangs(array("main", "companies")); + $langs->loadLangs(array("main", "companies")); $this->db = $db; $this->name = "ODT templates"; @@ -108,12 +108,12 @@ class doc_generic_myobject_odt extends ModelePDFMyObject * @param Translate $langs Lang object to use for output * @return string Description */ - public function info($langs) + public function info($langs) { global $conf, $langs; // Load translation files required by the page - $langs->loadLangs(array("errors", "companies")); + $langs->loadLangs(array("errors", "companies")); $form = new Form($this->db); @@ -170,12 +170,12 @@ class doc_generic_myobject_odt extends ModelePDFMyObject if ($nbofiles) { - $texte .= ''; + $texte .= ''; } $texte .= ''; @@ -191,7 +191,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject return $texte; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -203,9 +203,9 @@ class doc_generic_myobject_odt extends ModelePDFMyObject * @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 + // phpcs:enable global $user, $langs, $conf, $mysoc, $hookmanager; if (empty($srctemplatepath)) @@ -271,8 +271,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); if (!empty($conf->global->MAIN_DOC_USE_TIMING)) { - $format = $conf->global->MAIN_DOC_USE_TIMING; - if ($format == '1') $format = '%Y%m%d%H%M%S'; + $format = $conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } else @@ -304,10 +304,10 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // On peut utiliser le nom de la societe du contact if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { - $socobject = $object->thirdparty; - // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use - $contactobject = $object->contact; - } + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { @@ -338,7 +338,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( 'PATH_TO_TMP' => $conf->commande->dir_temp, @@ -367,7 +367,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array @@ -404,7 +404,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -439,11 +439,11 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog($e->getMessage(), LOG_INFO); } catch (SegmentException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -467,7 +467,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -481,8 +481,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject try { $odfHandler->exportAsAttachedPDF($file); } catch (Exception $e) { - $this->error = $e->getMessage(); - dol_syslog($e->getMessage(), LOG_INFO); + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } @@ -490,8 +490,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject try { $odfHandler->saveToDisk($file); } catch (Exception $e) { - $this->error = $e->getMessage(); - dol_syslog($e->getMessage(), LOG_INFO); + $this->error = $e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index 242ad38c077..ae5f5d1e876 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -98,15 +98,15 @@ class mod_myobject_advanced extends ModeleNumRefMyObject */ public function getExample() { - global $conf, $db, $langs, $mysoc; + global $conf, $db, $langs, $mysoc; - $object = new MyObject($db); - $object->initAsSpecimen(); + $object = new MyObject($db); + $object->initAsSpecimen(); /*$old_code_client = $mysoc->code_client; - $old_code_type = $mysoc->typent_code; - $mysoc->code_client = 'CCCCCCCCCC'; - $mysoc->typent_code = 'TTTTTTTTTT';*/ + $old_code_type = $mysoc->typent_code; + $mysoc->code_client = 'CCCCCCCCCC'; + $mysoc->typent_code = 'TTTTTTTTTT';*/ $numExample = $this->getNextValue($object); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php index 471e09f4f7d..a611b6210bc 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php @@ -57,7 +57,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject public function info() { global $langs; - return $langs->trans("SimpleNumRefModelDesc", $this->prefix); + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); } diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php index 1be39ddde83..06e3498fca0 100644 --- a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php +++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php @@ -38,17 +38,17 @@ $langs->load("mymodule"); $total = 0; $ilink = 0; foreach ($linkedObjectBlock as $key => $objectlink) { - $ilink++; + $ilink++; - $trclass = 'oddeven'; - if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total'; + $trclass = 'oddeven'; + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total'; ?>
    - - - + + + - + diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index dcee9eeaea5..4c5951dad70 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -40,278 +40,278 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceMyModuleTriggers extends DolibarrTriggers { - /** - * @var DoliDB Database handler - */ - protected $db; + /** + * @var DoliDB Database handler + */ + protected $db; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - $this->name = preg_replace('/^Interface/i', '', get_class($this)); - $this->family = "demo"; - $this->description = "MyModule triggers."; - // 'development', 'experimental', 'dolibarr' or version - $this->version = 'development'; - $this->picto = 'mymodule@mymodule'; - } + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "demo"; + $this->description = "MyModule triggers."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; + $this->picto = 'mymodule@mymodule'; + } - /** - * Trigger name - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } + /** + * Trigger name + * + * @return string Name of trigger file + */ + public function getName() + { + return $this->name; + } - /** - * Trigger description - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } + /** + * Trigger description + * + * @return string Description of trigger file + */ + public function getDesc() + { + return $this->description; + } - /** - * Function called when a Dolibarrr business event is done. - * All functions "runTrigger" are triggered if file - * is inside directory core/triggers - * - * @param string $action Event action code - * @param CommonObject $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param Conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) - { - if (empty($conf->mymodule->enabled)) return 0; // If module is not enabled, we do nothing + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file + * is inside directory core/triggers + * + * @param string $action Event action code + * @param CommonObject $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param Conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) + { + if (empty($conf->mymodule->enabled)) return 0; // If module is not enabled, we do nothing - // Put here code you want to execute when a Dolibarr business events occurs. - // Data and type of action are stored into $object and $action + // Put here code you want to execute when a Dolibarr business events occurs. + // Data and type of action are stored into $object and $action - switch ($action) { - // Users - //case 'USER_CREATE': - //case 'USER_MODIFY': - //case 'USER_NEW_PASSWORD': - //case 'USER_ENABLEDISABLE': - //case 'USER_DELETE': - //case 'USER_SETINGROUP': - //case 'USER_REMOVEFROMGROUP': + switch ($action) { + // Users + //case 'USER_CREATE': + //case 'USER_MODIFY': + //case 'USER_NEW_PASSWORD': + //case 'USER_ENABLEDISABLE': + //case 'USER_DELETE': + //case 'USER_SETINGROUP': + //case 'USER_REMOVEFROMGROUP': - // Actions - //case 'ACTION_MODIFY': - //case 'ACTION_CREATE': - //case 'ACTION_DELETE': + // Actions + //case 'ACTION_MODIFY': + //case 'ACTION_CREATE': + //case 'ACTION_DELETE': - // Groups - //case 'USERGROUP_CREATE': - //case 'USERGROUP_MODIFY': - //case 'USERGROUP_DELETE': + // Groups + //case 'USERGROUP_CREATE': + //case 'USERGROUP_MODIFY': + //case 'USERGROUP_DELETE': - // Companies - //case 'COMPANY_CREATE': - //case 'COMPANY_MODIFY': - //case 'COMPANY_DELETE': + // Companies + //case 'COMPANY_CREATE': + //case 'COMPANY_MODIFY': + //case 'COMPANY_DELETE': - // Contacts - //case 'CONTACT_CREATE': - //case 'CONTACT_MODIFY': - //case 'CONTACT_DELETE': - //case 'CONTACT_ENABLEDISABLE': + // Contacts + //case 'CONTACT_CREATE': + //case 'CONTACT_MODIFY': + //case 'CONTACT_DELETE': + //case 'CONTACT_ENABLEDISABLE': - // Products - //case 'PRODUCT_CREATE': - //case 'PRODUCT_MODIFY': - //case 'PRODUCT_DELETE': - //case 'PRODUCT_PRICE_MODIFY': - //case 'PRODUCT_SET_MULTILANGS': - //case 'PRODUCT_DEL_MULTILANGS': + // Products + //case 'PRODUCT_CREATE': + //case 'PRODUCT_MODIFY': + //case 'PRODUCT_DELETE': + //case 'PRODUCT_PRICE_MODIFY': + //case 'PRODUCT_SET_MULTILANGS': + //case 'PRODUCT_DEL_MULTILANGS': - //Stock mouvement - //case 'STOCK_MOVEMENT': + //Stock mouvement + //case 'STOCK_MOVEMENT': - //MYECMDIR - //case 'MYECMDIR_CREATE': - //case 'MYECMDIR_MODIFY': - //case 'MYECMDIR_DELETE': + //MYECMDIR + //case 'MYECMDIR_CREATE': + //case 'MYECMDIR_MODIFY': + //case 'MYECMDIR_DELETE': - // Customer orders - //case 'ORDER_CREATE': - //case 'ORDER_MODIFY': - //case 'ORDER_VALIDATE': - //case 'ORDER_DELETE': - //case 'ORDER_CANCEL': - //case 'ORDER_SENTBYMAIL': - //case 'ORDER_CLASSIFY_BILLED': - //case 'ORDER_SETDRAFT': - //case 'LINEORDER_INSERT': - //case 'LINEORDER_UPDATE': - //case 'LINEORDER_DELETE': + // Customer orders + //case 'ORDER_CREATE': + //case 'ORDER_MODIFY': + //case 'ORDER_VALIDATE': + //case 'ORDER_DELETE': + //case 'ORDER_CANCEL': + //case 'ORDER_SENTBYMAIL': + //case 'ORDER_CLASSIFY_BILLED': + //case 'ORDER_SETDRAFT': + //case 'LINEORDER_INSERT': + //case 'LINEORDER_UPDATE': + //case 'LINEORDER_DELETE': - // Supplier orders - //case 'ORDER_SUPPLIER_CREATE': - //case 'ORDER_SUPPLIER_MODIFY': - //case 'ORDER_SUPPLIER_VALIDATE': - //case 'ORDER_SUPPLIER_DELETE': - //case 'ORDER_SUPPLIER_APPROVE': - //case 'ORDER_SUPPLIER_REFUSE': - //case 'ORDER_SUPPLIER_CANCEL': - //case 'ORDER_SUPPLIER_SENTBYMAIL': - //case 'ORDER_SUPPLIER_DISPATCH': - //case 'LINEORDER_SUPPLIER_DISPATCH': - //case 'LINEORDER_SUPPLIER_CREATE': - //case 'LINEORDER_SUPPLIER_UPDATE': - //case 'LINEORDER_SUPPLIER_DELETE': + // Supplier orders + //case 'ORDER_SUPPLIER_CREATE': + //case 'ORDER_SUPPLIER_MODIFY': + //case 'ORDER_SUPPLIER_VALIDATE': + //case 'ORDER_SUPPLIER_DELETE': + //case 'ORDER_SUPPLIER_APPROVE': + //case 'ORDER_SUPPLIER_REFUSE': + //case 'ORDER_SUPPLIER_CANCEL': + //case 'ORDER_SUPPLIER_SENTBYMAIL': + //case 'ORDER_SUPPLIER_DISPATCH': + //case 'LINEORDER_SUPPLIER_DISPATCH': + //case 'LINEORDER_SUPPLIER_CREATE': + //case 'LINEORDER_SUPPLIER_UPDATE': + //case 'LINEORDER_SUPPLIER_DELETE': - // Proposals - //case 'PROPAL_CREATE': - //case 'PROPAL_MODIFY': - //case 'PROPAL_VALIDATE': - //case 'PROPAL_SENTBYMAIL': - //case 'PROPAL_CLOSE_SIGNED': - //case 'PROPAL_CLOSE_REFUSED': - //case 'PROPAL_DELETE': - //case 'LINEPROPAL_INSERT': - //case 'LINEPROPAL_UPDATE': - //case 'LINEPROPAL_DELETE': + // Proposals + //case 'PROPAL_CREATE': + //case 'PROPAL_MODIFY': + //case 'PROPAL_VALIDATE': + //case 'PROPAL_SENTBYMAIL': + //case 'PROPAL_CLOSE_SIGNED': + //case 'PROPAL_CLOSE_REFUSED': + //case 'PROPAL_DELETE': + //case 'LINEPROPAL_INSERT': + //case 'LINEPROPAL_UPDATE': + //case 'LINEPROPAL_DELETE': - // SupplierProposal - //case 'SUPPLIER_PROPOSAL_CREATE': - //case 'SUPPLIER_PROPOSAL_MODIFY': - //case 'SUPPLIER_PROPOSAL_VALIDATE': - //case 'SUPPLIER_PROPOSAL_SENTBYMAIL': - //case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED': - //case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED': - //case 'SUPPLIER_PROPOSAL_DELETE': - //case 'LINESUPPLIER_PROPOSAL_INSERT': - //case 'LINESUPPLIER_PROPOSAL_UPDATE': - //case 'LINESUPPLIER_PROPOSAL_DELETE': + // SupplierProposal + //case 'SUPPLIER_PROPOSAL_CREATE': + //case 'SUPPLIER_PROPOSAL_MODIFY': + //case 'SUPPLIER_PROPOSAL_VALIDATE': + //case 'SUPPLIER_PROPOSAL_SENTBYMAIL': + //case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED': + //case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED': + //case 'SUPPLIER_PROPOSAL_DELETE': + //case 'LINESUPPLIER_PROPOSAL_INSERT': + //case 'LINESUPPLIER_PROPOSAL_UPDATE': + //case 'LINESUPPLIER_PROPOSAL_DELETE': - // Contracts - //case 'CONTRACT_CREATE': - //case 'CONTRACT_MODIFY': - //case 'CONTRACT_ACTIVATE': - //case 'CONTRACT_CANCEL': - //case 'CONTRACT_CLOSE': - //case 'CONTRACT_DELETE': - //case 'LINECONTRACT_INSERT': - //case 'LINECONTRACT_UPDATE': - //case 'LINECONTRACT_DELETE': + // Contracts + //case 'CONTRACT_CREATE': + //case 'CONTRACT_MODIFY': + //case 'CONTRACT_ACTIVATE': + //case 'CONTRACT_CANCEL': + //case 'CONTRACT_CLOSE': + //case 'CONTRACT_DELETE': + //case 'LINECONTRACT_INSERT': + //case 'LINECONTRACT_UPDATE': + //case 'LINECONTRACT_DELETE': - // Bills - //case 'BILL_CREATE': - //case 'BILL_MODIFY': - //case 'BILL_VALIDATE': - //case 'BILL_UNVALIDATE': - //case 'BILL_SENTBYMAIL': - //case 'BILL_CANCEL': - //case 'BILL_DELETE': - //case 'BILL_PAYED': - //case 'LINEBILL_INSERT': - //case 'LINEBILL_UPDATE': - //case 'LINEBILL_DELETE': + // Bills + //case 'BILL_CREATE': + //case 'BILL_MODIFY': + //case 'BILL_VALIDATE': + //case 'BILL_UNVALIDATE': + //case 'BILL_SENTBYMAIL': + //case 'BILL_CANCEL': + //case 'BILL_DELETE': + //case 'BILL_PAYED': + //case 'LINEBILL_INSERT': + //case 'LINEBILL_UPDATE': + //case 'LINEBILL_DELETE': - //Supplier Bill - //case 'BILL_SUPPLIER_CREATE': - //case 'BILL_SUPPLIER_UPDATE': - //case 'BILL_SUPPLIER_DELETE': - //case 'BILL_SUPPLIER_PAYED': - //case 'BILL_SUPPLIER_UNPAYED': - //case 'BILL_SUPPLIER_VALIDATE': - //case 'BILL_SUPPLIER_UNVALIDATE': - //case 'LINEBILL_SUPPLIER_CREATE': - //case 'LINEBILL_SUPPLIER_UPDATE': - //case 'LINEBILL_SUPPLIER_DELETE': + //Supplier Bill + //case 'BILL_SUPPLIER_CREATE': + //case 'BILL_SUPPLIER_UPDATE': + //case 'BILL_SUPPLIER_DELETE': + //case 'BILL_SUPPLIER_PAYED': + //case 'BILL_SUPPLIER_UNPAYED': + //case 'BILL_SUPPLIER_VALIDATE': + //case 'BILL_SUPPLIER_UNVALIDATE': + //case 'LINEBILL_SUPPLIER_CREATE': + //case 'LINEBILL_SUPPLIER_UPDATE': + //case 'LINEBILL_SUPPLIER_DELETE': - // Payments - //case 'PAYMENT_CUSTOMER_CREATE': - //case 'PAYMENT_SUPPLIER_CREATE': - //case 'PAYMENT_ADD_TO_BANK': - //case 'PAYMENT_DELETE': + // Payments + //case 'PAYMENT_CUSTOMER_CREATE': + //case 'PAYMENT_SUPPLIER_CREATE': + //case 'PAYMENT_ADD_TO_BANK': + //case 'PAYMENT_DELETE': - // Online - //case 'PAYMENT_PAYBOX_OK': - //case 'PAYMENT_PAYPAL_OK': - //case 'PAYMENT_STRIPE_OK': + // Online + //case 'PAYMENT_PAYBOX_OK': + //case 'PAYMENT_PAYPAL_OK': + //case 'PAYMENT_STRIPE_OK': - // Donation - //case 'DON_CREATE': - //case 'DON_UPDATE': - //case 'DON_DELETE': + // Donation + //case 'DON_CREATE': + //case 'DON_UPDATE': + //case 'DON_DELETE': - // Interventions - //case 'FICHINTER_CREATE': - //case 'FICHINTER_MODIFY': - //case 'FICHINTER_VALIDATE': - //case 'FICHINTER_DELETE': - //case 'LINEFICHINTER_CREATE': - //case 'LINEFICHINTER_UPDATE': - //case 'LINEFICHINTER_DELETE': + // Interventions + //case 'FICHINTER_CREATE': + //case 'FICHINTER_MODIFY': + //case 'FICHINTER_VALIDATE': + //case 'FICHINTER_DELETE': + //case 'LINEFICHINTER_CREATE': + //case 'LINEFICHINTER_UPDATE': + //case 'LINEFICHINTER_DELETE': - // Members - //case 'MEMBER_CREATE': - //case 'MEMBER_VALIDATE': - //case 'MEMBER_SUBSCRIPTION': - //case 'MEMBER_MODIFY': - //case 'MEMBER_NEW_PASSWORD': - //case 'MEMBER_RESILIATE': - //case 'MEMBER_DELETE': + // Members + //case 'MEMBER_CREATE': + //case 'MEMBER_VALIDATE': + //case 'MEMBER_SUBSCRIPTION': + //case 'MEMBER_MODIFY': + //case 'MEMBER_NEW_PASSWORD': + //case 'MEMBER_RESILIATE': + //case 'MEMBER_DELETE': - // Categories - //case 'CATEGORY_CREATE': - //case 'CATEGORY_MODIFY': - //case 'CATEGORY_DELETE': - //case 'CATEGORY_SET_MULTILANGS': + // Categories + //case 'CATEGORY_CREATE': + //case 'CATEGORY_MODIFY': + //case 'CATEGORY_DELETE': + //case 'CATEGORY_SET_MULTILANGS': - // Projects - //case 'PROJECT_CREATE': - //case 'PROJECT_MODIFY': - //case 'PROJECT_DELETE': + // Projects + //case 'PROJECT_CREATE': + //case 'PROJECT_MODIFY': + //case 'PROJECT_DELETE': - // Project tasks - //case 'TASK_CREATE': - //case 'TASK_MODIFY': - //case 'TASK_DELETE': + // Project tasks + //case 'TASK_CREATE': + //case 'TASK_MODIFY': + //case 'TASK_DELETE': - // Task time spent - //case 'TASK_TIMESPENT_CREATE': - //case 'TASK_TIMESPENT_MODIFY': - //case 'TASK_TIMESPENT_DELETE': - //case 'PROJECT_ADD_CONTACT': - //case 'PROJECT_DELETE_CONTACT': - //case 'PROJECT_DELETE_RESOURCE': + // Task time spent + //case 'TASK_TIMESPENT_CREATE': + //case 'TASK_TIMESPENT_MODIFY': + //case 'TASK_TIMESPENT_DELETE': + //case 'PROJECT_ADD_CONTACT': + //case 'PROJECT_DELETE_CONTACT': + //case 'PROJECT_DELETE_RESOURCE': - // Shipping - //case 'SHIPPING_CREATE': - //case 'SHIPPING_MODIFY': - //case 'SHIPPING_VALIDATE': - //case 'SHIPPING_SENTBYMAIL': - //case 'SHIPPING_BILLED': - //case 'SHIPPING_CLOSED': - //case 'SHIPPING_REOPEN': - //case 'SHIPPING_DELETE': + // Shipping + //case 'SHIPPING_CREATE': + //case 'SHIPPING_MODIFY': + //case 'SHIPPING_VALIDATE': + //case 'SHIPPING_SENTBYMAIL': + //case 'SHIPPING_BILLED': + //case 'SHIPPING_CLOSED': + //case 'SHIPPING_REOPEN': + //case 'SHIPPING_DELETE': - // and more... + // and more... - default: - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - break; - } + default: + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + break; + } - return 0; - } + return 0; + } } diff --git a/htdocs/modulebuilder/template/css/mymodule.css.php b/htdocs/modulebuilder/template/css/mymodule.css.php index 58987d52b83..af1566c0869 100644 --- a/htdocs/modulebuilder/template/css/mymodule.css.php +++ b/htdocs/modulebuilder/template/css/mymodule.css.php @@ -32,6 +32,11 @@ if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +session_cache_limiter('public'); +// false or '' = keep cache instruction added by server +// 'public' = remove cache instruction added by server +// and if no cache-control added later, a default cache delay (10800) will be added by PHP. + // Load Dolibarr environment $res = 0; // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) @@ -48,14 +53,10 @@ if (!$res) die("Include of main fails"); require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -session_cache_limiter('public'); -// false or '' = keep cache instruction added by server -// 'public' = remove cache instruction added by server and if no cache-control added later, a default cache delay (10800) will be added by PHP. - // Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS /*if (empty($user->id) && ! empty($_SESSION['dol_login'])) { - $user->fetch('',$_SESSION['dol_login']); + $user->fetch('',$_SESSION['dol_login']); $user->getrights(); }*/ @@ -70,10 +71,10 @@ else header('Cache-Control: no-cache'); ?> div.mainmenu.mymodule::before { - content: "\f249"; + content: "\f249"; } div.mainmenu.mymodule { - background-image: none; + background-image: none; } .myclasscss { diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index 2d9bdf2f1e6..4a3356f1d7e 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -88,7 +88,7 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) $langs->load("orders"); $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; - $sql.= ", s.code_client"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -117,21 +117,21 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) $obj = $db->fetch_object($resql); print ''; + $orderstatic->id=$obj->rowid; + $orderstatic->ref=$obj->ref; + $orderstatic->ref_client=$obj->ref_client; + $orderstatic->total_ht = $obj->total_ht; + $orderstatic->total_tva = $obj->total_tva; + $orderstatic->total_ttc = $obj->total_ttc; + print $orderstatic->getNomUrl(1); + print ''; print ''; print ''; @@ -172,7 +172,7 @@ $max = 3; if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) { $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas"; - $sql.= ", s.code_client"; + $sql.= ", s.code_client"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 2, 3)"; @@ -192,7 +192,7 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) print ''; print ''; print ''; @@ -205,9 +205,9 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) $companystatic->id=$objp->rowid; $companystatic->name=$objp->name; $companystatic->client=$objp->client; - $companystatic->code_client = $objp->code_client; - $companystatic->code_fournisseur = $objp->code_fournisseur; - $companystatic->canvas=$objp->canvas; + $companystatic->code_client = $objp->code_client; + $companystatic->code_fournisseur = $objp->code_fournisseur; + $companystatic->canvas=$objp->canvas; print ''; print ''; print ''; + print ''; print ''; // Opportunity probability - print ''; - print ''; + print ''; print ''; // Opportunity amount - print ''; - print ''; + print ''; + print ''; print ''; } // Budget print ''; - print ''; + print ''; print ''; // Description @@ -667,7 +680,7 @@ if ($action == 'create' && $user->rights->projet->creer) print '"; } @@ -833,9 +846,22 @@ elseif ($object->id > 0) print ''; + print ''; print ''; // Opportunity probability - print ''; - print ''; + print ''; print ''; // Opportunity amount - print ''; - print ''; + print ''; + print ''; print ''; } @@ -923,7 +950,7 @@ elseif ($object->id > 0) // Budget print ''; - print ''; + print ''; print ''; // Description @@ -936,14 +963,14 @@ elseif ($object->id > 0) // Tags-Categories if ($conf->categorie->enabled) { - print '"; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 674db2cc5d6..417a825a77d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -68,7 +68,7 @@ class Project extends CommonObject /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'projectpub'; + public $picto = 'project'; /** * {@inheritdoc} @@ -1026,24 +1026,28 @@ class Project extends CommonObject } /** - * Return clicable name (with picto eventually) + * Return clickable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param string $option Variant ('', 'nolink') + * @param string $option Variant where the link point to ('', 'nolink') * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @param string $moreinpopup Text to add into popup * @param string $sep Separator between ref and label if option addlabel is set * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param string $morecss More css on a link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $addlabel = 0, $moreinpopup = '', $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $addlabel = 0, $moreinpopup = '', $sep = ' - ', $notooltip = 0, $save_lastsearch_value = -1, $morecss = '') { global $conf, $langs, $user, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $result = ''; + if (! empty($conf->global->PROJECT_OPEN_ALWAYS_ON_TAB)) { + $option = $conf->global->PROJECT_OPEN_ALWAYS_ON_TAB; + } $label = ''; if ($option != 'nolink') $label = ''.$langs->trans("Project").''; @@ -1073,6 +1077,10 @@ class Project extends CommonObject { $url = DOL_URL_ROOT.'/projet/tasks.php?id='.$this->id; } + elseif ($option == 'preview') + { + $url = DOL_URL_ROOT.'/projet/element.php?id='.$this->id; + } else { $url = DOL_URL_ROOT.'/projet/card.php?id='.$this->id; @@ -1108,6 +1116,7 @@ class Project extends CommonObject if (!$this->public) $picto = 'project'; $linkstart = ''; $linkend = ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 34dace09e93..23fa6551656 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -526,6 +526,32 @@ $listofreferent = array( */ ); +// Change rules for benefit calculation +if (! empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) { + foreach($listofreferent as $key => $element) { + if ($listofreferent[$key]['margin'] == 'add') { + unset($listofreferent[$key]['margin']); + } + } + $newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN); + foreach($newelementforplusmargin as $value) { + $listofreferent[$value]['margin']='add'; + } +} +if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { + foreach($listofreferent as $key => $element) { + if ($listofreferent[$key]['margin'] == 'add') { + unset($listofreferent[$key]['margin']); + } + } + $newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN); + foreach($newelementforplusmargin as $value) { + $listofreferent[$value]['margin']='minus'; + } +} + + + $parameters = array('listofreferent'=>$listofreferent); $resHook = $hookmanager->executeHooks('completeListOfReferent', $parameters, $object, $action); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index df6d5b3a13f..f9cab81f43c 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -116,7 +116,7 @@ if ($resql) $listofoppstatus[$objp->rowid] = $objp->percent; $listofopplabel[$objp->rowid] = $objp->label; $listofoppcode[$objp->rowid] = $objp->code; - switch($objp->code) { + switch ($objp->code) { case 'PROSP': $colorseries[$objp->rowid] = "-".$badgeStatus0; break; @@ -318,7 +318,7 @@ if ($resql) } print ''; - print ''; - print ''; - print ''; - print ''; - print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 67131c29ef4..0aefa412571 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -45,12 +45,14 @@ $id = GETPOST('id', 'int'); $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_categ = GETPOST("search_categ", 'alpha'); $search_project = GETPOST('search_project'); -if (!isset($_GET['search_projectstatus']) && !isset($_POST['search_projectstatus'])) + +$search_projectstatus = GETPOST('search_projectstatus'); +if (!isset($search_projectstatus) || $search_projectstatus === '') { if ($search_all != '') $search_projectstatus = -1; else $search_projectstatus = 1; } -else $search_projectstatus = GETPOST('search_projectstatus'); + $search_project_ref = GETPOST('search_project_ref'); $search_project_title = GETPOST('search_project_title'); $search_task_ref = GETPOST('search_task_ref'); @@ -441,7 +443,7 @@ else else $texthelp .= $langs->trans("TasksOnProjectsPublicDesc"); } -print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'projecttask', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "task"; @@ -886,7 +888,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index c758664d2c6..bbb275ef5df 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -67,7 +67,7 @@ llxHeader('', $langs->trans('Tasks')); $title = $langs->trans("TasksStatistics"); $dir = $conf->projet->dir_output.'/temp'; -print load_fiche_titre($title, '', 'project'); +print load_fiche_titre($title, '', 'projecttask'); dol_mkdir($dir); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index ea74482b4a1..78f5039fe8a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -270,7 +270,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel $object->timespent_note = $_POST["timespent_note_line"]; $object->timespent_old_duration = $_POST["old_duration"]; $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += $_POST["new_durationmin"] * 60; // We store duration in seconds + $object->timespent_duration += ($_POST["new_durationmin"] ? $_POST["new_durationmin"] : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); @@ -1377,10 +1377,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } } - // User + // By User if (!empty($arrayfields['author']['checked'])) { - print ''; @@ -1501,7 +1501,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) */ // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/public/demo/demo.css b/htdocs/public/demo/demo.css index 9328a8ecd1b..b185f8c933f 100644 --- a/htdocs/public/demo/demo.css +++ b/htdocs/public/demo/demo.css @@ -105,8 +105,11 @@ img.demothumb { object-fit: contain; height: 140px; background-position-y: bottom; + background-position-x: right; +} +.demologo { + width: 200px; } - @media only screen and (max-width: 767px) { diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index c470055dbce..f0caf948770 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -274,13 +274,13 @@ print "\n"; print '
    '; print '
    '; -print ''; +print ''; print '
    '; print '
    '; print '
    '; print '
    '; -print '
    '.$langs->trans("DemoDesc").'

    '; +print '
    '.$langs->trans("DemoDesc").'

    '; print '
    '.$langs->trans("ChooseYourDemoProfil").'
    '; print '
    '; print '
    '; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 5b456893bf9..7f788a84671 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -113,9 +113,9 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); $width = 150; } - elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) + elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; $width = 150; } @@ -130,7 +130,7 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 195a7560631..04fe1f75fca 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -66,7 +66,7 @@ $extrafields = new ExtraFields($db); $morehead = ''; if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = ''; -else $morehead = ''; +else $morehead = ''; llxHeaderVierge($langs->trans("MemberCard"), $morehead); diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 0514c5ad565..459926707b8 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -101,7 +101,7 @@ $form = new Form($db); $morehead = ''; if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = ''; -else $morehead = ''; +else $morehead = ''; llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 83e757b78f8..2378728a8d3 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -191,7 +191,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index ef5458456c5..d0ce716bb7d 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -690,7 +690,7 @@ if ($object->allow_spy) { if (strpos($toutsujet[$i], '@') !== false) { $toutsujetdate = explode("@", $toutsujet[$i]); - $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').')'.' - '.$toutsujetdate[1]; + $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').') - '.$toutsujetdate[1]; } else { $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').' ('.dol_print_date($toutsujet[$i], '%A').')'; } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c3e6553cf92..ea7fd71c9e6 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -793,7 +793,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } @@ -1719,7 +1719,7 @@ if ($action != 'dopayment') if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) { - print '
    '; + print '
    '; print '
    '; print ''.$langs->trans("CreditOrDebitCard").''; print '
    '; @@ -1739,7 +1739,7 @@ if ($action != 'dopayment') if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled)) { - print '
    '; + print '
    '; print ''; print '
    '; print ''.$langs->trans("CreditOrDebitCard").''; @@ -1763,7 +1763,11 @@ if ($action != 'dopayment') { if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral'; - print '
    '; + print '
    '; + if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY != 'integral') { + print '
     
    '; + } + print ' '; if ($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY == 'integral') { print '
    '; @@ -1924,7 +1928,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment print '
    '; print ''; - print ''; + print ''; print '
    '; print '
    '; + print ''; $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + print ''; print ''; - print ''; + print ''; + print ''; } else { print ''.$langs->trans("FileNotYetGenerated").''; - print ''; + print ''; + print ''; } print ''; } @@ -3163,6 +3168,14 @@ elseif (!empty($module)) print '
    '; print '
    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; @@ -3113,13 +3116,15 @@ elseif (!empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').''.img_picto($langs->trans("Edit"), 'edit').' '; + print ''.img_picto($langs->trans("Delete"), 'delete').'
    '; + + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + print ''; + if (!empty($triggers)) { foreach ($triggers as $trigger) @@ -3171,7 +3184,7 @@ elseif (!empty($module)) print ''; + print ''; print ''; print ''; } @@ -3180,9 +3193,11 @@ elseif (!empty($module)) { print ''; + print ''; + print ''; print ''; } + print '
    '; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print '
    '; print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
    '; print ' '.$langs->trans("NoTrigger"); - print '
    '; } else @@ -3227,7 +3242,7 @@ elseif (!empty($module)) if (dol_is_file($dirins.'/'.$pathtohook)) { print ''.$pathtohook.''; - print '
    '.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
    '.$langs->trans("WidgetFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').'
    '; print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
    trans("MyObject"); ?>getNomUrl(1); ?>trans("MyObject"); ?>getNomUrl(1); ?> date, 'day'); ?> getLibStatut(7); ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
    '; - $orderstatic->id=$obj->rowid; - $orderstatic->ref=$obj->ref; - $orderstatic->ref_client=$obj->ref_client; - $orderstatic->total_ht = $obj->total_ht; - $orderstatic->total_tva = $obj->total_tva; - $orderstatic->total_ttc = $obj->total_ttc; - print $orderstatic->getNomUrl(1); - print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; - $companystatic->code_client = $obj->code_client; - $companystatic->code_fournisseur = $obj->code_fournisseur; - $companystatic->canvas=$obj->canvas; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1,'customer',16); print ''.price($obj->total_ttc).'
    '; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max); - else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max); + else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max); else print $langs->trans("BoxTitleLastModifiedCustomers",$max); print ''.$langs->trans("DateModificationShort").'
    '.$companystatic->getNomUrl(1,'customer',48).''; diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 89efa438de9..9b71971b6cf 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -56,12 +56,12 @@ $backtopage = GETPOST('backtopage', 'alpha'); if (GETPOST('actioncode', 'array')) { - $actioncode = GETPOST('actioncode', 'array', 3); - if (!count($actioncode)) $actioncode = '0'; + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) $actioncode = '0'; } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); + $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -106,19 +106,19 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - // Cancel - if (GETPOST('cancel', 'alpha') && !empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } + // Cancel + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } - // Purge search criteria - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers - { - $actioncode = ''; - $search_agenda_label = ''; - } + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers + { + $actioncode = ''; + $search_agenda_label = ''; + } } @@ -148,53 +148,51 @@ if ($object->id > 0) $morehtmlref = '
    '; /* - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
    '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - $morehtmlref.='
    '.$langs->trans('Project') . ' '; - if ($permissiontoadd) - { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
    '; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
    '; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } - } - }*/ + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
    '.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
    '.$langs->trans('Project') . ' '; + if ($permissiontoadd) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
    '; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
    '; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ': '.$proj->getNomUrl(); + } else { + $morehtmlref .= ''; + } + } + }*/ $morehtmlref .= '
    '; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
    '; - print '
    '; + print '
    '; + print '
    '; - $object->info($object->id); + $object->info($object->id); dol_print_object_info($object, 1); print '
    '; @@ -205,54 +203,54 @@ if ($object->id > 0) // Actions buttons - $objthirdparty = $object; - $objcon = new stdClass(); + $objthirdparty = $object; + $objcon = new stdClass(); - $out = '&origin='.$object->element.'&originid='.$object->id; - $permok = $user->rights->agenda->myactions->create; - if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) - { - //$out.='trans("AddAnAction"),'filenew'); - //$out.=""; + $out = '&origin='.$object->element.'&originid='.$object->id; + $permok = $user->rights->agenda->myactions->create; + if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) + { + //$out.='trans("AddAnAction"),'filenew'); + //$out.=""; } print '
    '; - if (!empty($conf->agenda->enabled)) - { - if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) - { - print ''.$langs->trans("AddAction").''; - } - else - { - print ''.$langs->trans("AddAction").''; - } - } + if (!empty($conf->agenda->enabled)) + { + if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } + } - print '
    '; + print '
    '; - if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) - { - $param = '&id='.$object->id.'&socid='.$socid; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) + { + $param = '&id='.$object->id.'&socid='.$socid; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); - // List of all actions + // List of all actions $filters = array(); - $filters['search_agenda_label'] = $search_agenda_label; + $filters['search_agenda_label'] = $search_agenda_label; - // TODO Replace this with same code than into list.php - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); - } + // TODO Replace this with same code than into list.php + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + } } // End of page diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index e299fec88c5..e92c88f1364 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -127,47 +127,47 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - $error = 0; + $error = 0; - $backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1); + $backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1); - if (empty($backtopage) || ($cancel && empty($id))) { - if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; - else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); - } - } - $triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + } + } + $triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record - // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; - // Actions when linking object each other - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; - // Actions when printing a doc from card - include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; - // Action to move up and down lines of object - //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; + // Action to move up and down lines of object + //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; - // Action to build doc - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + // Action to build doc + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - if ($action == 'set_thirdparty' && $permissiontoadd) - { - $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY'); - } - if ($action == 'classin' && $permissiontoadd) - { - $object->setProject(GETPOST('projectid', 'int')); - } + if ($action == 'set_thirdparty' && $permissiontoadd) + { + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY'); + } + if ($action == 'classin' && $permissiontoadd) + { + $object->setProject(GETPOST('projectid', 'int')); + } - // Actions to send emails - $triggersendname = 'MYOBJECT_SENTBYMAIL'; - $autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; - $trackid = 'myobject'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + // Actions to send emails + $triggersendname = 'MYOBJECT_SENTBYMAIL'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; + $trackid = 'myobject'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -182,7 +182,9 @@ if (empty($reshook)) $form = new Form($db); $formfile = new FormFile($db); -llxHeader('', $langs->trans('MyObject'), ''); +$title = $langs->trans("MyObject"); +$help_url = ''; +llxHeader('', $title, $help_url); // Example : Adding jquery code print ''; print '
    '; } if (empty($conf->global->PROJECT_HIDE_TASKS)) @@ -567,7 +580,7 @@ if ($action == 'create' && $user->rights->projet->creer) print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
    '; } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print ' '; $htmltext = $langs->trans("ProjectBillTimeDescription"); @@ -591,7 +604,7 @@ if ($action == 'create' && $user->rights->projet->creer) print '
    '; $filteronlist = ''; if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; - $text = $form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300'); + $text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusx'); if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) { $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty"); @@ -632,27 +645,27 @@ if ($action == 'create' && $user->rights->projet->creer) if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { // Opportunity status - print '
    '.$langs->trans("OpportunityStatus").'
    '.$langs->trans("OpportunityStatus").''; print $formproject->selectOpportunityStatus('opp_status', GETPOST('opp_status') ?GETPOST('opp_status') : $object->opp_status); print '
    '.$langs->trans("OpportunityProbability").' %'; - print ''; + print '
    '.$langs->trans("OpportunityProbability").' %'; + print ''; print '
    '.$langs->trans("OpportunityAmount").'
    '.$langs->trans("OpportunityAmount").'
    '.$langs->trans("Budget").'
    '.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1); $arrayselected = GETPOST('categories', 'array'); - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print "
    '; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print ''; print '
    '; } if (empty($conf->global->PROJECT_HIDE_TASKS)) @@ -845,7 +871,7 @@ elseif ($object->id > 0) print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
    '; } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); @@ -884,8 +910,9 @@ elseif ($object->id > 0) if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $classfortr = ($object->usage_opportunity ? '' : ' hideobject'); // Opportunity status - print '
    '.$langs->trans("OpportunityStatus").'
    '.$langs->trans("OpportunityStatus").''; print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'inline-block valignmiddle'); print '
    '.$langs->trans("OpportunityProbability").' %'; + print '
    '.$langs->trans("OpportunityProbability").' %'; print ''; print '
    '.$langs->trans("OpportunityAmount").'
    '.$langs->trans("OpportunityAmount").'
    '.$langs->trans("Budget").'
    '.$langs->trans("Categories").''; + print '
    '.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_PROJECT); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, '0'); print "
    '; + print ''; if ($obj->socid) { $companystatic->id = $obj->socid; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 26b00bae2a9..43d0e0b7f7f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -713,7 +713,7 @@ while ($i < min($num, $limit)) $object->public = $obj->public; $object->ref = $obj->ref; $object->datee = $db->jdate($obj->date_end); - $object->statut = $obj->status; // deprecated + $object->statut = $obj->status; // deprecated $object->status = $obj->status; $object->public = $obj->public; $object->opp_status = $obj->fk_opp_status; @@ -919,7 +919,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index cb004bc33a0..ebc6a7dc556 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -499,7 +499,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third { if ($id > 0 || !empty($ref)) print '
    '; - print load_fiche_titre($langs->trans("NewTask"), '', 'project'); + print load_fiche_titre($langs->trans("NewTask"), '', 'projecttask'); if ($object->statut == Project::STATUS_CLOSED) { diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 0c9a09b37c0..415859127db 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -395,11 +395,11 @@ if ($id > 0 || !empty($ref)) print img_object('', 'user').' '.$langs->trans("Users"); print '
    '; + print ''; print $conf->global->MAIN_INFO_SOCIETE_NOM; print ''; + print ''; // On recupere les id des users deja selectionnes if ($object->project->public) $contactsofproject = ''; // Everybody else $contactsofproject = $projectstatic->getListContactId('internal'); @@ -430,13 +430,13 @@ if ($id > 0 || !empty($ref)) print img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts"); print ''; + print ''; $thirdpartyofproject = $projectstatic->getListContactId('thirdparty'); $selectedCompany = isset($_GET["newcompany"]) ? $_GET["newcompany"] : $projectstatic->socid; $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, '&withproject='.$withproject); print ''; + print ''; $contactofproject = $projectstatic->getListContactId('external'); $nbofcontacts = $form->select_contacts($selectedCompany, '', 'contactid', 0, '', $contactofproject); print ''; + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { if (empty($object->id)) $object->fetch($id); @@ -1390,7 +1390,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } if (count($contactsoftask) > 0) { print img_object('', 'user', 'class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); + print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'maxwidth200'); } else { print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); } @@ -1452,7 +1452,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Value spent if (!empty($arrayfields['value']['checked'])) { - print ''; + print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); print price($value, 1, $langs, 1, -1, -1, $conf->currency); print '
    '; diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 2610219d69d..a3f6d733fcb 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -245,7 +245,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 6b7805cf473..b1d6c149a51 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -181,7 +181,7 @@ if ($urllogo) print '>'; print ''; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/public/stripe/confirm_payment.php b/htdocs/public/stripe/confirm_payment.php index 25cb358ccea..9a45a2cbeec 100644 --- a/htdocs/public/stripe/confirm_payment.php +++ b/htdocs/public/stripe/confirm_payment.php @@ -129,8 +129,8 @@ try { )); } -/* - * generate payment response +/** + * Generate payment response * * @param \Stripe\PaymentIntent $intent PaymentIntent * @return void diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 8a3bb00e765..4291cb6f834 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -111,54 +111,54 @@ $user = new User($db); $user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); $user->getrights(); -if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc)) +if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc)) { $sql = "SELECT entity"; - $sql.= " FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql.= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'"; + $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token"; + $sql .= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'"; - dol_syslog(get_class($db) . "::fetch", LOG_DEBUG); + dol_syslog(get_class($db)."::fetch", LOG_DEBUG); $result = $db->query($sql); if ($result) { if ($db->num_rows($result)) { $obj = $db->fetch_object($result); - $key=$obj->entity; + $key = $obj->entity; } else { - $key=1; + $key = 1; } } else { - $key=1; + $key = 1; } - $ret=$mc->switchEntity($key); - if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; - if (! $res) die("Include of main fails"); + $ret = $mc->switchEntity($key); + if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; + if (!$res) die("Include of main fails"); } // list of action -$stripe=new Stripe($db); +$stripe = new Stripe($db); // Subject $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; dol_syslog("***** Stripe IPN was called with event->type = ".$event->type); if ($event->type == 'payout.created') { - $error=0; + $error = 0; - $result=dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); if ($result > 0) { $subject = $societeName.' - [NOTIFICATION] Stripe payout scheduled'; if (!empty($user->email)) { - $sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">"; + $sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">"; } else { $sendto = $conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; } diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 881f6c05691..40e6e55cb33 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -235,7 +235,7 @@ if ($action == "view_ticketlist") if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate') { - $arrayfields["ef.".$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => $extrafields->attributes[$object->table_element]['list'][$key], 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' => $extrafields->attributes[$object->table_element]['perms'][$key]); + $arrayfields["ef.".$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'checked' => ($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1, 'position' => $extrafields->attributes[$object->table_element]['pos'][$key], 'enabled' =>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3) && $extrafields->attributes[$object->table_element]['perms'][$key]); } } } diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 1938c68de3e..af656e69ab0 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -370,7 +370,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a } // Message list - print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket'); + print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'object_conversation'); $object->viewTicketMessages(false, true, $object->dao); } else diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 9c6e8df76f1..3d8547f9322 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1858,7 +1858,7 @@ elseif ($id || $ref) print ''; print '
    '.''.''.$formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'
    '.''.''.''.'
    '.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id)); + print $form->select_country((GETPOST('country_id') != '' ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
    '.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.img_picto('', 'object_phoning').'
    '.$form->editfieldkey('Fax', 'fax', '', $object, 0).''.img_picto('', 'object_phoning_fax').'
    '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).''.img_picto('', 'object_email').'
    '.img_picto('', 'object_email').'
    '.$form->editfieldkey('Web', 'url', '', $object, 0).''.img_picto('', 'globe').'
    '.img_picto('', 'globe').'
    '.$form->editfieldkey('Skype', 'skype', '', $object, 0).''; - // print 'skype).'">'; - // print '
    '.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).''; - // print 'twitter).'">'; - // print '
    '.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; - // print 'facebook).'">'; - // print '
    '.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).''; - // print 'linkedin).'">'; - // print '
    '.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).'
    '.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1 : 0), 1); - print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print '
    '.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2 : 0), 1); print '
    '.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''."\n"; + print '
    '.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"': '').'>'."\n"; $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
    '.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; + print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"': '').'>'; print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
    '; print $formcompany->selectProspectCustomerType($object->client); print '
    '.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print ''; - print ''; + print ''; + if ($conf->browser->layout == 'phone') print ''; print ''; + print ''; print ''; // Numbering module diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index f3b5ba15716..d1f59325c1f 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -142,4 +142,10 @@ elseif ($action == 'search' && $term != '') { } echo json_encode($object); +} elseif ($action == 'thecheck') { + $place = GETPOST('place', 'alpha'); + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; + $printer = new dolReceiptPrinter($db); + $printer->sendToPrinter($object, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term}); } diff --git a/htdocs/takepos/css/phone.css b/htdocs/takepos/css/phone.css index 49d833ade17..0f3606071f0 100644 --- a/htdocs/takepos/css/phone.css +++ b/htdocs/takepos/css/phone.css @@ -79,3 +79,31 @@ button.phonebutton { height:90%; font-weight: bold; } + +button.publicphonebutton { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ + width:33%; + height:90%; + font-weight: bold; +} + +button.publicphonebutton2 { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ + width:33%; + font-weight: bold; + padding: 8px 16px; +} diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 5f0006d24fe..6871fcbd68b 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -591,6 +591,9 @@ div#moreinfo, div#infowarehouse { height: calc(45% - 100px); } + div#moreinfo, div#infowarehouse { + padding: 0 5px 0 5px; + } div.div1 { padding-bottom: 0; diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index a5686054193..e668b01aacb 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -25,7 +25,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -require '../../main.inc.php'; // Load $user and permissions +if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../../main.inc.php'; // Load $user and permissions $id = GETPOST('id', 'int'); $w = GETPOST('w', 'int'); @@ -72,12 +72,12 @@ elseif ($query == "pro") $objProd = new Product($db); $objProd->fetch($id); - $image = $objProd->show_photos('product', $conf->product->multidir_output[$entity], 'small', 1); + $image = $objProd->show_photos('product', $conf->product->multidir_output[$objProd->entity], 'small', 1); preg_match('@src="([^"]+)"@', $image, $match); $file = array_pop($match); if ($file == "") header('Location: ../../public/theme/common/nophoto.png'); - else header('Location: '.$file.'&cache=1'); + else header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product'); } else { diff --git a/htdocs/takepos/genimg/qr.php b/htdocs/takepos/genimg/qr.php new file mode 100644 index 00000000000..3aca3b22ebf --- /dev/null +++ b/htdocs/takepos/genimg/qr.php @@ -0,0 +1,36 @@ + + * + * 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 . + */ + +if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); + +require '../../main.inc.php'; // Load $user and permissions +require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php'; + +$key = GETPOST('key'); + +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + +$module = new modTcpdfbarcode(); +$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y'); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 0688d4a8584..dbc68afeaf4 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -756,8 +756,13 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
    -
    - trans("Terminal")." "; +
    '; + $htmlforlines .= '
    '.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'
    '; $htmlforlines .= ''."\n"; } $htmlforlines .= '
    '; @@ -1914,15 +1881,18 @@ else || (!empty($conf->supplier_proposal->enabled) && !empty($user->rights->supplier_proposal->lire))) { print '
    '.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; + print ''.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; print $form->selectyesno("fournisseur", $object->fournisseur, 1); print '
    '; if (!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire)) { print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); } - print ''; + print ''; print ''; + if ($conf->browser->layout == 'phone') print ''; + print ''; @@ -1979,7 +1951,7 @@ else // Country print ''; @@ -2001,15 +1973,16 @@ else // Phone / Fax print ''; - print ''; + print ''; + if ($conf->browser->layout == 'phone') print ''; print ''; - print ''; + print ''; // EMail / Web print ''; - print ''; + print ''; print ''; - print ''; + print ''; if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -2025,36 +1998,9 @@ else } } } - // if (! empty($conf->socialnetworks->enabled)) - // { - // // Skype - // if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) - // { - // print ''; - // print ''; - // } - // // Twitter - // if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) - // { - // print ''; - // print ''; - // } - // // Facebook - // if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - // { - // print ''; - // print ''; - // } - // // LinkedIn - // if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) - // { - // print ''; - // print ''; - // } - // } // Prof ids - $i = 1; $j = 0; + $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); while ($i <= 6) { $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); @@ -2062,18 +2008,18 @@ else { $key = 'idprof'.$i; - if (($j % 2) == 0) print ''; + if (($j % $NBCOLS) == 0) print ''; $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY'; print ''; - if (($j % 2) == 1) print ''; + if (($j % $NBCOLS) == ($NBCOLS - 1)) print ''; $j++; } $i++; } - if ($j % 2 == 1) print ''; + if ($NBCOLS > 0 && $j % 2 == 1) print ''; // VAT is used print ''; - + if ($conf->browser->layout == 'phone') print ''; print ''; + if ($conf->browser->layout == 'phone') print ''; print ''; $statstring .= ""; } - if (!empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) { $statstring2 = ""; $statstring2 .= ''; @@ -310,7 +310,7 @@ if ($result) $thirdparty_static->name = $langs->trans("Prospect"); print $thirdparty_static->getNomUrl(0, 'prospect', 0, 1); } - if (!empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $thirdparty_static->fournisseur) { if ($thirdparty_static->client) print " / "; $thirdparty_static->name = $langs->trans("Supplier"); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 3d72fb1cdd3..1df7c38d6c5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -179,9 +179,9 @@ $arrayfields = array( 's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1), 's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), 's.code_client'=>array('label'=>"CustomerCodeShort", 'position'=>10, 'checked'=>$checkedcustomercode), - 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled))), + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode), - 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled))), + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>1), 's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1), 'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0), @@ -1153,12 +1153,12 @@ while ($i < min($num, $limit)) } if (!empty($arrayfields['s.phone']['checked'])) { - print "\n"; + print "\n"; if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['s.fax']['checked'])) { - print "\n"; + print "\n"; if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['s.url']['checked'])) @@ -1225,7 +1225,7 @@ while ($i < min($num, $limit)) $companystatic->name_alias = ''; $s .= $companystatic->getNomUrl(0, 'prospect', 0, 1); } - if ((!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) && $obj->fournisseur) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) { if ($s) $s .= ", "; $companystatic->name = $langs->trans("Supplier"); @@ -1276,7 +1276,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index d440930bbf5..6385346ce5d 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1138,11 +1138,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''.$langs->trans("CreateCardOnStripe").''; } - print ''; + print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; print ' '; - print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& + print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& print img_picto($langs->trans("Delete"), 'delete'); print ''; } @@ -1547,13 +1547,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '\n"; @@ -362,7 +362,7 @@ if (is_array($formmail->lines_model)) { if (!empty($arrayofmessagename[$modelmail->label])) { $moreonlabel = ' ('.$langs->trans("SeveralLangugeVariatFound").')'; } - $arrayofmessagename[$modelmail->label] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)).$moreonlabel; + $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->topic)).$moreonlabel; } } //var_dump($arraydefaultmessage); @@ -434,19 +434,6 @@ print "\n"; //print $form->selectarray('TAKEPOS_ADDON', $array, (empty($conf->global->TAKEPOS_ADDON) ? '0' : $conf->global->TAKEPOS_ADDON), 0); //print "\n"; -print '
    '; if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { @@ -1971,7 +1941,9 @@ else // Zip / Town print '
    '.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone'); - print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; + print '
    '.$form->editfieldkey('Town', 'town', '', $object, 0).''; print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent'); print '
    '.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id'); + print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
    '.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).''.img_picto('', 'object_phoning').' '.img_picto('', 'object_phoning').'
    '.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''.img_picto('', 'object_phoning_fax').'
    '.img_picto('', 'object_phoning_fax').'
    '.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''.img_picto('', 'object_email').'
    '.img_picto('', 'object_email').'
    '.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).''.img_picto('', 'globe').'
    '.img_picto('', 'globe').'
    '.$form->editfieldkey('Skype', 'skype', '', $object, 0).'
    '.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'
    '.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'
    '.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'
    '.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', !(empty($conf->global->$idprof_mandatory) || !$object->isACompany())).''; print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print '
    '.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; @@ -2093,7 +2039,7 @@ else print ''; } print '
    '.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); if (!isOnlyOneLocalTax(2)) @@ -2167,6 +2113,7 @@ else print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
    '.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); @@ -2826,7 +2773,7 @@ else $MAXEVENT = 10; - $morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id); + $morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt 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/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 8d004fa4c79..91d0fe9bb1a 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -28,13 +28,12 @@ require_once NUSOAP_PATH.'/nusoap.php'; $langs->load("companies"); //http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl -$WS_DOL_URL = 'http://ec.europa.eu/taxation_customs/vies/services/checkVatService'; +$WS_DOL_URL = 'https://ec.europa.eu/taxation_customs/vies/services/checkVatService'; //$WS_DOL_URL_WSDL=$WS_DOL_URL.'?wsdl'; -$WS_DOL_URL_WSDL = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'; +$WS_DOL_URL_WSDL = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'; $WS_METHOD = 'checkVat'; - $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 1100432c854..c50a746c444 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -129,7 +129,7 @@ class Thirdparties extends DolibarrApi $sql .= " FROM ".MAIN_DB_PREFIX."societe as t"; if ($category > 0) { if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c"; - if (!in_array($mode, array(1,2,3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc"; + if (!in_array($mode, array(1, 2, 3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc"; } if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c35b17fe4fa..de65e05d41e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3623,7 +3623,7 @@ class Societe extends CommonObject $this->phone = $member->phone; // Prof phone $this->email = $member->email; $this->socialnetworks = $member->socialnetworks; - $this->entity=$member->entity; + $this->entity = $member->entity; $this->client = 1; // A member is a customer by default $this->code_client = ($customercode ? $customercode : -1); @@ -3745,6 +3745,13 @@ class Societe extends CommonObject $this->instagram_url = empty($conf->global->MAIN_INFO_SOCIETE_INSTAGRAM_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_INSTAGRAM_URL; $this->youtube_url = empty($conf->global->MAIN_INFO_SOCIETE_YOUTUBE_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_YOUTUBE_URL; $this->github_url = empty($conf->global->MAIN_INFO_SOCIETE_GITHUB_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_GITHUB_URL; + $this->socialnetworks = array(); + if (! empty($this->facebook_url)) $this->socialnetworks['facebook'] = $this->facebook_url; + if (! empty($this->twitter_url)) $this->socialnetworks['twitter'] = $this->twitter_url; + if (! empty($this->linkedin_url)) $this->socialnetworks['linkedin'] = $this->linkedin_url; + if (! empty($this->instagram_url)) $this->socialnetworks['instagram'] = $this->instagram_url; + if (! empty($this->youtube_url)) $this->socialnetworks['youtube'] = $this->youtube_url; + if (! empty($this->github_url)) $this->socialnetworks['github'] = $this->github_url; // Id prof generiques $this->idprof1 = empty($conf->global->MAIN_INFO_SIREN) ? '' : $conf->global->MAIN_INFO_SIREN; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index fdd7c24f280..0000494a3fe 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -134,7 +134,7 @@ else $statstring .= ''.$langs->trans("Customers").''.round($third['customer']).'
    '.$langs->trans("Suppliers").''.round($third['supplier']).'".dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid)."".dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL')."".dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid)."".dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid, 'AC_TEL')."'; if ($user->rights->societe->creer) { - print ''; + print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; - print ' '; - - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; } diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index dc53f47ff26..e7ebae374e2 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -483,7 +483,7 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index ee9f5a1d072..08479b95871 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1098,7 +1098,7 @@ if ($action == 'create') { $currency_code = $conf->currency; - print load_fiche_titre($langs->trans("NewAskPrice")); + print load_fiche_titre($langs->trans("NewAskPrice"), '', 'supplier_proposal'); $soc = new Societe($db); if ($socid > 0) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 52bb42c4526..97c0ee27e4e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2069,11 +2069,14 @@ class SupplierProposal extends CommonObject if (!$error) { + $main = MAIN_DB_PREFIX.'supplier_proposaldet'; + $ef = $main."_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_supplier_proposal = ".$this->id.")"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal = ".$this->id; if ($this->db->query($sql)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal WHERE rowid = ".$this->id; - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { // Delete linked object $res = $this->deleteObjectLinked(); @@ -2462,7 +2465,7 @@ class SupplierProposal extends CommonObject // This assignment in condition is not a bug. It allows walking the results. while ($obj = $this->db->fetch_object($resql)) { - $this->nb["askprice"] = $obj->nb; + $this->nb["supplier_proposals"] = $obj->nb; } $this->db->free($resql); return 1; diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index e337f11dfe9..e8432ad8fe4 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -58,14 +58,12 @@ $help_url = "EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur" llxHeader("", $langs->trans("SupplierProposalArea"), $help_url); -print load_fiche_titre($langs->trans("SupplierProposalArea"), '', 'commercial'); +print load_fiche_titre($langs->trans("SupplierProposalArea"), '', 'supplier_proposal'); print '
    '; -/* - * Search form - */ +// Search form if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo { @@ -81,9 +79,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles } -/* - * Statistics - */ +// Statistics $sql = "SELECT count(p.rowid), p.fk_statut"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 28dbc3e12b8..ded5d9ca2bf 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -431,7 +431,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_proposal', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendSupplierProposalRef"; $modelmail = "supplier_proposal_send"; @@ -534,7 +534,7 @@ if ($resql) // Date if (!empty($arrayfields['sp.date_valid']['checked'])) { - print '
    '; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; @@ -545,7 +545,7 @@ if ($resql) // Date if (!empty($arrayfields['sp.date_livraison']['checked'])) { - print ''; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; @@ -878,7 +878,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index c12526bbe85..7e5b6aaf531 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -66,87 +66,87 @@ if (!file_exists($conffile)) // Load conf file if it is already defined -if (! defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) // Test on filesize is to ensure that conf file is more that an empty template with just 8) // Test on filesize is to ensure that conf file is more that an empty template with just global->MAIN_LOGTOHTML = 1; // Define prefix -if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_'; -define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix)?$dolibarr_main_db_prefix:'')); +if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) $dolibarr_main_db_prefix = 'llx_'; +define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : '')); -define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir -define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root)?$dolibarr_main_data_root:'')); -define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root)?$dolibarr_main_url_root:'')); // URL relative root -$uri=preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* -$suburi = strstr($uri, '/'); // $suburi contains url without domain -if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' -define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) +define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir +define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : '')); +define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root +$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* +$suburi = strstr($uri, '/'); // $suburi contains url without domain +if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' +define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) -if (empty($character_set_client)) $character_set_client="UTF-8"; -$conf->file->character_set_client=strtoupper($character_set_client); -if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($conf->db->type=='mysql'?'latin1':''); // Old installation -$conf->db->character_set=$dolibarr_main_db_character_set; -if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($conf->db->type=='mysql'?'latin1_swedish_ci':''); // Old installation -$conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation; -if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0; +if (empty($character_set_client)) $character_set_client = "UTF-8"; +$conf->file->character_set_client = strtoupper($character_set_client); +if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set = ($conf->db->type == 'mysql' ? 'latin1' : ''); // Old installation +$conf->db->character_set = $dolibarr_main_db_character_set; +if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation = ($conf->db->type == 'mysql' ? 'latin1_swedish_ci' : ''); // Old installation +$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; +if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0; $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; -if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; +if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = ''; $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; -if (empty($conf->db->user)) $conf->db->user=''; +if (empty($conf->db->user)) $conf->db->user = ''; // Defini objet langs diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php new file mode 100644 index 00000000000..2508ab56040 --- /dev/null +++ b/htdocs/takepos/admin/bar.php @@ -0,0 +1,178 @@ + + * Copyright (C) 2011-2017 Juanjo Menent + * + * 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/takepos/admin/bar.php + * \ingroup takepos + * \brief Setup page for TakePos module - Bar Restaurant features + */ + +require '../../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php"; + +// Security check +if (!$user->admin) accessforbidden(); + +$langs->loadLangs(array("admin", "cashdesk", "printing")); + +global $db; + +/* + * Actions + */ + +if (GETPOST('action', 'alpha') == 'set') +{ + $db->begin(); + + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); + + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +/* + * View + */ + +$form = new Form($db); +$formproduct = new FormProduct($db); + +llxHeader('', $langs->trans("CashDeskSetup")); + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'bar', 'TakePOS', -1); +print '
    '; + + +// Mode +print '
    '; +print ''; +print ''; + +print '
    '; +print ''; +print ''; +print ''; +print "\n"; + +if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { + print ''; + + print ''; +} + +print ''; + +print ''; + +if ($conf->global->TAKEPOS_SUPPLEMENTS) +{ + print '\n"; +} + +print ''; + + +print '
    '.$langs->trans("Parameters").''.$langs->trans("Value").'
    '; + print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); + print '
    '; + print $langs->trans("OrderNotes"); + print ''; + print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); + print '
    '; +print $langs->trans("BasicPhoneLayout"); +print ''; +//print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); +print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); +print '
    '; +print $langs->trans("ProductSupplements"); +print ''; +//print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); +print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); +print '
    '; + print $langs->trans("SupplementCategory"); + print ''; + print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); + print "
    '; +print $langs->trans("AutoOrder"); +print ''; +print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); +print '
    '; + +if ($conf->global->TAKEPOS_AUTO_ORDER) +{ + print '
    '; + print ''; + print ''; + print ''; + print "\n"; + + //global $dolibarr_main_url_root; + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables"; + $resql = $db->query($sql); + $rows = array(); + while ($row = $db->fetch_array($resql)) { + print ''; + } + + print '
    '.$langs->trans("Table").''.$langs->trans("URL").''.$langs->trans("QR").'
    '; + print $langs->trans("Table")." ".$row['label']; + print ''; + print "".$urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($row['rowid']).""; + print ''; + print ""; + print '
    '; +} + +print '
    '; + +print '
    '; + +print '
    '; + +print "
    \n"; + +print '
    '; + +llxFooter(); +$db->close(); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index bf5c4671b13..85406c46faa 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -274,7 +274,7 @@ if (!empty($conf->service->enabled)) print '
    '; print $form->textwithpicto($langs->trans("RootCategoryForProductsToSell"), $langs->trans("RootCategoryForProductsToSellDesc")); print ''; -print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0); +print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0); print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID'); print "
    '; -print ''; - -print '
    '; - -// Bar Restaurant mode -print '
    '; -print ''; - -print ''; -print ''; -print "\n"; - print ''; @@ -455,48 +442,6 @@ print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, //print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1); print "\n"; -if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") { - print ''; - - print ''; -} - -if ($conf->global->TAKEPOS_BAR_RESTAURANT) -{ - print ''; - - print ''; - - if ($conf->global->TAKEPOS_SUPPLEMENTS) - { - print '\n"; - } -} print '
    '.$langs->trans("Other").''.$langs->trans("Value").'
    '; print $langs->trans("EnableBarOrRestaurantFeatures"); print '
    '; - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; - print ''; - print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); - //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); - print '
    '; - print $langs->trans("OrderNotes"); - print ''; - print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); - //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); - print '
    '; - print $langs->trans("BasicPhoneLayout"); - print ''; - //print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); - print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); - print '
    '; - print $langs->trans("ProductSupplements"); - print ''; - //print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); - print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); - print '
    '; - print $langs->trans("SupplementCategory"); - print ''; - print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); - print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); - print "
    '; print '
    '; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 10a679615a9..46d168ddd24 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -264,7 +264,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { print '
    '.$langs->trans('CashDeskReaderKeyCodeForEnter').''; -print ''; +print ''; print '
    '; $htmlforlines .= $row->label; - $htmlforlines .= '
    '; @@ -987,6 +991,7 @@ if ($placeid > 0) } $htmlforlines .= '" id="'.$line->id.'">'; $htmlforlines .= '
    '; + if ($_SESSION["basiclayout"] == 1) $htmlforlines .= $line->qty." x "; //if ($line->product_label) $htmlforlines.= ''.$line->product_label.''; if (isset($line->product_type)) { diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index b2526ef885e..90f0aa363dc 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -31,15 +31,21 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); -require '../main.inc.php'; // Load $user and permissions +if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant +if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { + // Decode place if it is an order from customer phone + $key = GETPOST('key'); + $place = dol_decode($key); +} +else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); +$idproduct = GETPOST('idproduct', 'int'); if ($setterminal > 0) { @@ -48,11 +54,10 @@ if ($setterminal > 0) $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); -if (empty($user->rights->takepos->run)) { +if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { accessforbidden(); } - /* * View */ @@ -66,48 +71,82 @@ $head = ' '; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); -?> - - -global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '
    '.$langs->trans('TerminalSelect').'
    '; -?> + global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '
    '.$langs->trans('TerminalSelect').'
    '; + ?>
    - - - - + '.strtoupper(substr($langs->trans('Floors'), 0, 3)).''; + print ''; + print ''; + print ''; + } + else { + print ''; + print ''; + print ''; + } + ?>
    @@ -188,7 +315,8 @@ if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"]
    - + * + * 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/takepos/public/auto_order.php + * \ingroup takepos + * \brief Public orders for customers + */ + +if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip + +require '../../main.inc.php'; + +if (!$conf->global->TAKEPOS_AUTO_ORDER) accessforbidden(); // If Auto Order is disabled never allow NO LOGIN access + +$_SESSION["basiclayout"] = 1; +$_SESSION["takeposterminal"] = 1; + +define('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE', 1); +if (GETPOSTISSET("mobilepage")) require '../invoice.php'; +elseif (GETPOSTISSET("genimg")) require DOL_DOCUMENT_ROOT.'/takepos/genimg/index.php'; +else require '../phone.php'; diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index c025f504d73..90b3a5c1fee 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -25,7 +25,7 @@ * \brief Page to show a receipt. */ -require '../main.inc.php'; // Load $user and permissions +if (!isset($action)) require '../main.inc.php'; // If this file is called from send.php avoid load again include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->loadLangs(array("main", "cashdesk", "companies")); diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php index 5774c9bbaf1..3f59d4069b5 100644 --- a/htdocs/takepos/send.php +++ b/htdocs/takepos/send.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2020 Andreu Bisquerra Gaya * * 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 @@ -35,123 +36,73 @@ require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -$invoiceid = GETPOST('facid', 'int'); +$facid = GETPOST('facid', 'int'); +$action = GETPOST('action', 'alpha'); +$email = GETPOST('email', 'alpha'); if (empty($user->rights->takepos->run)) { accessforbidden(); } - -/* - * View - */ - -$invoice = new Facture($db); -if ($invoiceid > 0) -{ - $invoice->fetch($invoiceid); -} -else -{ - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; - $resql = $db->query($sql); - $obj = $db->fetch_object($resql); - if ($obj) - { - $invoiceid = $obj->rowid; - } - if (!$invoiceid) - { - $invoiceid = 0; // Invoice does not exist yet - } - else - { - $invoice->fetch($invoiceid); - } -} - $langs->loadLangs(array("main", "bills", "cashdesk")); +$invoice = new Facture($db); +$invoice->fetch($facid); +$customer = new Societe($db); +$customer->fetch($invoice->socid); + +if ($action=="send") +{ + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $outputlangs = new Translate('', $conf); + $model_id = $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE; + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'facture_send', $user, $outputlangs, $model_id); + $subject = $arraydefaultmessage->topic; + ob_start(); // turn on output receipt + include 'receipt.php'; + $receipt = ob_get_contents(); // get the contents of the output buffer + ob_end_clean(); + $msg="".$arraydefaultmessage->content."
    ".$receipt.""; + $sendto=$email; + $from=$mysoc->email; + $mail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1); + if ($mail->error || $mail->errors) { + setEventMessages($mail->error, $mail->errors, 'errors'); + } else { + $result = $mail->sendfile(); + } + exit; +} +$arrayofcss = array('/takepos/css/pos.css.php'); +$arrayofjs = array(); +top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?> -
    -
    +
    +

    - +
    diff --git a/htdocs/theme/dolibarr_logo.png b/htdocs/theme/dolibarr_logo.png index 77c21461910..c15f03c821b 100644 Binary files a/htdocs/theme/dolibarr_logo.png and b/htdocs/theme/dolibarr_logo.png differ diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e495a3bb4bc..fc365ae5812 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -17,6 +17,7 @@ --colorbacklinepair2: rgb(); --colorbacklinepairhover: rgb(); --colorbacklinepairchecked: rgb(); + --colorbacklinebreak: rgb(); --colorbackbody: rgb(); --colortexttitlenotab: rgb(); --colortexttitle: rgb(); @@ -149,7 +150,7 @@ input[name=duration_value] { margin-right: 4px; } -input[type=submit] { +input[type=submit], input[type=submit]:hover { margin-left: 5px; } input, input.flat, form.flat select, select, select.flat, .dataTables_length label select { @@ -240,6 +241,8 @@ input.buttongen { input.buttonpayment, button.buttonpayment, div.buttonpayment { min-width: 290px; margin-bottom: 15px; + margin-top: 15px; + height: 60px; background-image: none; line-height: 24px; padding: 8px; @@ -251,6 +254,8 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment { box-shadow: 1px 1px 4px #bbb; color: #fff; border-radius: 4px; + cursor: pointer; + max-width: 350px; } div.buttonpayment input:focus { color: #008; @@ -411,7 +416,7 @@ div#moretabsList, div#moretabsListaction { hr { border: 0; border-top: 1px solid #ccc; } .tabBar hr { margin-top: 20px; margin-bottom: 17px; } -.button:not(.bordertransp), .buttonDelete:not(.bordertransp) { +.button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) { margin-bottom: 0; margin-top: 0; margin-left: 5px; @@ -666,7 +671,9 @@ body[class*="colorblind-"] .text-success{ .editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover { color: var(--colortexttitle) !important; } - +.fawidth30 { + width: 20px; +} .floatnone { float: none !important; } @@ -874,7 +881,7 @@ select.flat.selectlimit { max-width: 0; overflow: auto; } -.divintdwithtwolinesmax { +.divintowithtwolinesmax { width: 75px; display: -webkit-box; -webkit-box-orient: vertical; @@ -1020,9 +1027,11 @@ table[summary="list_of_modules"] .fa-cog { .clearboth { clear:both; } .hideobject { display: none; } .minwidth50 { min-width: 50px; } +.minwidth75 { min-width: 75px; } /* rule for not too small screen only */ @media only screen and (min-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3) ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) { + .width20 { width: 20px; } .width25 { width: 25px; } .width50 { width: 50px; } .width75 { width: 75px; } @@ -1044,6 +1053,7 @@ table[summary="list_of_modules"] .fa-cog { .minwidth500imp { min-width: 500px !important; } } .widthauto { width: auto; } +.width20 { width: 20px; } .width25 { width: 25px; } .width50 { width: 50px; } .width75 { width: 75px; } @@ -1128,6 +1138,22 @@ table[summary="list_of_modules"] .fa-cog { padding-left: 5px; padding-right: 5px; } + + .hideonsmartphone { display: none; } + .hideonsmartphoneimp { display: none !important; } + + span.pictotitle { + margin-: 0 !important; + } + div.fiche>table.table-fiche-title { + margin-top: 7px !important; + margin-bottom: 15px !important; + } + + select.minwidth100imp, select.minwidth100, select.minwidth200, .widthcentpercentminusx { + width: calc(100% - 30px) !important; + display: inline-block; + } } /* Force values for small screen 570 */ @@ -1136,6 +1162,10 @@ table[summary="list_of_modules"] .fa-cog { body { font-size: ; } + + .box-flex-item { + margin: 3px 2px 3px 2px !important; + } div.refidno { font-size: !important; } @@ -1159,6 +1189,18 @@ table[summary="list_of_modules"] .fa-cog { text-overflow: ellipsis; white-space: nowrap; } + .tdoverflowmax100onsmartphone { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .tdoverflowmax150onsmartphone { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } .border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { height: 40px !important; } @@ -1185,8 +1227,6 @@ table[summary="list_of_modules"] .fa-cog { max-width: 138px; /* length of input text in the quick search box when using a smartphone and without dolidroid */ } - .hideonsmartphone { display: none; } - .hideonsmartphoneimp { display: none !important; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; } .maxwidth50onsmartphone { max-width: 40px; } @@ -1465,10 +1505,10 @@ body.onlinepaymentbody div.fiche { /* For online payment page */ margin: 20px !important; } div.fiche>table:first-child { - margin-bottom: 15px !important; + margin-bottom: 15px; } div.fiche>table.table-fiche-title { - margin-bottom: 7px !important; + margin-bottom: 7px; } div.fichecenter { width: 100%; @@ -1584,7 +1624,7 @@ div.nopadding { } td.nobordernopadding.widthpictotitle.col-picto { - color: var(--colortexttitlenotab); + color: #bbb; opacity: 0.85; } .table-list-of-attached-files .col-picto, .table-list-of-links .col-picto { @@ -1596,16 +1636,21 @@ td.nobordernopadding.widthpictotitle.col-picto { width: unset; color: #999; } + +span.widthpictotitle.pictotitle { + /* background: rgba(70, 3, 62, 0.5); */ + background: var(--colortexttitlenotab); + opacity: 0.8; + color: #fff !important; + padding: 7px; + border-radius: 2px; + min-width: 30px; + text-align: center; +} .pictotitle { margin-: 8px; /* margin-bottom: 4px; */ } -@media only screen and (max-width: 767px) -{ - span.pictotitle { - margin-: 0 !important; - } -} .pictoobjectwidth { width: 14px; } @@ -1686,6 +1731,7 @@ div.statusref { margin-top: 8px; margin-bottom: 10px; clear: both; + text-align: right; } div.statusref img { padding-left: 8px; @@ -1729,7 +1775,7 @@ img.photorefnoborder { border-bottom: px solid rgb(); /* border-bottom: 2px solid var(--colorbackhmenu1); */ } -.trextrafieldseparator td { +.trextrafieldseparator td, .trextrafields_collapse_last td { /* border-bottom: 2px solid var(--colorbackhmenu1) !important; */ border-bottom: 2px solid rgb() !important; } @@ -1879,8 +1925,8 @@ div.tmenuleft } div.tmenucenter { - padding-left: 0px; - padding-right: 3px; + padding-left: 2px; + padding-right: 2px; padding-top: 8px; height: 26px; @@ -2701,9 +2747,15 @@ a.tabTitle { text-decoration: none; white-space: nowrap; } +.tabTitleText { + display: none; +} .imgTabTitle { max-height: 14px; } +div.tabs div.tabsElem:first-of-type a.tab { + margin-left: 0px !important; +} a.tabunactive { color: var(--colortextlink) !important; @@ -3267,7 +3319,7 @@ td.evenodd, tr.nohoverpair td, #trlinefordates td { .trforbreak td { font-weight: 500; border-bottom: 1pt solid black !important; - /* background-color: # !important; */ + background-color: var(--colorbacklinebreak) !important; !important; } .trforbreak.nobold td a, .trforbreak.nobold span.secondary { font-weight: normal !important; @@ -3360,6 +3412,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste } tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a { text-shadow: none !important; + color: rgb(); } tr.liste_titre_topborder td { border-top-width: px; @@ -3577,8 +3630,25 @@ ul.noborder li:nth-child(even):not(.liste_titre) { margin-right: 8px; } + @media only screen and (max-width: 767px) { + div.tabs { + padding-left: 0 !important; + padding-right: 0!important; + margin-left: 0 !important; + margin-right: 0 !important; + } + + a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { + padding: 12px 12px 13px; + } + a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active { + padding: 0px 0px 0px 0px; + } + a.tmenusel:link, a.tmenusel:visited, a.tmenusel:hover, a.tmenusel:active { + padding: 0px 0px 0px 0px; + } .boxstats, .boxstats130 { margin: 3px; } @@ -3614,7 +3684,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } span.boxstatstext { - opacity: 0.7; + opacity: 0.5; line-height: 18px; color: var(--colortext); } @@ -3847,7 +3917,7 @@ div.boximport { .fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor); } -.widthpictotitle { width: 26px; text-align: ; } +td.widthpictotitle { width: 26px; text-align: ; } span.widthpictotitle { font-size: 1.7em; }; .dolgraphtitle { margin-top: 6px; margin-bottom: 4px; } @@ -4861,7 +4931,7 @@ ul.ecmjqft li { ul.ecmjqft a { line-height: 24px; vertical-align: middle; - color: #333; + color: unset; padding: 0px 0px; font-weight:normal; display: inline-block !important; @@ -6303,7 +6373,9 @@ div.tabsElem a.tab { div.login_block_user, div.login_block_other { clear: both; } .atoplogin, .atoplogin:hover { - color: #000 !important; + color:unset !important; + padding-left: 4px; + padding-right: 4px; } .login_block_elem { padding: 0 !important; @@ -6337,7 +6409,6 @@ div.tabsElem a.tab { word-break: break-word; } .badge { - line-height: 1.2em; min-width: auto; font-size: 12px; } diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 028039f6c8b..98130f1d03a 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -6,14 +6,20 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> * Component: Info Box * ------------------- */ + +.info-box-module-external span.info-box-icon-version { + background: #bbb; +} + .info-box { display: block; position: relative; min-height: 90px; - background: #fff; + /* background: #fff; */ width: 100%; - box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2), 0px 0px 2px rgba(0, 0, 0, 0.1); - border-radius: 2px; + box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1); + border-radius: 2px; + border: 1px solid #eee; margin-bottom: 15px; } .info-box.info-box-sm{ @@ -62,16 +68,19 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> text-align: center; font-size: 45px; line-height: 90px; - background: rgba(0, 0, 0, 0.2); + background: rgba(0, 0, 0, 0.08) !important } .info-box-sm .info-box-icon { height: 80px; width: 80px; font-size: 25px; + line-height: 100px; +} +.opened-dash-board-wrap .info-box-sm .info-box-icon { line-height: 80px; } .info-box-module .info-box-icon { - height: 106px; + height: 107px; } .info-box-icon > img { max-width: 100%; @@ -166,6 +175,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> .info-box-title{ text-transform: uppercase; font-weight: bold; + padding-bottom: 4px; } .info-box-text{ font-size: 0.92em; @@ -194,12 +204,11 @@ if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'backgro if (!isset($conf->global->THEME_AGRESSIVENESS_RATIO) && $prefix) $conf->global->THEME_AGRESSIVENESS_RATIO = -50; if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) $conf->global->THEME_AGRESSIVENESS_RATIO = GETPOST('THEME_AGRESSIVENESS_RATIO', 'int'); //var_dump($conf->global->THEME_AGRESSIVENESS_RATIO); + ?> .info-box-icon { color: #fff !important; - - background-color: #eee !important; opacity: 0.95; } diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index 5b9395fbc04..c344838458d 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -8,7 +8,7 @@ font-style: normal; font-variant: normal; text-rendering: auto; - line-height: 26px; + line-height: 23px; font-size: ; -webkit-font-smoothing: antialiased; text-align:center; diff --git a/htdocs/theme/eldy/progress.inc.php b/htdocs/theme/eldy/progress.inc.php index b0bd96df1d2..71f25ff35ba 100644 --- a/htdocs/theme/eldy/progress.inc.php +++ b/htdocs/theme/eldy/progress.inc.php @@ -123,7 +123,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> width: 3px; } .progress-group .progress-text { - font-weight: 600; + /* font-weight: 600; */ } .progress-group .progress-number { float: right; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 39fcd003335..927d29e1919 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -128,6 +128,7 @@ $colorbacklinebreak = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (emp $colorbackbody = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_BACKBODY) ? $colorbackbody : $conf->global->THEME_ELDY_BACKBODY) : (empty($user->conf->THEME_ELDY_BACKBODY) ? $colorbackbody : $user->conf->THEME_ELDY_BACKBODY); $colortexttitlenotab = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $conf->global->THEME_ELDY_TEXTTITLENOTAB) : (empty($user->conf->THEME_ELDY_TEXTTITLENOTAB) ? $colortexttitlenotab : $user->conf->THEME_ELDY_TEXTTITLENOTAB); $colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $conf->global->THEME_ELDY_TEXTTITLE) : (empty($user->conf->THEME_ELDY_TEXTTITLE) ? $colortexttitle : $user->conf->THEME_ELDY_TEXTTITLE); +$colortexttitlelink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $colortexttitlelink : $conf->global->THEME_ELDY_TEXTTITLELINK) : (empty($user->conf->THEME_ELDY_TEXTTITLELINK) ? $colortexttitlelink : $user->conf->THEME_ELDY_TEXTTITLELINK); $colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXT) ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT); $colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TEXTLINK) ? $colortextlink : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK); $fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_FONT_SIZE1) ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1); diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index f6324f0146f..d2a11725ecf 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -65,10 +65,11 @@ $colorbacklinepair1 = '251,251,251'; // line pair $colorbacklinepair2 = '251,251,251'; // line pair $colorbacklinepairhover = '230,237,244'; // line hover $colorbacklinepairchecked = '230,237,244'; // line checked -$colorbacklinebreak = '233,228,230'; // line break +$colorbacklinebreak = '253,251,250'; // line break $colorbackbody = '255,255,255'; $colortexttitlenotab = '0,113,120'; // 150,90,121 140,80,10 or 10,140,80 #875a7b green=0,113,120, violet: 0,50,120 $colortexttitle = '0,0,0'; +$colortexttitlelink = '10, 20, 100'; $colortext = '0,0,0'; $colortextlink = '10, 20, 100'; $fontsize = '0.86em'; diff --git a/htdocs/theme/eldy/timeline.inc.php b/htdocs/theme/eldy/timeline.inc.php index 21e683e42f0..eb13821c221 100644 --- a/htdocs/theme/eldy/timeline.inc.php +++ b/htdocs/theme/eldy/timeline.inc.php @@ -154,7 +154,7 @@ a.timeline-btn:hover border-radius: 50%; text-align: center; left: 18px; - top: 0; + top: 5px; } .timeline > .time-label > span { font-weight: 600; diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index d9b467f130b..2dec0087a1b 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -2,23 +2,68 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> /*