Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW_deposit_payment_terms

This commit is contained in:
Marc de Lima Lucio 2021-10-13 11:33:04 +02:00
commit 29768a1c6e
241 changed files with 23278 additions and 813 deletions

View File

@ -116,13 +116,13 @@ a process to follow to optimize the chance to have PRs merged efficiently...
Also, some code changes need a prior approbation:
* if you want to include a new external library (into htdocs/includes directory), please ask before to the core project manager (mention @dolibarr-yoda in your issue) to see if such a library can be accepted.
* if you want to include a new external library (into htdocs/includes directory), please ask before to the core project manager (mention @dolibarr-jedi in your issue) to see if such a library can be accepted.
* if you add a new table, you must first create a page on https://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Then ask the project manager (@dolibarr-yoda) if the new data model you plan to add is compatible with curent and future works in progress and can be accepted as you suggest.
* if you add a new tables or fields, you MUST first submit a standalone PR with the data structure changes you plan to add/modify (and only data structure changes). Start development only once this data structure has been accepted.
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR (A label is added in such a case).
If the label of PR start with "Draft" or "WIP" (Work In Progress), it will not be analyzed for merging until you change the label of PR (but it can be analyzed for discussion).
If the label of PR start with "Draft" or "WIP" (Work In Progress), it will not be analyzed for merging until you change the label of the PR (but it can be analyzed for discussion).
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.

View File

@ -1,18 +1,18 @@
# Instructions
*This is a template to help you make good pull requests. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*
*Please:*
- *only keep the "Fix", "Close" or "New" section*
- *only keep the "FIX", "CLOSE" or "NEW" section* (use uppercase to have the PR appears into the ChangeLog, lowercase will not appears)
- *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)*
- *replace the bracket enclosed texts with meaningful information*
# Fix #[*issue_number Short description*]
# FIX|Fix #[*issue_number Short description*]
[*Long description*]
# Close #[*issue_number Short description*]
# CLOSE|Close #[*issue_number Short description*]
[*Long description*]
# New [*Short description*]
# NEW|New [*Short description*]
[*Long description*]

View File

@ -14,7 +14,7 @@ Following changes may create regressions for some external modules, but were nec
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
* The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
***** ChangeLog for 14.0.2 compared to 14.0.1 *****

View File

@ -2056,7 +2056,7 @@ CREATE TABLE `llx_c_holiday_types` (
`label` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`affect` int(11) NOT NULL,
`delay` int(11) NOT NULL,
`newByMonth` double(8,5) NOT NULL DEFAULT 0.00000,
`newbymonth` double(8,5) NOT NULL DEFAULT 0.00000,
`fk_country` int(11) DEFAULT NULL,
`active` int(11) DEFAULT 1,
PRIMARY KEY (`rowid`),

View File

@ -430,7 +430,7 @@ if ($action != 'export_csv') {
print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">'.price($opening_balance).'</td>';
print '<td class="right nowraponall amount">'.price(price2num($opening_balance, 'MT')).'</td>';
}
$urlzoom = '';
@ -444,9 +444,9 @@ if ($action != 'export_csv') {
}
}
// Debit
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price($line->debit).'</a></td>';
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price(price2num($line->debit, 'MT')).'</a></td>';
// Credit
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price($line->credit).'</a></td>';
print '<td class="right nowraponall amount"><a href="'.$urlzoom.'">'.price(price2num($line->credit, 'MT')).'</a></td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
@ -467,10 +467,10 @@ if ($action != 'export_csv') {
if (!empty($show_subgroup)) {
print '<tr class="liste_total"><td class="right">'.$langs->trans("SubTotal").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">'.price($sous_total_opening_balance).'</td>';
print '<td class="right nowraponall amount">'.price(price2num($sous_total_opening_balance, 'MT')).'</td>';
}
print '<td class="right nowraponall amount">'.price($sous_total_debit).'</td>';
print '<td class="right nowraponall amount">'.price($sous_total_credit).'</td>';
print '<td class="right nowraponall amount">'.price(price2num($sous_total_debit, 'MT')).'</td>';
print '<td class="right nowraponall amount">'.price(price2num($sous_total_credit, 'MT')).'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>';
} else {
@ -482,10 +482,10 @@ if ($action != 'export_csv') {
print '<tr class="liste_total"><td class="right">'.$langs->trans("AccountBalance").':</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowrap right">'.price($total_opening_balance).'</td>';
print '<td class="nowrap right">'.price(price2num($total_opening_balance, 'MT')).'</td>';
}
print '<td class="right nowraponall amount">'.price($total_debit).'</td>';
print '<td class="right nowraponall amount">'.price($total_credit).'</td>';
print '<td class="right nowraponall amount">'.price(price2num($total_debit, 'MT')).'</td>';
print '<td class="right nowraponall amount">'.price(price2num($total_credit, 'MT')).'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="right nowraponall amount">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>';
} else {

View File

@ -914,7 +914,8 @@ class AccountancyExport
print "ValidDate".$separator;
print "Montantdevise".$separator;
print "Idevise".$separator;
print "DateLimitReglmt";
print "DateLimitReglmt".$separator;
print "NumFacture".$separator;
print $end_line;
foreach ($objectLines as $line) {
@ -927,6 +928,22 @@ class AccountancyExport
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$invoice = new FactureFournisseur($db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref_supplier;
}
// FEC:JournalCode
print $line->code_journal . $separator;
@ -984,6 +1001,9 @@ class AccountancyExport
// FEC_suppl:DateLimitReglmt
print $date_limit_payment;
// FEC_suppl:NumFacture
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator;
print $end_line;
}
}
@ -1020,7 +1040,8 @@ class AccountancyExport
print "ValidDate".$separator;
print "Montantdevise".$separator;
print "Idevise".$separator;
print "DateLimitReglmt";
print "DateLimitReglmt".$separator;
print "NumFacture".$separator;
print $end_line;
foreach ($objectLines as $line) {
@ -1033,6 +1054,22 @@ class AccountancyExport
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$invoice = new FactureFournisseur($db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref_supplier;
}
// FEC:JournalCode
print $line->code_journal . $separator;
@ -1090,6 +1127,10 @@ class AccountancyExport
// FEC_suppl:DateLimitReglmt
print $date_limit_payment;
// FEC_suppl:NumFacture
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator;
print $end_line;
}
}

View File

@ -191,7 +191,14 @@ print '<script type="text/javascript">
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta_client,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
} else {
$sql .= " s.code_compta as code_compta_client,";
$sql .= " s.code_compta_fournisseur,";
}
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
@ -201,7 +208,7 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,";
$sql .= " fd.situation_percent,";
$sql .= " co.code as country_code, co.label as country,";
$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";
$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";
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
@ -213,6 +220,9 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " WHERE fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy

View File

@ -240,10 +240,14 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$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, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
$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,";
$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,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta_client,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
$sql .= " spe.accountancy_code_sell as company_code_sell";
} else {
$sql .= " s.code_compta as code_compta_client,";
$sql .= " s.code_compta_fournisseur,";
$sql .= " s.accountancy_code_sell as company_code_sell";
}
$parameters = array();
@ -635,7 +639,7 @@ if ($result) {
// Vat rate
$code_vat_differ='';
if ($product_static->tva_tx !== $facture_static_det->tva_tx) {
if ($product_static->tva_tx !== $facture_static_det->tva_tx && ! empty($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
}
print '<td style="'.$code_vat_differ.'" class="right">';

View File

@ -81,7 +81,12 @@ $help_url = '';
llxHeader('', $langs->trans("AccountancyArea"), $help_url);
if ($conf->accounting->enabled) {
if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
print "<br>";
} elseif ($conf->accounting->enabled) {
$step = 0;
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
@ -258,7 +263,8 @@ if ($conf->accounting->enabled) {
} else {
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span><br>\n";
print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
print "<br>";
}
// End of page

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2021 Frédéric France <frederic.france@netlogic.fr>
@ -119,7 +119,14 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
$sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
} else {
$sql .= " soc.code_compta,";
$sql .= " soc.code_compta_fournisseur,";
}
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, u.statut as userstatus,";
$sql .= " bu2.type as typeop_user,";
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
@ -130,6 +137,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid A
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc on bu1.url_id=soc.rowid";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = soc.rowid AND spe.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy

View File

@ -105,7 +105,14 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
} else {
$sql .= " s.code_compta as code_compta,";
$sql .= " s.code_compta_fournisseur,";
}
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_buy,";
} else {
@ -120,6 +127,9 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$sql .= " WHERE f.fk_statut > 0";
$sql .= " AND fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy

View File

@ -107,7 +107,14 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
} else {
$sql .= " s.code_compta as code_compta,";
$sql .= " s.code_compta_fournisseur,";
}
$sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " ppe.accountancy_code_sell";
@ -122,6 +129,9 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$sql .= " WHERE fd.fk_code_ventilation > 0";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
$sql .= " AND f.fk_statut > 0";

View File

@ -202,7 +202,14 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
}
$sql .= " co.code as country_code, co.label as country,";
$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";
$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";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= ", spe.accountancy_code_customer as code_compta_client";
$sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
} else {
$sql .= ", s.code_compta as code_compta_client";
$sql .= ", 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;
@ -214,6 +221,9 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$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

View File

@ -243,10 +243,14 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$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, aa4.rowid as aarowid_thirdparty,";
$sql .= " co.code as country_code, co.label as country_label,";
$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,";
$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,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta_client,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
$sql .= " spe.accountancy_code_buy as company_code_buy";
} else {
$sql .= " s.code_compta as code_compta_client,";
$sql .= " s.code_compta_fournisseur,";
$sql .= " s.accountancy_code_buy as company_code_buy";
}
$parameters = array();
@ -678,7 +682,7 @@ if ($result) {
print '</td>';
// Vat rate
if ($objp->vat_tx_l != $objp->vat_tx_p) {
if ($objp->vat_tx_l != $objp->vat_tx_p && ! empty($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
}
print '<td style="'.$code_vat_differ.'" class="right">';

View File

@ -1012,7 +1012,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (count($listetype)) {
print $form->selectarray("typeid", $listetype, (GETPOST('typeid', 'int') ? GETPOST('typeid', 'int') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, '', 0, 0, 0, '', '', 1);
} else {
print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
print '<span class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</span>';
}
print "</td>\n";
@ -1997,7 +1997,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</div>';
if ($isinspip == -1) {
print '<br><br><font class="error">'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.'</font>';
print '<br><br><span class="error">'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.'</span>';
}

View File

@ -190,7 +190,7 @@ if ($result > 0) {
if (empty($dn)) {
$langs->load("errors");
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>';
print '<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</span></td></tr>';
} else {
$records = $ldap->getAttribute($dn, $search);
@ -199,7 +199,7 @@ if ($result > 0) {
// Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
print '<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</span></td></tr>';
} else {
$result = show_ldap_content($records, 0, $records['count'], true);
}

View File

@ -161,7 +161,7 @@ if ($result > 0) {
// Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
print '<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</span></td></tr>';
} else {
$result = show_ldap_content($records, 0, $records['count'], true);
}

View File

@ -91,7 +91,7 @@ $form = new Form($db);
$formother = new FormOther($db);
$formcompany = new FormCompany($db);
$countrynotdefined = '<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</span>';
print '<span class="opacitymedium">'.$langs->trans("AccountantDesc")."</span><br>\n";
print "<br>\n";

View File

@ -302,7 +302,7 @@ if (!isset($_SERVER['WINDIR'])) {
print '<input type="text" size="40" name="GENBARCODE_LOCATION" value="'.$conf->global->GENBARCODE_LOCATION.'">';
if (!empty($conf->global->GENBARCODE_LOCATION) && !@file_exists($conf->global->GENBARCODE_LOCATION)) {
$langs->load("errors");
print '<br><font class="error">'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).'</font>';
print '<br><span class="error">'.$langs->trans("ErrorFileNotFound", $conf->global->GENBARCODE_LOCATION).'</span>';
}
print '</td></tr>';
}

View File

@ -369,7 +369,7 @@ $form = new Form($db);
$formother = new FormOther($db);
$formcompany = new FormCompany($db);
$countrynotdefined = '<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</span>';
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');

View File

@ -223,7 +223,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
@ -315,7 +315,7 @@ $tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle,picto";
$tabfield[28] = "code,label,affect,delay,newByMonth,country_id,country";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
@ -361,7 +361,7 @@ $tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle,picto";
$tabfieldvalue[28] = "code,label,affect,delay,newByMonth,country";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label";
@ -407,7 +407,7 @@ $tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle,picto";
$tabfieldinsert[28] = "code,label,affect,delay,newByMonth,fk_country";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label";
@ -548,7 +548,7 @@ $tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
//$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
@ -1401,7 +1401,7 @@ if ($id) {
if ($value == 'delay') {
$valuetoshow = $langs->trans("NoticePeriod");
}
if ($value == 'newByMonth') {
if ($value == 'newbymonth') {
$valuetoshow = $langs->trans("NewByMonth");
}
if ($value == 'fk_tva') {
@ -1750,7 +1750,7 @@ if ($id) {
if ($value == 'delay') {
$valuetoshow = $langs->trans("NoticePeriod");
}
if ($value == 'newByMonth') {
if ($value == 'newbymonth') {
$valuetoshow = $langs->trans("NewByMonth");
}
if ($value == 'fk_tva') {

View File

@ -145,13 +145,18 @@ if ($action == 'updateMask') {
$draft = GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha');
$res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
$res3 = 0;
if (!empty($conf->projet->enabled) && GETPOSTISSET('EXPENSEREPORT_PROJECT_IS_REQUIRED')) { // Option may not be provided
$res3 = dolibarr_set_const($db, 'EXPENSEREPORT_PROJECT_IS_REQUIRED', GETPOST('EXPENSEREPORT_PROJECT_IS_REQUIRED', 'int'), 'chaine', 0, '', $conf->entity);
}
$dates = GETPOST('EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', 'int');
$res3 = dolibarr_set_const($db, 'EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', intval($dates), 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, 'EXPENSEREPORT_PREFILL_DATES_WITH_CURRENT_MONTH', intval($dates), 'chaine', 0, '', $conf->entity);
$amounts = GETPOST('EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', 'int');
$res4 = dolibarr_set_const($db, 'EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', intval($amounts), 'chaine', 0, '', $conf->entity);
$res5 = dolibarr_set_const($db, 'EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY', intval($amounts), 'chaine', 0, '', $conf->entity);
if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0) || !($res4 >0)) {
if (!($res1 > 0) || !($res2 > 0) || !($res3 >= 0) || !($res4 >0) || !($res5 >0)) {
$error++;
}
@ -464,6 +469,14 @@ print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htm
print '<input class="flat minwidth200" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n";
if (!empty($conf->projet->enabled)) {
print '<tr class="oddeven"><td>';
print $langs->trans('ProjectIsRequiredOnExpenseReports');
print '</td><td class="right">';
print $form->selectyesno('EXPENSEREPORT_PROJECT_IS_REQUIRED', empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED) ? 0 : 1, 1);
print '</td></tr>';
}
print '<tr class="oddeven"><td>';
print $langs->trans('PrefillExpenseReportDatesWithCurrentMonth');
print '</td><td class="right">';

View File

@ -275,9 +275,9 @@ if ($resql) {
print "<td>".$langs->trans("Status")."</td>";
print "<td>";
if ($result > 0 && empty($rss->error)) {
print '<font class="ok">'.$langs->trans("Online").'</div>';
print '<span class="ok">'.$langs->trans("Online").'</div>';
} else {
print '<font class="error">'.$langs->trans("Offline");
print '<span class="error">'.$langs->trans("Offline");
$langs->load("errors");
if ($rssparser->error) {
print ' - '.$langs->trans($rssparser->error);

655
htdocs/admin/hrm.php Normal file
View File

@ -0,0 +1,655 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
* Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
* Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file hrm/admin/setup.php
* \ingroup hrm
* \brief HrmTest setup page.
*/
// Load Dolibarr environment
require '../main.inc.php';
global $langs, $user;
// Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php';
//require_once "../class/myclass.class.php";
// Translations
$langs->loadLangs(array("admin", "hrm"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject';
$arrayofparameters = array(
'HRM_MAXRANK'=>array('type'=>'integer','enabled'=>1),
'HRM_DEFAULT_SKILL_DESCRIPTION'=>array('type'=>'textarea','enabled'=>1),
);
$error = 0;
$setupnotempty = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
/*
* Actions
*/
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
if ($action == 'update') {
$max_rank = GETPOST('HRM_MAXRANK', 'int');
// We complete skill possible level notation if necessary
if (!empty($max_rank)) {
$static_skill = new Skill($db);
$TAllSkills = $static_skill->fetchAll();
foreach ($TAllSkills as &$skill) {
if (empty($skill->lines)) $skill->fetchLines();
if (count($skill->lines) < $conf->global->HRM_MAXRANK) {
$skill->createSkills(count($skill->lines) + 1);
}
}
}
} elseif ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha');
$maskorder = GETPOST('maskorder', 'alpha');
if ($maskconstorder) {
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object');
$tmpobject = new $tmpobjectkey($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound) {
require_once $file;
$module = new $classname($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}
} elseif ($action == 'set') {
// Activate a model
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->$constforval = $value;
}
// We disable/enable the document template (into llx_document_model table)
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
/*
* View
*/
$form = new Form($db);
$help_url = '';
$page_name = "HRMSetup";
llxHeader('', $langs->trans($page_name), $help_url);
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = hrmAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "hrm");
$moduledir = 'hrm';
$myTmpObjects = array();
$myTmpObjects['evaluation'] = array('includerefgeneration'=>1, 'includedocgeneration'=>0);
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'MyObject') {
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
/*
* Orders Numbering model
*/
$setupnotempty++;
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
$file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.'/'.$file.'.php';
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
continue;
}
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
continue;
}
if ($module->isEnabled()) {
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$langs->load("errors");
print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') {
print $langs->trans($tmp);
} else {
print $tmp;
}
print '</td>'."\n";
print '<td class="center">';
$constforvar = 'HRMTEST_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
$mytmpinstance = new $myTmpObjectKey($db);
$mytmpinstance->initAsSpecimen();
// Info
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mytmpinstance);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval);
}
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
}
}
print "</table>\n";
}
if ($myTmpObjectArray['includedocgeneration']) {
/*
* Document templates generators
*/
$setupnotempty++;
$type = strtolower($myTmpObjectKey);
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$realpath = $reldir."core/modules/".$moduledir.$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$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;
}
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
} else {
print $module->description;
}
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.urlencode($module->scandir).'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
$constforvar = 'HRMTEST_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.urlencode($module->scandir).'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
}
}
print load_fiche_titre($langs->trans('OtherOptions'), '', '');
if ($action == 'edit') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
print '</td><td>';
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print "</textarea>\n";
} elseif ($val['type']== 'integer') {
print '<input class="flat" name="'.$constname.'" id="'.$constname.'" value="'.$conf->global->$constname.'" type="number" step="1" min="0" max="50" >' . "\n";
} elseif ($val['type']== 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
//$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
$arrayofmessagename = array();
if (is_array($formmail->lines_model)) {
foreach ($formmail->lines_model as $modelmail) {
//var_dump($modelmail);
$moreonlabel = '';
if (!empty($arrayofmessagename[$modelmail->label])) {
$moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
}
// The 'label' is the key that is unique if we exclude the language
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($db);
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#generate_token'.$constname.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
action: \'getrandompassword\',
generic: true
},
function(token) {
$("#'.$constname.'").val(token);
});
});
});';
print '</script>';
}
} elseif ($val['type'] == 'product') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
$form->select_produits($selected, $constname, '', 0);
}
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
}
print '</td></tr>';
}
}
print '</table>';
print '<br><div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '<br>';
} else {
if (!empty($arrayofparameters)) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
print '</td><td>';
if ($val['type'] == 'textarea') {
print dol_nl2br($conf->global->{$constname});
} elseif ($val['type']== 'html') {
print $conf->global->{$constname};
} elseif ($val['type'] == 'yesno') {
print ajax_constantonoff($constname);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
if ($template<0) {
setEventMessages(null, $formmail->errors, 'errors');
}
print $langs->trans($template->label);
} elseif (preg_match('/category:/', $val['type'])) {
$c = new Categorie($db);
$result = $c->fetch($conf->global->{$constname});
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
}
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) {
print $langs->trans("Prospect");
} elseif ($conf->global->{$constname}==3) {
print $langs->trans("ProspectCustomer");
} elseif ($conf->global->{$constname}==1) {
print $langs->trans("Customer");
} elseif ($conf->global->{$constname}==0) {
print $langs->trans("NorProspectNorCustomer");
}
} elseif ($val['type'] == 'product') {
$product = new Product($db);
$resprod = $product->fetch($conf->global->{$constname});
if ($resprod > 0) {
print $product->ref;
} elseif ($resprod < 0) {
setEventMessages(null, $object->errors, "errors");
}
} else {
print $conf->global->{$constname};
}
print '</td></tr>';
}
}
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
} else {
print '<br>'.$langs->trans("NothingToSetup");
}
}
if (empty($setupnotempty)) {
print '<br>'.$langs->trans("NothingToSetup");
}
// Page end
print dol_get_fiche_end();
llxFooter();
$db->close();

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -153,7 +153,7 @@ $arraylist['dolibarr2ldap'] = $langs->trans("DolibarrToLDAP");
print $form->selectarray('activesynchro', $arraylist, $conf->global->LDAP_SYNCHRO_ACTIVE);
print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnSynchroActiveExample").'</span>';
if ($conf->global->LDAP_SYNCHRO_ACTIVE && !$conf->global->LDAP_USER_DN) {
print '<br><font class="error">'.$langs->trans("LDAPSetupNotComplete").'</font>';
print '<br><span class="error">'.$langs->trans("LDAPSetupNotComplete").'</span>';
}
print '</td></tr>';
@ -297,24 +297,24 @@ if (function_exists("ldap_connect")) {
if ($result > 0) {
// Test ldap connect and bind
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</font>';
print '<span class="ok">'.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
print '<br>';
if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) {
if ($result == 2) {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<span class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<br>';
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<span class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</span>';
print '<br>';
print $langs->trans("Error").' '.$ldap->error;
print '<br>';
}
} else {
print img_picto('', 'warning').' ';
print '<font class="warning">'.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").'</font>';
print '<span class="warning">'.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").'</span>';
print '<br>';
}
@ -322,18 +322,18 @@ if (function_exists("ldap_connect")) {
// Test ldap_getversion
if (($ldap->getVersion() == 3)) {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSetupForVersion3").'</font>';
print '<span class="ok">'.$langs->trans("LDAPSetupForVersion3").'</span>';
print '<br>';
} else {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSetupForVersion2").'</font>';
print '<span class="ok">'.$langs->trans("LDAPSetupForVersion2").'</span>';
print '<br>';
}
$unbind = $ldap->unbind();
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</font>';
print '<span class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</span>';
print '<br>';
print $langs->trans("Error").' '.$ldap->error;
print '<br>';

View File

@ -321,12 +321,12 @@ if (function_exists("ldap_connect")) {
if ($result2 > 0) {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
print '<span class="ok">'.$langs->trans("LDAPSynchroOK").'</span><br>';
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print '<span class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
@ -336,9 +336,9 @@ if (function_exists("ldap_connect")) {
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print '<span class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}

View File

@ -260,12 +260,12 @@ if (function_exists("ldap_connect")) {
if ($result2 > 0) {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
print '<span class="ok">'.$langs->trans("LDAPSynchroOK").'</span><br>';
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print '<span class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
@ -275,9 +275,9 @@ if (function_exists("ldap_connect")) {
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print '<span class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}
@ -331,9 +331,9 @@ if (function_exists("ldap_connect")) {
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print '<span class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}

View File

@ -472,12 +472,12 @@ if (function_exists("ldap_connect")) {
if ($result2 > 0) {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
print '<span class="ok">'.$langs->trans("LDAPSynchroOK").'</span><br>';
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print '<span class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
@ -487,9 +487,9 @@ if (function_exists("ldap_connect")) {
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print '<span class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}

View File

@ -223,12 +223,12 @@ if (function_exists("ldap_connect")) {
if ($result2 > 0) {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
print '<span class="ok">'.$langs->trans("LDAPSynchroOK").'</span><br>';
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print '<span class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
@ -238,9 +238,9 @@ if (function_exists("ldap_connect")) {
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print '<span class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}

View File

@ -444,12 +444,12 @@ if (function_exists("ldap_connect")) {
if ($result2 > 0) {
print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
print '<span class="ok">'.$langs->trans("LDAPSynchroOK").'</span><br>';
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print '<span class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
@ -459,9 +459,9 @@ if (function_exists("ldap_connect")) {
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print '<span class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}
@ -530,9 +530,9 @@ if (function_exists("ldap_connect")) {
print "\n<br>";
} else {
print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print '<span class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error;
print '</font><br>';
print '</span><br>';
print $langs->trans("ErrorLDAPMakeManualTest", $conf->ldap->dir_temp).'<br>';
}
}

View File

@ -307,7 +307,7 @@ for ($i = 1; $i <= 6; $i++) {
$pid = false;
}
} else {
$pid = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
$pid = img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
}
if ($pid) {
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';

View File

@ -63,7 +63,7 @@ if ($action == 'updateform') {
if ($res3 && $res4 && $res5 && $res6) {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
} elseif ($action == 'delete') {
} elseif ($action == 'deletefile') {
// Delete file
$langs->load("other");
$file = $conf->admin->dir_temp.'/'.GETPOST('urlfile', 'alpha');

View File

@ -183,7 +183,7 @@ if ($action == 'edit') {
if (count($listofmethods)) {
print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, $conf->global->MAIN_SMS_SENDMODE, 1);
} else {
print '<font class="error">'.$langs->trans("None").'</font>';
print '<span class="error">'.$langs->trans("None").'</span>';
}
print '</td></tr>';

View File

@ -132,6 +132,8 @@ if ($action == 'updateMask') {
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
} elseif ($action == 'unsetdoc') {
dolibarr_del_const($db, "COMMANDE_SUPPLIER_ADDON_PDF", $conf->entity);
} elseif ($action == 'setmod') {
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
@ -397,7 +399,8 @@ foreach ($dirmodels as $reldir) {
// Default
print '<td class="center">';
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") {
print img_picto($langs->trans("Default"), 'on');
// print img_picto($langs->trans("Default"), 'on');
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}

View File

@ -89,6 +89,8 @@ if ($action == 'updateMask') {
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
} elseif ($action == 'unsetdoc') {
dolibarr_del_const($db, "SUPPLIER_PAYMENT_ADDON_PDF", $conf->entity);
} elseif ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');

View File

@ -55,7 +55,7 @@ if (!$user->admin) {
* Actions
*/
if ($action == 'delete') {
if ($action == 'deletefile') {
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha'))) {
$file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
$ret = dol_delete_file($file, 1);
@ -513,7 +513,7 @@ if (!empty($_SESSION["commandbackuplastdone"])) {
$_SESSION["commandbackupresult"] = '';
}
if (!empty($_SESSION["commandbackuptorun"])) {
print '<br><font class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':</font><br>'."\n";
print '<br><span class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':</span><br>'."\n";
print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
print ajax_autoselect("commandbackuptoruntext", 0);
print '<br>';

View File

@ -120,7 +120,7 @@ class Documents extends DolibarrApi
*
* Test sample 1: { "modulepart": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }.
*
* @param string $modulepart Name of module or area concerned by file download ('invoice', 'order', ...).
* @param string $modulepart Name of module or area concerned by file download ('thirdparty', 'member', 'proposal', 'supplier_proposal', 'order', 'supplier_order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...)
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf).
* @param string $doctemplate Set here the doc template to use for document generation (If not set, use the default template).
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
@ -325,6 +325,20 @@ class Documents extends DolibarrApi
throw new RestException(404, 'Proposal not found');
}
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
} elseif ($modulepart == 'supplier_proposal') {
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
if (!DolibarrApiAccess::$user->rights->supplier_proposal->read) {
throw new RestException(401);
}
$object = new Propal($this->db);
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Supplier proposal not found');
}
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -340,6 +354,22 @@ class Documents extends DolibarrApi
}
$upload_dir = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
} elseif ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') {
$modulepart = 'supplier_order';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (empty(DolibarrApiAccess::$user->rights->fournisseur->commande->lire) && empty(DolibarrApiAccess::$user->rights->supplier_order->lire)) {
throw new RestException(401);
}
$object = new CommandeFournisseur($this->db);
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'Purchase order not found');
}
$upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref);
} elseif ($modulepart == 'shipment' || $modulepart == 'expedition') {
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
@ -373,7 +403,7 @@ class Documents extends DolibarrApi
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (!DolibarrApiAccess::$user->rights->fournisseur->facture->lire) {
if (empty(DolibarrApiAccess::$user->rights->fournisseur->facture->lire) && empty(DolibarrApiAccess::$user->rights->supplier_invoice->lire)) {
throw new RestException(401);
}
@ -504,7 +534,7 @@ class Documents extends DolibarrApi
* Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
*
* @param string $filename Name of file to create ('FA1705-0123.txt')
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
* @param string $modulepart Name of module or area concerned by file upload ('product', 'service', 'invoice', 'proposal', 'project', 'project_task', 'supplier_invoice', 'expensereport', 'member', ...)
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
* @param string $subdir Subdirectory (Only if ref not provided)
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)

View File

@ -274,7 +274,7 @@ if ($conf->product->enabled || $conf->product->service) {
} else {
$disabled = 1;
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
print '<font class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</font> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
print '<span class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined").'</span> (<a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>)<br>';
}
if (empty($nbno)) {
$disabled1 = 1;

View File

@ -54,7 +54,9 @@ function bomAdminPrepareHead()
//$this->tabs = array(
// 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'bom');
complete_head_from_modules($conf, $langs, null, $head, $h, 'bom@mrp');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@mrp', 'remove');
return $head;
}

View File

@ -73,8 +73,10 @@ $search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha');
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'), 'tzuserrel');
$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'), 'tzuserrel');
$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'), 'tzuserrel');
$datestart_dtstart = dol_mktime(0, 0, 0, GETPOST('datestart_dtstartmonth', 'int'), GETPOST('datestart_dtstartday', 'int'), GETPOST('datestart_dtstartyear', 'int'), 'tzuserrel');
$datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int'), GETPOST('datestart_dtendday', 'int'), GETPOST('datestart_dtendyear', 'int'), 'tzuserrel');
$dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel');
$dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel');
if ($search_status == '' && !GETPOSTISSET('search_status')) {
$search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
@ -205,8 +207,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_id = '';
$search_title = '';
$search_note = '';
$datestart = '';
$dateend = '';
$datestart_dtstart = '';
$datestart_dtend = '';
$dateend_dtstart = '';
$dateend_dtend = '';
$search_status = '';
$toselect = '';
$search_array_options = array();
@ -323,23 +327,41 @@ if ($search_title != '') {
if ($search_note != '') {
$param .= '&search_note='.urlencode($search_note);
}
if (GETPOST('datestartday', 'int')) {
$param .= '&datestartday='.GETPOST('datestartday', 'int');
if (GETPOST('datestartday_dtstart', 'int')) {
$param .= '&datestartday_dtstart='.GETPOST('datestartday_dtstart', 'int');
}
if (GETPOST('datestartmonth', 'int')) {
$param .= '&datestartmonth='.GETPOST('datestartmonth', 'int');
if (GETPOST('datestartmonth_dtstart', 'int')) {
$param .= '&datestartmonth_dtstart='.GETPOST('datestartmonth_dtstart', 'int');
}
if (GETPOST('datestartyear', 'int')) {
$param .= '&datestartyear='.GETPOST('datestartyear', 'int');
if (GETPOST('datestartyear_dtstart', 'int')) {
$param .= '&datestartyear_dtstart='.GETPOST('datestartyear_dtstart', 'int');
}
if (GETPOST('dateendday', 'int')) {
$param .= '&dateendday='.GETPOST('dateendday', 'int');
if (GETPOST('datestartday_dtend', 'int')) {
$param .= '&datestartday_dtend='.GETPOST('datestartday_dtend', 'int');
}
if (GETPOST('dateendmonth', 'int')) {
$param .= '&dateendmonth='.GETPOST('dateendmonth', 'int');
if (GETPOST('datestartmonth_dtend', 'int')) {
$param .= '&datestartmonth_dtend='.GETPOST('datestartmonth_dtend', 'int');
}
if (GETPOST('dateendyear', 'int')) {
$param .= '&dateendyear='.GETPOST('dateendyear', 'int');
if (GETPOST('datestartyear_dtend', 'int')) {
$param .= '&datestartyear_dtend='.GETPOST('datestartyear_dtend', 'int');
}
if (GETPOST('dateendday_dtstart', 'int')) {
$param .= '&dateendday_dtstart='.GETPOST('dateendday_dtstart', 'int');
}
if (GETPOST('dateendmonth_dtstart', 'int')) {
$param .= '&dateendmonth_dtstart='.GETPOST('dateendmonth_dtstart', 'int');
}
if (GETPOST('dateendyear_dtstart', 'int')) {
$param .= '&dateendyear_dtstart='.GETPOST('dateendyear_dtstart', 'int');
}
if (GETPOST('dateendday_dtend', 'int')) {
$param .= '&dateendday_dtend='.GETPOST('dateendday_dtend', 'int');
}
if (GETPOST('dateendmonth_dtend', 'int')) {
$param .= '&dateendmonth_dtend='.GETPOST('dateendmonth_dtend', 'int');
}
if (GETPOST('dateendyear_dtend', 'int')) {
$param .= '&dateendyear_dtend='.GETPOST('dateendyear_dtend', 'int');
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
@ -502,11 +524,17 @@ if ($filtert > 0 || $usergroup > 0) {
if ($dateselect > 0) {
$sql .= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect - 3600)."' AND a.datep <= '".$db->idate($dateselect + 3600 * 24 - 1)."'))";
}
if ($datestart > 0) {
$sql .= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart + 3600 * 24 - 1)."'";
if ($datestart_dtstart > 0) {
$sql .= " AND a.datep >= '".$db->idate($datestart_dtstart)."'";
}
if ($dateend > 0) {
$sql .= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend + 3600 * 24 - 1)."'";
if ($datestart_dtend > 0) {
$sql .= " AND a.datep <= '".$db->idate($datestart_dtend)."'";
}
if ($dateend_dtstart > 0) {
$sql .= " AND a.datep2 >= '".$db->idate($dateend_dtstart)."'";
}
if ($dateend_dtend > 0) {
$sql .= " AND a.datep2 <= '".$db->idate($dateend_dtend)."'";
}
// Add where from extra fields
@ -723,12 +751,22 @@ if (!empty($arrayfields['a.note']['checked'])) {
}
if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '<div class="nowrap">';
print $form->selectDate($datestart_dtstart, 'datestart_dtstart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel');
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($datestart_dtend, 'datestart_dtend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('To'), 'tzuserrel');
print '</div>';
print '</td>';
}
if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '<div class="nowrap">';
print $form->selectDate($dateend_dtstart, 'dateend_dtstart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'), 'tzuserrel');
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($dateend_dtend, 'dateend_dtend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('To'), 'tzuserrel');
print '</div>';
print '</td>';
}
if (!empty($arrayfields['s.nom']['checked'])) {

View File

@ -163,7 +163,7 @@ if ($resql) {
// Button to build doc
print '<td class="center">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=builddoc&amp;page='.$page.'&amp;month='.$obj->month.'&amp;year='.$obj->year.'">'.img_picto($langs->trans('BuildDoc'), 'filenew').'</a>';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=builddoc&page='.((int) $page).'&month='.((int) $obj->month).'&year='.((int) $obj->year).'">'.img_picto($langs->trans('BuildDoc'), 'filenew').'</a>';
print '</td>';
$name = "actions-".$obj->month."-".$obj->year.".pdf";

View File

@ -351,7 +351,7 @@ if ($object->id > 0) {
print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
}
print '</td></tr>';

View File

@ -912,7 +912,7 @@ if ($action == 'create') {
}
}
if (empty($nbemail)) {
$nbemail .= ' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
$nbemail .= ' '.img_warning('').' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
}
if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning');
@ -1161,7 +1161,7 @@ if ($action == 'create') {
}
}
if (empty($nbemail)) {
$nbemail .= ' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
$nbemail .= ' '.img_warning('').' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
}
if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning');

View File

@ -284,7 +284,7 @@ if ($object->fetch($id) >= 0) {
}
}
if (empty($nbemail)) {
$nbemail .= ' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
$nbemail .= ' '.img_warning('').' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
}
if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning');

View File

@ -3756,8 +3756,9 @@ if ($action == 'create') {
print '<input type="hidden" name="amount" value="'.$objectsrc->total_ht.'">'."\n";
print '<input type="hidden" name="total" value="'.$objectsrc->total_ttc.'">'."\n";
print '<input type="hidden" name="tva" value="'.$objectsrc->total_tva.'">'."\n";
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
// The commented lines below are fields already added as hidden parameters before
//print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
//print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
switch (get_class($objectsrc)) {
case 'Propal':

View File

@ -81,6 +81,12 @@ if ($type == 'bank-transfer') {
}
}
if ($type == 'bank-transfer') {
$usercancreate = ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer);
} else {
$usercancreate = $user->rights->facture->creer;
}
/*
* Actions
@ -93,7 +99,7 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
if ($action == "new") {
if ($action == "new" && $usercancreate) {
if ($object->id > 0) {
$db->begin();
@ -117,7 +123,7 @@ if (empty($reshook)) {
$action = '';
}
if ($action == "delete") {
if ($action == "delete" && $usercancreate) {
if ($object->id > 0) {
$result = $object->demande_prelevement_delete($user, GETPOST('did', 'int'));
if ($result == 0) {
@ -126,6 +132,83 @@ if (empty($reshook)) {
}
}
}
// payments conditions
if ($action == 'setconditions' && $usercancreate) {
$object->fetch($id);
$object->cond_reglement_code = 0; // To clean property
$object->cond_reglement_id = 0; // To clean property
$error = 0;
$db->begin();
if (!$error) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (!$error) {
$old_date_echeance = $object->date_echeance;
$new_date_echeance = $object->calculate_date_lim_reglement();
if ($new_date_echeance > $old_date_echeance) {
$object->date_echeance = $new_date_echeance;
}
if ($object->date_echeance < $object->date) {
$object->date_echeance = $object->date;
}
$result = $object->update($user);
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
} elseif ($action == 'setmode' && $usercancreate) {
// payment mode
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
} elseif ($action == 'setdatef' && $usercancreate) {
$newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver');
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
} else {
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
}
}
$object->date = $newdate;
$date_echence_calc = $object->calculate_date_lim_reglement();
if (!empty($object->date_echeance) && $object->date_echeance < $date_echence_calc) {
$object->date_echeance = $date_echence_calc;
}
if ($object->date_echeance && $object->date_echeance < $object->date) {
$object->date_echeance = $object->date;
}
$result = $object->update($user);
if ($result < 0) {
dol_print_error($db, $object->error);
}
} elseif ($action == 'setdate_lim_reglement' && $usercancreate) {
$object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int'));
if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
$object->date_echeance = $object->date;
setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
}
$result = $object->update($user);
if ($result < 0) {
dol_print_error($db, $object->error);
}
}
}
@ -206,6 +289,34 @@ if ($object->id > 0) {
$head = facture_prepare_head($object);
}
$numopen = 0;
$pending = 0;
$numclosed = 0;
// How many Direct debit or Credit transfer open requests ?
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$sql .= " , pfd.date_traite as date_traite";
$sql .= " , pfd.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
} else {
$sql .= " WHERE fk_facture = ".((int) $object->id);
}
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
if ($result_sql) {
$num = $db->num_rows($result_sql);
$numopen = $num;
} else {
dol_print_error($db);
}
print dol_get_fiche_head($head, 'standingorders', $title, -1, ($type == 'bank-transfer' ? 'supplier_invoice' : 'bill'));
// Invoice content
@ -363,14 +474,14 @@ if ($object->id > 0) {
print $langs->trans('DateInvoice');
print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != $object::TYPE_CREDIT_NOTE) {
if ($action == 'editinvoicedate') {
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate');
print $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate', 0, 0, 1, $type);
} else {
print dol_print_date($object->date, 'day');
}
@ -386,13 +497,13 @@ if ($object->id > 0) {
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
if ($object->type != $object::TYPE_CREDIT_NOTE) {
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 0, $type);
} else {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
}
@ -407,7 +518,7 @@ if ($object->id > 0) {
print $langs->trans('DateMaxPayment');
print '</td>';
if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
@ -418,7 +529,7 @@ if ($object->id > 0) {
}
if ($action == 'editpaymentterm') {
$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm');
print $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm', 0, 0, 1, $type);
} else {
print dol_print_date($duedate, 'day');
if ($object->hasDelay()) {
@ -436,12 +547,16 @@ if ($object->id > 0) {
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
$filtertype = 'CRDT';
if ($type == 'bank-transfer') {
$filtertype = 'DBIT';
}
if ($action == 'editmode') {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', $filtertype, 1, 0, $type);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
@ -453,7 +568,7 @@ if ($object->id > 0) {
print $langs->trans('BankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="3">';
@ -481,7 +596,9 @@ if ($object->id > 0) {
print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
}
} else {
print img_warning($langs->trans("NoDefaultIBANFound"));
if ($numopen || ($type != 'bank-transfer' && $object->mode_reglement_code == 'PRE') || ($type == 'bank-transfer' && $object->mode_reglement_code == 'VIR')) {
print img_warning($langs->trans("NoDefaultIBANFound"));
}
}
print '</td></tr>';
@ -565,34 +682,6 @@ if ($object->id > 0) {
print dol_get_fiche_end();
$numopen = 0;
$pending = 0;
$numclosed = 0;
// How many Direct debit opened requests ?
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$sql .= " , pfd.date_traite as date_traite";
$sql .= " , pfd.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
} else {
$sql .= " WHERE fk_facture = ".((int) $object->id);
}
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
if ($result_sql) {
$num = $db->num_rows($result_sql);
$numopen = $num;
} else {
dol_print_error($db);
}
// For which amount ?
$sql = "SELECT SUM(pfd.amount) as amount";

View File

@ -363,7 +363,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
}
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
print '<td>'.$facstatic->getLibStatut(3).'</td>';
$alreadypaid = $facstatic->getSommePaiement();
print '<td>'.$facstatic->getLibStatut(3, $alreadypaid).'</td>';
print '</tr>';
$total_ht += $obj->total_ht;
$total_ttc += $obj->total_ttc;
@ -711,7 +712,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
print "</tr>\n";
}
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <span style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</span> </td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($tot_ht).'</td>';
}

View File

@ -416,10 +416,13 @@ if ($resql) {
print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';
print "</tr>\n";
if ($objp->paye == 1) { // If at least one invoice is paid, disable delete
// If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production
if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) {
$disable_delete = 1;
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
}
$total = $total + $objp->amount;
$i++;
}

View File

@ -173,7 +173,7 @@ if ($result > 0) {
// Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
print '<tr class="oddeven"><td colspan="2"><span class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</span></td></tr>';
} else {
$result = show_ldap_content($records, 0, $records['count'], true);
}

View File

@ -129,7 +129,6 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (!$error) {
$result = $object->create($user);
var_dump($object);exit;
if ($result > 0) {
// Creation OK
if ($conf->categorie->enabled && method_exists($object, 'setCategories')) {
@ -298,6 +297,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
}
$result = $object->delete($user);
if ($result > 0) {
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');

View File

@ -334,7 +334,7 @@ if ($type == 'directory') {
$textifempty = $langs->trans('NoFileFound');
} elseif ($section === '0') {
if ($module == 'ecm') {
$textifempty = '<br><div class="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
$textifempty = '<br><div class="center"><span class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</span></div><br>';
} else {
$textifempty = $langs->trans('NoFileFound');
}
@ -396,9 +396,9 @@ if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) {
//$param.=($param?'?':'').(preg_replace('/^&/','',$param));
if ($useajax || $action == 'delete') {
if ($useajax || $action == 'deletefile') {
$urlfile = '';
if ($action == 'delete') {
if ($action == 'deletefile') {
$urlfile = GETPOST('urlfile', 'alpha');
}

View File

@ -283,7 +283,7 @@ if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_
print '</td>';
print '<td class="left">';
if ($nbofsubdir && $nboffilesinsubdir) {
print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
print '<span style="color: #AAAAAA">+'.$nboffilesinsubdir.'</span> ';
}
print '</td>';
@ -439,7 +439,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir,
print '</td>';
print '<td class="left">';
if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) {
print '<font class="opacitymedium">+'.$nboffilesinsubdir.'</font> ';
print '<span class="opacitymedium">+'.$nboffilesinsubdir.'</span> ';
}
print '</td>';

View File

@ -86,13 +86,23 @@ class box_contacts extends ModeleBoxes
$sql .= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile, sp.email as spemail";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_client, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= ", spe.accountancy_code_customer as code_compta";
$sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
} else {
$sql .= ", s.code_compta";
$sql .= ", s.code_compta_fournisseur";
}
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", co.label as country, co.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON sp.fk_pays = co.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}

View File

@ -88,7 +88,12 @@ class box_factures_imp extends ModeleBoxes
if ($user->rights->facture->lire) {
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_client, s.client";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= ", spe.accountancy_code_customer as code_compta";
} else {
$sql .= ", s.code_compta";
}
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql .= ", f.ref, f.date_lim_reglement as datelimite";
@ -100,6 +105,9 @@ class box_factures_imp extends ModeleBoxes
$sql .= ", f.paye, f.fk_statut as status, f.rowid as facid";
$sql .= ", sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
@ -115,7 +123,12 @@ class box_factures_imp extends ModeleBoxes
if ($user->socid) {
$sql .= " AND s.rowid = ".((int) $user->socid);
}
$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,";
} else {
$sql .= " s.code_compta,";
}
$sql .= " f.ref, f.date_lim_reglement,";
$sql .= " f.type, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";

View File

@ -3629,7 +3629,7 @@ abstract class CommonObject
public function add_object_linked($origin = null, $origin_id = null, $f_user = null, $notrigger = 0)
{
// phpcs:enable
global $user;
global $user, $hookmanager, $action;
$origin = (!empty($origin) ? $origin : $this->origin);
$origin_id = (!empty($origin_id) ? $origin_id : $this->origin_id);
$f_user = isset($f_user) ? $f_user : $user;
@ -3647,6 +3647,20 @@ abstract class CommonObject
if ($origin == 'supplierorder') {
$origin = 'order_supplier';
}
// Elements of the core modules which have `$module` property but may to which we don't want to prefix module part to the element name for finding the linked object in llx_element_element.
// It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target.
$coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization');
// Add module part to target type if object has $module property and isn't in core modules.
$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
$parameters = array('targettype'=>$targettype);
// Hook for explicitly set the targettype if it must be differtent than $this->element
$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype'];
}
$this->db->begin();
$error = 0;
@ -3659,7 +3673,7 @@ abstract class CommonObject
$sql .= ((int) $origin_id);
$sql .= ", '" . $this->db->escape($origin) . "'";
$sql .= ", " . ((int) $this->id);
$sql .= ", '" . $this->db->escape($this->element) . "'";
$sql .= ", '" . $this->db->escape($targettype) . "'";
$sql .= ")";
dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
@ -3712,7 +3726,7 @@ abstract class CommonObject
*/
public function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1)
{
global $conf;
global $conf, $hookmanager, $action;
$this->linkedObjectsIds = array();
$this->linkedObjects = array();
@ -3722,6 +3736,16 @@ abstract class CommonObject
$withtargettype = false;
$withsourcetype = false;
$parameters = array('sourcetype'=>$sourcetype, 'sourceid'=>$sourceid, 'targettype'=>$targettype, 'targetid'=>$targetid);
// Hook for explicitly set the targettype if it must be differtent than $this->element
$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
if (!empty($hookmanager->resArray['sourcetype'])) $sourcetype = $hookmanager->resArray['sourcetype'];
if (!empty($hookmanager->resArray['sourceid'])) $sourceid = $hookmanager->resArray['sourceid'];
if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype'];
if (!empty($hookmanager->resArray['targetid'])) $targetid = $hookmanager->resArray['targetid'];
}
if (!empty($sourceid) && !empty($sourcetype) && empty($targetid)) {
$justsource = true; // the source (id and type) is a search criteria
if (!empty($targettype)) {
@ -5335,7 +5359,7 @@ abstract class CommonObject
$ecmfile->gen_or_uploaded = 'generated';
$ecmfile->description = ''; // indexed content
$ecmfile->keywords = ''; // keyword content
$ecmfile->src_object_type = $this->table_element.(empty($this->module) ? '' : '@'.$this->module);
$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
$ecmfile->src_object_id = $this->id;
$result = $ecmfile->create($user);
@ -7819,7 +7843,7 @@ abstract class CommonObject
$out .= $labeltoshow;
}
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) {
$out .= '&nbsp;<font color="red">*</font>';
$out .= '&nbsp;<span style="color: red">*</span>';
}
} else {
if ($mode != 'view' && !empty($extrafields->attributes[$this->table_element]['required'][$key])) {

View File

@ -1519,7 +1519,7 @@ class DolGraph
if (empty($conf->dol_optimize_smallscreen)) {
return ($defaultsize ? $defaultsize : '500');
} else {
return (empty($_SESSION['dol_screen_width']) ? '280' : ($_SESSION['dol_screen_width'] - 40));
return (empty($_SESSION['dol_screenwidth']) ? '280' : ($_SESSION['dol_screenwidth'] - 40));
}
}
if ($direction == 'height') {

View File

@ -1268,6 +1268,7 @@ class Form
$selected_input_value = $societetmp->name;
unset($societetmp);
}
// mode 1
$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : '');
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
@ -1443,6 +1444,10 @@ class Form
$label .= ' ('.$obj->name_alias.')';
}
if ($conf->global->SOCIETE_SHOW_VAT_IN_LIST && !empty($obj->tva_intra)) {
$label .= ' - '.$obj->tva_intra.'';
}
if ($showtype) {
if ($obj->client || $obj->fournisseur) {
$label .= ' (';
@ -3621,6 +3626,7 @@ class Form
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("PaymentConditionShort".$obj->code) != ("PaymentConditionShort".$obj->code) ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
@ -3875,10 +3881,10 @@ class Form
* Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want.
* See instead to force the default value by the caller.
*
* @param int $selected Id of payment term to preselect by default
* @param string $htmlname Nom de la zone select
* @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
* @param int $addempty Add an empty entry
* @param int $selected Id of payment term to preselect by default
* @param string $htmlname Nom de la zone select
* @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
* @param int $addempty Add an empty entry
* @param int $noinfoadmin 0=Add admin info, 1=Disable admin info
* @param string $morecss Add more CSS on select tag
* @param float $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters)
@ -3904,20 +3910,17 @@ class Form
if ($addempty) {
print '<option value="0">&nbsp;</option>';
}
$selectedDepositPercent = null;
foreach ($this->cache_conditions_paiements as $id => $arrayconditions) {
if ($filtertype <= 0 && ! empty($arrayconditions['deposit_percent'])) {
continue;
}
if ($selected == $id) {
$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
print '<option value="'.$id.'" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
} else {
print '<option value="'.$id.'" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
}
$label = $arrayconditions['label'];
if (! empty($arrayconditions['deposit_percent'])) {
@ -3925,7 +3928,6 @@ class Form
}
print $label;
print '</option>';
}
print '</select>';
@ -3933,7 +3935,6 @@ class Form
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox($htmlname);
if ($deposit_percent >= 0) {
print ' <span id="'.$htmlname.'_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
print $langs->trans('DepositPercent') . ' : ';
@ -5145,20 +5146,24 @@ class Form
* @param string $selected Id condition pre-selectionne
* @param string $htmlname Name of select html field
* @param int $addempty Add empty entry
* @param string $type Type ('direct-debit' or 'bank-transfer')
* @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
* @param float $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters)
* 0 : use default deposit percentage from entry
* > 0 : force deposit percentage (for example, from company object)
* @return void
*/
public function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0, $filtertype = -1, $deposit_percent = -1)
public function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0, $type = '', $filtertype = -1, $deposit_percent = -1)
{
// phpcs:enable
global $langs;
if ($htmlname != "none") {
print '<form method="post" action="'.$page.'">';
print '<form method="POST" action="'.$page.'">';
print '<input type="hidden" name="action" value="setconditions">';
print '<input type="hidden" name="token" value="'.newToken().'">';
if ($type) {
print '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
}
$this->select_conditions_paiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
print '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
print '</form>';
@ -5259,10 +5264,11 @@ class Form
* @param int $displayhour Display hour selector
* @param int $displaymin Display minutes selector
* @param int $nooutput 1=No print output, return string
* @param string $type 'direct-debit' or 'bank-transfer'
* @return string
* @see selectDate()
*/
public function form_date($page, $selected, $htmlname, $displayhour = 0, $displaymin = 0, $nooutput = 0)
public function form_date($page, $selected, $htmlname, $displayhour = 0, $displaymin = 0, $nooutput = 0, $type = '')
{
// phpcs:enable
global $langs;
@ -5270,9 +5276,12 @@ class Form
$ret = '';
if ($htmlname != "none") {
$ret .= '<form method="post" action="'.$page.'" name="form'.$htmlname.'">';
$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
if ($type) {
$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
}
$ret .= '<table class="nobordernopadding">';
$ret .= '<tr><td>';
$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
@ -5337,12 +5346,13 @@ class Form
* @param string $page Page
* @param int $selected Id mode pre-selectionne
* @param string $htmlname Name of select html field
* @param string $filtertype To filter on field type in llx_c_paiement (array('code'=>xx,'label'=>zz))
* @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
* @param int $active Active or not, -1 = all
* @param int $addempty 1=Add empty entry
* @param int $addempty 1=Add empty entry
* @param string $type Type ('direct-debit' or 'bank-transfer')
* @return void
*/
public function form_modes_reglement($page, $selected = '', $htmlname = 'mode_reglement_id', $filtertype = '', $active = 1, $addempty = 0)
public function form_modes_reglement($page, $selected = '', $htmlname = 'mode_reglement_id', $filtertype = '', $active = 1, $addempty = 0, $type = '')
{
// phpcs:enable
global $langs;
@ -5350,7 +5360,10 @@ class Form
print '<form method="POST" action="'.$page.'">';
print '<input type="hidden" name="action" value="setmode">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active);
if ($type) {
print '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
}
print $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
print '</form>';
} else {
@ -5835,11 +5848,11 @@ class Form
return $num;
} else {
$this->error = '<font class="error">'.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).'</font>';
$this->error = '<span class="error">'.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).'</span>';
return -1;
}
} else {
$this->error = '<font class="error">'.$this->db->error().'</font>';
$this->error = '<span class="error">'.$this->db->error().'</span>';
return -2;
}
}
@ -5890,9 +5903,9 @@ class Form
// Check parameters
if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
if ($societe_vendeuse->id == $mysoc->id) {
$return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</font>';
$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
} else {
$return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</font>';
$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
}
return $return;
}

View File

@ -700,8 +700,18 @@ class FormCompany extends Form
return $socid;
} else {
// Search to list thirdparties
$sql = "SELECT s.rowid, s.nom as name FROM";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
$sql = "SELECT s.rowid, s.nom as name ";
if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) {
$sql .= ", s.code_client, s.code_fournisseur";
}
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
$sql .= ", s.address, s.zip, s.town";
$sql .= ", dictp.code as country_code";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid = s.fk_pays";
}
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
// For ajax search we limit here. For combo list, we limit later
if (is_array($limitto) && count($limitto)) {

View File

@ -1338,11 +1338,11 @@ class FormFile
print '<tr class="oddeven" id="row-'.($filearray[$key]['rowid'] > 0 ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
// File name
print '<td class="minwith200">';
print '<td class="minwith200 tdoverflowmax500">';
// Show file name with link to download
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a class="paddingright" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
print '<a class="paddingright valignmiddle" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
if ($forcedownload) {
print '&attachment=1';
}
@ -1351,7 +1351,7 @@ class FormFile
}
print '&file='.urlencode($filepath);
print '">';
print img_mime($file['name'], $file['name'].' ('.dol_print_size($file['size'], 0, 0).')', 'inline-block valignbottom paddingright');
print img_mime($file['name'], $file['name'].' ('.dol_print_size($file['size'], 0, 0).')', 'inline-block valignmiddle paddingright');
if ($showrelpart == 1) {
print $relativepath;
}
@ -1503,7 +1503,7 @@ class FormFile
if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) {
$useajax = 0;
}
print '<a href="'.((($useinecm && $useinecm != 6) && $useajax) ? '#' : ($url.'?action=delete&token='.newToken().'&urlfile='.urlencode($filepath).$param)).'" class="reposition deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
print '<a href="'.((($useinecm && $useinecm != 6) && $useajax) ? '#' : ($url.'?action=deletefile&token='.newToken().'&urlfile='.urlencode($filepath).$param)).'" class="reposition deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
}
print "</td>";
@ -1511,10 +1511,10 @@ class FormFile
if ($nboffiles > 1 && $conf->browser->layout != 'phone') {
print '<td class="linecolmove tdlineupdown center">';
if ($i > 0) {
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id.'">'.img_up('default', 0, 'imgupforline').'</a>';
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id.'">'.img_up('default', 0, 'imgupforline').'</a>';
}
if ($i < $nboffiles - 1) {
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id.'">'.img_down('default', 0, 'imgdownforline').'</a>';
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id.'">'.img_down('default', 0, 'imgdownforline').'</a>';
}
print '</td>';
} else {
@ -1542,11 +1542,11 @@ class FormFile
if (empty($disablemove)) {
$colspan++; // 6 columns or 7
}
print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">';
print '<tr class="oddeven"><td colspan="'.$colspan.'">';
if (empty($textifempty)) {
print $langs->trans("NoFileFound");
print '<span class="opacitymedium">'.$langs->trans("NoFileFound").'</span>';
} else {
print $textifempty;
print '<span class="opacitymedium">'.$textifempty.'</span>';
}
print '</td></tr>';
}
@ -1578,7 +1578,7 @@ class FormFile
*
* @param string $upload_dir Directory that was scanned. This directory will contains files into subdirs REF/files
* @param array $filearray Array of files loaded by dol_dir_list function before calling this function
* @param string $modulepart Value for modulepart used by download wrapper
* @param string $modulepart Value for modulepart used by download wrapper. Value can be $object->table_name (that is 'myobject' or 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose)
* @param string $param Parameters on sort links
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file
* @param string $relativepath Relative path of docs (autodefined if not provided)
@ -1742,7 +1742,8 @@ class FormFile
$id = 0;
$ref = '';
// To show ref or specific information according to view to show (defined by $module)
// To show ref or specific information according to view to show (defined by $modulepart)
// $modulepart can be $object->table_name (that is 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose)
$reg = array();
if ($modulepart == 'company' || $modulepart == 'tax') {
preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg);
@ -1848,10 +1849,9 @@ class FormFile
// File
// Check if document source has external module part, if it the case use it for module part on document.php
preg_match('/^[^@]*@([^@]*)$/', $modulepart.'@expertisemedical', $modulesuffix);
print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.(empty($modulesuffix) ? $modulepart : $modulesuffix[1]);
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.urlencode($modulepart);
if ($forcedownload) {
print '&attachment=1';
}
@ -1862,7 +1862,7 @@ class FormFile
//print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
print $this->showPreview($file, (empty($modulesuffix) ? $modulepart : $modulesuffix[1]), $file['relativename']);
print $this->showPreview($file, $modulepart, $file['relativename']);
print "</td>\n";
@ -2096,8 +2096,8 @@ class FormFile
print "</tr>\n";
}
if ($nboflinks == 0) {
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">';
print $langs->trans("NoLinkFound");
print '<tr class="oddeven"><td colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("NoLinkFound").'</span>';
print '</td></tr>';
}
print "</table>";

View File

@ -178,7 +178,7 @@ function limitChars(textarea, limit, infodiv)
} else {
if ($this->fromtype) {
$langs->load("errors");
print '<font class="warning"> &lt;'.$langs->trans("ErrorNoPhoneDefinedForThisUser").'&gt; </font>';
print '<span class="warning"> &lt;'.$langs->trans("ErrorNoPhoneDefinedForThisUser").'&gt; </span>';
}
}
print "</td></tr>\n";

View File

@ -1232,7 +1232,7 @@ class FormTicket
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : '');
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':''));
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
print '<label for="send_msg_email">'.$langs->trans('SendMessageByEmail').'</label>';
print '</td></tr>';

View File

@ -879,7 +879,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$i++;
}
} else {
print '<tr class="oddeven"><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr class="oddeven"><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
$db->free($result);
} else {
@ -1446,8 +1446,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element) {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && $filterobj->table_element && $filterobj->element) {
if (!empty($filterobj->fields['ref'])) {
$sql .= ", o.ref";
} elseif (!empty($filterobj->fields['label'])) {
$sql .= ", o.label";
}
}
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
@ -1482,7 +1486,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element) {
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (is_array($filterobj->fields['ref']) || is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
$sql .= ", ".MAIN_DB_PREFIX.$filterobj->table_element." as o";
}
@ -1524,7 +1528,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && is_array($filterobj->fields['ref']) && $filterobj->table_element && $filterobj->element) {
} elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (is_array($filterobj->fields['ref']) || is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
// Generic case
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? "@".$module : "")."'";
if ($filterobj->id) {

View File

@ -1613,7 +1613,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
* @param string $morecss More Css
* @param string $morecss More CSS on the link <a>
* @param int $limittoshow Limit number of tabs to show. Use 0 to use automatic default value.
* @param string $moretabssuffix A suffix to use when you have several dol_get_fiche_head() in same page
* @return string
@ -6156,7 +6156,7 @@ function yn($yesno, $case = 1, $color = 0)
}
}
if ($color) {
return '<font class="'.$classname.'">'.$result.'</font>';
return '<span class="'.$classname.'">'.$result.'</span>';
}
return $result;
}

View File

@ -54,6 +54,22 @@ function establishment_prepare_head($object)
complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment', 'remove');
$head[$h][0] = dol_buildpath("/hrm/admin/setup.php", 1);
$head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm');
$head[$h][0] = dol_buildpath("/hrm/admin/about.php", 1);
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm');
return $head;
}

View File

@ -484,7 +484,7 @@ function getNumberInvoicesPieChart($mode)
$sql .= " sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub30, 'Y-m-d')."'", 1, 0).") as nblate30";
$sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($datenowsub15, 'Y-m-d')."'", 1, 0).") as nblate15";
$sql .= ", sum(".$db->ifsql("f.date_lim_reglement < '".date_format($now, 'Y-m-d')."'", 1, 0).") as nblatenow";
$sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($now, 'Y-m-d')."'", 1, 0).") as nbnotlatenow";
$sql .= ", sum(".$db->ifsql("f.date_lim_reglement >= '".date_format($now, 'Y-m-d')."' OR f.date_lim_reglement IS NULL", 1, 0).") as nbnotlatenow";
$sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd15, 'Y-m-d')."'", 1, 0).") as nbnotlate15";
$sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd30, 'Y-m-d')."'", 1, 0).") as nbnotlate30";
if ($mode == 'customers') {
@ -515,13 +515,20 @@ function getNumberInvoicesPieChart($mode)
,array($langs->trans('InvoiceNotLate'), $obj->nbnotlatenow - $obj->nbnotlate15)
,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30)
,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30));*/
$dataseries[0]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30);
$dataseries[$i]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30);
$i++;
}
foreach ($dataseries as $key=>$value) {
$total += $value[1];
foreach ($dataseries[0] as $key=>$value) {
$total += $value;
}
$legend = array($langs->trans('InvoiceLate30Days'), $langs->trans('InvoiceLate15Days'), $langs->trans('InvoiceLateMinus15Days'), $langs->trans('InvoiceNotLate'), $langs->trans('InvoiceNotLate15Days'), $langs->trans('InvoiceNotLate30Days'));
$legend = array(
$langs->trans('InvoiceLate30Days'),
$langs->trans('InvoiceLate15Days'),
$langs->trans('InvoiceLateMinus15Days'),
$mode == 'customers' ? $langs->trans('InvoiceNotLate') : $langs->trans("InvoiceToPay"),
$mode == 'customers' ? $langs->trans('InvoiceNotLate15Days') : $langs->trans("InvoiceToPay15Days"),
$mode == 'customers' ? $langs->trans('InvoiceNotLate30Days') : $langs->trans("InvoiceToPay30Days"),
);
$colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11, '-'.$badgeStatus11);
@ -1226,7 +1233,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
print "</tr>\n";
}
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc - $totalam).')</font> </td>';
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <span style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc - $totalam).')</span> </td>';
print '<td>&nbsp;</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right"><span class="amount">'.price($total).'</span></td>';
@ -1391,7 +1398,7 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
print "</tr>\n";
}
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <font style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc - $totalam).')</font> </td>';
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <span style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc - $totalam).')</span> </td>';
print '<td>&nbsp;</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="right">'.price($total).'</td>';

View File

@ -224,7 +224,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
}
if ($type == 'free') {
$out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : '');
$out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '<span style="color: #666666">' : '').$amount.($mode ? '</span>' : '').'&tag='.($mode ? '<span style="color: #666666">' : '').$freetag.($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
@ -234,120 +234,120 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
}
//if ($mode) $out.='&noidempotency=1';
} elseif ($type == 'order') {
$out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'order_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
} else {
$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
}
}
} elseif ($type == 'invoice') {
$out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'invoice_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
} else {
$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
}
}
} elseif ($type == 'contractline') {
$out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'contractline_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
} else {
$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
}
}
} elseif ($type == 'member' || $type == 'membersubscription') {
$newtype = 'member';
$out = $urltouse.'/public/payment/newpayment.php?source=member&ref='.($mode ? '<font color="#666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source=member&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'member_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
} else {
$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$newtype."' + member_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$newtype.$ref, 2);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
}
}
}
if ($type == 'donation') {
$out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<font color="#666666">' : '');
$out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'donation_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$out .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
} else {
$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
}
}
}
@ -450,7 +450,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0,
}
}
print '<font style="font-size: 10px;"><br><hr>'."\n";
print '<span style="font-size: 10px;"><br><hr>'."\n";
print $fromcompany->name.'<br>';
print $line1;
if (strlen($line1.$line2) > 50) {
@ -459,5 +459,5 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0,
print ' - ';
}
print $line2;
print '</font></div>'."\n";
print '</span></div>'."\n";
}

View File

@ -49,7 +49,7 @@ function pdf_admin_prepare_head()
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/pdf.php';
$head[$h][1] = $langs->trans("Common");
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'general';
$h++;
@ -2240,6 +2240,7 @@ function pdf_getTotalQty($object, $type, $outputlangs)
if (!empty($object->lines[$i]->fk_parent_line)) {
$special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
}
$hidedetails = '';
$parameters = array('i'=>$i, 'outputlangs'=>$outputlangs, 'hidedetails'=>$hidedetails, 'special_code'=>$special_code);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_getTotalQty', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -2263,7 +2264,7 @@ function pdf_getTotalQty($object, $type, $outputlangs)
* @param Translate $outputlangs Object lang for output
* @return array Linked objects
*/
function pdf_getLinkedObjects($object, $outputlangs)
function pdf_getLinkedObjects(&$object, $outputlangs)
{
global $db, $hookmanager;
@ -2285,7 +2286,17 @@ function pdf_getLinkedObjects($object, $outputlangs)
}
} elseif ($objecttype == 'commande' || $objecttype == 'supplier_order') {
$outputlangs->load('orders');
foreach ($objects as $elementobject) {
if (count($objects) > 1) {
$object->note_public .= dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefOrder").' : <br>');
foreach ($objects as $elementobject) {
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '').' ');
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : ');
$object->note_public .= dol_concatdesc($object->note_public, dol_print_date($elementobject->date, 'day', '', $outputlangs));
$object->note_public .= dol_concatdesc($object->note_public, '<br>');
}
} elseif (count($objects) == 1) {
$elementobject = array_shift($objects);
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref).($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '').($elementobject->ref_supplier ? ' ('.$elementobject->ref_supplier.')' : '');
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate");
@ -2310,12 +2321,40 @@ function pdf_getLinkedObjects($object, $outputlangs)
} elseif ($objecttype == 'shipping') {
$outputlangs->loadLangs(array("orders", "sendings"));
foreach ($objects as $x => $elementobject) {
if (count($objects) > 1) {
$order = null;
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') $object->note_public .= dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' : <br>');
else $object->note_public .= dol_concatdesc($object->note_public, '<br>'.$outputlangs->transnoentities("RefSending").' : <br>');
// We concat this record info into fields xxx_value. title is overwrote.
foreach ($objects as $elementobject) {
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') { // There is not already a link to order and object is not the order, so we show also info with order
$elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (! empty($elementobject->linkedObjectsIds['commande'])) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$order = new Commande($db);
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
if ($ret < 1) {
$order = null;
}
}
}
if (! is_object($order)) {
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref));
$object->note_public .= dol_concatdesc($object->note_public, '<br>');
} else {
$object->note_public .= dol_concatdesc($object->note_public, $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''));
$object->note_public .= dol_concatdesc($object->note_public, ' / '.$outputlangs->transnoentities($elementobject->ref));
$object->note_public .= dol_concatdesc($object->note_public, '<br>');
}
}
} elseif (count($objects) == 1) {
$elementobject = array_shift($objects);
$order = null;
// We concat this record info into fields xxx_value. title is overwrote.
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') { // There is not already a link to order and object is not the order, so we show also info with order
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') { // There is not already a link to order and object is not the order, so we show also info with order
$elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (!empty($elementobject->linkedObjectsIds['commande'])) {
if (! empty($elementobject->linkedObjectsIds['commande'])) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$order = new Commande($db);
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
@ -2324,24 +2363,15 @@ function pdf_getLinkedObjects($object, $outputlangs)
}
}
}
if (!is_object($order)) {
if (! is_object($order)) {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
if (!empty($linkedobjects[$objecttype]['ref_value'])) {
$linkedobjects[$objecttype]['ref_value'] .= ' / ';
}
if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / ';
$linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref);
//$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateShipment");
//if (! empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'].=' / ';
//$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
} else {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending");
if (empty($linkedobjects[$objecttype]['ref_value'])) {
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '');
}
if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '');
$linkedobjects[$objecttype]['ref_value'] .= ' / '.$outputlangs->transnoentities($elementobject->ref);
//$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ($elementobject->date_delivery ? ' / ' . $outputlangs->transnoentities("DateShipment") : '');
//if (empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);
//$linkedobjects[$objecttype]['date_value'].= ($elementobject->date_delivery ? ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs) : '');
}
}
}

View File

@ -853,7 +853,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
print $hookmanager->resPrint;
if (empty($reshook)) {
if ($user->login) {
print $langs->trans("CurrentLogin").': <font class="error">'.$user->login.'</font><br>';
print $langs->trans("CurrentLogin").': <span class="error">'.$user->login.'</span><br>';
print $langs->trans("ErrorForbidden2", $langs->transnoentitiesnoconv("Home"), $langs->transnoentitiesnoconv("Users"));
} else {
print $langs->trans("ErrorForbidden3");

View File

@ -63,16 +63,16 @@ function getOnlineSignatureUrl($mode, $type, $ref = '')
$out = '';
if ($type == 'proposal') {
$out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<font color="#666666">' : '');
$out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'proposal_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</font>' : '');
$out .= ($mode ? '</span>' : '');
if ($mode == 1) {
$out .= '&hashp=<font color="#666666">hash_of_file</font>';
$out .= '&hashp=<span style="color: #666666">hash_of_file</span>';
} else {
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propaltmp = new Propal($db);

View File

@ -528,8 +528,10 @@ function includeContainer($containerref)
}
/**
* Return HTML content to add structured data for an article, news or Blog Post.
* Use the json-ld format.
* Return HTML content to add structured data for an article, news or Blog Post. Use the json-ld format.
* Example:
* <?php getStructureData('blogpost'); ?>
* <?php getStructureData('software', array('name'=>'Name', 'os'=>'Windows', 'price'=>10)); ?>
*
* @param string $type 'blogpost', 'product', 'software', 'organization', 'qa', ...
* @param array $data Array of data parameters for structured data
@ -734,6 +736,81 @@ function getStructuredData($type, $data = array())
return $ret;
}
/**
* Return HTML content to add as header card for an article, news or Blog Post or home page.
*
* @param array $params Array of parameters
* @return string HTML content
*/
function getSocialNetworkHeaderCards($params = null)
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
$out = '';
if ($website->virtualhost) {
$pageurl = $websitepage->pageurl;
$title = $websitepage->title;
$image = $websitepage->image;
$companyname = $mysoc->name;
$description = $websitepage->description;
$pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl);
$title = str_replace('__WEBSITE_KEY__', $website->ref, $title);
$image = '/medias'.(preg_match('/^\//', $image) ? '' : '/').str_replace('__WEBSITE_KEY__', $website->ref, $image);
$companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname);
$description = str_replace('__WEBSITE_KEY__', $website->ref, $description);
$shortlangcode = '';
if ($websitepage->lang) {
$shortlangcode = substr($websitepage->lang, 0, 2); // en_US or en-US -> en
}
if (empty($shortlangcode)) {
$shortlangcode = substr($website->lang, 0, 2); // en_US or en-US -> en
}
$fullurl = $website->virtualhost.'/'.$websitepage->pageurl.'.php';
$canonicalurl = $website->virtualhost.(($websitepage->id == $website->fk_default_home) ? '/' : (($shortlangcode != substr($website->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$websitepage->pageurl.'.php'));
$hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords))));
// Open Graph
$out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article
$out .= '<meta name="og:title" content="'.$websitepage->title.'">'."\n";
if ($websitepage->image) {
$out .= '<meta name="og:image" content="'.$website->virtualhost.$image.'">'."\n";
}
$out .= '<meta name="og:url" content="'.$canonicalurl.'">'."\n";
// Twitter
$out .= '<meta name="twitter:card" content="summary">'."\n";
if (!empty($params) && !empty($params['twitter_account'])) {
$out .= '<meta name="twitter:site" content="@'.$params['twitter_account'].'">'."\n";
$out .= '<meta name="twitter:creator" content="@'.$params['twitter_account'].'">'."\n";
}
$out .= '<meta name="twitter:title" content="'.$websitepage->title.'">'."\n";
if ($websitepage->description) {
$out .= '<meta name="twitter:description" content="'.$websitepage->description.'">'."\n";
}
if ($websitepage->image) {
$out .= '<meta name="twitter:image" content="'.$website->virtualhost.$image.'">'."\n";
}
//$out .= '<meta name="twitter:domain" content="'.getDomainFromURL($website->virtualhost, 1).'">';
/*
$out .= '<meta name="twitter:app:name:iphone" content="">';
$out .= '<meta name="twitter:app:name:ipad" content="">';
$out .= '<meta name="twitter:app:name:googleplay" content="">';
$out .= '<meta name="twitter:app:url:iphone" content="">';
$out .= '<meta name="twitter:app:url:ipad" content="">';
$out .= '<meta name="twitter:app:url:googleplay" content="">';
$out .= '<meta name="twitter:app:id:iphone" content="">';
$out .= '<meta name="twitter:app:id:ipad" content="">';
$out .= '<meta name="twitter:app:id:googleplay" content="">';
*/
}
return $out;
}
/**
* Return HTML content to add structured data for an article, news or Blog Post.
*

View File

@ -546,7 +546,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
print '</div>'."\n";
$lastlevel0 = 'enabled';
} elseif ($showmenu) { // Not enabled but visible (so greyed)
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'."\n";
print '<div class="menu_titre">'.$tabstring.'<span class="vmenudisabled">'.$menu_array[$i]['titre'].'</span></div>'."\n";
$lastlevel0 = 'greyed';
} else {
$lastlevel0 = 'hidden';
@ -582,7 +582,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
}
print '</div>'."\n";
} elseif ($showmenu && $lastlevel0 == 'enabled') { // Not enabled but visible (so greyed), except if parent was not enabled.
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n";
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring.'<span class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</span><br></div>'."\n";
}
}

View File

@ -309,7 +309,7 @@ class MenuManager
print '</ul>';
}
if ($val['enabled'] == 2) {
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
print '<span class="vsmenudisabled">'.$val['titre'].'</span>';
}
print '</li>';
print '</ul>'."\n";

View File

@ -1850,6 +1850,29 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="pictofixedwidth"'));
}
}
if (!empty($conf->hrm->enabled)) {
// Skills
$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("skill"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'shapes', 'class="pictofixedwidth"'));
$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm&action=create", $langs->trans("NewSkill"), 1, $user->rights->hrm->all->write);
$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->hrm->all->read);
// Job
$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("Job"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'technic', 'class="pictofixedwidth"'));
$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->rights->hrm->all->write);
$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->hrm->all->read);
// Position
$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("Position"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user-cog', 'class="pictofixedwidth"'));
$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->rights->hrm->all->write);
$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->hrm->all->read);
// Evaluation
$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("Eval"), 0, $user->rights->hrm->evaluation->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="pictofixedwidth"'));
$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm&action=create", $langs->trans("NewEval"), 1, $user->rights->hrm->evaluation->write);
$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->hrm->evaluation->read);
$newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("Compare"), 1, $user->rights->hrm->compare->read);
}
}
@ -2081,7 +2104,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
print '</div>'."\n";
$lastlevel0 = 'enabled';
} elseif ($showmenu) { // Not enabled but visible (so greyed)
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'."\n";
print '<div class="menu_titre">'.$tabstring.'<span class="vmenudisabled">'.$menu_array[$i]['titre'].'</span></div>'."\n";
$lastlevel0 = 'greyed';
} else {
$lastlevel0 = 'hidden';
@ -2122,7 +2145,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Not enabled but visible (so greyed), except if parent was not enabled.
print '<div class="menu_contenu'.$cssmenu.'">';
print $tabstring;
print '<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n";
print '<span class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</span><br></div>'."\n";
}
}

View File

@ -317,14 +317,14 @@ class MenuManager
print '</ul>';
}
if ($val['enabled'] == 2) {
print '<font class="vsmenudisabled">';
print '<span class="vsmenudisabled">';
// Add font-awesome
if ($val['level'] == 0 && !empty($val['prefix'])) {
print $val['prefix'];
}
print $val['titre'];
print '</font>';
print '</span>';
}
print '</li>';
print '</ul>'."\n";

View File

@ -320,7 +320,7 @@ class MenuManager
print '</ul>';
}
if ($val['enabled'] == 2) {
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
print '<span class="vsmenudisabled">'.$val['titre'].'</span>';
}
print '</li>';
print '</ul>'."\n";
@ -407,7 +407,7 @@ class MenuManager
if ($menu_array[$i]['enabled']) {
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($menu_array[$i]['url'], 1).'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>'.$menu_array[$i]['titre'].'</a></div>'."\n";
} else {
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'."\n";
print '<div class="menu_titre">'.$tabstring.'<span class="vmenudisabled">'.$menu_array[$i]['titre'].'</span></div>'."\n";
}
print '<div class="menu_top"></div>'."\n";
}
@ -433,7 +433,7 @@ class MenuManager
print '</span>';
}
} else {
print $tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font>';
print $tabstring.'<span class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</span>';
}
// If title is not pure text and contains a table, no carriage return added

View File

@ -29,7 +29,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
/**
* Class to build sending documents with model espadon
@ -651,6 +651,11 @@ class pdf_espadon extends ModelePdfExpedition
$nexY = max($pdf->GetY(), $nexY);
}
if ($this->getColumnStatus('unit_order')) {
$this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit));
$nexY = max($pdf->GetY(), $nexY);
}
if ($this->getColumnStatus('qty_shipped')) {
$this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped);
$nexY = max($pdf->GetY(), $nexY);
@ -1312,6 +1317,20 @@ class pdf_espadon extends ModelePdfExpedition
),
);
$rank = $rank + 10;
$this->cols['unit_order'] = array(
'rank' => $rank,
'width' => 15, // in mm
'status' => empty($conf->global->PRODUCT_USE_UNITS) ? 0 : 1,
'title' => array(
'textkey' => 'Unit'
),
'border-left' => true, // add left line separator
'content' => array(
'align' => 'C',
),
);
$rank = $rank + 10;
$this->cols['qty_shipped'] = array(
'rank' => $rank,

View File

@ -0,0 +1,148 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/core/modules/hrm/mod_evaluation_advanced.php
* \ingroup hrm
* \brief File containing class for advanced numbering model of Evaluation
*/
dol_include_once('/core/modules/hrm/modules_evaluation.php');
/**
* Class to manage customer Bom numbering rules advanced
*/
class mod_evaluation_advanced extends ModeleNumRefEvaluation
{
/**
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
* @var string Error message
*/
public $error = '';
/**
* @var string name
*/
public $name = 'advanced';
/**
* Returns the description of the numbering model
*
* @return string Texte descripif
*/
public function info()
{
global $conf, $langs, $db;
$langs->load("bills");
$form = new Form($db);
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
$texte .= '<input type="hidden" name="action" value="updateMask">';
$texte .= '<input type="hidden" name="maskconstBom" value="HRM_EVALUATION_ADVANCED_MASK">';
$texte .= '<table class="nobordernopadding" width="100%">';
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Evaluation"), $langs->transnoentities("Evaluation"));
$tooltip .= $langs->trans("GenericMaskCodes2");
$tooltip .= $langs->trans("GenericMaskCodes3");
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Evaluation"), $langs->transnoentities("Evaluation"));
$tooltip .= $langs->trans("GenericMaskCodes5");
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskEvaluation" value="'.$conf->global->HRM_EVALUATION_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte .= '</tr>';
$texte .= '</table>';
$texte .= '</form>';
return $texte;
}
/**
* Return an example of numbering
*
* @return string Example
*/
public function getExample()
{
global $conf, $db, $langs, $mysoc;
$object = new Evaluation($db);
$object->initAsSpecimen();
/*$old_code_client = $mysoc->code_client;
$old_code_type = $mysoc->typent_code;
$mysoc->code_client = 'CCCCCCCCCC';
$mysoc->typent_code = 'TTTTTTTTTT';*/
$numExample = $this->getNextValue($object);
/*$mysoc->code_client = $old_code_client;
$mysoc->typent_code = $old_code_type;*/
if (!$numExample) {
$numExample = $langs->trans('NotConfigured');
}
return $numExample;
}
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
public function getNextValue($object)
{
global $db, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// We get cursor rule
$mask = $conf->global->HRM_EVALUATION_ADVANCED_MASK;
if (!$mask) {
$this->error = 'NotConfigured';
return 0;
}
$date = $object->date;
$numFinal = get_next_value($db, $mask, 'hrm_evaluation', 'ref', '', null, $date);
return $numFinal;
}
}

View File

@ -0,0 +1,161 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
*
* 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 <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/core/modules/hrm/mod_evaluation_standard.php
* \ingroup hrm
* \brief File of class to manage Evaluation numbering rules standard
*/
dol_include_once('/core/modules/hrm/modules_evaluation.php');
/**
* Class to manage customer order numbering rules standard
*/
class mod_evaluation_standard extends ModeleNumRefEvaluation
{
/**
* Dolibarr version of the loaded document
* @var string
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefix = 'EVAL';
/**
* @var string Error code (or message)
*/
public $error = '';
/**
* @var string name
*/
public $name = 'standard';
/**
* Return description of numbering module
*
* @return string Text with description
*/
public function info()
{
global $langs;
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
}
/**
* Return an example of numbering
*
* @return string Example
*/
public function getExample()
{
return $this->prefix."0501-0001";
}
/**
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
global $conf, $langs, $db;
$coyymm = ''; $max = '';
$posindice = strlen($this->prefix) + 6;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql .= " FROM ".MAIN_DB_PREFIX."hrm_evaluation";
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
if ($object->ismultientitymanaged == 1) {
$sql .= " AND entity = ".$conf->entity;
} elseif ($object->ismultientitymanaged == 2) {
// TODO
}
$resql = $db->query($sql);
if ($resql) {
$row = $db->fetch_row($resql);
if ($row) {
$coyymm = substr($row[0], 0, 6); $max = $row[0];
}
}
if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
$langs->load("errors");
$this->error = $langs->trans('ErrorNumRefModel', $max);
return false;
}
return true;
}
/**
* Return next free value
*
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/
public function getNextValue($object)
{
global $db, $conf;
// first we get the max value
$posindice = strlen($this->prefix) + 6;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql .= " FROM ".MAIN_DB_PREFIX."hrm_evaluation";
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
if ($object->ismultientitymanaged == 1) {
$sql .= " AND entity = ".$conf->entity;
} elseif ($object->ismultientitymanaged == 2) {
// TODO
}
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$max = intval($obj->max);
} else {
$max = 0;
}
} else {
dol_syslog("mod_evaluation_standard::getNextValue", LOG_DEBUG);
return -1;
}
//$date=time();
$date = $object->date_creation;
$yymm = strftime("%y%m", $date);
if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
} else {
$num = sprintf("%04s", $max + 1);
}
dol_syslog("mod_evaluation_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
}

View File

@ -0,0 +1,158 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* 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 <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/core/modules/hrm/modules_evaluation.php
* \ingroup hrm
* \brief File that contains parent class for evaluations document models and parent class for evaluations numbering models
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
/**
* Parent class for documents models
*/
abstract class ModelePDFEvaluation extends CommonDocGenerator
{
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
public static function liste_modeles($db, $maxfilenamelength = 0)
{
// phpcs:enable
global $conf;
$type = 'evaluation';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$list = getListOfModels($db, $type, $maxfilenamelength);
return $list;
}
}
/**
* Parent class to manage numbering of Evaluation
*/
abstract class ModeleNumRefEvaluation
{
/**
* @var string Error code (or message)
*/
public $error = '';
/**
* Return if a module can be used or not
*
* @return boolean true if module can be used
*/
public function isEnabled()
{
return true;
}
/**
* Returns the default description of the numbering template
*
* @return string Texte descripif
*/
public function info()
{
global $langs;
$langs->load("hrm");
return $langs->trans("NoDescription");
}
/**
* Returns an example of numbering
*
* @return string Example
*/
public function getExample()
{
global $langs;
$langs->load("hrm");
return $langs->trans("NoExample");
}
/**
* Checks if the numbers already in the database do not
* cause conflicts that would prevent this numbering working.
*
* @param Object $object Object we need next value for
* @return boolean false if conflict, true if ok
*/
public function canBeActivated($object)
{
return true;
}
/**
* Returns next assigned value
*
* @param Object $object Object we need next value for
* @return string Valeur
*/
public function getNextValue($object)
{
global $langs;
return $langs->trans("NotAvailable");
}
/**
* Returns version of numbering module
*
* @return string Valeur
*/
public function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') {
return $langs->trans("VersionDevelopment");
}
if ($this->version == 'experimental') {
return $langs->trans("VersionExperimental");
}
if ($this->version == 'dolibarr') {
return DOL_VERSION;
}
if ($this->version) {
return $this->version;
}
return $langs->trans("NotAvailable");
}
}

View File

@ -34,7 +34,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
*/
class modFournisseur extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
@ -430,8 +429,8 @@ class modFournisseur extends DolibarrModules
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"OrderId", 'f.ref'=>"Ref", 'f.ref_supplier'=>"RefSupplier", 'f.date_creation'=>"DateCreation", 'f.date_commande'=>"OrderDate", 'f.date_livraison'=>"DateDeliveryPlanned",
'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.fk_statut'=>'Status', 'f.date_approve'=>'DateApprove', 'f.date_approve2'=>'DateApprove2',
'f.note_public'=>"NotePublic", 'f.note_private'=>"NotePrivate", 'ua1.login'=>'ApprovedBy', 'ua2.login'=>'ApprovedBy2', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription",
'f.total_ht'=>"TotalHT", 'f.total_ttc'=>"TotalTTC", 'f.total_tva'=>"TotalVAT", 'f.fk_statut'=>'Status', 'f.date_valid'=>'DateValidation', 'f.date_approve'=>'DateApprove', 'f.date_approve2'=>'DateApprove2',
'f.note_public'=>"NotePublic", 'f.note_private'=>"NotePrivate", 'uv.login'=>'UserValidation', 'ua1.login'=>'ApprovedBy', 'ua2.login'=>'ApprovedBy2', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription",
'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.remise_percent'=>"Discount", 'fd.total_ht'=>"LineTotalHT", 'fd.total_ttc'=>"LineTotalTTC",
'fd.total_tva'=>"LineTotalVAT", 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'RefSupplier', 'fd.fk_product'=>'ProductId',
'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel'
@ -451,13 +450,13 @@ class modFournisseur extends DolibarrModules
's.rowid'=>"company", 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.cp'=>'Text', 's.ville'=>'Text', 'c.code'=>'Text', 's.tel'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', 's.tva_intra'=>'Text', 'f.ref'=>"Text", 'f.ref_supplier'=>"Text",
'f.date_creation'=>"Date", 'f.date_commande'=>"Date", 'f.date_livraison'=>"Date", 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric",
'f.fk_statut'=>'Status', 'f.date_approve'=>'Date', 'f.date_approve2'=>'Date', 'f.note_public'=>"Text", 'f.note_private'=>"Text", 'fd.description'=>"Text",
'f.fk_statut'=>'Status', 'f.date_valid'=>'Date', 'f.date_approve'=>'Date', 'f.date_approve2'=>'Date', 'f.note_public'=>"Text", 'f.note_private'=>"Text", 'fd.description'=>"Text",
'fd.tva_tx'=>"Numeric", 'fd.qty'=>"Numeric", 'fd.remise_percent'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.total_tva'=>"Numeric",
'fd.product_type'=>'Numeric', 'fd.ref'=>'Text', 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', 'project.ref'=>'Text', 'project.title'=>'Text'
);
$this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 's.phone'=>'company', 's.siren'=>'company',
's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', 's.tva_intra'=>'company', 'ua1.login'=>'user',
's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', 's.tva_intra'=>'company', 'uv.login'=>'user', 'ua1.login'=>'user',
'ua2.login'=>'user', 'fd.rowid'=>'order_line', 'fd.description'=>"order_line", 'fd.tva_tx'=>"order_line", 'fd.qty'=>"order_line", 'fd.remise_percent'=>"order_line",
'fd.total_ht'=>"order_line", 'fd.total_ttc'=>"order_line", 'fd.total_tva'=>"order_line", 'fd.product_type'=>'order_line', 'fd.ref'=>'order_line', 'fd.fk_product'=>'product',
'p.ref'=>'product', 'p.label'=>'product', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project'
@ -484,6 +483,7 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande_fournisseur as f';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as project on (f.fk_projet = project.rowid)';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON uv.rowid = f.fk_user_valid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua1 ON ua1.rowid = f.fk_user_approve';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua2 ON ua2.rowid = f.fk_user_approve2';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,';

View File

@ -46,82 +46,218 @@ class modHRM extends DolibarrModules
$this->module_position = '50';
// 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 employees carrier and feelings (department, employment contract)";
// Module description, used if translation string 'ModulehrmDesc' not found (hrm is name of module).
$this->description = "hrm Description product ";
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "hrm Description long";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'experimental';
// Author
$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 HRMTEST 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'
// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
$this->picto = 'hrm';
// define triggers
$this->module_parts = array();
// 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' => 1,
// Set this to 1 if module has its own printing directory (core/modules/printing)
'printing' => 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(
'/hrm/css/radio_js_number.css',
),
// Set this to relative path of js file if module must load a js on all pages
'js' => array(
// '/hrm/js/hrm.js.php',
),
// Data directories to create when module is enabled
$this->dirs = array();
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 0,
);
// Config pages
$this->config_page_url = array('admin_hrm.php@hrm');
// Data directories to create when module is enabled.
// Example: this->dirs = array("/hrm/temp","/hrm/subdir");
$this->dirs = array("/hrm/temp");
// Config pages. Put here list of php page, stored into hrm/admin directory, to use to setup module.
$this->config_page_url = array("hrm.php");
// 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(/*"modSalaries, modExpenseReport, modHoliday"*/); // 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, 6); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module
// 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', ...)
// The language file dedicated to your module
$this->langfiles = array("hrm");
// Prerequisites
$this->phpmin = array(5, 6); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
// Messages at activation
$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'=>'HrmTestWasAutomaticallyActivatedBecauseOfYourCountryChoice');
//$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('HRMTEST_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
// 2 => array('HRMTEST_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
// );
$this->const = array();
if (!isset($conf->hrm) || !isset($conf->hrm->enabled)) {
$conf->hrm = new stdClass();
$conf->hrm->enabled = 0;
}
// Array to add new pages in new tabs
$this->tabs = array();
$this->tabs[] = array('data'=>'user:+skill_tab:Skills:hrm:1:/hrm/skill_tab.php?id=__ID__&objecttype=user'); // To add a new tab identified by code tabname1
//$this->tabs[] = array('data'=>'job:+tabname1:Poste:mylangfile@hrm:1:/hrm/poste_list.php?fk_job=__ID__'); // To add a new tab identified by code tabname1
// Example:
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@hrm:$user->rights->hrm->read:/hrm/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@hrm:$user->rights->othermodule->read:/hrm/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();
// Constantes
$this->const = array();
// Boxes/Widgets
// Add here list of php file(s) stored in hrm/core/boxes that contains a class to show a widget.
$this->boxes = array(
// 0 => array(
// 'file' => 'hrmwidget1.php@hrm',
// 'note' => 'Widget provided by HrmTest',
// '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' => '/hrm/class/poste.class.php',
// 'objectname' => 'Poste',
// 'method' => 'doScheduledJob',
// 'parameters' => '',
// 'comment' => 'Comment',
// 'frequency' => 2,
// 'unitfrequency' => 3600,
// 'status' => 0,
// 'test' => '$conf->hrm->enabled',
// 'priority' => 50,
// ),
);
// Permissions provided by this module
$this->rights = array();
$r = 0;
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
// Boxes
$this->boxes = array();
// Permissions
$this->rights = array(); // Permission array used by this module
$r = 0;
/*
$this->rights[$r][0] = 4001;
$this->rights[$r][1] = 'See employees';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'read';
// Skill / Job / Position
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('ReadSkillJobPosition'); // Permission label
$this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->read)
$r++;
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('CreateUpdateSkillJobPosition'); // Permission label
$this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->write)
$r++;
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('DeleteSkillJobPosition'); // Permission label
$this->rights[$r][4] = 'all';
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->delete)
$r++;
$this->rights[$r][0] = 4002;
$this->rights[$r][1] = 'Create employees';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'write';
//Eval
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('ReadEval'); // Permission label
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->read)
$r++;
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('CreateUpdateEval'); // Permission label
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->write)
$r++;
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('ValidateEval'); // Permission label
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->write)
$r++;
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('DeleteEval'); // Permission label
$this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->delete)
$r++;
$this->rights[$r][0] = 4003;
$this->rights[$r][1] = 'Delete employees';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'delete';
// Comparison
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = $langs->trans('SeeComparisonMenu'); // Permission label
$this->rights[$r][4] = 'compare';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->poste->delete)
$r++;
$this->rights[$r][0] = 4004;
$this->rights[$r][1] = 'Export employees';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'export';
$r++;
*/
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
}
/**
@ -138,6 +274,11 @@ class modHRM extends DolibarrModules
// Permissions
$this->remove($options);
/*$result = $this->_load_tables('/hrm/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')
}*/
$sql = array();
return $this->_init($sql, $options);

View File

@ -252,17 +252,32 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
*/
public function checkIfAccountancyCodeIsAlreadyUsed($db, $code, $type = '')
{
global $conf;
if ($type == 'supplier') {
$typethirdparty = 'code_compta_fournisseur';
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$typethirdparty = 'accountancy_code_supplier';
} else {
$typethirdparty = 'code_compta_fournisseur';
}
} elseif ($type == 'customer') {
$typethirdparty = 'code_compta';
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$typethirdparty = 'accountancy_code_customer';
} else {
$typethirdparty = 'code_compta';
}
} else {
$this->error = 'Bad value for parameter type';
return -1;
}
$sql = "SELECT ".$typethirdparty." FROM ".MAIN_DB_PREFIX."societe";
$sql .= " WHERE ".$typethirdparty." = '".$db->escape($code)."'";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql = "SELECT " . $typethirdparty . " FROM " . MAIN_DB_PREFIX . "societe_perentity";
$sql .= " WHERE " . $typethirdparty . " = '" . $db->escape($code) . "'";
} else {
$sql = "SELECT " . $typethirdparty . " FROM " . MAIN_DB_PREFIX . "societe";
$sql .= " WHERE " . $typethirdparty . " = '" . $db->escape($code) . "'";
}
$resql = $db->query($sql);
if ($resql) {

View File

@ -63,10 +63,10 @@ if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket
/*
* Confirm form to delete
* Confirm form to delete a file
*/
if ($action == 'delete') {
if ($action == 'deletefile') {
$langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
print $form->formconfirm(
$_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")).'&linkid='.GETPOST('linkid', 'int').(empty($param) ? '' : $param),

View File

@ -233,7 +233,7 @@ if ($action == 'convertimgwebp' && $permtoadd) {
if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'delete') {
$langs->load("ecm");
print '<table width="100%" class="liste noborderbottom">'."\n";
print '<table class="liste centpercent">'."\n";
print '<!-- Title for manual directories -->'."\n";
print '<tr class="liste_titre">'."\n";

View File

@ -310,7 +310,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->fil
print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>';
} else {
$langs->load("errors");
print '<font class="warning">'.$langs->trans("ErrorOpenIDSetupNotComplete", 'MAIN_AUTHENTICATION_OPENID_URL').'</font>';
print '<span class="warning">'.$langs->trans("ErrorOpenIDSetupNotComplete", 'MAIN_AUTHENTICATION_OPENID_URL').'</span>';
}
echo '</div>';

View File

@ -17,7 +17,7 @@
/**
* \file htdocs/ecm/ajax/ecmdatabase.php
* \brief File to build ecm database
* \brief File to build/refresh the ecm database for directories
*/
if (!defined('NOTOKENRENEWAL')) {
@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$action = GETPOST('action', 'aZ09');
$element = GETPOST('element', 'alpha');
/*
* View
*/
@ -86,7 +87,7 @@ if (isset($action) && !empty($action)) {
}
if (!$dirisindatabase) {
$txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
$txt = "Directory found on disk ".$dirdesc['fullname'].", not found into table ecm_directories, so we add it";
dol_syslog($txt);
// We must first find the fk_parent of directory to create $dirdesc['fullname']
@ -155,15 +156,16 @@ if (isset($action) && !empty($action)) {
foreach ($sqltree as $dirdesc) { // Loop on each sqltree to check dir is on disk
$dirtotest = $conf->$element->dir_output.'/'.$dirdesc['fullrelativename'];
if (!dol_is_dir($dirtotest)) {
$mesg .= $dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']."<br>\n";
dol_syslog($dirtotest." not found onto disk. We delete from database dir with id=".$dirdesc['id']);
$ecmdirtmp->id = $dirdesc['id'];
$ecmdirtmp->delete($user, 'databaseonly');
//exit;
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
dol_syslog("sql = ".$sql);
dol_syslog("Nb of directories added into database = ".$adirwascreated);
$sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cache counting, we set to value -1 = "unknown"
$db->query($sql);
}
}

View File

@ -450,7 +450,7 @@ print dol_get_fiche_end();
// Actions buttons
if ($action != 'edit' && $action != 'delete') {
if ($action != 'edit' && $action != 'delete' && $action != 'deletefile') {
print '<div class="tabsAction">';
if ($permtoadd) {
@ -482,8 +482,8 @@ if ($action != 'edit' && $action != 'delete') {
}
// Confirm remove file
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.GETPOST("section", 'alpha').'&urlfile='.urlencode($_GET["urlfile"]).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
if ($action == 'deletefile') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST("section", 'alpha')).'&urlfile='.urlencode(GETPOST("urlfile")).($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
}
// Confirm remove file
@ -498,7 +498,7 @@ if ($action == 'delete_dir') {
);
}
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.GETPOST('section', 'alpha').($module ? '&module='.$module : '').($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode(GETPOST('section', 'alpha')).($module ? '&module='.$module : '').($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $relativepathwithoutslash), 'confirm_deletedir', $formquestion, 1, 1);
}

View File

@ -411,8 +411,8 @@ if ($action == 'edit') {
}
// Confirmation de la suppression d'une ligne categorie
if ($action == 'delete_file') {
// Confirm deletion of a file
if ($action == 'deletefile') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', $urlfile), 'confirm_deletefile', '', 1, 1);
}
@ -426,7 +426,7 @@ if ($action != 'edit') {
/*
if ($user->rights->ecm->setup)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=delete_file&token='.newToken().'&section='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Delete').'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=deletefile&token='.newToken().'&section='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Delete').'</a>';
}
else
{

View File

@ -376,7 +376,7 @@ print dol_get_fiche_head($head, 'index_auto', '', -1, '');
// Confirm remove file (for non javascript users)
if ($action == 'delete' && empty($conf->use_javascript_ajax)) {
if ($action == 'deletefile' && empty($conf->use_javascript_ajax)) {
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 1);
}
@ -413,8 +413,8 @@ if ($action == 'delete_section') {
// End confirm
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'delete') {
print '<table width="100%" class="liste noborderbottom">'."\n";
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'deletefile') {
print '<table class="liste centpercent">'."\n";
print '<!-- Title for auto directories -->'."\n";
print '<tr class="liste_titre">'."\n";

View File

@ -239,7 +239,7 @@ $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$formfile = new FormFile($db);
$param = '&amp;section='.$section;
$param = '&section='.urlencode($section);
$textifempty = ($section ? $langs->trans("NoFileFound") : $langs->trans("ECMSelectASection"));
$formfile->list_of_documents($filearray, '', 'ecm', $param, 1, $relativepath, $user->rights->ecm->upload, 1, $textifempty);

View File

@ -78,13 +78,14 @@ $(document).ready(function() {
$('#refreshbutton').click( function() {
console.log("Click on refreshbutton");
$.pleaseBePatient("<?php echo $langs->trans('PleaseBePatient'); ?>");
$.get( "<?php echo DOL_URL_ROOT.'/ecm/ajax/ecmdatabase.php'; ?>", {
action: "build",
element: "ecm"
$.get("<?php echo DOL_URL_ROOT.'/ecm/ajax/ecmdatabase.php'; ?>", {
action: 'build',
token: '<?php echo newToken(); ?>',
element: 'ecm'
},
function(response) {
$.unblockUI();
location.href="<?php echo $_SERVER['PHP_SELF']; ?>";
location.href='<?php echo $_SERVER['PHP_SELF']; ?>';
});
});
});

View File

@ -238,9 +238,10 @@ class ConferenceOrBooth extends ActionComm
* @param string $ref Ref
* @param string $ref_ext Ref ext to get
* @param string $email_msgid Email msgid
* @param int $loadresources 1=Load also resources
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '')
public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '', $loadresources = 1)
{
global $dolibarr_main_url_root, $conf, $langs;
@ -271,7 +272,6 @@ class ConferenceOrBooth extends ActionComm
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
//TODO set percent according status
global $conf;

View File

@ -105,9 +105,9 @@ class ConferenceOrBoothAttendee extends CommonObject
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',),
'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>3,),

View File

@ -475,7 +475,8 @@ if ($projectid > 0) {
if (!empty($project->id)) {
$head = conferenceorboothProjectPrepareHead($project);
$tab = 'conferenceorbooth';
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', '');
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
}
// Build and execute select
@ -628,7 +629,7 @@ $arrayofmassactions = array(
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'presend_attendees', 'predelete'))) {
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);

View File

@ -57,9 +57,10 @@ $projectstatic = new Project($db);
$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('conferenceorboothattendeecard', 'globalcard')); // Note that conf->hooks_modules contains array
if ($conf_or_booth_id > 0) {
$confOrBooth = new ConferenceOrBooth($db);
$result = $confOrBooth->fetch($conf_or_booth_id);
$result = $confOrBooth->fetch($id > 0 ? $id : $conf_or_booth_id);
if ($result < 0) {
setEventMessages(null, $confOrBooth->errors, 'errors');
} else {
@ -102,6 +103,10 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Now we have loaded the attendee, we can force the project (in case value provided as parameter is wrong or value not provided)
if ($object->fk_project > 0) {
$fk_project = $object->fk_project;
}
$permissiontoread = $user->rights->eventorganization->read;
$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
@ -125,7 +130,7 @@ if (empty($reshook)) {
$error = 0;
if (!empty($withproject)) {
$backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?withproject=1';
$backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?withproject=1&fk_project='.((int) $fk_project);
} else {
$backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php';
}
@ -151,7 +156,6 @@ if (empty($reshook)) {
$action = '';
}
$triggermodname = 'EVENTORGANIZATION_CONFERENCEORBOOTHATTENDEE_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
@ -653,14 +657,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($user->socid)) {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken().'', '', $permissiontoadd);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken(), '', $permissiontoadd);
// Clone
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:''), '', $permissiontoadd);
// Delete (need delete permission, or if draft, just need create/modify permission)
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:''), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
}
print '</div>'."\n";
}

View File

@ -181,7 +181,9 @@ if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend'
&& $massaction != 'presend_attendees'
&& $massaction != 'confirm_presend_attendees') {
$massaction = '';
}
@ -216,6 +218,7 @@ if (empty($reshook)) {
$objectclass = 'ConferenceOrBoothAttendee';
$objectlabel = 'ConferenceOrBoothAttendee';
$uploaddir = $conf->eventorganization->dir_output;
include DOL_DOCUMENT_ROOT.'/eventorganization/core/actions_massactions_mail.inc.php';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -598,7 +601,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) {
if (empty($confOrBooth->id)) {
$head = conferenceorboothProjectPrepareHead($projectstatic);
$tab = 'attendees';
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', '');
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($project->public ? 'projectpub' : 'project'), 0, '', 'reposition');
}
}
@ -676,6 +679,7 @@ $arrayofmassactions = array(
//'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
'presend_attendees'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail").' - '.$langs->trans("Attendees"),
);
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
@ -699,7 +703,8 @@ print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
print '<input type="hidden" name="page_y" value="">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd);
$params = array('morecss'=>'reposition');
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -708,6 +713,7 @@ $topicmail = "SendConferenceOrBoothAttendeeRef";
$modelmail = "conferenceorboothattendee";
$objecttmp = new ConferenceOrBoothAttendee($db);
$trackid = 'xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/eventorganization/tpl/massactions_mail_pre.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) {

View File

@ -90,7 +90,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') {
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$attendees = $attendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm' => $objecttmp->id));
$attendees = $attendee->fetchAll();
if (is_array($attendees) && count($attendees) > 0) {
foreach ($attendees as $attmail) {
if (!empty($attmail->email)) {
@ -119,7 +119,7 @@ if (!$error && $massaction == 'confirm_presend_attendees') {
$receiver = array($receiver);
}
}
if (!trim($_POST['sendto']) && count($receiver) == 0 && count($listofselectedid) == 1) { // if only one recipient, receiver is mandatory
if (!trim($_POST['sendto']) && count($receiver) == 0 && count($listofselectedid) == 0) { // if only one recipient, receiver is mandatory
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings');
$massaction = 'presend_attendees';

View File

@ -37,7 +37,7 @@ if ($massaction == 'presend_attendees') {
foreach ($arrayofselected as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$attendees = $attendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$objecttmp->id));
$attendees = $attendee->fetchAll();
if (is_array($attendees) && count($attendees)>0) {
foreach ($attendees as $attmail) {
if (!empty($attmail->email)) {

View File

@ -1160,10 +1160,16 @@ if ($action == 'create') {
print "</td>\n";
}
// unit of order
$unit_order = '';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$unit_order = measuringUnitString($line->fk_unit);
}
// Qty
print '<td class="center">'.$line->qty;
print '<input name="qtyasked'.$indiceAsked.'" id="qtyasked'.$indiceAsked.'" type="hidden" value="'.$line->qty.'">';
print '</td>';
print ''.$unit_order.'</td>';
$qtyProdCom = $line->qty;
// Qty already shipped
@ -1171,7 +1177,7 @@ if ($action == 'create') {
$quantityDelivered = $object->expeditions[$line->id];
print $quantityDelivered;
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
print '</td>';
print ''.$unit_order.'</td>';
// Qty to ship
$quantityAsked = $line->qty;
@ -2056,7 +2062,7 @@ if ($action == 'create') {
// Get list of products already sent for same source object into $alreadysent
$alreadysent = array();
if ($origin && $origin_id > 0) {
$sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end";
$sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.fk_unit, obj.date_start, obj.date_end";
$sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot";
$sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
//if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received";
@ -2176,8 +2182,13 @@ if ($action == 'create') {
print "</td>\n";
}
$unit_order = '';
if ($conf->global->PRODUCT_USE_UNITS) {
$unit_order = measuringUnitString($lines[$i]->fk_unit);
}
// Qty ordered
print '<td class="center linecolqty">'.$lines[$i]->qty_asked.'</td>';
print '<td class="center linecolqty">'.$lines[$i]->qty_asked.' '.$unit_order.'</td>';
// Qty in other shipments (with shipment and warehouse used)
if ($origin && $origin_id > 0) {
@ -2241,7 +2252,7 @@ if ($action == 'create') {
print '<!-- case edit 2 -->';
print '<tr>';
// Qty to ship or shipped
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">'.$unit_order.'</td>';
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number managment
@ -2252,7 +2263,7 @@ if ($action == 'create') {
foreach ($lines[$i]->details_entrepot as $detail_entrepot) {
print '<tr>';
// Qty to ship or shipped
print '<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$detail_entrepot->line_id.'" id="qtyl'.$detail_entrepot->line_id.'" type="text" size="4" value="'.$detail_entrepot->qty_shipped.'">'.$unit_order.'</td>';
// Warehouse source
print '<td>'.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number managment
@ -2267,7 +2278,7 @@ if ($action == 'create') {
print '<!-- case edit 5 -->';
print '<tr>';
// Qty to ship or shipped
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'"></td>';
print '<td><input class="qtyl" name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">'.$unit_order.'</td>';
// Warehouse source
print '<td></td>';
// Batch number managment
@ -2289,7 +2300,7 @@ if ($action == 'create') {
print '</table></td>';
} else {
// Qty to ship or shipped
print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.'</td>';
print '<td class="linecolqtytoship center">'.$lines[$i]->qty_shipped.' '.$unit_order.'</td>';
// Warehouse source
if (!empty($conf->stock->enabled)) {

View File

@ -617,7 +617,7 @@ if ($id > 0 || !empty($ref)) {
$sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,";
$sql .= " cd.price, cd.tva_tx, cd.subprice,";
$sql .= " cd.qty,";
$sql .= " cd.qty, cd.fk_unit,";
$sql .= ' cd.date_start,';
$sql .= ' cd.date_end,';
$sql .= ' cd.special_code,';
@ -625,8 +625,10 @@ if ($id > 0 || !empty($ref)) {
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,';
$sql .= ' p.surface, p.surface_units, p.volume, p.volume_units';
$sql .= ', p.tobatch, p.tosell, p.tobuy, p.barcode';
$sql .= ', u.short_label as unit_order';
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units as u ON cd.fk_unit = u.rowid";
$sql .= " WHERE cd.fk_commande = ".((int) $object->id);
$sql .= " ORDER BY cd.rang, cd.rowid";
@ -766,7 +768,7 @@ if ($id > 0 || !empty($ref)) {
}
// Qty ordered
print '<td class="center">'.$objp->qty.'</td>';
print '<td class="center">'.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
// Qty already shipped
$qtyProdCom = $objp->qty;
@ -774,7 +776,7 @@ if ($id > 0 || !empty($ref)) {
// Nb of sending products for this line of order
$qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0);
print $qtyAlreadyShipped;
print '</td>';
print ($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
// Qty remains to ship
print '<td class="center">';
@ -785,7 +787,7 @@ if ($id > 0 || !empty($ref)) {
} else {
print '0 ('.$langs->trans("Service").')';
}
print '</td>';
print ($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
if ($objp->fk_product > 0) {
$product = new Product($db);

Some files were not shown because too many files have changed in this diff Show More