Merge remote-tracking branch 'upstream/develop' into socialnetworks
This commit is contained in:
commit
a43e6f96b5
@ -42,6 +42,8 @@ FIX: #12041
|
|||||||
FIX: #12054
|
FIX: #12054
|
||||||
FIX: #12083
|
FIX: #12083
|
||||||
FIX: #12088
|
FIX: #12088
|
||||||
|
FIX: CVE-2019-17578 CVE-2019-17577 CVE-2019-17576
|
||||||
|
FIX: Clean the + of categories on the product view only in POS module
|
||||||
FIX: access to public interface when origin email has an alias.
|
FIX: access to public interface when origin email has an alias.
|
||||||
FIX: Alias name is not into the email recipient label.
|
FIX: Alias name is not into the email recipient label.
|
||||||
FIX: allow standalone credit note even if no invoice
|
FIX: allow standalone credit note even if no invoice
|
||||||
|
|||||||
@ -201,7 +201,7 @@
|
|||||||
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
|
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="ignoreBlankLines" value="true"/>
|
<property name="ignoreBlankLines" value="false"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
|
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
@ -65,6 +66,8 @@ $year_current = $year_start;
|
|||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -101,7 +104,7 @@ if ($action == 'validatehistory') {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||||
if ($db->type == 'pgsql') {
|
/*if ($db->type == 'pgsql') {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||||
@ -114,16 +117,83 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
// Customer Invoice lines (must be same request than into page list.php for manual binding)
|
||||||
|
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||||
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||||
|
$sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||||
|
$sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||||
|
$sql.= " co.code as country_code, co.label as country_label,";
|
||||||
|
$sql.= " s.tva_intra";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
|
||||||
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
|
$sql.= " AND l.product_type <= 2";
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||||
|
$result = $db->query($sql);
|
||||||
$resql1 = $db->query($sql1);
|
if (! $result) {
|
||||||
if (! $resql1) {
|
$error++;
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
$num_lines = $db->num_rows($result);
|
||||||
|
|
||||||
|
$isSellerInEEC = isInEEC($mysoc);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
// Search suggested account for product/service
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||||
|
$objp->code_sell_p = $objp->code_sell;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
} else {
|
||||||
|
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||||
|
$objp->code_sell_p = $objp->code_sell_intra;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||||
|
$suggestedaccountingaccountfor = 'eec';
|
||||||
|
} else { // Foreign sale
|
||||||
|
$objp->code_sell_p = $objp->code_sell_export;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||||
|
$suggestedaccountingaccountfor = 'export';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($objp->aarowid_suggest > 0)
|
||||||
|
{
|
||||||
|
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
|
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
|
||||||
|
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
|
||||||
|
|
||||||
|
$resqlupdate = $db->query($sqlupdate);
|
||||||
|
if (! $resqlupdate)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
else {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -358,6 +358,7 @@ if ($result) {
|
|||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
|
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
|
||||||
|
|
||||||
|
// Date invoice
|
||||||
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||||
|
|
||||||
// Ref Product
|
// Ref Product
|
||||||
@ -377,7 +378,13 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
|
|
||||||
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>';
|
// Country
|
||||||
|
print '<td>';
|
||||||
|
if ($objp->country_code)
|
||||||
|
{
|
||||||
|
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -219,9 +219,9 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
|||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND l.product_type <= 2";
|
$sql.= " AND l.product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
@ -247,7 +247,7 @@ if (strlen(trim($search_account))) {
|
|||||||
$sql .= natural_search("aa.account_number", $search_account);
|
$sql .= natural_search("aa.account_number", $search_account);
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
|
||||||
}
|
}
|
||||||
$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
||||||
if (strlen(trim($search_country))) {
|
if (strlen(trim($search_country))) {
|
||||||
@ -406,7 +406,7 @@ if ($result) {
|
|||||||
|
|
||||||
$isSellerInEEC = isInEEC($mysoc);
|
$isSellerInEEC = isInEEC($mysoc);
|
||||||
|
|
||||||
while ( $i < min($num_lines, $limit) ) {
|
while ($i < min($num_lines, $limit)) {
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$objp->code_sell_l = '';
|
$objp->code_sell_l = '';
|
||||||
@ -518,6 +518,7 @@ if ($result) {
|
|||||||
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Country
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label;
|
$labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label;
|
||||||
print $labelcountry;
|
print $labelcountry;
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
@ -63,6 +64,7 @@ $year_current = $year_start;
|
|||||||
// Validate History
|
// Validate History
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
|
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -99,7 +101,7 @@ if ($action == 'validatehistory') {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||||
if ($db->type == 'pgsql') {
|
/*if ($db->type == 'pgsql') {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||||
@ -112,16 +114,85 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||||
|
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||||
|
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||||
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||||
|
$sql.= " aa.rowid as aarowid,";
|
||||||
|
$sql.= " co.code as country_code, co.label as country_label,";
|
||||||
|
$sql.= " s.tva_intra";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
|
$sql.= " AND l.product_type <= 2";
|
||||||
|
|
||||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$result = $db->query($sql);
|
||||||
if (! $resql1) {
|
if (! $result) {
|
||||||
$error ++;
|
$error++;
|
||||||
$db->rollback();
|
|
||||||
setEventMessages($db->lasterror(), null, 'errors');
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
$num_lines = $db->num_rows($result);
|
||||||
|
|
||||||
|
$isSellerInEEC = isInEEC($mysoc);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
// Search suggested account for product/service
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||||
|
$objp->code_buy_p = $objp->code_buy;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = '';
|
||||||
|
} else {
|
||||||
|
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||||
|
//$objp->code_buy_p = $objp->code_buy_intra;
|
||||||
|
$objp->code_buy_p = $objp->code_buy;
|
||||||
|
//$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = 'eec';
|
||||||
|
} else { // Foreign sale
|
||||||
|
//$objp->code_buy_p = $objp->code_buy_export;
|
||||||
|
$objp->code_buy_p = $objp->code_buy;
|
||||||
|
//$objp->aarowid_suggest = $objp->aarowid_export;
|
||||||
|
$objp->aarowid_suggest = $objp->aarowid;
|
||||||
|
$suggestedaccountingaccountfor = 'export';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($objp->aarowid_suggest > 0)
|
||||||
|
{
|
||||||
|
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||||
|
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
|
||||||
|
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
|
||||||
|
|
||||||
|
$resqlupdate = $db->query($sqlupdate);
|
||||||
|
if (! $resqlupdate)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error)
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
else {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -367,6 +367,7 @@ if ($result) {
|
|||||||
print $objp->invoice_label;
|
print $objp->invoice_label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Date invoice
|
||||||
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||||
|
|
||||||
// Ref product
|
// Ref product
|
||||||
@ -387,7 +388,12 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
|
||||||
|
|
||||||
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>';
|
print '<td>';
|
||||||
|
if ($objp->country_code)
|
||||||
|
{
|
||||||
|
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '<td>' . $objp->tva_intra . '</td>';
|
print '<td>' . $objp->tva_intra . '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -222,7 +222,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
|||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND l.product_type <= 2";
|
$sql.= " AND l.product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
@ -307,8 +307,8 @@ if ($result) {
|
|||||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
@ -463,7 +463,7 @@ if ($result) {
|
|||||||
|
|
||||||
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||||
|
|
||||||
// Ref product
|
// Ref Product
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($product_static->id > 0)
|
if ($product_static->id > 0)
|
||||||
print $product_static->getNomUrl(1);
|
print $product_static->getNomUrl(1);
|
||||||
@ -471,7 +471,7 @@ if ($result) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<td>';
|
print '<td class="tdoverflowonsmartphone">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||||
|
|||||||
@ -999,7 +999,7 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// EMail
|
// EMail
|
||||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email', 'alpha')?GETPOST('member_email', 'alpha'):$object->email).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email', 'alpha')?GETPOST('member_email', 'alpha'):$object->email).'"></td></tr>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
|
||||||
@ -1036,13 +1036,13 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pro phone
|
// Pro phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone', 'alpha')?GETPOST('phone', 'alpha'):$object->phone).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone', 'alpha')?GETPOST('phone', 'alpha'):$object->phone).'"></td></tr>';
|
||||||
|
|
||||||
// Personal phone
|
// Personal phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso', 'alpha')?GETPOST('phone_perso', 'alpha'):$object->phone_perso).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso', 'alpha')?GETPOST('phone_perso', 'alpha'):$object->phone_perso).'"></td></tr>';
|
||||||
|
|
||||||
// Mobile phone
|
// Mobile phone
|
||||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile', 'alpha')?GETPOST('phone_mobile', 'alpha'):$object->phone_mobile).'"></td></tr>';
|
||||||
|
|
||||||
if (! empty($conf->socialnetworks->enabled)) {
|
if (! empty($conf->socialnetworks->enabled)) {
|
||||||
foreach ($socialnetworks as $key => $value) {
|
foreach ($socialnetworks as $key => $value) {
|
||||||
@ -1258,7 +1258,7 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// EMail
|
// EMail
|
||||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email", '', 2):$object->email).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email", '', 2):$object->email).'"></td></tr>';
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||||
@ -1288,13 +1288,13 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pro phone
|
// Pro phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?GETPOST("phone"):$object->phone).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?GETPOST("phone"):$object->phone).'"></td></tr>';
|
||||||
|
|
||||||
// Personal phone
|
// Personal phone
|
||||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>';
|
||||||
|
|
||||||
// Mobile phone
|
// Mobile phone
|
||||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
|
print '<tr><td>'.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?GETPOST("phone_mobile"):$object->phone_mobile).'"></td></tr>';
|
||||||
|
|
||||||
if (! empty($conf->socialnetworks->enabled)) {
|
if (! empty($conf->socialnetworks->enabled)) {
|
||||||
foreach ($socialnetworks as $key => $value) {
|
foreach ($socialnetworks as $key => $value) {
|
||||||
|
|||||||
@ -2129,7 +2129,11 @@ class Adherent extends CommonObject
|
|||||||
// Only picto
|
// Only picto
|
||||||
if ($withpictoimg > 0) $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</span>';
|
if ($withpictoimg > 0) $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</span>';
|
||||||
// Picto must be a photo
|
// Picto must be a photo
|
||||||
else $picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</span>';
|
else {
|
||||||
|
$picto='<span class="nopadding'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>';
|
||||||
|
$picto.=Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1);
|
||||||
|
$picto.='</span>';
|
||||||
|
}
|
||||||
$result.=$picto;
|
$result.=$picto;
|
||||||
}
|
}
|
||||||
if ($withpictoimg > -2 && $withpictoimg != 2)
|
if ($withpictoimg > -2 && $withpictoimg != 2)
|
||||||
@ -2172,83 +2176,46 @@ class Adherent extends CommonObject
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
if ($mode == 0)
|
|
||||||
|
if ($statut == -1)
|
||||||
{
|
{
|
||||||
if ($statut == -1) return $langs->trans("MemberStatusDraft");
|
$statusType = 'status0';
|
||||||
|
$labelstatut = $langs->trans("MemberStatusDraft");
|
||||||
|
$labelstatutShort = $langs->trans("MemberStatusDraftShort");
|
||||||
|
}
|
||||||
elseif ($statut >= 1) {
|
elseif ($statut >= 1) {
|
||||||
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription");
|
if ($need_subscription == 0)
|
||||||
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive");
|
|
||||||
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate");
|
|
||||||
else return $langs->trans("MemberStatusPaid");
|
|
||||||
}
|
|
||||||
elseif ($statut == 0) return $langs->trans("MemberStatusResiliated");
|
|
||||||
}
|
|
||||||
elseif ($mode == 1)
|
|
||||||
{
|
{
|
||||||
if ($statut == -1) return $langs->trans("MemberStatusDraftShort");
|
$statusType = 'status4';
|
||||||
elseif ($statut >= 1) {
|
$labelstatut = $langs->trans("MemberStatusNoSubscription");
|
||||||
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription");
|
$labelstatutShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||||
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort");
|
|
||||||
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort");
|
|
||||||
else return $langs->trans("MemberStatusPaidShort");
|
|
||||||
}
|
}
|
||||||
elseif ($statut == 0) return $langs->trans("MemberStatusResiliatedShort");
|
elseif (! $date_end_subscription)
|
||||||
}
|
|
||||||
elseif ($mode == 2)
|
|
||||||
{
|
{
|
||||||
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraftShort");
|
$statusType = 'status1';
|
||||||
elseif ($statut >= 1) {
|
$labelstatut = $langs->trans("MemberStatusActive");
|
||||||
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscriptionShort");
|
$labelstatutShort = $langs->trans("MemberStatusActiveShort");
|
||||||
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActiveShort");
|
|
||||||
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLateShort");
|
|
||||||
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaidShort");
|
|
||||||
}
|
}
|
||||||
elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliatedShort");
|
elseif ($date_end_subscription < time())
|
||||||
}
|
|
||||||
elseif ($mode == 3)
|
|
||||||
{
|
{
|
||||||
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0');
|
$statusType = 'status3';
|
||||||
elseif ($statut >= 1) {
|
$labelstatut = $langs->trans("MemberStatusActiveLate");
|
||||||
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
|
$labelstatutShort = $langs->trans("MemberStatusActiveLateShort");
|
||||||
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1');
|
|
||||||
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
|
|
||||||
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4');
|
|
||||||
}
|
}
|
||||||
elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
|
else {
|
||||||
|
$statusType = 'status4';
|
||||||
|
$labelstatut = $langs->trans("MemberStatusPaid");
|
||||||
|
$labelstatutShort = $langs->trans("MemberStatusPaidShort");
|
||||||
}
|
}
|
||||||
elseif ($mode == 4)
|
}
|
||||||
|
elseif ($statut == 0)
|
||||||
{
|
{
|
||||||
if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'), 'statut0').' '.$langs->trans("MemberStatusDraft");
|
$statusType = 'status6';
|
||||||
elseif ($statut >= 1) {
|
$labelstatut = $langs->trans("MemberStatusResiliated");
|
||||||
if ($need_subscription == 0) return img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4').' '.$langs->trans("MemberStatusNoSubscription");
|
$labelstatutShort = $langs->trans("MemberStatusResiliatedShort");
|
||||||
elseif (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'), 'statut1').' '.$langs->trans("MemberStatusActive");
|
|
||||||
elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'), 'statut3').' '.$langs->trans("MemberStatusActiveLate");
|
|
||||||
else return img_picto($langs->trans('MemberStatusPaid'), 'statut4').' '.$langs->trans("MemberStatusPaid");
|
|
||||||
}
|
|
||||||
if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'), 'statut5').' '.$langs->trans("MemberStatusResiliated");
|
|
||||||
}
|
|
||||||
elseif ($mode == 5)
|
|
||||||
{
|
|
||||||
if ($statut == -1) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusDraftShort").'</span> '.img_picto($langs->trans('MemberStatusDraft'), 'statut0');
|
|
||||||
elseif ($statut >= 1) {
|
|
||||||
if ($need_subscription == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusNoSubscriptionShort").' </span>'.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
|
|
||||||
elseif (! $date_end_subscription) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveShort").' </span>'.img_picto($langs->trans('MemberStatusActive'), 'statut1');
|
|
||||||
elseif ($date_end_subscription < time()) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusActiveLateShort").' </span>'.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
|
|
||||||
else return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusPaidShort").' </span>'.img_picto($langs->trans('MemberStatusPaid'), 'statut4');
|
|
||||||
}
|
|
||||||
if ($statut == 0) return '<span class="hideonsmartphone">'.$langs->trans("MemberStatusResiliated").' </span>'.img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
|
|
||||||
}
|
|
||||||
elseif ($mode == 6)
|
|
||||||
{
|
|
||||||
if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'), 'statut0');
|
|
||||||
if ($statut >= 1) {
|
|
||||||
if ($need_subscription == 0) return $langs->trans("MemberStatusNoSubscription").' '.img_picto($langs->trans('MemberStatusNoSubscription'), 'statut4');
|
|
||||||
elseif (! $date_end_subscription) return $langs->trans("MemberStatusActive").' '.img_picto($langs->trans('MemberStatusActive'), 'statut1');
|
|
||||||
elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate").' '.img_picto($langs->trans('MemberStatusActiveLate'), 'statut3');
|
|
||||||
else return $langs->trans("MemberStatusPaid").' '.img_picto($langs->trans('MemberStatusPaid'), 'statut4');
|
|
||||||
}
|
|
||||||
if ($statut == 0) return $langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'), 'statut5');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -227,10 +227,8 @@ $sql = "SELECT c.subscription, c.dateadh as dateh";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
||||||
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
|
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||||
$sql.= " AND d.rowid = c.fk_adherent";
|
$sql.= " AND d.rowid = c.fk_adherent";
|
||||||
if(isset($date_select) && $date_select != '')
|
|
||||||
{
|
|
||||||
$sql .= " AND c.dateadh LIKE '".$date_select."%'";
|
|
||||||
}
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -251,21 +249,33 @@ if ($result)
|
|||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("Subscriptions").'</th>';
|
print '<th>'.$langs->trans("Year").'</th>';
|
||||||
print '<th class="right">'.$langs->trans("Number").'</th>';
|
print '<th class="right">'.$langs->trans("Subscriptions").'</th>';
|
||||||
print '<th class="right">'.$langs->trans("AmountTotal").'</th>';
|
print '<th class="right">'.$langs->trans("AmountTotal").'</th>';
|
||||||
print '<th class="right">'.$langs->trans("AmountAverage").'</th>';
|
print '<th class="right">'.$langs->trans("AmountAverage").'</th>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
krsort($Total);
|
krsort($Total);
|
||||||
|
$i = 0;
|
||||||
foreach ($Total as $key=>$value)
|
foreach ($Total as $key=>$value)
|
||||||
{
|
{
|
||||||
|
if ($i >= 8)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print "<td>...</td>";
|
||||||
|
print "<td class=\"right\"></td>";
|
||||||
|
print "<td class=\"right\"></td>";
|
||||||
|
print "<td class=\"right\"></td>";
|
||||||
|
print "</tr>\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
|
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
|
||||||
print "<td class=\"right\">".$Number[$key]."</td>";
|
print "<td class=\"right\">".$Number[$key]."</td>";
|
||||||
print "<td class=\"right\">".price($value)."</td>";
|
print "<td class=\"right\">".price($value)."</td>";
|
||||||
print "<td class=\"right\">".price(price2num($value/$Number[$key], 'MT'))."</td>";
|
print "<td class=\"right\">".price(price2num($value/$Number[$key], 'MT'))."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
|
|||||||
@ -681,6 +681,7 @@ while ($i < min($num, $limit))
|
|||||||
$memberstatic->datefin= $datefin;
|
$memberstatic->datefin= $datefin;
|
||||||
$memberstatic->socid = $obj->fk_soc;
|
$memberstatic->socid = $obj->fk_soc;
|
||||||
$memberstatic->photo = $obj->photo;
|
$memberstatic->photo = $obj->photo;
|
||||||
|
$memberstatic->morphy = $obj->morphy;
|
||||||
|
|
||||||
if (! empty($obj->fk_soc)) {
|
if (! empty($obj->fk_soc)) {
|
||||||
$memberstatic->fetch_thirdparty();
|
$memberstatic->fetch_thirdparty();
|
||||||
|
|||||||
@ -476,7 +476,7 @@ if (! empty($conf->barcode->enabled)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
print '<tr class="oddeven"><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
|
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||||
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
|
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
|
||||||
print '</td><td class="nocellnopadd right" valign="middle">';
|
print '</td><td class="nocellnopadd right" valign="middle">';
|
||||||
@ -493,7 +493,7 @@ print '</td></tr></table>';
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Logo (squarred)
|
// Logo (squarred)
|
||||||
print '<tr class="oddeven"><td><label for="logo_squarred">'.$langs->trans("LogoSquarred").' (png,jpg)</label></td><td>';
|
print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||||
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
|
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
|
||||||
print '</td><td class="nocellnopadd right" valign="middle">';
|
print '</td><td class="nocellnopadd right" valign="middle">';
|
||||||
|
|||||||
@ -395,52 +395,6 @@ class PrestaShopWebservice
|
|||||||
self::checkStatusCode($request['status_code']);// check the response validity
|
self::checkStatusCode($request['status_code']);// check the response validity
|
||||||
return self::parseXML($request['response']);
|
return self::parseXML($request['response']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete (DELETE) a resource.
|
|
||||||
* Unique parameter must take : <br><br>
|
|
||||||
* 'resource' => Resource name<br>
|
|
||||||
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
|
|
||||||
* <code>
|
|
||||||
* <?php
|
|
||||||
* require_once('./PrestaShopWebservice.php');
|
|
||||||
* try
|
|
||||||
* {
|
|
||||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
|
||||||
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
|
|
||||||
* // Following code will not be executed if an exception is thrown.
|
|
||||||
* echo 'Successfully deleted.';
|
|
||||||
* }
|
|
||||||
* catch (PrestaShopWebserviceException $ex)
|
|
||||||
* {
|
|
||||||
* echo 'Error : '.$ex->getMessage();
|
|
||||||
* }
|
|
||||||
* ?>
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param array $options Array representing resource to delete.
|
|
||||||
* @return boolean True
|
|
||||||
*/
|
|
||||||
public function delete($options)
|
|
||||||
{
|
|
||||||
if (isset($options['url'])) {
|
|
||||||
$url = $options['url'];
|
|
||||||
} elseif (isset($options['resource']) && isset($options['id'])) {
|
|
||||||
if (is_array($options['id']))
|
|
||||||
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
|
|
||||||
else
|
|
||||||
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
|
|
||||||
}
|
|
||||||
if (isset($options['id_shop'])) {
|
|
||||||
$url .= '&id_shop='.$options['id_shop'];
|
|
||||||
}
|
|
||||||
if (isset($options['id_group_shop'])) {
|
|
||||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
|
||||||
}
|
|
||||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
|
|
||||||
self::checkStatusCode($request['status_code']);// check the response validity
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -65,27 +65,27 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
|
|||||||
|
|
||||||
if ($action == 'update' && empty($_POST["cancel"]))
|
if ($action == 'update' && empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
// Send mode parameters
|
// Send mode parameters
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED", 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
// Content parameters
|
// Content parameters
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO"), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE', 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||||
exit;
|
exit;
|
||||||
@ -101,8 +101,8 @@ $mode='emailfortest';
|
|||||||
$trackid=(($action == 'testhtml')?"testhtml":"test");
|
$trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
|
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test';
|
||||||
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
|
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action='testhtml';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -821,7 +821,7 @@ else
|
|||||||
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
$formmail->fromid=$user->id;
|
$formmail->fromid=$user->id;
|
||||||
$formmail->fromalsorobot=1;
|
$formmail->fromalsorobot=1;
|
||||||
$formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
$formmail->fromtype=(GETPOSTISSET('fromtype')?GETPOST('fromtype', 'aZ09'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||||
$formmail->withfromreadonly=1;
|
$formmail->withfromreadonly=1;
|
||||||
$formmail->withsubstit=1;
|
$formmail->withsubstit=1;
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
@ -847,7 +847,7 @@ else
|
|||||||
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (GETPOST("mode")=='init')
|
if (GETPOST("mode", "aZ09")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -178,6 +178,7 @@ class DolibarrApi
|
|||||||
unset($object->lines[$i]->cond_reglement);
|
unset($object->lines[$i]->cond_reglement);
|
||||||
unset($object->lines[$i]->fk_delivery_address);
|
unset($object->lines[$i]->fk_delivery_address);
|
||||||
unset($object->lines[$i]->fk_projet);
|
unset($object->lines[$i]->fk_projet);
|
||||||
|
unset($object->lines[$i]->fk_project);
|
||||||
unset($object->lines[$i]->thirdparty);
|
unset($object->lines[$i]->thirdparty);
|
||||||
unset($object->lines[$i]->user);
|
unset($object->lines[$i]->user);
|
||||||
unset($object->lines[$i]->model_pdf);
|
unset($object->lines[$i]->model_pdf);
|
||||||
@ -290,6 +291,7 @@ class DolibarrApi
|
|||||||
if (count($tmp) < 3) return '';
|
if (count($tmp) < 3) return '';
|
||||||
|
|
||||||
$tmpescaped=$tmp[2];
|
$tmpescaped=$tmp[2];
|
||||||
|
$regbis = array();
|
||||||
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
|
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
|
||||||
{
|
{
|
||||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||||
|
|||||||
@ -197,13 +197,64 @@ class Setup extends DolibarrApi
|
|||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
public function getCountryByID($id, $lang = '')
|
public function getCountryByID($id, $lang = '')
|
||||||
|
{
|
||||||
|
return $this->_fetchCcountry($id, '', '', $lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get country by Code.
|
||||||
|
*
|
||||||
|
* @param string $code Code of country
|
||||||
|
* @param string $lang Code of the language the name of the
|
||||||
|
* country must be translated to
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*
|
||||||
|
* @url GET dictionary/countries/byCode/{code}
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
public function getCountryByCode($code, $lang = '')
|
||||||
|
{
|
||||||
|
return $this->_fetchCcountry('', $code, '', $lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get country by Iso.
|
||||||
|
*
|
||||||
|
* @param string $iso ISO of country
|
||||||
|
* @param string $lang Code of the language the name of the
|
||||||
|
* country must be translated to
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*
|
||||||
|
* @url GET dictionary/countries/byISO/{iso}
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
public function getCountryByISO($iso, $lang = '')
|
||||||
|
{
|
||||||
|
return $this->_fetchCcountry('', '', $iso, $lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get country.
|
||||||
|
*
|
||||||
|
* @param int $id ID of country
|
||||||
|
* @param string $code Code of country
|
||||||
|
* @param string $iso ISO of country
|
||||||
|
* @param string $lang Code of the language the name of the
|
||||||
|
* country must be translated to
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
private function _fetchCcountry($id, $code = '', $iso = '', $lang = '')
|
||||||
{
|
{
|
||||||
$country = new Ccountry($this->db);
|
$country = new Ccountry($this->db);
|
||||||
|
|
||||||
if ($country->fetch($id) < 0) {
|
$result = $country->fetch($id, $code, $iso);
|
||||||
|
if ($result < 0) {
|
||||||
throw new RestException(503, 'Error when retrieving country : '.$country->error);
|
throw new RestException(503, 'Error when retrieving country : '.$country->error);
|
||||||
}
|
} elseif ($result == 0) {
|
||||||
elseif ($country->fetch($id) == 0) {
|
|
||||||
throw new RestException(404, 'country not found');
|
throw new RestException(404, 'country not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,6 +371,66 @@ class Setup extends DolibarrApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of shipment methods.
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Number of items per page
|
||||||
|
* @param int $page Page number (starting from zero)
|
||||||
|
* @param int $active Payment term is active or not {@min 0} {@max 1}
|
||||||
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||||
|
*
|
||||||
|
* @return array List of shipment methods
|
||||||
|
*
|
||||||
|
* @url GET dictionary/shipment_methods
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
|
{
|
||||||
|
$list = array();
|
||||||
|
$sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
|
||||||
|
$sql.= " WHERE t.active = ".$active;
|
||||||
|
// Add sql filters
|
||||||
|
if ($sqlfilters)
|
||||||
|
{
|
||||||
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
|
{
|
||||||
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
|
}
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= $this->db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0) {
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql .= $this->db->plimit($limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$num = $this->db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
for ($i = 0; $i < $min; $i++) {
|
||||||
|
$list[] = $this->db->fetch_object($result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RestException(503, 'Error when retrieving list of shipment methods : '.$this->db->lasterror());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of events types.
|
* Get the list of events types.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -615,7 +615,7 @@ if ($rowid > 0)
|
|||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
print '<br><br><table class="border" width="100%">';
|
print '<br><br><table class="border" width="100%">';
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attributes[$object->element]['label'] as $key=>$label)
|
||||||
{
|
{
|
||||||
if (isset($_POST["options_" . $key])) {
|
if (isset($_POST["options_" . $key])) {
|
||||||
if (is_array($_POST["options_" . $key])) {
|
if (is_array($_POST["options_" . $key])) {
|
||||||
|
|||||||
@ -79,6 +79,7 @@ $permissionnote=$user->rights->bom->write; // Used by the include of actions_set
|
|||||||
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
|
||||||
$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php
|
$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php
|
||||||
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php
|
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||||
|
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -93,11 +94,11 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$permissiontoadd = $user->rights->bom->write;
|
|
||||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
|
|
||||||
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
||||||
if (empty($backtopage)) {
|
|
||||||
if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
//var_dump($backurlforlist);exit;
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
||||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
||||||
}
|
}
|
||||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
@ -218,7 +219,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
dol_fiche_head(array(), '');
|
dol_fiche_head(array(), '');
|
||||||
|
|
||||||
print '<table class="border centpercent">'."\n";
|
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
|
||||||
@ -252,7 +253,9 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border centpercent">'."\n";
|
//$object->fields['keyfield']['disabled'] = 1;
|
||||||
|
|
||||||
|
print '<table class="border centpercent tableforfieldedit">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
||||||
|
|||||||
@ -91,7 +91,7 @@ class BOM extends CommonObject
|
|||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
||||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
||||||
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||||
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||||
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||||
@ -817,34 +817,10 @@ class BOM extends CommonObject
|
|||||||
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 0)
|
$statusType = 'status'.$status;
|
||||||
{
|
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||||
return $this->labelstatus[$status];
|
|
||||||
}
|
return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode);
|
||||||
elseif ($mode == 1)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 2)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 3)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
elseif ($mode == 4)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 5)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
elseif ($mode == 6)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.($status == self::STATUS_VALIDATED ? 4 : $status), '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -92,7 +92,7 @@ $coldisplay++;
|
|||||||
echo $line->efficiency;
|
echo $line->efficiency;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) {
|
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) {
|
||||||
print '<td class="linecoledit center">';
|
print '<td class="linecoledit center">';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
if (($line->info_bits & 2) == 2 || ! empty($disableedit)) {
|
if (($line->info_bits & 2) == 2 || ! empty($disableedit)) {
|
||||||
|
|||||||
@ -66,6 +66,7 @@ function printBookmarksList()
|
|||||||
|
|
||||||
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
||||||
|
$ret.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
||||||
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||||
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
|
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
|
||||||
|
|||||||
@ -138,13 +138,16 @@ $arrayfields=array(
|
|||||||
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
|
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -58,7 +58,7 @@ if (!empty($conf->variants->enabled)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings'));
|
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings', 'other'));
|
||||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($conf->margin->enabled))
|
||||||
$langs->load('margins');
|
$langs->load('margins');
|
||||||
@ -121,6 +121,7 @@ $usercancreateorder = $user->rights->commande->creer;
|
|||||||
$usercancreateinvoice = $user->rights->facture->creer;
|
$usercancreateinvoice = $user->rights->facture->creer;
|
||||||
$usercancreatecontract = $user->rights->contrat->creer;
|
$usercancreatecontract = $user->rights->contrat->creer;
|
||||||
$usercancreateintervention = $user->rights->ficheinter->creer;
|
$usercancreateintervention = $user->rights->ficheinter->creer;
|
||||||
|
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
|
||||||
|
|
||||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||||
@ -2499,13 +2500,23 @@ if ($action == 'create')
|
|||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">' . $langs->trans('SendMail') . '</a>';
|
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">' . $langs->trans('SendMail') . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an order
|
// Create a sale order
|
||||||
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||||
if ($usercancreateorder) {
|
if ($usercancreateorder) {
|
||||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a>';
|
print '<a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a purchase order
|
||||||
|
if (! empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL))
|
||||||
|
{
|
||||||
|
if (! empty($conf->fournisseur->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||||
|
if ($usercancreatepurchaseorder) {
|
||||||
|
print '<a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddPurchaseOrder") . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create an intervention
|
// Create an intervention
|
||||||
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||||
if ($usercancreateintervention) {
|
if ($usercancreateintervention) {
|
||||||
|
|||||||
@ -106,6 +106,8 @@ $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancr
|
|||||||
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)));
|
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)));
|
||||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
|
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
|
||||||
|
|
||||||
|
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
|
||||||
|
|
||||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||||
$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||||
@ -2566,6 +2568,16 @@ if ($action == 'create' && $usercancreate)
|
|||||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
|
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
// Create a purchase order
|
||||||
|
if (! empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER))
|
||||||
|
{
|
||||||
|
if (! empty($conf->fournisseur->enabled) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||||
|
if ($usercancreatepurchaseorder) {
|
||||||
|
print '<a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddPurchaseOrder") . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create intervention
|
// Create intervention
|
||||||
if ($conf->ficheinter->enabled) {
|
if ($conf->ficheinter->enabled) {
|
||||||
$langs->load("interventions");
|
$langs->load("interventions");
|
||||||
|
|||||||
@ -157,13 +157,16 @@ $arrayfields=array(
|
|||||||
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020),
|
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -47,12 +47,9 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
$cancel = GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (isset($_GET["id"]) || isset($_GET["ref"]))
|
$id = GETPOST("id", 'int') ? GETPOST("id", 'int'): GETPOST('ref', 'alpha');
|
||||||
{
|
$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
|
||||||
$id = isset($_GET["id"])?GETPOST("id"):(isset($_GET["ref"])?GETPOST("ref"):'');
|
|
||||||
}
|
|
||||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
|
||||||
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
||||||
|
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
@ -79,12 +76,12 @@ if ($action == 'add')
|
|||||||
// Create account
|
// Create account
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
|
|
||||||
$object->ref = dol_sanitizeFileName(trim($_POST["ref"]));
|
$object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
|
||||||
$object->label = trim($_POST["label"]);
|
$object->label = trim(GETPOST("label", 'alphanohtml'));
|
||||||
$object->courant = $_POST["type"];
|
$object->courant = $_POST["type"];
|
||||||
$object->clos = $_POST["clos"];
|
$object->clos = $_POST["clos"];
|
||||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
$object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
|
||||||
$object->url = $_POST["url"];
|
$object->url = trim(GETPOST("url", 'alpha'));
|
||||||
|
|
||||||
$object->bank = trim($_POST["bank"]);
|
$object->bank = trim($_POST["bank"]);
|
||||||
$object->code_banque = trim($_POST["code_banque"]);
|
$object->code_banque = trim($_POST["code_banque"]);
|
||||||
@ -93,27 +90,34 @@ if ($action == 'add')
|
|||||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||||
$object->bic = trim($_POST["bic"]);
|
$object->bic = trim($_POST["bic"]);
|
||||||
$object->iban = trim($_POST["iban"]);
|
$object->iban = trim($_POST["iban"]);
|
||||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
$object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
|
||||||
|
|
||||||
$object->proprio = trim($_POST["proprio"]);
|
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
||||||
$object->owner_address = trim($_POST["owner_address"]);
|
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
||||||
|
|
||||||
$account_number = GETPOST('account_number', 'alpha');
|
$account_number = GETPOST('account_number', 'alphanohtml');
|
||||||
if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; } else { $object->account_number = $account_number; }
|
if (empty($account_number) || $account_number == '-1')
|
||||||
|
{
|
||||||
|
$object->account_number = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$object->account_number = $account_number;
|
||||||
|
}
|
||||||
$fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
|
$fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
|
||||||
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal = ''; } else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
|
||||||
|
|
||||||
$object->solde = $_POST["solde"];
|
$object->solde = $_POST["solde"];
|
||||||
$object->date_solde = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$object->date_solde = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST("reyear", 'int'));
|
||||||
|
|
||||||
$object->currency_code = trim($_POST["account_currency_code"]);
|
$object->currency_code = trim($_POST["account_currency_code"]);
|
||||||
|
|
||||||
$object->state_id = $_POST["account_state_id"];
|
$object->state_id = GETPOST("account_state_id", 'int');
|
||||||
$object->country_id = $_POST["account_country_id"];
|
$object->country_id = GETPOST("account_country_id", 'int');
|
||||||
|
|
||||||
$object->min_allowed = GETPOST("account_min_allowed", 'int');
|
$object->min_allowed = GETPOST("account_min_allowed", 'int');
|
||||||
$object->min_desired = GETPOST("account_min_desired", 'int');
|
$object->min_desired = GETPOST("account_min_desired", 'int');
|
||||||
$object->comment = trim(GETPOST("account_comment"));
|
$object->comment = trim(GETPOST("account_comment", 'none'));
|
||||||
|
|
||||||
$object->fk_user_author = $user->id;
|
$object->fk_user_author = $user->id;
|
||||||
|
|
||||||
@ -176,14 +180,14 @@ if ($action == 'update')
|
|||||||
|
|
||||||
// Update account
|
// Update account
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
$object->fetch(GETPOST("id"));
|
$object->fetch(GETPOST("id", 'int'));
|
||||||
|
|
||||||
$object->ref = dol_string_nospecial(trim($_POST["ref"]));
|
$object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
|
||||||
$object->label = trim($_POST["label"]);
|
$object->label = trim(GETPOST("label", 'alphanohtml'));
|
||||||
$object->courant = $_POST["type"];
|
$object->courant = $_POST["type"];
|
||||||
$object->clos = $_POST["clos"];
|
$object->clos = $_POST["clos"];
|
||||||
$object->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
$object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
|
||||||
$object->url = trim($_POST["url"]);
|
$object->url = trim(GETPOST("url", 'alpha'));
|
||||||
|
|
||||||
$object->bank = trim($_POST["bank"]);
|
$object->bank = trim($_POST["bank"]);
|
||||||
$object->code_banque = trim($_POST["code_banque"]);
|
$object->code_banque = trim($_POST["code_banque"]);
|
||||||
@ -192,10 +196,10 @@ if ($action == 'update')
|
|||||||
$object->cle_rib = trim($_POST["cle_rib"]);
|
$object->cle_rib = trim($_POST["cle_rib"]);
|
||||||
$object->bic = trim($_POST["bic"]);
|
$object->bic = trim($_POST["bic"]);
|
||||||
$object->iban = trim($_POST["iban"]);
|
$object->iban = trim($_POST["iban"]);
|
||||||
$object->domiciliation = trim($_POST["domiciliation"]);
|
$object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
|
||||||
|
|
||||||
$object->proprio = trim($_POST["proprio"]);
|
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
||||||
$object->owner_address = trim($_POST["owner_address"]);
|
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
||||||
|
|
||||||
$account_number = GETPOST('account_number', 'alpha');
|
$account_number = GETPOST('account_number', 'alpha');
|
||||||
if (empty($account_number) || $account_number == '-1')
|
if (empty($account_number) || $account_number == '-1')
|
||||||
@ -211,12 +215,12 @@ if ($action == 'update')
|
|||||||
|
|
||||||
$object->currency_code = trim($_POST["account_currency_code"]);
|
$object->currency_code = trim($_POST["account_currency_code"]);
|
||||||
|
|
||||||
$object->state_id = $_POST["account_state_id"];
|
$object->state_id = GETPOST("account_state_id", 'int');
|
||||||
$object->country_id = $_POST["account_country_id"];
|
$object->country_id = GETPOST("account_country_id", 'int');
|
||||||
|
|
||||||
$object->min_allowed = GETPOST("account_min_allowed", 'int');
|
$object->min_allowed = GETPOST("account_min_allowed", 'int');
|
||||||
$object->min_desired = GETPOST("account_min_desired", 'int');
|
$object->min_desired = GETPOST("account_min_desired", 'int');
|
||||||
$object->comment = trim(GETPOST("account_comment"));
|
$object->comment = trim(GETPOST("account_comment", 'none'));
|
||||||
|
|
||||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
|
||||||
{
|
{
|
||||||
@ -289,7 +293,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($account->error, $account->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,11 +414,16 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||||
|
|
||||||
|
$arrayselected = array();
|
||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
$cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
|
$cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
|
||||||
|
if (is_array($cats))
|
||||||
|
{
|
||||||
foreach($cats as $cat) {
|
foreach($cats as $cat) {
|
||||||
$arrayselected[] = $cat->id;
|
$arrayselected[] = $cat->id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
@ -625,8 +634,8 @@ else
|
|||||||
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$conciliate=$object->canBeConciliated();
|
$conciliate=$object->canBeConciliated();
|
||||||
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
if ($conciliate == -2) print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("CashAccount").')</span>';
|
||||||
elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
|
elseif ($conciliate == -3) print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
|
||||||
else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
|
else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -1082,38 +1082,27 @@ class Account extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return label of given object status
|
* Return label of given object status
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $status Id status
|
||||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('banks');
|
$langs->load('banks');
|
||||||
|
|
||||||
if ($statut == self::STATUS_OPEN) {
|
if ($status == self::STATUS_OPEN) {
|
||||||
$label = $langs->trans("StatusAccountOpened");
|
$label = $langs->trans("StatusAccountOpened");
|
||||||
$picto = img_picto($label, 'statut4');
|
$labelshort = $langs->trans("StatusAccountOpened");
|
||||||
|
$statusType = 'status4';
|
||||||
} else {
|
} else {
|
||||||
$label = $langs->trans("StatusAccountClosed");
|
$label = $langs->trans("StatusAccountClosed");
|
||||||
$picto = img_picto($label, 'statut5');
|
$labelshort = $langs->trans("StatusAccountClosed");
|
||||||
|
$statusType = 'status5';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 2) {
|
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
|
||||||
return $picto.' '.$label;
|
|
||||||
} elseif ($mode == 3) {
|
|
||||||
return $picto;
|
|
||||||
} elseif ($mode == 4) {
|
|
||||||
return $picto.' '.$label;
|
|
||||||
} elseif ($mode == 5) {
|
|
||||||
return $label.' '.$picto;
|
|
||||||
} elseif ($mode == 6) {
|
|
||||||
return $label.' '.$picto;
|
|
||||||
}
|
|
||||||
|
|
||||||
//There is no short mode for this label
|
|
||||||
return $label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2318,11 +2307,11 @@ class AccountLine extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $status Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Libelle du statut
|
* @return string Libelle du statut
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
@ -2330,33 +2319,33 @@ class AccountLine extends CommonObject
|
|||||||
/*
|
/*
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans("ActivityCeased");
|
if ($status==0) return $langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return $langs->trans("InActivity");
|
if ($status==1) return $langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 1)
|
if ($mode == 1)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans("ActivityCeased");
|
if ($status==0) return $langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return $langs->trans("InActivity");
|
if ($status==1) return $langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 2)
|
if ($mode == 2)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 3)
|
if ($mode == 3)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
||||||
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
|
||||||
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
if ($status==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
|
||||||
if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
if ($status==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,8 +52,6 @@ if ($user->societe_id) {
|
|||||||
}
|
}
|
||||||
if ($user->societe_id)
|
if ($user->societe_id)
|
||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '',
|
|
||||||
$fieldtype);
|
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
@ -69,8 +67,10 @@ if (!$sortfield)
|
|||||||
$sortfield = "name";
|
$sortfield = "name";
|
||||||
|
|
||||||
$object = new Account($db);
|
$object = new Account($db);
|
||||||
if ($id)
|
if ($id > 0 || ! empty($ref)) $object->fetch($id, $ref);
|
||||||
$object->fetch($id);
|
|
||||||
|
$result = restrictedArea($user, 'banque', $object->id, 'bank_account', '', '');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -105,14 +105,14 @@ if ($id > 0 || !empty($ref)) {
|
|||||||
|
|
||||||
|
|
||||||
// Build file list
|
// Build file list
|
||||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$',
|
$filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
|
||||||
$sortfield,
|
|
||||||
(strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1);
|
|
||||||
$totalsize = 0;
|
$totalsize = 0;
|
||||||
foreach ($filearray as $key => $file) {
|
foreach ($filearray as $key => $file) {
|
||||||
$totalsize+=$file['size'];
|
$totalsize+=$file['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$morehtmlref = '';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|||||||
@ -98,13 +98,16 @@ $arrayfields=array(
|
|||||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
|
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -2566,6 +2566,7 @@ $form = new Form($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
$formmargin = new FormMargin($db);
|
$formmargin = new FormMargin($db);
|
||||||
|
$soc = new Societe($db);
|
||||||
$paymentstatic=new Paiement($db);
|
$paymentstatic=new Paiement($db);
|
||||||
$bankaccountstatic = new Account($db);
|
$bankaccountstatic = new Account($db);
|
||||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||||
@ -2586,7 +2587,6 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans('NewBill'), '', 'invoicing');
|
print load_fiche_titre($langs->trans('NewBill'), '', 'invoicing');
|
||||||
|
|
||||||
$soc = new Societe($db);
|
|
||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
$res = $soc->fetch($socid);
|
$res = $soc->fetch($socid);
|
||||||
|
|
||||||
@ -3465,7 +3465,6 @@ elseif ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$result = $object->fetch_thirdparty();
|
$result = $object->fetch_thirdparty();
|
||||||
|
|
||||||
$soc = new Societe($db);
|
|
||||||
$result=$soc->fetch($object->socid);
|
$result=$soc->fetch($object->socid);
|
||||||
if ($result < 0) dol_print_error($db);
|
if ($result < 0) dol_print_error($db);
|
||||||
$selleruserevenustamp = $mysoc->useRevenueStamp();
|
$selleruserevenustamp = $mysoc->useRevenueStamp();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
@ -202,6 +202,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$object->email = GETPOST("email", 'alpha');
|
$object->email = GETPOST("email", 'alpha');
|
||||||
|
$object->no_email = GETPOST("no_email", "int");
|
||||||
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
$object->phone_pro = GETPOST("phone_pro", 'alpha');
|
||||||
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
$object->phone_perso = GETPOST("phone_perso", 'alpha');
|
||||||
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
$object->phone_mobile = GETPOST("phone_mobile", 'alpha');
|
||||||
@ -240,6 +241,22 @@ if (empty($reshook))
|
|||||||
// Categories association
|
// Categories association
|
||||||
$contcats = GETPOST('contcats', 'array');
|
$contcats = GETPOST('contcats', 'array');
|
||||||
$object->setCategories($contcats);
|
$object->setCategories($contcats);
|
||||||
|
|
||||||
|
// Add mass emailing flag into table mailing_unsubscribe
|
||||||
|
if (GETPOST('no_email', 'int') && $object->email)
|
||||||
|
{
|
||||||
|
$sql="SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE entity IN (".getEntity('mailing', 0).") AND email = '".$db->escape($object->email)."'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj=$db->fetch_object($resql);
|
||||||
|
if (empty($obj->nb))
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe(email, entity, date_creat) VALUES ('".$db->escape($object->email)."', ".$db->escape(getEntity('mailing', 0)).", '".$db->idate(dol_now())."')";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +387,7 @@ if (empty($reshook))
|
|||||||
$object->country_id = GETPOST("country_id", 'int');
|
$object->country_id = GETPOST("country_id", 'int');
|
||||||
|
|
||||||
$object->email = GETPOST("email", 'alpha');
|
$object->email = GETPOST("email", 'alpha');
|
||||||
|
$object->no_email = GETPOST("no_email", "int");
|
||||||
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
//$object->jabberid = GETPOST("jabberid", 'alpha');
|
||||||
//$object->skype = GETPOST("skype", 'alpha');
|
//$object->skype = GETPOST("skype", 'alpha');
|
||||||
//$object->twitter = GETPOST("twitter", 'alpha');
|
//$object->twitter = GETPOST("twitter", 'alpha');
|
||||||
@ -404,6 +422,35 @@ if (empty($reshook))
|
|||||||
$categories = GETPOST('contcats', 'array');
|
$categories = GETPOST('contcats', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
|
$no_email = GETPOST('no_email', 'int');
|
||||||
|
|
||||||
|
// Update mass emailing flag into table mailing_unsubscribe
|
||||||
|
if (GETPOSTISSET('no_email') && $object->email)
|
||||||
|
{
|
||||||
|
if ($no_email)
|
||||||
|
{
|
||||||
|
$sql="SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE entity IN (".getEntity('mailing', 0).") AND email = '".$db->escape($object->email)."'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj=$db->fetch_object($resql);
|
||||||
|
$noemail = $obj->nb;
|
||||||
|
if (empty($noemail))
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe(email, entity, date_creat) VALUES ('".$db->escape($object->email)."', ".$db->escape(getEntity('mailing', 0)).", '".$db->idate(dol_now())."')";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = '".$db->escape($object->email)."' AND entity = ".$db->escape(getEntity('mailing', 0));
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->no_email = $no_email;
|
||||||
|
}
|
||||||
|
|
||||||
$object->old_lastname='';
|
$object->old_lastname='';
|
||||||
$object->old_firstname='';
|
$object->old_firstname='';
|
||||||
$action = 'view';
|
$action = 'view';
|
||||||
|
|||||||
@ -83,6 +83,11 @@ class Contact extends CommonObject
|
|||||||
public $civility_id; // In fact we store civility_code
|
public $civility_id; // In fact we store civility_code
|
||||||
public $civility_code;
|
public $civility_code;
|
||||||
public $civility;
|
public $civility;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $address;
|
public $address;
|
||||||
public $zip;
|
public $zip;
|
||||||
public $town;
|
public $town;
|
||||||
@ -97,8 +102,19 @@ class Contact extends CommonObject
|
|||||||
public $statut; // 0=inactif, 1=actif
|
public $statut; // 0=inactif, 1=actif
|
||||||
|
|
||||||
public $code;
|
public $code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsuscribe all : 1 = contact has globaly unsubscribe of all mass emailings
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $no_email;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array array of socialnetworks
|
* @var array array of socialnetworks
|
||||||
*/
|
*/
|
||||||
@ -433,6 +449,7 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
if (! $error && $this->user_id > 0)
|
if (! $error && $this->user_id > 0)
|
||||||
{
|
{
|
||||||
|
// If contact is linked to a user
|
||||||
$tmpobj = new User($this->db);
|
$tmpobj = new User($this->db);
|
||||||
$tmpobj->fetch($this->user_id);
|
$tmpobj->fetch($this->user_id);
|
||||||
$usermustbemodified = 0;
|
$usermustbemodified = 0;
|
||||||
@ -1294,45 +1311,34 @@ class Contact extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $status Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Libelle
|
* @return string Libelle
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $mode)
|
public function LibStatut($status, $mode)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
if ($mode == 0)
|
if (empty($this->status) || empty($this->statusshort))
|
||||||
{
|
{
|
||||||
if ($statut==0 || $statut==5) return $langs->trans('Disabled');
|
$this->labelstatus[0] = 'ActivityCeased';
|
||||||
elseif ($statut==1 || $statut==4) return $langs->trans('Enabled');
|
$this->labelstatusshort[0] = 'ActivityCeased';
|
||||||
}
|
$this->labelstatus[5] = 'ActivityCeased';
|
||||||
elseif ($mode == 1)
|
$this->labelstatusshort[5] = 'ActivityCeased';
|
||||||
{
|
$this->labelstatus[1] = 'InActivity';
|
||||||
if ($statut==0 || $statut==5) return $langs->trans('Disabled');
|
$this->labelstatusshort[1] = 'InActivity';
|
||||||
elseif ($statut==1 || $statut==4) return $langs->trans('Enabled');
|
$this->labelstatus[4] = 'InActivity';
|
||||||
}
|
$this->labelstatusshort[4] = 'InActivity';
|
||||||
elseif ($mode == 2)
|
|
||||||
{
|
|
||||||
if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
|
|
||||||
elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
|
|
||||||
}
|
|
||||||
elseif ($mode == 3)
|
|
||||||
{
|
|
||||||
if ($statut==0 || $statut==5) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
||||||
elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
||||||
}
|
|
||||||
elseif ($mode == 4)
|
|
||||||
{
|
|
||||||
if ($statut==0) return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
|
|
||||||
elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
|
|
||||||
}
|
|
||||||
elseif ($mode == 5)
|
|
||||||
{
|
|
||||||
if ($statut==0 || $statut==5) return '<span class="hideonsmartphone">'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
||||||
elseif ($statut==1 || $statut==4) return '<span class="hideonsmartphone">'.$langs->trans('Enabled').' </span>'.img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$statusType = 'status4';
|
||||||
|
if ($status==0 || $status==5) $statusType = 'status5';
|
||||||
|
|
||||||
|
$label = $langs->trans($this->labelstatus[$status]);
|
||||||
|
$labelshort = $langs->trans($this->labelstatusshort[$status]);
|
||||||
|
|
||||||
|
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1340,14 +1346,14 @@ class Contact extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Return translated label of Public or Private
|
* Return translated label of Public or Private
|
||||||
*
|
*
|
||||||
* @param int $statut Type (0 = public, 1 = private)
|
* @param int $status Type (0 = public, 1 = private)
|
||||||
* @return string Label translated
|
* @return string Label translated
|
||||||
*/
|
*/
|
||||||
public function LibPubPriv($statut)
|
public function LibPubPriv($status)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
if ($statut=='1') return $langs->trans('ContactPrivate');
|
if ($status=='1') return $langs->trans('ContactPrivate');
|
||||||
else return $langs->trans('ContactPublic');
|
else return $langs->trans('ContactPublic');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1402,18 +1408,18 @@ class Contact extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Change status of a user
|
* Change status of a user
|
||||||
*
|
*
|
||||||
* @param int $statut Status to set
|
* @param int $status Status to set
|
||||||
* @return int <0 if KO, 0 if nothing is done, >0 if OK
|
* @return int <0 if KO, 0 if nothing is done, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function setstatus($statut)
|
public function setstatus($status)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user;
|
global $conf,$langs,$user;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($this->statut == $statut) return 0;
|
if ($this->statut == $status) return 0;
|
||||||
else $this->statut = $statut;
|
else $this->statut = $status;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
@ -191,15 +191,18 @@ if (! empty($conf->socialnetworks->enabled)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
$object=new Contact($db);
|
|
||||||
if (($id > 0 || ! empty($ref)) && $action != 'add')
|
if (($id > 0 || ! empty($ref)) && $action != 'add')
|
||||||
{
|
{
|
||||||
$result=$object->fetch($id, $ref);
|
$result=$object->fetch($id, $ref);
|
||||||
@ -950,7 +953,7 @@ while ($i < min($num, $limit))
|
|||||||
// Status
|
// Status
|
||||||
if (! empty($arrayfields['p.statut']['checked']))
|
if (! empty($arrayfields['p.statut']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="center">'.$contactstatic->getLibStatut(3).'</td>';
|
print '<td class="center">'.$contactstatic->getLibStatut(5).'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.import_key']['checked']))
|
if (! empty($arrayfields['p.import_key']['checked']))
|
||||||
|
|||||||
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
if ($cancel)
|
if ($cancel)
|
||||||
{
|
{
|
||||||
|
/*var_dump($cancel);
|
||||||
|
var_dump($backtopage);exit;*/
|
||||||
if (! empty($backtopage))
|
if (! empty($backtopage))
|
||||||
{
|
{
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
@ -80,7 +82,8 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Creation OK
|
// Creation OK
|
||||||
$urltogo=$backtopage?str_replace('__ID__', $result, $backtopage):$backurlforlist;
|
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
|
||||||
|
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
|
||||||
header("Location: ".$urltogo);
|
header("Location: ".$urltogo);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,9 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
|
|
||||||
$listofobjectid=array();
|
$listofobjectid=array();
|
||||||
$listofobjectthirdparties=array();
|
$listofobjectthirdparties=array();
|
||||||
|
$listofobjectcontacts = array();
|
||||||
$listofobjectref=array();
|
$listofobjectref=array();
|
||||||
|
$contactidtosend=array();
|
||||||
$attachedfilesThirdpartyObj=array();
|
$attachedfilesThirdpartyObj=array();
|
||||||
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
|
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
|
||||||
|
|
||||||
@ -97,6 +99,16 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user;
|
if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user;
|
||||||
if (empty($thirdpartyid)) $thirdpartyid=0;
|
if (empty($thirdpartyid)) $thirdpartyid=0;
|
||||||
|
|
||||||
|
if ($objectclass == 'Facture') {
|
||||||
|
$tmparraycontact = array();
|
||||||
|
$tmparraycontact = $objecttmp->liste_contact(-1, 'external', 0, 'BILLING');
|
||||||
|
if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
|
||||||
|
foreach ($tmparraycontact as $data_email) {
|
||||||
|
$listofobjectcontacts[$toselectid][$data_email['id']] = $data_email['email'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||||
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
||||||
}
|
}
|
||||||
@ -248,6 +260,21 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$fuser->fetch($objectobj->fk_user);
|
$fuser->fetch($objectobj->fk_user);
|
||||||
$sendto = $fuser->email;
|
$sendto = $fuser->email;
|
||||||
}
|
}
|
||||||
|
elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid]))
|
||||||
|
{
|
||||||
|
$emails_to_sends = array();
|
||||||
|
$objectobj->fetch_thirdparty();
|
||||||
|
$contactidtosend=array();
|
||||||
|
foreach ($listofobjectcontacts[$objectid] as $contactemailid => $contactemailemail) {
|
||||||
|
$emails_to_sends[] = $objectobj->thirdparty->contact_get_property($contactemailid, 'email');
|
||||||
|
if (!in_array($contactemailid, $contactidtosend)) {
|
||||||
|
$contactidtosend[] = $contactemailid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($emails_to_sends) > 0) {
|
||||||
|
$sendto = implode(',', $emails_to_sends);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$objectobj->fetch_thirdparty();
|
$objectobj->fetch_thirdparty();
|
||||||
@ -499,7 +526,7 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$actionmsg2='';
|
$actionmsg2='';
|
||||||
|
|
||||||
// Initialisation donnees
|
// Initialisation donnees
|
||||||
$objectobj2->sendtoid = 0;
|
$objectobj2->sendtoid = (empty($contactidtosend)?0:$contactidtosend);
|
||||||
$objectobj2->actionmsg = $actionmsg; // Long text
|
$objectobj2->actionmsg = $actionmsg; // Long text
|
||||||
$objectobj2->actionmsg2 = $actionmsg2; // Short text
|
$objectobj2->actionmsg2 = $actionmsg2; // Short text
|
||||||
$objectobj2->fk_element = $objid2;
|
$objectobj2->fk_element = $objid2;
|
||||||
|
|||||||
@ -165,9 +165,10 @@ class Ccountry // extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $id Id object
|
* @param int $id Id object
|
||||||
* @param string $code Code
|
* @param string $code Code
|
||||||
|
* @param string $code_iso Code ISO
|
||||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function fetch($id, $code = '')
|
public function fetch($id, $code = '', $code_iso = '')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
@ -179,6 +180,7 @@ class Ccountry // extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
|
||||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||||
|
elseif ($code_iso) $sql.= " WHERE t.code_iso = '".$this->db->escape($code_iso)."'";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|||||||
@ -224,15 +224,15 @@ abstract class CommonDocGenerator
|
|||||||
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
||||||
$object->fetch_optionals();
|
$object->fetch_optionals();
|
||||||
|
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||||
{
|
{
|
||||||
if($extrafields->attribute_type[$key] == 'price')
|
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||||
{
|
{
|
||||||
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
||||||
}
|
}
|
||||||
elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
|
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
||||||
{
|
{
|
||||||
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
|
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
||||||
}
|
}
|
||||||
$array_thirdparty = array_merge($array_thirdparty, array ('company_options_'.$key => $object->array_options ['options_' . $key]));
|
$array_thirdparty = array_merge($array_thirdparty, array ('company_options_'.$key => $object->array_options ['options_' . $key]));
|
||||||
}
|
}
|
||||||
@ -298,15 +298,15 @@ abstract class CommonDocGenerator
|
|||||||
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
||||||
$object->fetch_optionals();
|
$object->fetch_optionals();
|
||||||
|
|
||||||
foreach($extrafields->attribute_label as $key => $label)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||||
{
|
{
|
||||||
if ($extrafields->attribute_type[$key] == 'price')
|
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||||
{
|
{
|
||||||
$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
|
$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
|
||||||
}
|
}
|
||||||
elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox')
|
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
||||||
{
|
{
|
||||||
$object->array_options['options_' . $key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_' . $key]];
|
$object->array_options['options_' . $key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_' . $key]];
|
||||||
}
|
}
|
||||||
$array_contact = array_merge($array_contact, array($array_key.'_options_' . $key => $object->array_options['options_'. $key]));
|
$array_contact = array_merge($array_contact, array($array_key.'_options_' . $key => $object->array_options['options_'. $key]));
|
||||||
}
|
}
|
||||||
@ -643,11 +643,11 @@ abstract class CommonDocGenerator
|
|||||||
$array_key.'_tracking_number'=>$object->tracking_number,
|
$array_key.'_tracking_number'=>$object->tracking_number,
|
||||||
$array_key.'_tracking_url'=>$object->tracking_url,
|
$array_key.'_tracking_url'=>$object->tracking_url,
|
||||||
$array_key.'_shipping_method'=>$object->listmeths[0]['libelle'],
|
$array_key.'_shipping_method'=>$object->listmeths[0]['libelle'],
|
||||||
$array_key.'_weight'=>$object->trueWeight.' '.measuring_units_string($object->weight_units, 'weight'),
|
$array_key.'_weight'=>$object->trueWeight.' '.measuringUnitString(0, 'weight', $object->weight_units),
|
||||||
$array_key.'_width'=>$object->trueWidth.' '.measuring_units_string($object->width_units, 'size'),
|
$array_key.'_width'=>$object->trueWidth.' '.measuringUnitString(0, 'size', $object->width_units),
|
||||||
$array_key.'_height'=>$object->trueHeight.' '.measuring_units_string($object->height_units, 'size'),
|
$array_key.'_height'=>$object->trueHeight.' '.measuringUnitString(0, 'size', $object->height_units),
|
||||||
$array_key.'_depth'=>$object->trueDepth.' '.measuring_units_string($object->depth_units, 'size'),
|
$array_key.'_depth'=>$object->trueDepth.' '.measuringUnitString(0, 'size', $object->depth_units),
|
||||||
$array_key.'_size'=>$calculatedVolume.' '.measuring_units_string(0, 'volume'),
|
$array_key.'_size'=>$calculatedVolume.' '.measuringUnitString(0, 'volume'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add vat by rates
|
// Add vat by rates
|
||||||
@ -701,10 +701,10 @@ abstract class CommonDocGenerator
|
|||||||
'line_price_ht'=>price($line->total_ht),
|
'line_price_ht'=>price($line->total_ht),
|
||||||
'line_price_ttc'=>price($line->total_ttc),
|
'line_price_ttc'=>price($line->total_ttc),
|
||||||
'line_price_vat'=>price($line->total_tva),
|
'line_price_vat'=>price($line->total_tva),
|
||||||
'line_weight'=>empty($line->weight) ? '' : $line->weight*$line->qty_shipped.' '.measuring_units_string($line->weight_units, 'weight'),
|
'line_weight'=>empty($line->weight) ? '' : $line->weight*$line->qty_shipped.' '.measuringUnitString(0, 'weight', $line->weight_units),
|
||||||
'line_length'=>empty($line->length) ? '' : $line->length*$line->qty_shipped.' '.measuring_units_string($line->length_units, 'size'),
|
'line_length'=>empty($line->length) ? '' : $line->length*$line->qty_shipped.' '.measuringUnitString(0, 'size', $line->length_units),
|
||||||
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuring_units_string($line->surface_units, 'surface'),
|
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuringUnitString(0, 'surface', $line->surface_units),
|
||||||
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuring_units_string($line->volume_units, 'volume'),
|
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuringUnitString(0, 'volume', $line->volume_units),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
@ -765,30 +765,30 @@ abstract class CommonDocGenerator
|
|||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||||
{
|
{
|
||||||
if($extrafields->attribute_type[$key] == 'price')
|
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||||
{
|
{
|
||||||
$object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
|
$object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
|
||||||
$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
||||||
//Add value to store price with currency
|
//Add value to store price with currency
|
||||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
|
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
|
||||||
}
|
}
|
||||||
elseif($extrafields->attribute_type[$key] == 'select')
|
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
|
||||||
{
|
{
|
||||||
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
|
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
||||||
}
|
}
|
||||||
elseif($extrafields->attribute_type[$key] == 'checkbox') {
|
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
|
||||||
$valArray=explode(',', $object->array_options['options_'.$key]);
|
$valArray=explode(',', $object->array_options['options_'.$key]);
|
||||||
$output=array();
|
$output=array();
|
||||||
foreach($extrafields->attribute_param[$key]['options'] as $keyopt=>$valopt) {
|
foreach($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
|
||||||
if (in_array($keyopt, $valArray)) {
|
if (in_array($keyopt, $valArray)) {
|
||||||
$output[]=$valopt;
|
$output[]=$valopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$object->array_options['options_'.$key] = implode(', ', $output);
|
$object->array_options['options_'.$key] = implode(', ', $output);
|
||||||
}
|
}
|
||||||
elseif($extrafields->attribute_type[$key] == 'date')
|
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
|
||||||
{
|
{
|
||||||
if (strlen($object->array_options['options_'.$key])>0)
|
if (strlen($object->array_options['options_'.$key])>0)
|
||||||
{
|
{
|
||||||
@ -806,7 +806,7 @@ abstract class CommonDocGenerator
|
|||||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||||
}
|
}
|
||||||
elseif($extrafields->attribute_type[$key] == 'datetime')
|
elseif($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
|
||||||
{
|
{
|
||||||
$datetime = $object->array_options['options_'.$key];
|
$datetime = $object->array_options['options_'.$key];
|
||||||
$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
|
$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
|
||||||
@ -815,7 +815,7 @@ abstract class CommonDocGenerator
|
|||||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||||
}
|
}
|
||||||
elseif($extrafields->attribute_type[$key] == 'link')
|
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
|
||||||
{
|
{
|
||||||
$id = $object->array_options['options_'.$key];
|
$id = $object->array_options['options_'.$key];
|
||||||
if ($id != "")
|
if ($id != "")
|
||||||
|
|||||||
@ -538,7 +538,6 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
return dolGetStatus($labelstatut, $labelstatutShort, '', $statusType, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1889,13 +1889,19 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
if ($this->table_element == 'actioncomm')
|
if (! empty($this->fields['fk_project'])) // Common case
|
||||||
|
{
|
||||||
|
if ($projectid) $sql.= ' SET fk_project = '.$projectid;
|
||||||
|
else $sql.= ' SET fk_project = NULL';
|
||||||
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
}
|
||||||
|
elseif ($this->table_element == 'actioncomm') // Special case for actioncomm
|
||||||
{
|
{
|
||||||
if ($projectid) $sql.= ' SET fk_project = '.$projectid;
|
if ($projectid) $sql.= ' SET fk_project = '.$projectid;
|
||||||
else $sql.= ' SET fk_project = NULL';
|
else $sql.= ' SET fk_project = NULL';
|
||||||
$sql.= ' WHERE id = '.$this->id;
|
$sql.= ' WHERE id = '.$this->id;
|
||||||
}
|
}
|
||||||
else
|
else // Special case for old architecture objects
|
||||||
{
|
{
|
||||||
if ($projectid) $sql.= ' SET fk_projet = '.$projectid;
|
if ($projectid) $sql.= ' SET fk_projet = '.$projectid;
|
||||||
else $sql.= ' SET fk_projet = NULL';
|
else $sql.= ' SET fk_projet = NULL';
|
||||||
@ -3833,9 +3839,10 @@ abstract class CommonObject
|
|||||||
$trueWeightUnit = 0.0283495;
|
$trueWeightUnit = 0.0283495;
|
||||||
$totalWeight += $weight * $qty * $trueWeightUnit;
|
$totalWeight += $weight * $qty * $trueWeightUnit;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$totalWeight += $weight * $qty; // This may be wrong if we mix different units
|
$totalWeight += $weight * $qty; // This may be wrong if we mix different units
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
|
if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
|
||||||
{
|
{
|
||||||
//print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit;
|
//print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit;
|
||||||
@ -5563,16 +5570,20 @@ abstract class CommonObject
|
|||||||
$type='';
|
$type='';
|
||||||
$param = array();
|
$param = array();
|
||||||
$param['options']=array();
|
$param['options']=array();
|
||||||
$size =$this->fields[$key]['size'];
|
$reg=array();
|
||||||
|
$size = $this->fields[$key]['size'];
|
||||||
// Because we work on extrafields
|
// Because we work on extrafields
|
||||||
if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){
|
if (preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){
|
||||||
$param['options']=array($reg[1].':'.$reg[2]=>'N');
|
$param['options']=array($reg[2].':'.$reg[3].':'.$reg[4].':'.$reg[5] => 'N');
|
||||||
$type ='link';
|
$type ='link';
|
||||||
} elseif(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)) {
|
} elseif (preg_match('/^(integer|link):(.*):(.*):(.*)/i', $val['type'], $reg)){
|
||||||
$param['options']=array($reg[1].':'.$reg[2]=>'N');
|
$param['options']=array($reg[2].':'.$reg[3].':'.$reg[4] => 'N');
|
||||||
|
$type ='link';
|
||||||
|
} elseif (preg_match('/^(integer|link):(.*):(.*)/i', $val['type'], $reg)){
|
||||||
|
$param['options']=array($reg[2].':'.$reg[3] => 'N');
|
||||||
$type ='link';
|
$type ='link';
|
||||||
} elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
|
} elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
|
||||||
$param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N');
|
$param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
|
||||||
$type ='sellist';
|
$type ='sellist';
|
||||||
} elseif(preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) {
|
} elseif(preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) {
|
||||||
$param['options']=array();
|
$param['options']=array();
|
||||||
@ -6085,16 +6096,26 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
elseif ($type == 'link')
|
elseif ($type == 'link')
|
||||||
{
|
{
|
||||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]'
|
||||||
|
$param_list_array = explode(':', $param_list[0]);
|
||||||
$showempty=(($required && $default != '')?0:1);
|
$showempty=(($required && $default != '')?0:1);
|
||||||
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty);
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', '', '', 0, empty($val['disabled'])?0:1);
|
||||||
|
|
||||||
|
if (! empty($param_list_array[2])) // If we set to add a create button
|
||||||
|
{
|
||||||
|
if (! GETPOSTISSET('backtopage') && empty($val['disabled'])) // To avoid to open several infinitely the 'Create Object' button and to avoid to have button if field is protected by a "disabled".
|
||||||
{
|
{
|
||||||
list($class,$classfile)=explode(':', $param_list[0]);
|
list($class,$classfile)=explode(':', $param_list[0]);
|
||||||
if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) $url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php', 1);
|
if (file_exists(dol_buildpath(dirname(dirname($classfile)).'/card.php'))) $url_path=dol_buildpath(dirname(dirname($classfile)).'/card.php', 1);
|
||||||
else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.$class.'_card.php', 1);
|
else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.strtolower($class).'_card.php', 1);
|
||||||
$out.='<a class="butActionNew" href="'.$url_path.'?action=create&backtopage='.$_SERVER['PHP_SELF'].'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
$paramforthenewlink = '';
|
||||||
// TODO Add Javascript code to add input fields contents to new elements urls
|
$paramforthenewlink .= (GETPOSTISSET('action')?'&action='.GETPOST('action', 'aZ09'):'');
|
||||||
|
$paramforthenewlink .= (GETPOSTISSET('id')?'&id='.GETPOST('id', 'int'):'');
|
||||||
|
$paramforthenewlink .= '&fk_'.strtolower($class).'=--IDFORBACKTOPAGE--';
|
||||||
|
// TODO Add Javascript code to add input fields already filled into $paramforthenewlink so we won't loose them when going back to main page
|
||||||
|
$out.='<a class="butActionNew" title="'.$langs->trans("New").'" href="'.$url_path.'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].($paramforthenewlink ? '?'.$paramforthenewlink : '')).'"><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($type == 'password')
|
elseif ($type == 'password')
|
||||||
@ -6174,6 +6195,7 @@ abstract class CommonObject
|
|||||||
$label = $val['label'];
|
$label = $val['label'];
|
||||||
$type = $val['type'];
|
$type = $val['type'];
|
||||||
$size = $val['css'];
|
$size = $val['css'];
|
||||||
|
$reg = array();
|
||||||
|
|
||||||
// Convert var to be able to share same code than showOutputField of extrafields
|
// Convert var to be able to share same code than showOutputField of extrafields
|
||||||
if (preg_match('/varchar\((\d+)\)/', $type, $reg))
|
if (preg_match('/varchar\((\d+)\)/', $type, $reg))
|
||||||
@ -6189,7 +6211,9 @@ abstract class CommonObject
|
|||||||
$computed=$val['computed'];
|
$computed=$val['computed'];
|
||||||
$unique=$val['unique'];
|
$unique=$val['unique'];
|
||||||
$required=$val['required'];
|
$required=$val['required'];
|
||||||
$param=$val['param'];
|
$param=array();
|
||||||
|
$param['options']=array();
|
||||||
|
|
||||||
if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
|
if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
|
||||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
|
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -353,6 +353,12 @@ class Conf
|
|||||||
$this->propal->dir_output=$rootfordata."/propale";
|
$this->propal->dir_output=$rootfordata."/propale";
|
||||||
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
||||||
|
|
||||||
|
// For backward compatibility
|
||||||
|
$this->banque->multidir_output = array($this->entity => $rootfordata."/bank");
|
||||||
|
$this->banque->multidir_temp = array($this->entity => $rootfordata."/bank/temp");
|
||||||
|
$this->banque->dir_output=$rootfordata."/bank";
|
||||||
|
$this->banque->dir_temp=$rootfordata."/bank/temp";
|
||||||
|
|
||||||
// For medias storage
|
// For medias storage
|
||||||
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
||||||
$this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");
|
$this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");
|
||||||
|
|||||||
@ -234,8 +234,6 @@ class CUnits // extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
$records=array();
|
|
||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
$sql.= " t.rowid,";
|
$sql.= " t.rowid,";
|
||||||
$sql.= " t.code,";
|
$sql.= " t.code,";
|
||||||
@ -249,8 +247,8 @@ class CUnits // extends CommonObject
|
|||||||
$sqlwhere = array();
|
$sqlwhere = array();
|
||||||
if (count($filter) > 0) {
|
if (count($filter) > 0) {
|
||||||
foreach ($filter as $key => $value) {
|
foreach ($filter as $key => $value) {
|
||||||
if ($key=='t.rowid' || $key=='t.active') {
|
if ($key=='t.rowid' || $key=='t.active' || $key=='t.scale') {
|
||||||
$sqlwhere[] = $key . '='. $value;
|
$sqlwhere[] = $key . '='. (int) $value;
|
||||||
}
|
}
|
||||||
elseif (strpos($key, 'date') !== false) {
|
elseif (strpos($key, 'date') !== false) {
|
||||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||||
@ -273,6 +271,7 @@ class CUnits // extends CommonObject
|
|||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$this->records=array();
|
$this->records=array();
|
||||||
|
|||||||
@ -1573,7 +1573,7 @@ class ExtraFields
|
|||||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||||
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
|
||||||
*/
|
*/
|
||||||
if (! empty($help)) {
|
if (! empty($help) && $keyprefix != 'search_options_') {
|
||||||
$out .= $form->textwithpicto('', $help, 1, 'help', '', 0, 3);
|
$out .= $form->textwithpicto('', $help, 1, 'help', '', 0, 3);
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
@ -2088,6 +2088,7 @@ class ExtraFields
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$value_key=GETPOST("options_".$key);
|
$value_key=GETPOST("options_".$key);
|
||||||
|
if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->array_options["options_".$key]=$value_key;
|
$object->array_options["options_".$key]=$value_key;
|
||||||
|
|||||||
@ -2425,7 +2425,7 @@ class Form
|
|||||||
$outvalUnits .= ' - ' . $unitToShow;
|
$outvalUnits .= ' - ' . $unitToShow;
|
||||||
}
|
}
|
||||||
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
|
||||||
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuring_units_string($objp->length_units, 'size');
|
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
|
||||||
$outvalUnits .= ' - ' . $unitToShow;
|
$outvalUnits .= ' - ' . $unitToShow;
|
||||||
}
|
}
|
||||||
if (!empty($objp->surface) && $objp->surface_units!==null) {
|
if (!empty($objp->surface) && $objp->surface_units!==null) {
|
||||||
@ -2802,7 +2802,7 @@ class Form
|
|||||||
$outvalUnits .= ' - ' . $unitToShow;
|
$outvalUnits .= ' - ' . $unitToShow;
|
||||||
}
|
}
|
||||||
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
|
if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units!==null) {
|
||||||
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuring_units_string($objp->length_units, 'size');
|
$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
|
||||||
$outvalUnits .= ' - ' . $unitToShow;
|
$outvalUnits .= ' - ' . $unitToShow;
|
||||||
}
|
}
|
||||||
if (!empty($objp->surface) && $objp->surface_units!==null) {
|
if (!empty($objp->surface) && $objp->surface_units!==null) {
|
||||||
@ -2827,15 +2827,6 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$opt = '<option value="'.$outkey.'"';
|
|
||||||
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected';
|
|
||||||
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt.=' disabled';
|
|
||||||
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
|
|
||||||
{
|
|
||||||
$opt.= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
|
|
||||||
}
|
|
||||||
$opt.= '>';
|
|
||||||
|
|
||||||
$objRef = $objp->ref;
|
$objRef = $objp->ref;
|
||||||
if ($filterkey && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1);
|
if ($filterkey && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1);
|
||||||
$objRefFourn = $objp->ref_fourn;
|
$objRefFourn = $objp->ref_fourn;
|
||||||
@ -2843,19 +2834,17 @@ class Form
|
|||||||
$label = $objp->label;
|
$label = $objp->label;
|
||||||
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $label, 1);
|
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $label, 1);
|
||||||
|
|
||||||
$opt.=$objp->ref;
|
$optlabel = $objp->ref;
|
||||||
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
|
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
|
||||||
$opt.=' ('.$objp->ref_fourn.')';
|
$optlabel.=' <span class=\'opacitymedium\'>('.$objp->ref_fourn.')</span>';
|
||||||
$opt.=' - ';
|
|
||||||
$outval.=$objRef;
|
$outvallabel = $objRef;
|
||||||
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
|
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
|
||||||
$outval.=' ('.$objRefFourn.')';
|
$outvallabel.=' ('.$objRefFourn.')';
|
||||||
$outval.=' - ';
|
|
||||||
$opt.=dol_trunc($label, 72);
|
|
||||||
$outval.=dol_trunc($label, 72);
|
|
||||||
// Units
|
// Units
|
||||||
$opt .= $outvalUnits;
|
$optlabel .= $outvalUnits;
|
||||||
$outval .= $outvalUnits;
|
$outvallabel .= $outvalUnits;
|
||||||
|
|
||||||
if (! empty($objp->idprodfournprice))
|
if (! empty($objp->idprodfournprice))
|
||||||
{
|
{
|
||||||
@ -2880,66 +2869,81 @@ class Form
|
|||||||
}
|
}
|
||||||
if ($objp->quantity == 1)
|
if ($objp->quantity == 1)
|
||||||
{
|
{
|
||||||
$opt.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
|
$optlabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
|
||||||
$outval.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/";
|
$outvallabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/";
|
||||||
$opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
|
$optlabel.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
|
||||||
$outval.=$langs->transnoentities("Unit");
|
$outvallabel.=$langs->transnoentities("Unit");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$opt.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
|
$optlabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
|
||||||
$outval.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
|
$outvallabel.= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
|
||||||
$opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
|
$optlabel.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
|
||||||
$outval.= ' '.$langs->transnoentities("Units");
|
$outvallabel.= ' '.$langs->transnoentities("Units");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($objp->quantity >= 1)
|
if ($objp->quantity > 1)
|
||||||
{
|
{
|
||||||
$opt.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
|
$optlabel.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
|
||||||
$outval.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
|
$outvallabel.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
|
||||||
}
|
}
|
||||||
if ($objp->remise_percent >= 1)
|
if ($objp->remise_percent >= 1)
|
||||||
{
|
{
|
||||||
$opt.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
|
$optlabel.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
|
||||||
$outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
|
$outvallabel.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
|
||||||
}
|
}
|
||||||
if ($objp->duration)
|
if ($objp->duration)
|
||||||
{
|
{
|
||||||
$opt .= " - ".$objp->duration;
|
$optlabel .= " - ".$objp->duration;
|
||||||
$outval.=" - ".$objp->duration;
|
$outvallabel.=" - ".$objp->duration;
|
||||||
}
|
}
|
||||||
if (! $socid)
|
if (! $socid)
|
||||||
{
|
{
|
||||||
$opt .= " - ".dol_trunc($objp->name, 8);
|
$optlabel .= " - ".dol_trunc($objp->name, 8);
|
||||||
$outval.=" - ".dol_trunc($objp->name, 8);
|
$outvallabel.=" - ".dol_trunc($objp->name, 8);
|
||||||
}
|
}
|
||||||
if (! empty($conf->barcode->enabled) && !empty($objp->barcode))
|
if (! empty($conf->barcode->enabled) && !empty($objp->barcode))
|
||||||
{
|
{
|
||||||
$opt .= " - ".$objp->barcode;
|
//$optlabel .= " - <span class='fa fa-barcode'></span>".$objp->barcode;
|
||||||
$outval.=" - ".$objp->barcode;
|
$optlabel .= " - ".$objp->barcode;
|
||||||
|
$outvallabel.=" - ".$objp->barcode;
|
||||||
}
|
}
|
||||||
if ($objp->supplier_reputation)
|
if ($objp->supplier_reputation)
|
||||||
{
|
{
|
||||||
//TODO dictionary
|
//TODO dictionary
|
||||||
$reputations=array(''=>$langs->trans('Standard'),'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
|
$reputations=array(''=>$langs->trans('Standard'),'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
|
||||||
|
|
||||||
$opt .= " - ".$reputations[$objp->supplier_reputation];
|
$optlabel .= " - ".$reputations[$objp->supplier_reputation];
|
||||||
$outval.=" - ".$reputations[$objp->supplier_reputation];
|
$outvallabel.=" - ".$reputations[$objp->supplier_reputation];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier
|
if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier
|
||||||
{
|
{
|
||||||
$opt.= ' - '.$langs->trans("NoPriceDefinedForThisSupplier");
|
$optlabel.= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
|
||||||
$outval.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
|
$outvallabel.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
|
||||||
}
|
}
|
||||||
else // No supplier price defined for product, even on other suppliers
|
else // No supplier price defined for product, even on other suppliers
|
||||||
{
|
{
|
||||||
$opt.= ' - '.$langs->trans("NoPriceDefinedForThisSupplier");
|
$optlabel.= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
|
||||||
$outval.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
|
$outvallabel.=' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$opt = '<option value="'.$outkey.'"';
|
||||||
|
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected';
|
||||||
|
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt.=' disabled';
|
||||||
|
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
|
||||||
|
{
|
||||||
|
$opt.= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
|
||||||
|
}
|
||||||
|
$opt.= ' data-html="'.dol_escape_htmltag($optlabel).'"';
|
||||||
|
$opt.= '>';
|
||||||
|
|
||||||
|
$opt.=$optlabel;
|
||||||
|
$outval.=$outvallabel;
|
||||||
|
|
||||||
$opt .= "</option>\n";
|
$opt .= "</option>\n";
|
||||||
|
|
||||||
|
|
||||||
@ -5815,7 +5819,7 @@ class Form
|
|||||||
* Generic method to select a component from a combo list.
|
* Generic method to select a component from a combo list.
|
||||||
* This is the generic method that will replace all specific existing methods.
|
* This is the generic method that will replace all specific existing methods.
|
||||||
*
|
*
|
||||||
* @param string $objectdesc Objectclassname:Objectclasspath
|
* @param string $objectdesc ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]
|
||||||
* @param string $htmlname Name of HTML select component
|
* @param string $htmlname Name of HTML select component
|
||||||
* @param int $preselectedvalue Preselected value (ID of element)
|
* @param int $preselectedvalue Preselected value (ID of element)
|
||||||
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
|
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
|
||||||
@ -5824,10 +5828,11 @@ class Form
|
|||||||
* @param string $morecss More CSS
|
* @param string $morecss More CSS
|
||||||
* @param string $moreparams More params provided to ajax call
|
* @param string $moreparams More params provided to ajax call
|
||||||
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
||||||
|
* @param int $disabled 1=Html component is disabled
|
||||||
* @return string Return HTML string
|
* @return string Return HTML string
|
||||||
* @see selectForFormsList() select_thirdparty
|
* @see selectForFormsList() select_thirdparty
|
||||||
*/
|
*/
|
||||||
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0)
|
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0)
|
||||||
{
|
{
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
@ -5836,12 +5841,16 @@ class Form
|
|||||||
$InfoFieldList = explode(":", $objectdesc);
|
$InfoFieldList = explode(":", $objectdesc);
|
||||||
$classname=$InfoFieldList[0];
|
$classname=$InfoFieldList[0];
|
||||||
$classpath=$InfoFieldList[1];
|
$classpath=$InfoFieldList[1];
|
||||||
|
$addcreatebuttonornot=empty($InfoFieldList[2])?0:$InfoFieldList[2];
|
||||||
|
$filter=empty($InfoFieldList[3])?'':$InfoFieldList[3];
|
||||||
|
|
||||||
if (! empty($classpath))
|
if (! empty($classpath))
|
||||||
{
|
{
|
||||||
dol_include_once($classpath);
|
dol_include_once($classpath);
|
||||||
if ($classname && class_exists($classname))
|
if ($classname && class_exists($classname))
|
||||||
{
|
{
|
||||||
$objecttmp = new $classname($this->db);
|
$objecttmp = new $classname($this->db);
|
||||||
|
$objecttmp->filter = $filter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! is_object($objecttmp))
|
if (! is_object($objecttmp))
|
||||||
@ -5854,12 +5863,12 @@ class Form
|
|||||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
|
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
|
||||||
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::selectForForms", LOG_DEBUG);
|
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
|
||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->$confkeyforautocompletemode) && ! $forcecombo)
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->$confkeyforautocompletemode) && ! $forcecombo)
|
||||||
{
|
{
|
||||||
$objectdesc=$classname.':'.$classpath;
|
$objectdesc=$classname.':'.$classpath.':'.$addcreatebuttonornot.':'.$filter;
|
||||||
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
|
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
|
||||||
|
|
||||||
// No immediate load of all database
|
// No immediate load of all database
|
||||||
@ -5868,22 +5877,50 @@ class Form
|
|||||||
$out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
$out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
||||||
$out.= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
$out.= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
||||||
if ($placeholder) $placeholder=' placeholder="'.$placeholder.'"';
|
if ($placeholder) $placeholder=' placeholder="'.$placeholder.'"';
|
||||||
$out.= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
|
$out.= '<input type="text" class="'.$morecss.'"'.($disabled?' disabled="disabled"':'').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Immediate load of all database
|
// Immediate load of table record. Note: filter is inside $objecttmp->filter
|
||||||
$out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo);
|
$out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to forge a SQL criteria
|
||||||
|
*
|
||||||
|
* @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
|
||||||
|
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||||
|
*/
|
||||||
|
protected static function forgeCriteriaCallback($matches)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
//dol_syslog("Convert matches ".$matches[1]);
|
||||||
|
if (empty($matches[1])) return '';
|
||||||
|
$tmp=explode(':', $matches[1]);
|
||||||
|
if (count($tmp) < 3) return '';
|
||||||
|
|
||||||
|
$tmpescaped=$tmp[2];
|
||||||
|
$regbis = array();
|
||||||
|
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
|
||||||
|
{
|
||||||
|
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tmpescaped = $db->escape($tmpescaped);
|
||||||
|
}
|
||||||
|
return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output html form to select an object.
|
* Output html form to select an object.
|
||||||
* Note, this function is called by selectForForms or by ajax selectobject.php
|
* Note, this function is called by selectForForms or by ajax selectobject.php
|
||||||
*
|
*
|
||||||
* @param Object $objecttmp Object
|
* @param Object $objecttmp Object to knwo the table to scan for combo.
|
||||||
* @param string $htmlname Name of HTML select component
|
* @param string $htmlname Name of HTML select component
|
||||||
* @param int $preselectedvalue Preselected value (ID of element)
|
* @param int $preselectedvalue Preselected value (ID of element)
|
||||||
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
|
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
|
||||||
@ -5893,13 +5930,16 @@ class Form
|
|||||||
* @param string $moreparams More params provided to ajax call
|
* @param string $moreparams More params provided to ajax call
|
||||||
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
||||||
* @param int $outputmode 0=HTML select string, 1=Array
|
* @param int $outputmode 0=HTML select string, 1=Array
|
||||||
|
* @param int $disabled 1=Html component is disabled
|
||||||
* @return string Return HTML string
|
* @return string Return HTML string
|
||||||
* @see selectForForms()
|
* @see selectForForms()
|
||||||
*/
|
*/
|
||||||
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0)
|
public function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
|
//print "$objecttmp->filter, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled";
|
||||||
|
|
||||||
$prefixforautocompletemode=$objecttmp->element;
|
$prefixforautocompletemode=$objecttmp->element;
|
||||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
|
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
|
||||||
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||||
@ -5923,19 +5963,28 @@ class Form
|
|||||||
// Search data
|
// Search data
|
||||||
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t";
|
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t";
|
||||||
if ($objecttmp->ismultientitymanaged == 2)
|
if ($objecttmp->ismultientitymanaged == 2)
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE 1=1";
|
$sql.= " WHERE 1=1";
|
||||||
if(! empty($objecttmp->ismultientitymanaged)) $sql.= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
if(! empty($objecttmp->ismultientitymanaged)) $sql.= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
||||||
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->societe_id))
|
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->socid)) {
|
||||||
{
|
if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->socid;
|
||||||
if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->societe_id;
|
else $sql.= " AND t.fk_soc = ".$user->socid;
|
||||||
else $sql.= " AND t.fk_soc = ".$user->societe_id;
|
|
||||||
}
|
}
|
||||||
if ($searchkey != '') $sql.=natural_search(explode(',', $fieldstoshow), $searchkey);
|
if ($searchkey != '') $sql.=natural_search(explode(',', $fieldstoshow), $searchkey);
|
||||||
if ($objecttmp->ismultientitymanaged == 2)
|
if ($objecttmp->ismultientitymanaged == 2) {
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND t.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND t.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
}
|
||||||
|
if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
|
/*if (! DolibarrApi::_checkFilters($objecttmp->filter))
|
||||||
|
{
|
||||||
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$objecttmp->filter);
|
||||||
|
}*/
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $objecttmp->filter).")";
|
||||||
|
}
|
||||||
$sql.=$this->db->order($fieldstoshow, "ASC");
|
$sql.=$this->db->order($fieldstoshow, "ASC");
|
||||||
//$sql.=$this->db->plimit($limit, 0);
|
//$sql.=$this->db->plimit($limit, 0);
|
||||||
|
//print $sql;
|
||||||
|
|
||||||
// Build output string
|
// Build output string
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -5948,7 +5997,7 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct $out and $outarray
|
// Construct $out and $outarray
|
||||||
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparams?' '.$moreparams:'').' name="'.$htmlname.'">'."\n";
|
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').($moreparams?' '.$moreparams:'').' name="'.$htmlname.'">'."\n";
|
||||||
|
|
||||||
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
|
// Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
|
||||||
$textifempty=' ';
|
$textifempty=' ';
|
||||||
@ -7331,12 +7380,17 @@ class Form
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$nophoto='/public/theme/common/nophoto.png';
|
$nophoto='/public/theme/common/nophoto.png';
|
||||||
if (in_array($modulepart, array('userphoto','contact'))) // For module that are "physical" users
|
if (in_array($modulepart, array('userphoto','contact','memberphoto'))) // For module that are "physical" users
|
||||||
{
|
{
|
||||||
|
if ($modulepart == 'memberphoto' && strpos($object->morphy, 'mor') !== false) {
|
||||||
|
$nophoto='/public/theme/common/company.png';
|
||||||
|
}
|
||||||
|
else {
|
||||||
$nophoto='/public/theme/common/user_anonymous.png';
|
$nophoto='/public/theme/common/user_anonymous.png';
|
||||||
if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png';
|
if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png';
|
||||||
if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png';
|
if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->gravatar->enabled) && $email)
|
if (! empty($conf->gravatar->enabled) && $email)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -231,10 +231,10 @@ class FormFile
|
|||||||
|
|
||||||
if (empty($usewithoutform))
|
if (empty($usewithoutform))
|
||||||
{
|
{
|
||||||
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">';
|
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">'."\n";
|
||||||
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">';
|
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||||
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
|
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">'."\n";
|
||||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= '<div class="valignmiddle">';
|
$out .= '<div class="valignmiddle">';
|
||||||
@ -1078,10 +1078,11 @@ class FormFile
|
|||||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||||
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
|
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
|
||||||
* @param int $addfilterfields Add line with filters
|
* @param int $addfilterfields Add line with filters
|
||||||
|
* @param int $disablecrop Disable crop feature on images (-1 = auto, prefer to set it explicitely to 0 or 1)
|
||||||
* @return int <0 if KO, nb of files shown if OK
|
* @return int <0 if KO, nb of files shown if OK
|
||||||
* @see list_of_autoecmfiles()
|
* @see list_of_autoecmfiles()
|
||||||
*/
|
*/
|
||||||
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0)
|
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $user, $conf, $langs, $hookmanager;
|
global $user, $conf, $langs, $hookmanager;
|
||||||
@ -1089,8 +1090,11 @@ class FormFile
|
|||||||
global $dolibarr_main_url_root;
|
global $dolibarr_main_url_root;
|
||||||
global $form;
|
global $form;
|
||||||
|
|
||||||
|
if ($disablecrop == -1)
|
||||||
|
{
|
||||||
$disablecrop=1;
|
$disablecrop=1;
|
||||||
if (in_array($modulepart, array('bom','expensereport','holiday','member','project','product','produit','service','societe','tax','ticket','user'))) $disablecrop=0;
|
if (in_array($modulepart, array('bank','bom','expensereport','holiday','member','project','product','produit','service','societe','tax','ticket','user'))) $disablecrop=0;
|
||||||
|
}
|
||||||
|
|
||||||
// Define relative path used to store the file
|
// Define relative path used to store the file
|
||||||
if (empty($relativepath))
|
if (empty($relativepath))
|
||||||
@ -1168,6 +1172,7 @@ class FormFile
|
|||||||
if (GETPOST('action', 'aZ09') == 'editfile' && $permtoeditline)
|
if (GETPOST('action', 'aZ09') == 'editfile' && $permtoeditline)
|
||||||
{
|
{
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" method="POST">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="renamefile">';
|
print '<input type="hidden" name="action" value="renamefile">';
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||||
@ -1485,6 +1490,7 @@ class FormFile
|
|||||||
if (! empty($addfilterfields))
|
if (! empty($addfilterfields))
|
||||||
{
|
{
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="module" value="'.$modulepart.'">';
|
print '<input type="hidden" name="module" value="'.$modulepart.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1772,10 +1778,13 @@ class FormFile
|
|||||||
$res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder);
|
$res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder);
|
||||||
$param .= (isset($object->id)?'&id=' . $object->id : '');
|
$param .= (isset($object->id)?'&id=' . $object->id : '');
|
||||||
|
|
||||||
|
print '<!-- listOfLinks -->'."\n";
|
||||||
|
|
||||||
// Show list of associated links
|
// Show list of associated links
|
||||||
print load_fiche_titre($langs->trans("LinkedFiles"));
|
print load_fiche_titre($langs->trans("LinkedFiles"));
|
||||||
|
|
||||||
print '<form action="' . $_SERVER['PHP_SELF'] . ($param?'?'.$param:'') . '" method="POST">';
|
print '<form action="' . $_SERVER['PHP_SELF'] . ($param?'?'.$param:'') . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
print '<table width="100%" class="liste noborder nobottom">';
|
print '<table width="100%" class="liste noborder nobottom">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@ -586,15 +586,15 @@ class Translate
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return text translated of text received as parameter (and encode it into HTML)
|
* Return text translated of text received as parameter (and encode it into HTML)
|
||||||
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
|
* If there is no match for this text, we look in alternative file and if still not found,
|
||||||
* et si toujours pas trouve, il est retourne tel quel
|
* it is returned as it is
|
||||||
* Les parametres de cette methode peuvent contenir de balises HTML.
|
* The parameters of this method can contain HTML tags
|
||||||
*
|
*
|
||||||
* @param string $key Key to translate
|
* @param string $key Key to translate
|
||||||
* @param string $param1 chaine de param1
|
* @param string $param1 param1 string
|
||||||
* @param string $param2 chaine de param2
|
* @param string $param2 param2 string
|
||||||
* @param string $param3 chaine de param3
|
* @param string $param3 param3 string
|
||||||
* @param string $param4 chaine de param4
|
* @param string $param4 param4 string
|
||||||
* @param int $maxsize Max length of text
|
* @param int $maxsize Max length of text
|
||||||
* @return string Translated string (encoded into HTML entities and UTF8)
|
* @return string Translated string (encoded into HTML entities and UTF8)
|
||||||
*/
|
*/
|
||||||
@ -647,9 +647,9 @@ class Translate
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return translated value of a text string
|
* Return translated value of a text string
|
||||||
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
|
* If there is no match for this text, we look in alternative file and if still not found
|
||||||
* et si toujours pas trouve, il est retourne tel quel.
|
* it is returned as is.
|
||||||
* Parameters of this method must not contains any HTML tags.
|
* Parameters of this method must not contain any HTML tags.
|
||||||
*
|
*
|
||||||
* @param string $key Key to translate
|
* @param string $key Key to translate
|
||||||
* @param string $param1 chaine de param1
|
* @param string $param1 chaine de param1
|
||||||
@ -667,9 +667,9 @@ class Translate
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return translated value of a text string
|
* Return translated value of a text string
|
||||||
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
|
* If there is no match for this text, we look in alternative file and if still not found,
|
||||||
* et si toujours pas trouve, il est retourne tel quel.
|
* it is returned as is.
|
||||||
* No convert to encoding charset of lang object is done.
|
* No conversion to encoding charset of lang object is done.
|
||||||
* Parameters of this method must not contains any HTML tags.
|
* Parameters of this method must not contains any HTML tags.
|
||||||
*
|
*
|
||||||
* @param string $key Key to translate
|
* @param string $key Key to translate
|
||||||
|
|||||||
@ -1732,13 +1732,10 @@ function company_admin_prepare_head()
|
|||||||
$head[$h][2] = 'company';
|
$head[$h][2] = 'company';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/openinghours.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/openinghours.php";
|
||||||
$head[$h][1] = $langs->trans("OpeningHours");
|
$head[$h][1] = $langs->trans("OpeningHours");
|
||||||
$head[$h][2] = 'openinghours';
|
$head[$h][2] = 'openinghours';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/admin/accountant.php";
|
$head[$h][0] = DOL_URL_ROOT."/admin/accountant.php";
|
||||||
$head[$h][1] = $langs->trans("Accountant");
|
$head[$h][1] = $langs->trans("Accountant");
|
||||||
|
|||||||
@ -4652,7 +4652,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round
|
|||||||
$unit = $forceunitoutput;
|
$unit = $forceunitoutput;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string(0, $type, $unit);
|
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuringUnitString(0, $type, $unit);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@ -5945,6 +5945,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
$substitutionarray['__REF__'] = '__REF__';
|
$substitutionarray['__REF__'] = '__REF__';
|
||||||
$substitutionarray['__REF_CLIENT__'] = '__REF_CLIENT__';
|
$substitutionarray['__REF_CLIENT__'] = '__REF_CLIENT__';
|
||||||
$substitutionarray['__REF_SUPPLIER__'] = '__REF_SUPPLIER__';
|
$substitutionarray['__REF_SUPPLIER__'] = '__REF_SUPPLIER__';
|
||||||
|
$substitutionarray['__NOTE_PUBLIC__'] = '__NOTE_PUBLIC__';
|
||||||
|
$substitutionarray['__NOTE_PRIVATE__'] = '__NOTE_PRIVATE__';
|
||||||
$substitutionarray['__EXTRAFIELD_XXX__'] = '__EXTRAFIELD_XXX__';
|
$substitutionarray['__EXTRAFIELD_XXX__'] = '__EXTRAFIELD_XXX__';
|
||||||
|
|
||||||
if (! empty($conf->societe->enabled))
|
if (! empty($conf->societe->enabled))
|
||||||
@ -5952,7 +5954,21 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
$substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__';
|
$substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__';
|
||||||
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
|
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
|
||||||
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = '__THIRDPARTY_NAME_ALIAS__';
|
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = '__THIRDPARTY_NAME_ALIAS__';
|
||||||
|
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = '__THIRDPARTY_CODE_CLIENT__';
|
||||||
|
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = '__THIRDPARTY_CODE_FOURNISSEUR__';
|
||||||
$substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__';
|
$substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__';
|
||||||
|
$substitutionarray['__THIRDPARTY_PHONE__'] = '__THIRDPARTY_PHONE__';
|
||||||
|
$substitutionarray['__THIRDPARTY_FAX__'] = '__THIRDPARTY_FAX__';
|
||||||
|
$substitutionarray['__THIRDPARTY_ADRESSE__'] = '__THIRDPARTY_ADRESSE__';
|
||||||
|
$substitutionarray['__THIRDPARTY_ZIP__'] = '__THIRDPARTY_ZIP__';
|
||||||
|
$substitutionarray['__THIRDPARTY_TOWN__'] = '__THIRDPARTY_TOWN__';
|
||||||
|
$substitutionarray['__THIRDPARTY_SIREN__'] = '__THIRDPARTY_SIREN__';
|
||||||
|
$substitutionarray['__THIRDPARTY_SIRET__'] = '__THIRDPARTY_SIRET__';
|
||||||
|
$substitutionarray['__THIRDPARTY_APE__'] = '__THIRDPARTY_APE__';
|
||||||
|
$substitutionarray['__THIRDPARTY_RCSRM__'] = '__THIRDPARTY_RCSRM__';
|
||||||
|
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = '__THIRDPARTY_TVAINTRA__';
|
||||||
|
/*$substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = '__THIRDPARTY_NOTE_PUBLIC__';
|
||||||
|
$substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = '__THIRDPARTY_NOTE_PRIVATE__';*/
|
||||||
}
|
}
|
||||||
if (! empty($conf->adherent->enabled))
|
if (! empty($conf->adherent->enabled))
|
||||||
{
|
{
|
||||||
@ -5960,12 +5976,16 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
$substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__';
|
$substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__';
|
||||||
$substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__';
|
$substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__';
|
||||||
$substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__';
|
$substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__';
|
||||||
|
/*$substitutionarray['__MEMBER_NOTE_PUBLIC__'] = '__MEMBER_NOTE_PUBLIC__';
|
||||||
|
$substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/
|
||||||
}
|
}
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$substitutionarray['__PROJECT_ID__'] = '__PROJECT_ID__';
|
$substitutionarray['__PROJECT_ID__'] = '__PROJECT_ID__';
|
||||||
$substitutionarray['__PROJECT_REF__'] = '__PROJECT_REF__';
|
$substitutionarray['__PROJECT_REF__'] = '__PROJECT_REF__';
|
||||||
$substitutionarray['__PROJECT_NAME__'] = '__PROJECT_NAME__';
|
$substitutionarray['__PROJECT_NAME__'] = '__PROJECT_NAME__';
|
||||||
|
/*$substitutionarray['__PROJECT_NOTE_PUBLIC__'] = '__PROJECT_NOTE_PUBLIC__';
|
||||||
|
$substitutionarray['__PROJECT_NOTE_PRIVATE__'] = '__PROJECT_NOTE_PRIVATE__';*/
|
||||||
}
|
}
|
||||||
if (! empty($conf->contrat->enabled))
|
if (! empty($conf->contrat->enabled))
|
||||||
{
|
{
|
||||||
@ -5998,13 +6018,17 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
$substitutionarray['__REF__'] = $object->ref;
|
$substitutionarray['__REF__'] = $object->ref;
|
||||||
$substitutionarray['__REF_CLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
|
$substitutionarray['__REF_CLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
|
||||||
$substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
$substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
||||||
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): '');
|
$substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null);
|
||||||
|
$substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null);
|
||||||
|
|
||||||
|
$substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): '');
|
||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
|
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
|
||||||
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
||||||
|
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
|
||||||
// TODO Remove this
|
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
|
||||||
$msgishtml = 0;
|
$substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): '');
|
||||||
|
|
||||||
$birthday = dol_print_date($object->birth, 'day');
|
$birthday = dol_print_date($object->birth, 'day');
|
||||||
|
|
||||||
@ -6012,22 +6036,22 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
{
|
{
|
||||||
$substitutionarray['__MEMBER_ID__']=$object->id;
|
$substitutionarray['__MEMBER_ID__']=$object->id;
|
||||||
if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
|
if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
|
||||||
$substitutionarray['__MEMBER_FIRSTNAME__']=$msgishtml?dol_htmlentitiesbr($object->firstname):$object->firstname;
|
$substitutionarray['__MEMBER_FIRSTNAME__']=$object->firstname;
|
||||||
$substitutionarray['__MEMBER_LASTNAME__']=$msgishtml?dol_htmlentitiesbr($object->lastname):$object->lastname;
|
$substitutionarray['__MEMBER_LASTNAME__']=$object->lastname;
|
||||||
if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$msgishtml?dol_htmlentitiesbr($object->getFullName($outputlangs)):$object->getFullName($outputlangs);
|
if (method_exists($object, 'getFullName')) $substitutionarray['__MEMBER_FULLNAME__']=$object->getFullName($outputlangs);
|
||||||
$substitutionarray['__MEMBER_COMPANY__']=$msgishtml?dol_htmlentitiesbr($object->societe):$object->societe;
|
$substitutionarray['__MEMBER_COMPANY__']=$object->societe;
|
||||||
$substitutionarray['__MEMBER_ADDRESS__']=$msgishtml?dol_htmlentitiesbr($object->address):$object->address;
|
$substitutionarray['__MEMBER_ADDRESS__']=$object->address;
|
||||||
$substitutionarray['__MEMBER_ZIP__']=$msgishtml?dol_htmlentitiesbr($object->zip):$object->zip;
|
$substitutionarray['__MEMBER_ZIP__']=$object->zip;
|
||||||
$substitutionarray['__MEMBER_TOWN__']=$msgishtml?dol_htmlentitiesbr($object->town):$object->town;
|
$substitutionarray['__MEMBER_TOWN__']=$object->town;
|
||||||
$substitutionarray['__MEMBER_COUNTRY__']=$msgishtml?dol_htmlentitiesbr($object->country):$object->country;
|
$substitutionarray['__MEMBER_COUNTRY__']=$object->country;
|
||||||
$substitutionarray['__MEMBER_EMAIL__']=$msgishtml?dol_htmlentitiesbr($object->email):$object->email;
|
$substitutionarray['__MEMBER_EMAIL__']=$object->email;
|
||||||
$substitutionarray['__MEMBER_BIRTH__']=$msgishtml?dol_htmlentitiesbr($birthday):$birthday;
|
$substitutionarray['__MEMBER_BIRTH__']=$birthday;
|
||||||
$substitutionarray['__MEMBER_PHOTO__']=$msgishtml?dol_htmlentitiesbr($object->photo):$object->photo;
|
$substitutionarray['__MEMBER_PHOTO__']=$object->photo;
|
||||||
$substitutionarray['__MEMBER_LOGIN__']=$msgishtml?dol_htmlentitiesbr($object->login):$object->login;
|
$substitutionarray['__MEMBER_LOGIN__']=$object->login;
|
||||||
$substitutionarray['__MEMBER_PASSWORD__']=$msgishtml?dol_htmlentitiesbr($object->pass):$object->pass;
|
$substitutionarray['__MEMBER_PASSWORD__']=$object->pass;
|
||||||
$substitutionarray['__MEMBER_PHONE__']=$msgishtml?dol_htmlentitiesbr($object->phone):$object->phone;
|
$substitutionarray['__MEMBER_PHONE__']=$object->phone;
|
||||||
$substitutionarray['__MEMBER_PHONEPRO__']=$msgishtml?dol_htmlentitiesbr($object->phone_perso):$object->phone_perso;
|
$substitutionarray['__MEMBER_PHONEPRO__']=$object->phone_perso;
|
||||||
$substitutionarray['__MEMBER_PHONEMOBILE__']=$msgishtml?dol_htmlentitiesbr($object->phone_mobile):$object->phone_mobile;
|
$substitutionarray['__MEMBER_PHONEMOBILE__']=$object->phone_mobile;
|
||||||
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc');
|
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc');
|
||||||
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->first_subscription_date_start, 'dayrfc');
|
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->first_subscription_date_start, 'dayrfc');
|
||||||
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->first_subscription_date_end, 'dayrfc');
|
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->first_subscription_date_end, 'dayrfc');
|
||||||
@ -6041,14 +6065,38 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||||||
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:'');
|
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:'');
|
||||||
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:'');
|
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:'');
|
||||||
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object)?$object->name_alias:'');
|
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object)?$object->name_alias:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object)?$object->code_client:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object)?$object->code_fournisseur:'');
|
||||||
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object)?$object->email:'');
|
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object)?$object->email:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object)?$object->phone:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object)?$object->name_fax:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_ADRESSE__'] = (is_object($object)?$object->address:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object)?$object->zip:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object)?$object->town:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_SIREN__'] = (is_object($object)?$object->idprof1:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_SIRET__'] = (is_object($object)?$object->idprof2:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_APE__'] = (is_object($object)?$object->idprof3:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_RCSRM__'] = (is_object($object)?$object->idprof4:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object)?$object->tva_intra:'');
|
||||||
}
|
}
|
||||||
elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0)
|
elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0)
|
||||||
{
|
{
|
||||||
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
|
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
|
||||||
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
|
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
|
||||||
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty)?$object->thirdparty->name_alias:'');
|
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty)?$object->thirdparty->name_alias:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object->thirdparty)?$object->thirdparty->code_client:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object->thirdparty)?$object->thirdparty->code_fournisseur:'');
|
||||||
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty)?$object->thirdparty->email:'');
|
$substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty)?$object->thirdparty->email:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object->thirdparty)?$object->phone:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object->thirdparty)?$object->name_fax:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_ADRESSE__'] = (is_object($object->thirdparty)?$object->address:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object->thirdparty)?$object->zip:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object->thirdparty)?$object->town:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_SIREN__'] = (is_object($object->thirdparty)?$object->idprof1:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_SIRET__'] = (is_object($object->thirdparty)?$object->idprof2:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_APE__'] = (is_object($object->thirdparty)?$object->idprof3:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_RCSRM__'] = (is_object($object->thirdparty)?$object->idprof4:'');
|
||||||
|
$substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object->thirdparty)?$object->tva_intra:'');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($object->project) && $object->project->id > 0)
|
if (is_object($object->project) && $object->project->id > 0)
|
||||||
@ -8074,7 +8122,7 @@ function roundUpToNextMultiple($n, $x = 5)
|
|||||||
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
|
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
|
||||||
{
|
{
|
||||||
$attr=array(
|
$attr=array(
|
||||||
'class'=>'badge'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
|
'class'=>'badge badge-status'.(!empty($mode)?' badge-'.$mode:'').(!empty($type)?' badge-'.$type:'')
|
||||||
);
|
);
|
||||||
|
|
||||||
if(empty($html)){
|
if(empty($html)){
|
||||||
@ -8135,13 +8183,35 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$return = '';
|
$return = '';
|
||||||
|
|
||||||
$dolGetBadgeParams = array();
|
$dolGetBadgeParams = array();
|
||||||
if(!empty($params['badgeParams'])){
|
|
||||||
|
if (!empty($params['badgeParams'])){
|
||||||
$dolGetBadgeParams = $params['badgeParams'];
|
$dolGetBadgeParams = $params['badgeParams'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// image's filename are still in French
|
// TODO : add a hook
|
||||||
|
|
||||||
|
if ($displayMode == 0) {
|
||||||
|
$return = !empty($html)?$html:$statusLabel;
|
||||||
|
}
|
||||||
|
elseif ($displayMode == 1) {
|
||||||
|
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
|
||||||
|
}
|
||||||
|
// use status with images
|
||||||
|
elseif (empty($conf->global->MAIN_STATUS_USES_CSS)) {
|
||||||
|
$return = '';
|
||||||
|
$htmlLabel = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
||||||
|
$htmlLabelShort = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
||||||
|
|
||||||
|
// For small screen, we use the short label instead of long label.
|
||||||
|
if (! empty($conf->dol_optimize_smallscreen))
|
||||||
|
{
|
||||||
|
if ($displayMode == 0) $displayMode = 1;
|
||||||
|
elseif ($displayMode == 4) $displayMode = 2;
|
||||||
|
elseif ($displayMode == 6) $displayMode = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// image's filename are still in French, so we use this array to convert
|
||||||
$statusImg=array(
|
$statusImg=array(
|
||||||
'status0' => 'statut0'
|
'status0' => 'statut0'
|
||||||
,'status1' => 'statut1'
|
,'status1' => 'statut1'
|
||||||
@ -8155,21 +8225,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
|||||||
,'status9' => 'statut9'
|
,'status9' => 'statut9'
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO : add a hook
|
if (!empty($statusImg[$statusType])){
|
||||||
|
|
||||||
if ($displayMode == 0) {
|
|
||||||
$return = !empty($html)?$html:$statusLabel;
|
|
||||||
}
|
|
||||||
elseif ($displayMode == 1) {
|
|
||||||
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
|
|
||||||
}
|
|
||||||
// use status with images
|
|
||||||
elseif (empty($conf->global->MAIN_STATUS_USES_CSS)){
|
|
||||||
$return = '';
|
|
||||||
$htmlLabel = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:$statusLabel).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
|
||||||
$htmlLabelShort = (in_array($displayMode, array(1,2,5))?'<span class="hideonsmartphone">':'').(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).(in_array($displayMode, array(1,2,5))?'</span>':'');
|
|
||||||
|
|
||||||
if(!empty($statusImg[$statusType])){
|
|
||||||
$htmlImg = img_picto($statusLabel, $statusImg[$statusType]);
|
$htmlImg = img_picto($statusLabel, $statusImg[$statusType]);
|
||||||
}else{
|
}else{
|
||||||
$htmlImg = img_picto($statusLabel, $statusType);
|
$htmlImg = img_picto($statusLabel, $statusType);
|
||||||
|
|||||||
@ -2252,11 +2252,14 @@ function colorValidateHex($color, $allow_white = true)
|
|||||||
*
|
*
|
||||||
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
|
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
|
||||||
* @param integer $ratio Default=-50. Note: 0=Component color is unchanged, -100=Component color become 88, +100=Component color become 00 or FF
|
* @param integer $ratio Default=-50. Note: 0=Component color is unchanged, -100=Component color become 88, +100=Component color become 00 or FF
|
||||||
|
* @param integer $brightness Default=0. Adjust brightness. -100=Decrease brightness by 100%, +100=Increase of 100%.
|
||||||
* @return string New string of color
|
* @return string New string of color
|
||||||
* @see colorAdjustBrightness()
|
* @see colorAdjustBrightness()
|
||||||
*/
|
*/
|
||||||
function colorAgressivity($hex, $ratio = -50)
|
function colorAgressiveness($hex, $ratio = -50, $brightness = 0)
|
||||||
{
|
{
|
||||||
|
if (empty($ratio)) $ratio = 0; // To avoid null
|
||||||
|
|
||||||
// Steps should be between -255 and 255. Negative = darker, positive = lighter
|
// Steps should be between -255 and 255. Negative = darker, positive = lighter
|
||||||
$ratio = max(-100, min(100, $ratio));
|
$ratio = max(-100, min(100, $ratio));
|
||||||
|
|
||||||
@ -2277,12 +2280,21 @@ function colorAgressivity($hex, $ratio = -50)
|
|||||||
if ($color > 127) $color += ((255 - $color) * ($ratio / 100));
|
if ($color > 127) $color += ((255 - $color) * ($ratio / 100));
|
||||||
if ($color < 128) $color -= ($color * ($ratio / 100));
|
if ($color < 128) $color -= ($color * ($ratio / 100));
|
||||||
}
|
}
|
||||||
else // We decrease agressivity
|
else // We decrease agressiveness
|
||||||
{
|
{
|
||||||
if ($color > 128) $color -= (($color - 128) * (abs($ratio) / 100));
|
if ($color > 128) $color -= (($color - 128) * (abs($ratio) / 100));
|
||||||
if ($color < 127) $color += ((128 - $color) * (abs($ratio) / 100));
|
if ($color < 127) $color += ((128 - $color) * (abs($ratio) / 100));
|
||||||
}
|
}
|
||||||
$color = max(0, min(255, $color)); // Adjust color
|
if ($brightness > 0)
|
||||||
|
{
|
||||||
|
$color = ($color * (100 + abs($brightness)) / 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$color = ($color * (100 - abs($brightness)) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
$color = max(0, min(255, $color)); // Adjust color to stay into valid range
|
||||||
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
|
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2294,7 +2306,7 @@ function colorAgressivity($hex, $ratio = -50)
|
|||||||
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
|
* @param string $hex Color in hex ('#AA1122' or 'AA1122' or '#a12' or 'a12')
|
||||||
* @param integer $steps Step/offset added to each color component. It should be between -255 and 255. Negative = darker, positive = lighter
|
* @param integer $steps Step/offset added to each color component. It should be between -255 and 255. Negative = darker, positive = lighter
|
||||||
* @return string New color with format '#AA1122'
|
* @return string New color with format '#AA1122'
|
||||||
* @see colorAgressivity()
|
* @see colorAgressiveness()
|
||||||
*/
|
*/
|
||||||
function colorAdjustBrightness($hex, $steps)
|
function colorAdjustBrightness($hex, $steps)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -479,6 +479,22 @@ function show_stats_for_company($product, $socid)
|
|||||||
return $nblines++;
|
return $nblines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return translation label of a unit key.
|
||||||
|
* Function kept for backward compatibility.
|
||||||
|
*
|
||||||
|
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
||||||
|
* @param string $measuring_style Style of unit: weight, volume,...
|
||||||
|
* @param int $unit ID of unit (rowid in llx_c_units table)
|
||||||
|
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
||||||
|
* @return string Unit string
|
||||||
|
* @see measuringUnitString() formproduct->selectMeasuringUnits()
|
||||||
|
*/
|
||||||
|
function measuring_units_string($scale = '', $measuring_style = '', $unit = 0, $use_short_label = 0)
|
||||||
|
{
|
||||||
|
return measuringUnitString($unit, $measuring_style, $scale, $use_short_label);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return translation label of a unit key
|
* Return translation label of a unit key
|
||||||
*
|
*
|
||||||
@ -487,9 +503,9 @@ function show_stats_for_company($product, $socid)
|
|||||||
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
* @param string $scale Scale of unit: '0', '-3', '6', ...
|
||||||
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
* @param int $use_short_label 1=Use short label ('g' instead of 'gram'). Short labels are not translated.
|
||||||
* @return string Unit string
|
* @return string Unit string
|
||||||
* @see formproduct->selectMeasuringUnits
|
* @see formproduct->selectMeasuringUnits()
|
||||||
*/
|
*/
|
||||||
function measuring_units_string($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
|
function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_short_label = 0)
|
||||||
{
|
{
|
||||||
global $langs, $db;
|
global $langs, $db;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
||||||
|
|||||||
@ -509,12 +509,12 @@ class pdf_espadon extends ModelePdfExpedition
|
|||||||
$weighttxt='';
|
$weighttxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
||||||
{
|
{
|
||||||
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units, "weight");
|
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units);
|
||||||
}
|
}
|
||||||
$voltxt='';
|
$voltxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
||||||
{
|
{
|
||||||
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0, "volume");
|
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -525,12 +525,12 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
$weighttxt='';
|
$weighttxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
|
||||||
{
|
{
|
||||||
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units, "weight");
|
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units);
|
||||||
}
|
}
|
||||||
$voltxt='';
|
$voltxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
|
||||||
{
|
{
|
||||||
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0, "volume");
|
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))
|
if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
|
* \file htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
|
||||||
* \ingroup ficheinter
|
* \ingroup ficheinter
|
||||||
* \brief Fichier de la classe permettant de generer les fiches d'intervention au modele Soleil
|
* \brief File of Class to build interventions documents with model Soleil
|
||||||
*/
|
*/
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
@ -142,7 +142,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
$this->option_condreg = 0; // Display payment terms
|
$this->option_condreg = 0; // Display payment terms
|
||||||
$this->option_codeproduitservice = 0; // Display product-service code
|
$this->option_codeproduitservice = 0; // Display product-service code
|
||||||
$this->option_multilang = 1; // Available in several languages
|
$this->option_multilang = 1; // Available in several languages
|
||||||
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
|
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
|
||||||
|
|
||||||
// Get source company
|
// Get source company
|
||||||
$this->emetteur=$mysoc;
|
$this->emetteur=$mysoc;
|
||||||
@ -266,7 +266,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
$tab_height = 130;
|
$tab_height = 130;
|
||||||
$tab_height_newpage = 150;
|
$tab_height_newpage = 150;
|
||||||
|
|
||||||
// Affiche notes
|
// Display notes
|
||||||
$notetoshow=empty($object->note_public)?'':$object->note_public;
|
$notetoshow=empty($object->note_public)?'':$object->note_public;
|
||||||
if ($notetoshow)
|
if ($notetoshow)
|
||||||
{
|
{
|
||||||
@ -394,7 +394,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
|
$pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
|
||||||
|
|
||||||
// Detect if some page were added automatically and output _tableau for past pages
|
// Detect if some page were added automatically and output _tableau for past pages
|
||||||
while ($pagenb < $pageposafter)
|
while ($pagenb < $pageposafter)
|
||||||
@ -573,7 +573,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FICHINTER_DRAFT_WATERMARK);
|
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FICHINTER_DRAFT_WATERMARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Prepare la suite
|
//Prepare next
|
||||||
$pdf->SetTextColor(0, 0, 60);
|
$pdf->SetTextColor(0, 0, 60);
|
||||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class mod_arctic extends ModeleNumRefFicheinter
|
|||||||
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
|
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
|
||||||
$tooltip.=$langs->trans("GenericMaskCodes5");
|
$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||||
|
|
||||||
// Parametrage du prefix
|
// Setting the prefix
|
||||||
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||||
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">', $tooltip, 1, 1).'</td>';
|
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class mod_arctic extends ModeleNumRefFicheinter
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
// On défini critere recherche compteur
|
// We define the search criteria of the counter
|
||||||
$mask=$conf->global->FICHINTER_ARTIC_MASK;
|
$mask=$conf->global->FICHINTER_ARTIC_MASK;
|
||||||
|
|
||||||
if (! $mask)
|
if (! $mask)
|
||||||
|
|||||||
@ -164,7 +164,12 @@ class modFicheinter extends DolibarrModules
|
|||||||
's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
|
's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
|
||||||
's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
|
's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
|
||||||
's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",
|
's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InterId",'f.ref'=>"InterRef",'f.datec'=>"InterDateCreation",
|
||||||
'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote", 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'InterLineId',
|
'f.duree'=>"InterDuration",'f.fk_statut'=>'InterStatus','f.description'=>"InterNote");
|
||||||
|
$keyforselect='fichinter'; $keyforelement='intervention'; $keyforaliasextra='extra';
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
|
$this->export_fields_array[$r]+=array(
|
||||||
|
'pj.ref'=>'ProjectRef','pj.title'=>'ProjectLabel',
|
||||||
|
'fd.rowid'=>'InterLineId',
|
||||||
'fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc"
|
'fd.date'=>"InterLineDate",'fd.duree'=>"InterLineDuration",'fd.description'=>"InterLineDesc"
|
||||||
);
|
);
|
||||||
//$this->export_TypeFields_array[$r]=array(
|
//$this->export_TypeFields_array[$r]=array(
|
||||||
@ -175,24 +180,30 @@ class modFicheinter extends DolibarrModules
|
|||||||
// 'fd.total_ht'=>"Numeric"
|
// 'fd.total_ht'=>"Numeric"
|
||||||
//);
|
//);
|
||||||
$this->export_TypeFields_array[$r]=array(
|
$this->export_TypeFields_array[$r]=array(
|
||||||
's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text',
|
's.rowid'=>"Numeric",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label','s.phone'=>'Text','s.siren'=>'Text',
|
||||||
's.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",
|
's.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||||
'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean", 'pj.ref'=>'Text',
|
'f.rowid'=>'Numeric','f.ref'=>"Text",'f.datec'=>"Date",
|
||||||
'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric"
|
'f.duree'=>"Duree",'f.fk_statut'=>'Numeric','f.description'=>"Text",'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",
|
||||||
|
'pj.ref'=>'Text','pj.title'=>'Text',
|
||||||
|
'fd.rowid'=>"Numeric",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",'fd.total_ht'=>"Numeric"
|
||||||
);
|
);
|
||||||
$this->export_entities_array[$r]=array(
|
$this->export_entities_array[$r]=array(
|
||||||
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
|
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
|
||||||
's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company',
|
's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company',
|
||||||
's.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",
|
's.code_compta_fournisseur'=>'company','f.rowid'=>"intervention",'f.ref'=>"intervention",'f.datec'=>"intervention",'f.duree'=>"intervention",
|
||||||
'f.fk_statut'=>"intervention",'f.description'=>"intervention", 'pj.ref'=>'project', 'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",
|
'f.fk_statut'=>"intervention",'f.description'=>"intervention", 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",
|
||||||
'fd.duree'=>'inter_line','fd.description'=>'inter_line'
|
'fd.duree'=>'inter_line','fd.description'=>'inter_line'
|
||||||
);
|
);
|
||||||
$this->export_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
$this->export_dependencies_array[$r]=array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||||
|
$keyforselect='fichinterdet'; $keyforelement='inter_line'; $keyforaliasextra='extradet';
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||||
|
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fichinter as f';
|
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'fichinter as f';
|
||||||
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter_extrafields as extra ON f.rowid = extra.fk_object';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
|
||||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet as fd ON f.rowid = fd.fk_fichinter,';
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet as fd ON f.rowid = fd.fk_fichinter';
|
||||||
|
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'fichinterdet_extrafields as extradet ON fd.rowid = extradet.fk_object,';
|
||||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
|
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
|
||||||
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
|
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
|
||||||
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('intervention').')';
|
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('intervention').')';
|
||||||
|
|||||||
@ -182,7 +182,8 @@ class modProduct extends DolibarrModules
|
|||||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||||
'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",
|
'p.weight'=>"Weight", 'p.weight_units'=>"WeightUnits", 'p.length'=>"Length", 'p.width'=>"Width", 'p.height'=>"Height", 'p.length_units'=>"SizeUnits",
|
||||||
|
'p.surface'=>"Surface", 'p.surface_units'=>"SurfaceUnits", 'p.volume'=>"Volume", 'p.volume_units'=>"VolumeUnits",
|
||||||
'p.duration'=>"Duration",
|
'p.duration'=>"Duration",
|
||||||
'p.finished' => 'Nature',
|
'p.finished' => 'Nature',
|
||||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
|
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
|
||||||
|
|||||||
@ -450,12 +450,12 @@ class pdf_squille extends ModelePdfReception
|
|||||||
$weighttxt='';
|
$weighttxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight)
|
||||||
{
|
{
|
||||||
$weighttxt=round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->weight_units, "weight");
|
$weighttxt=round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->product->weight_units);
|
||||||
}
|
}
|
||||||
$voltxt='';
|
$voltxt='';
|
||||||
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->volume)
|
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->volume)
|
||||||
{
|
{
|
||||||
$voltxt=round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->volume_units?$object->lines[$i]->product->volume_units:0, "volume");
|
$voltxt=round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).' '.measuringUnitString(0, "volume", $object->lines[$i]->product->volume_units?$object->lines[$i]->product->volume_units:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');
|
$pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');
|
||||||
|
|||||||
@ -55,22 +55,10 @@ elseif ($modulepart == 'project')
|
|||||||
}
|
}
|
||||||
elseif ($modulepart == 'bom')
|
elseif ($modulepart == 'bom')
|
||||||
{
|
{
|
||||||
$result=restrictedArea($user, 'bom', $id, 'bom_bom');
|
$result=restrictedArea($user, $modulepart, $id, 'bom_bom');
|
||||||
if (! $user->rights->bom->read) accessforbidden();
|
if (! $user->rights->bom->read) accessforbidden();
|
||||||
$accessallowed=1;
|
$accessallowed=1;
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'expensereport')
|
|
||||||
{
|
|
||||||
$result=restrictedArea($user, 'expensereport', $id, 'expensereport');
|
|
||||||
if (! $user->rights->expensereport->lire) accessforbidden();
|
|
||||||
$accessallowed=1;
|
|
||||||
}
|
|
||||||
elseif ($modulepart == 'holiday')
|
|
||||||
{
|
|
||||||
$result=restrictedArea($user, 'holiday', $id, 'holiday');
|
|
||||||
if (! $user->rights->holiday->read) accessforbidden();
|
|
||||||
$accessallowed=1;
|
|
||||||
}
|
|
||||||
elseif ($modulepart == 'member')
|
elseif ($modulepart == 'member')
|
||||||
{
|
{
|
||||||
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid');
|
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid');
|
||||||
@ -79,26 +67,26 @@ elseif ($modulepart == 'member')
|
|||||||
}
|
}
|
||||||
elseif ($modulepart == 'user')
|
elseif ($modulepart == 'user')
|
||||||
{
|
{
|
||||||
$result=restrictedArea($user, 'user', $id, 'user');
|
$result=restrictedArea($user, $modulepart, $id, $modulepart);
|
||||||
if (! $user->rights->user->user->lire) accessforbidden();
|
if (! $user->rights->user->user->lire) accessforbidden();
|
||||||
$accessallowed=1;
|
$accessallowed=1;
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'societe')
|
|
||||||
{
|
|
||||||
$result=restrictedArea($user, 'societe', $id, 'societe');
|
|
||||||
if (! $user->rights->societe->lire) accessforbidden();
|
|
||||||
$accessallowed=1;
|
|
||||||
}
|
|
||||||
elseif ($modulepart == 'tax')
|
elseif ($modulepart == 'tax')
|
||||||
{
|
{
|
||||||
$result=restrictedArea($user, 'tax', $id, 'chargesociales', 'charges');
|
$result=restrictedArea($user, $modulepart, $id, 'chargesociales', 'charges');
|
||||||
if (! $user->rights->tax->charges->lire) accessforbidden();
|
if (! $user->rights->tax->charges->lire) accessforbidden();
|
||||||
$accessallowed=1;
|
$accessallowed=1;
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'ticket')
|
elseif ($modulepart == 'bank')
|
||||||
{
|
{
|
||||||
$result=restrictedArea($user, 'ticket', $id, 'ticket');
|
$result=restrictedArea($user, 'banque', $id, 'bank_account');
|
||||||
if (! $user->rights->ticket->read) accessforbidden();
|
if (! $user->rights->banque->lire) accessforbidden();
|
||||||
|
$accessallowed=1;
|
||||||
|
}
|
||||||
|
else // ticket, holiday, expensereport, societe...
|
||||||
|
{
|
||||||
|
$result=restrictedArea($user, $modulepart, $id, $modulepart);
|
||||||
|
if (empty($user->rights->$modulepart->read) && empty($user->rights->$modulepart->lire)) accessforbidden();
|
||||||
$accessallowed=1;
|
$accessallowed=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +130,7 @@ elseif ($modulepart == 'holiday')
|
|||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||||
$dir=$conf->holiday->dir_output; // By default
|
$dir=$conf->$modulepart->dir_output; // By default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'member')
|
elseif ($modulepart == 'member')
|
||||||
@ -164,7 +152,7 @@ elseif ($modulepart == 'societe')
|
|||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||||
$dir=$conf->societe->dir_output;
|
$dir=$conf->$modulepart->dir_output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'user')
|
elseif ($modulepart == 'user')
|
||||||
@ -175,7 +163,7 @@ elseif ($modulepart == 'user')
|
|||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||||
$dir=$conf->user->dir_output; // By default
|
$dir=$conf->$modulepart->dir_output; // By default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'expensereport')
|
elseif ($modulepart == 'expensereport')
|
||||||
@ -197,7 +185,7 @@ elseif ($modulepart == 'tax')
|
|||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||||
$dir=$conf->tax->dir_output; // By default
|
$dir=$conf->$modulepart->dir_output; // By default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'ticket')
|
elseif ($modulepart == 'ticket')
|
||||||
@ -208,7 +196,7 @@ elseif ($modulepart == 'ticket')
|
|||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||||
$dir=$conf->ticket->dir_output; // By default
|
$dir=$conf->$modulepart->dir_output; // By default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($modulepart == 'bom')
|
elseif ($modulepart == 'bom')
|
||||||
@ -219,7 +207,18 @@ elseif ($modulepart == 'bom')
|
|||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||||
$dir=$conf->bom->dir_output; // By default
|
$dir=$conf->$modulepart->dir_output; // By default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($modulepart == 'bank')
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
$object = new Account($db);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$result = $object->fetch($id);
|
||||||
|
if ($result <= 0) dol_print_error($db, 'Failed to load object');
|
||||||
|
$dir=$conf->banque->dir_output; // By default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -237,6 +236,7 @@ if (empty($backtourl))
|
|||||||
elseif (in_array($modulepart, array('tax'))) $backtourl=DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
elseif (in_array($modulepart, array('tax'))) $backtourl=DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||||
elseif (in_array($modulepart, array('ticket'))) $backtourl=DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
elseif (in_array($modulepart, array('ticket'))) $backtourl=DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||||
elseif (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
elseif (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||||
|
elseif (in_array($modulepart, array('bank'))) $backtourl=DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||||
else $backtourl=DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
else $backtourl=DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,6 +422,7 @@ print '<br>'."\n";
|
|||||||
|
|
||||||
print '<!-- Form to resize -->'."\n";
|
print '<!-- Form to resize -->'."\n";
|
||||||
print '<form name="redim_file" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
|
print '<form name="redim_file" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
print '<fieldset id="redim_file">';
|
print '<fieldset id="redim_file">';
|
||||||
print '<legend>'.$langs->trans("Resize").'</legend>';
|
print '<legend>'.$langs->trans("Resize").'</legend>';
|
||||||
@ -472,7 +473,9 @@ if (! empty($conf->use_javascript_ajax))
|
|||||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$object->entity.'&file='.urlencode($original_file).'" alt="" id="cropbox" width="'.$widthforcrop.'px"/>';
|
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$object->entity.'&file='.urlencode($original_file).'" alt="" id="cropbox" width="'.$widthforcrop.'px"/>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div><br>';
|
print '</div><br>';
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">
|
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '
|
||||||
<div class="jc_coords">
|
<div class="jc_coords">
|
||||||
'.$langs->trans("NewSizeAfterCropping").':
|
'.$langs->trans("NewSizeAfterCropping").':
|
||||||
<label>X1 <input type="number" class="flat maxwidth50" id="x" name="x" /></label>
|
<label>X1 <input type="number" class="flat maxwidth50" id="x" name="x" /></label>
|
||||||
|
|||||||
@ -23,8 +23,15 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
|
|||||||
$align=$extrafields->getAlignFlag($key);
|
$align=$extrafields->getAlignFlag($key);
|
||||||
$sortonfield = $extrafieldsobjectprefix.$key;
|
$sortonfield = $extrafieldsobjectprefix.$key;
|
||||||
if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
|
if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
|
||||||
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
|
if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') {
|
||||||
else print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder)."\n";
|
print '<th class="liste_titre thseparator"></th>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||||
|
|
||||||
|
print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', 0, $tooltip)."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,6 +85,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$value = $object->array_options["options_" . $key];
|
$value = $object->array_options["options_" . $key];
|
||||||
|
//var_dump($key.' - '.$value);
|
||||||
}
|
}
|
||||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate')
|
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate')
|
||||||
{
|
{
|
||||||
@ -178,7 +179,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//print $key.'-'.$value.'-'.$object->table_element;
|
//var_dump($key.'-'.$value.'-'.$object->table_element);
|
||||||
print $extrafields->showOutputField($key, $value, '', $object->table_element);
|
print $extrafields->showOutputField($key, $value, '', $object->table_element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -138,22 +138,20 @@ if ($nolinesbefore) {
|
|||||||
print '<td class="linecolcycleref2 right"></td>';
|
print '<td class="linecolcycleref2 right"></td>';
|
||||||
}
|
}
|
||||||
if (! empty($usemargins))
|
if (! empty($usemargins))
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!empty($user->rights->margins->creer)) {
|
if (empty($user->rights->margins->creer)) {
|
||||||
?>
|
$colspan++;
|
||||||
<td class="margininfos linecolmargin1 right">
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
else $colspan++;
|
else {
|
||||||
|
print '<td class="margininfos linecolmargin1 right">';
|
||||||
if ($conf->global->MARGIN_TYPE == "1")
|
if ($conf->global->MARGIN_TYPE == "1")
|
||||||
echo $langs->trans('BuyingPrice');
|
echo $langs->trans('BuyingPrice');
|
||||||
else
|
else
|
||||||
echo $langs->trans('CostPrice');
|
echo $langs->trans('CostPrice');
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
|
||||||
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td>
|
<td class="linecoledit" colspan="<?php echo $colspan; ?>"> </td>
|
||||||
@ -442,16 +440,12 @@ if ($nolinesbefore) {
|
|||||||
<td class="nobottom margininfos linecolmargin right">
|
<td class="nobottom margininfos linecolmargin right">
|
||||||
<!-- For predef product -->
|
<!-- For predef product -->
|
||||||
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
|
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
|
||||||
<select id="fournprice_predef" name="fournprice_predef" class="flat" style="display: none;"></select>
|
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp" style="display: none;"></select>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<!-- For free product -->
|
<!-- For free product -->
|
||||||
<input type="text" size="5" id="buying_price" name="buying_price" class="flat right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price", 'alpha', 2):''); ?>">
|
<input type="text" id="buying_price" name="buying_price" class="flat maxwidth75 right" value="<?php echo (isset($_POST["buying_price"])?GETPOST("buying_price", 'alpha', 2):''); ?>">
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->rights->margins->creer)
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||||
{
|
{
|
||||||
echo '<td class="nobottom nowrap margininfos right"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?GETPOST("np_marginRate", 'alpha', 2):'').'"><span class="np_marginRate hideonsmartphone">%</span></td>';
|
echo '<td class="nobottom nowrap margininfos right"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(isset($_POST["np_marginRate"])?GETPOST("np_marginRate", 'alpha', 2):'').'"><span class="np_marginRate hideonsmartphone">%</span></td>';
|
||||||
|
|||||||
@ -217,10 +217,10 @@ $coldisplay=0;
|
|||||||
<td class="margininfos right">
|
<td class="margininfos right">
|
||||||
<!-- For predef product -->
|
<!-- For predef product -->
|
||||||
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
|
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
|
||||||
<select id="fournprice_predef" name="fournprice_predef" class="flat right" style="display: none;"></select>
|
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp right" style="display: none;"></select>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<!-- For free product -->
|
<!-- For free product -->
|
||||||
<input class="flat right" type="text" size="5" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>">
|
<input class="flat maxwidth75 right" type="text" id="buying_price" name="buying_price" class="hideobject" value="<?php echo price($line->pa_ht, 0, '', 0); ?>">
|
||||||
</td>
|
</td>
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ $coldisplay=0;
|
|||||||
if ($line->subprice < 0)
|
if ($line->subprice < 0)
|
||||||
echo '<td class="right nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
|
echo '<td class="right nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
|
||||||
else
|
else
|
||||||
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
|
echo '<td class="right nowrap margininfos"><input class="right maxwidth75" type="text" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
|
elseif (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||||
@ -242,7 +242,7 @@ $coldisplay=0;
|
|||||||
if ($line->subprice < 0)
|
if ($line->subprice < 0)
|
||||||
echo '<td class="right nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
|
echo '<td class="right nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
|
||||||
else
|
else
|
||||||
echo '<td class="right nowrap margininfos"><input class="right" type="text" size="2" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
|
echo '<td class="right nowrap margininfos"><input class="right maxwidth75" type="text" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,15 @@ class Don extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $picto = 'generic';
|
public $picto = 'generic';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Date of the donation
|
||||||
|
*/
|
||||||
public $date;
|
public $date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* amount of donation
|
||||||
|
* @var double
|
||||||
|
*/
|
||||||
public $amount;
|
public $amount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,7 +141,7 @@ class Don extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
|
* Returns the donation status label (draft, valid, abandoned, paid)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||||
* @return string Libelle
|
* @return string Libelle
|
||||||
@ -145,7 +153,7 @@ class Don extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Return the label of a given status
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/don/class/dontats.class.php
|
* \file htdocs/don/class/donstats.class.php
|
||||||
* \ingroup donations
|
* \ingroup donations
|
||||||
* \brief File of class to manage donations statistics
|
* \brief File of class to manage donations statistics
|
||||||
*/
|
*/
|
||||||
@ -42,8 +42,19 @@ class DonationStats extends Stats
|
|||||||
public $socid;
|
public $socid;
|
||||||
public $userid;
|
public $userid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string FROM
|
||||||
|
*/
|
||||||
public $from;
|
public $from;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string field
|
||||||
|
*/
|
||||||
public $field;
|
public $field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string WHERE
|
||||||
|
*/
|
||||||
public $where;
|
public $where;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -211,7 +211,7 @@ if ($resql)
|
|||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "fk_projet", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
|||||||
@ -379,7 +379,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
|
$ret=$object->create($user); // This create shipment (like Odoo picking) and lines of shipments. Stock movement will be done when validating shipment.
|
||||||
if ($ret <= 0)
|
if ($ret <= 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -994,7 +994,7 @@ if ($action == 'create')
|
|||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans("Weight");
|
print $langs->trans("Weight");
|
||||||
print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> ';
|
print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight', 'int').'"> ';
|
||||||
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'));
|
$text=$formproduct->selectMeasuringUnits("weight_units", "weight", GETPOST('weight_units', 'int'), 0, 2);
|
||||||
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
||||||
print $form->textwithpicto($text, $htmltext);
|
print $form->textwithpicto($text, $htmltext);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -1005,7 +1005,7 @@ if ($action == 'create')
|
|||||||
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">';
|
print ' x <input name="sizeH" size="4" value="'.GETPOST('sizeH', 'int').'">';
|
||||||
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">';
|
print ' x <input name="sizeS" size="4" value="'.GETPOST('sizeS', 'int').'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
$text=$formproduct->selectMeasuringUnits("size_units", "size");
|
$text=$formproduct->selectMeasuringUnits("size_units", "size", GETPOST('size_units', 'int'), 0, 2);
|
||||||
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
$htmltext=$langs->trans("KeepEmptyForAutoCalculation");
|
||||||
print $form->textwithpicto($text, $htmltext);
|
print $form->textwithpicto($text, $htmltext);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -1707,7 +1707,6 @@ elseif ($id || $ref)
|
|||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
|
|
||||||
|
|
||||||
// Calculate totalWeight and totalVolume for all products
|
// Calculate totalWeight and totalVolume for all products
|
||||||
// by adding weight and volume of each product line.
|
// by adding weight and volume of each product line.
|
||||||
$tmparray=$object->getTotalWeightVolume();
|
$tmparray=$object->getTotalWeightVolume();
|
||||||
@ -1850,16 +1849,14 @@ elseif ($id || $ref)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $object->trueWeight;
|
print $object->trueWeight;
|
||||||
print ($object->trueWeight && $object->weight_units!='')?' '.measuring_units_string(0, "weight", $object->weight_units):'';
|
print ($object->trueWeight && $object->weight_units!='')?' '.measuringUnitString(0, "weight", $object->weight_units):'';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculated
|
// Calculated
|
||||||
if ($totalWeight > 0)
|
if ($totalWeight > 0)
|
||||||
{
|
{
|
||||||
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
|
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
|
||||||
//print $totalWeight.' '.measuring_units_string(0, "weight");
|
|
||||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||||
//if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')';
|
|
||||||
if (!empty($object->trueWeight)) print ')';
|
if (!empty($object->trueWeight)) print ')';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -1867,7 +1864,7 @@ elseif ($id || $ref)
|
|||||||
// Width
|
// Width
|
||||||
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
|
print $form->editfieldval("Width", 'trueWidth', $object->trueWidth, $object, $user->rights->expedition->creer);
|
||||||
print ($object->trueWidth && $object->width_units!='')?' '.measuring_units_string(0, "size", $object->width_units):'';
|
print ($object->trueWidth && $object->width_units!='')?' '.measuringUnitString(0, "size", $object->width_units):'';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Height
|
// Height
|
||||||
@ -1887,7 +1884,7 @@ elseif ($id || $ref)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $object->trueHeight;
|
print $object->trueHeight;
|
||||||
print ($object->trueHeight && $object->height_units!='')?' '.measuring_units_string(0, "size", $object->height_units):'';
|
print ($object->trueHeight && $object->height_units!='')?' '.measuringUnitString(0, "size", $object->height_units):'';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -1895,7 +1892,7 @@ elseif ($id || $ref)
|
|||||||
// Depth
|
// Depth
|
||||||
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
|
print $form->editfieldval("Depth", 'trueDepth', $object->trueDepth, $object, $user->rights->expedition->creer);
|
||||||
print ($object->trueDepth && $object->depth_units!='')?' '.measuring_units_string(0, "size", $object->depth_units):'';
|
print ($object->trueDepth && $object->depth_units!='')?' '.measuringUnitString(0, "size", $object->depth_units):'';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
@ -1915,15 +1912,13 @@ elseif ($id || $ref)
|
|||||||
{
|
{
|
||||||
if ($volumeUnit < 50)
|
if ($volumeUnit < 50)
|
||||||
{
|
{
|
||||||
//print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume");
|
|
||||||
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||||
}
|
}
|
||||||
else print $calculatedVolume.' '.measuring_units_string($volumeUnit, "volume");
|
else print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit);
|
||||||
}
|
}
|
||||||
if ($totalVolume > 0)
|
if ($totalVolume > 0)
|
||||||
{
|
{
|
||||||
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
|
if ($calculatedVolume) print ' ('.$langs->trans("SumOfProductVolumes").': ';
|
||||||
//print $totalVolume.' '.measuring_units_string(0, "volume");
|
|
||||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||||
//if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')';
|
//if (empty($calculatedVolume)) print ' ('.$langs->trans("Calculated").')';
|
||||||
if ($calculatedVolume) print ')';
|
if ($calculatedVolume) print ')';
|
||||||
@ -2199,6 +2194,20 @@ elseif ($id || $ref)
|
|||||||
$product_static->id=$lines[$i]->fk_product;
|
$product_static->id=$lines[$i]->fk_product;
|
||||||
$product_static->ref=$lines[$i]->ref;
|
$product_static->ref=$lines[$i]->ref;
|
||||||
$product_static->status_batch=$lines[$i]->product_tobatch;
|
$product_static->status_batch=$lines[$i]->product_tobatch;
|
||||||
|
|
||||||
|
$product_static->weight=$lines[$i]->weight;
|
||||||
|
$product_static->weight_units=$lines[$i]->weight_units;
|
||||||
|
$product_static->length=$lines[$i]->length;
|
||||||
|
$product_static->length_units=$lines[$i]->length_units;
|
||||||
|
$product_static->width=$lines[$i]->width;
|
||||||
|
$product_static->width_units=$lines[$i]->width_units;
|
||||||
|
$product_static->height=$lines[$i]->height;
|
||||||
|
$product_static->height_units=$lines[$i]->height_units;
|
||||||
|
$product_static->surface=$lines[$i]->surface;
|
||||||
|
$product_static->surface_units=$lines[$i]->surface_units;
|
||||||
|
$product_static->volume=$lines[$i]->volume;
|
||||||
|
$product_static->volume_units=$lines[$i]->volume_units;
|
||||||
|
|
||||||
$text=$product_static->getNomUrl(1);
|
$text=$product_static->getNomUrl(1);
|
||||||
$text.= ' - '.$label;
|
$text.= ' - '.$label;
|
||||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description));
|
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description));
|
||||||
@ -2252,7 +2261,7 @@ elseif ($id || $ref)
|
|||||||
if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0)
|
if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0)
|
||||||
{
|
{
|
||||||
$warehousestatic->fetch($shipmentline_var['warehouse']);
|
$warehousestatic->fetch($shipmentline_var['warehouse']);
|
||||||
$htmltext .= '<br>'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1);
|
$htmltext .= '<br>'.$langs->trans("FromLocation").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
|
||||||
}
|
}
|
||||||
print ' '.$form->textwithpicto('', $htmltext, 1);
|
print ' '.$form->textwithpicto('', $htmltext, 1);
|
||||||
}
|
}
|
||||||
@ -2409,18 +2418,18 @@ elseif ($id || $ref)
|
|||||||
|
|
||||||
// Weight
|
// Weight
|
||||||
print '<td class="center linecolweight">';
|
print '<td class="center linecolweight">';
|
||||||
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "weight", $lines[$i]->weight_units);
|
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "weight", $lines[$i]->weight_units);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
print '<td class="center linecolvolume">';
|
print '<td class="center linecolvolume">';
|
||||||
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string(0, "volume", $lines[$i]->volume_units);
|
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units);
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
//print '<td class="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume").'</td>';
|
//print '<td class="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuringUnitString(0, "volume", $lines[$i]->volume_units).'</td>';
|
||||||
|
|
||||||
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
if ($action == 'editline' && $lines[$i]->id == $line_id)
|
||||||
{
|
{
|
||||||
@ -2433,10 +2442,10 @@ elseif ($id || $ref)
|
|||||||
{
|
{
|
||||||
// edit-delete buttons
|
// edit-delete buttons
|
||||||
print '<td class="linecoledit center">';
|
print '<td class="linecoledit center">';
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=editline&lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
|
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=editline&lineid=' . $lines[$i]->id . '">' . img_edit() . '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="linecoldelete" width="10">';
|
print '<td class="linecoldelete" width="10">';
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=deleteline&lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>';
|
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=deleteline&lineid=' . $lines[$i]->id . '">' . img_delete() . '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Display lines extrafields
|
// Display lines extrafields
|
||||||
|
|||||||
@ -324,8 +324,8 @@ class Expedition extends CommonObject
|
|||||||
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
|
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
|
||||||
$sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth
|
$sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth
|
||||||
$sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight
|
$sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight
|
||||||
$sql.= ", ".($this->weight_units>0?$this->weight_units:'NULL');
|
$sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
|
||||||
$sql.= ", ".($this->size_units>0?$this->size_units:'NULL');
|
$sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
|
||||||
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
|
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
|
||||||
|
|||||||
@ -42,7 +42,7 @@ if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propa
|
|||||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm'));
|
$langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm','other'));
|
||||||
|
|
||||||
$id = GETPOST('id', 'int'); // id of order
|
$id = GETPOST('id', 'int'); // id of order
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
@ -618,7 +618,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$sql.= ' cd.date_start,';
|
$sql.= ' cd.date_start,';
|
||||||
$sql.= ' cd.date_end,';
|
$sql.= ' cd.date_end,';
|
||||||
$sql.= ' cd.special_code,';
|
$sql.= ' cd.special_code,';
|
||||||
$sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc';
|
$sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc,';
|
||||||
|
$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.= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
|
$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."product as p ON cd.fk_product = p.rowid";
|
||||||
$sql.= " WHERE cd.fk_commande = ".$object->id;
|
$sql.= " WHERE cd.fk_commande = ".$object->id;
|
||||||
@ -705,6 +707,20 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$product_static->id=$objp->fk_product;
|
$product_static->id=$objp->fk_product;
|
||||||
$product_static->ref=$objp->ref;
|
$product_static->ref=$objp->ref;
|
||||||
$product_static->entity = $objp->entity;
|
$product_static->entity = $objp->entity;
|
||||||
|
|
||||||
|
$product_static->weight=$objp->weight;
|
||||||
|
$product_static->weight_units=$objp->weight_units;
|
||||||
|
$product_static->length=$objp->length;
|
||||||
|
$product_static->length_units=$objp->length_units;
|
||||||
|
$product_static->width=$objp->width;
|
||||||
|
$product_static->width_units=$objp->width_units;
|
||||||
|
$product_static->height=$objp->height;
|
||||||
|
$product_static->height_units=$objp->height_units;
|
||||||
|
$product_static->surface=$objp->surface;
|
||||||
|
$product_static->surface_units=$objp->surface_units;
|
||||||
|
$product_static->volume=$objp->volume;
|
||||||
|
$product_static->volume_units=$objp->volume_units;
|
||||||
|
|
||||||
$text=$product_static->getNomUrl(1);
|
$text=$product_static->getNomUrl(1);
|
||||||
$text.= ' - '.$label;
|
$text.= ' - '.$label;
|
||||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'<br>';
|
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'<br>';
|
||||||
|
|||||||
@ -57,7 +57,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
|||||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int'));
|
$date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int'));
|
||||||
$date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int'));
|
$date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int'));
|
||||||
$date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int'));
|
$date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int'));
|
||||||
$fk_projet=GETPOST('fk_projet', 'int');
|
$fk_project=GETPOST('fk_project', 'int');
|
||||||
$vatrate=GETPOST('vatrate', 'alpha');
|
$vatrate=GETPOST('vatrate', 'alpha');
|
||||||
$ref=GETPOST("ref", 'alpha');
|
$ref=GETPOST("ref", 'alpha');
|
||||||
$comments=GETPOST('comments', 'none');
|
$comments=GETPOST('comments', 'none');
|
||||||
@ -145,7 +145,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
$action='';
|
$action='';
|
||||||
|
|
||||||
$fk_projet='';
|
$fk_project='';
|
||||||
$date_start='';
|
$date_start='';
|
||||||
$date_end='';
|
$date_end='';
|
||||||
$date='';
|
$date='';
|
||||||
@ -1232,7 +1232,7 @@ if (empty($reshook))
|
|||||||
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
|
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
|
||||||
|
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type, $fk_ecm_files);
|
$result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_project, $fk_c_exp_tax_cat, $type, $fk_ecm_files);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
@ -1257,7 +1257,7 @@ if (empty($reshook))
|
|||||||
unset($vatrate);
|
unset($vatrate);
|
||||||
unset($comments);
|
unset($comments);
|
||||||
unset($fk_c_type_fees);
|
unset($fk_c_type_fees);
|
||||||
unset($fk_projet);
|
unset($fk_project);
|
||||||
|
|
||||||
unset($date);
|
unset($date);
|
||||||
} else {
|
} else {
|
||||||
@ -1334,7 +1334,7 @@ if (empty($reshook))
|
|||||||
$rowid = $_POST['rowid'];
|
$rowid = $_POST['rowid'];
|
||||||
$type_fees_id = GETPOST('fk_c_type_fees', 'int');
|
$type_fees_id = GETPOST('fk_c_type_fees', 'int');
|
||||||
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int');
|
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int');
|
||||||
$projet_id = $fk_projet;
|
$projet_id = $fk_project;
|
||||||
$comments = GETPOST('comments', 'none');
|
$comments = GETPOST('comments', 'none');
|
||||||
$qty = GETPOST('qty', 'int');
|
$qty = GETPOST('qty', 'int');
|
||||||
$vatrate = GETPOST('vatrate', 'alpha');
|
$vatrate = GETPOST('vatrate', 'alpha');
|
||||||
@ -2372,7 +2372,7 @@ else
|
|||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formproject->select_projects(-1, $line->fk_project, 'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
|
$formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2527,7 +2527,7 @@ else
|
|||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300');
|
$formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -136,6 +136,51 @@ class ExpenseReport extends CommonObject
|
|||||||
const STATUS_CLOSED = 6;
|
const STATUS_CLOSED = 6;
|
||||||
|
|
||||||
|
|
||||||
|
public $fields=array(
|
||||||
|
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
|
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
||||||
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20),
|
||||||
|
'ref_number_int' =>array('type'=>'integer', 'label'=>'Ref number int', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||||
|
'ref_ext' =>array('type'=>'integer', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||||
|
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
|
||||||
|
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'Total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
|
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
|
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||||
|
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||||
|
'date_debut' =>array('type'=>'date', 'label'=>'Date debut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>60),
|
||||||
|
'date_fin' =>array('type'=>'date', 'label'=>'Date fin', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>65),
|
||||||
|
'date_valid' =>array('type'=>'datetime', 'label'=>'Date valid', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||||
|
'date_approve' =>array('type'=>'datetime', 'label'=>'Date approve', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
|
'date_refuse' =>array('type'=>'datetime', 'label'=>'Date refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||||
|
'date_cancel' =>array('type'=>'datetime', 'label'=>'Date cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||||
|
'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>100),
|
||||||
|
'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||||
|
'fk_user_valid' =>array('type'=>'integer', 'label'=>'Fk user valid', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||||
|
'fk_user_validator' =>array('type'=>'integer', 'label'=>'Fk user validator', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||||
|
'fk_user_approve' =>array('type'=>'integer', 'label'=>'Fk user approve', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||||
|
'fk_user_refuse' =>array('type'=>'integer', 'label'=>'Fk user refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||||
|
'fk_user_cancel' =>array('type'=>'integer', 'label'=>'Fk user cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||||
|
'fk_c_paiement' =>array('type'=>'integer', 'label'=>'Fk c paiement', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||||
|
'paid' =>array('type'=>'integer', 'label'=>'Paid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>145),
|
||||||
|
'note_public' =>array('type'=>'text', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||||
|
'note_private' =>array('type'=>'text', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||||
|
'detail_refuse' =>array('type'=>'varchar(255)', 'label'=>'Detail refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||||
|
'detail_cancel' =>array('type'=>'varchar(255)', 'label'=>'Detail cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||||
|
'integration_compta' =>array('type'=>'integer', 'label'=>'Integration compta', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||||
|
'fk_bank_account' =>array('type'=>'integer', 'label'=>'Fk bank account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||||
|
'model_pdf' =>array('type'=>'varchar(50)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||||
|
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||||
|
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||||
|
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||||
|
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||||
|
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||||
|
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||||
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||||
|
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>220),
|
||||||
|
'date_create' =>array('type'=>'datetime', 'label'=>'Date create', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>300),
|
||||||
|
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305),
|
||||||
|
'fk_statut' =>array('type'=>'integer', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
@ -1198,7 +1198,7 @@ if ($step == 5 && $datatoexport)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<td>'.(! empty($list)?$list:$langs->trans("None")).'</td>';
|
print '<td>'.(! empty($list)?$list:'<span class="opacitymedium">'.$langs->trans("None").'</span>').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -158,12 +158,10 @@ if ($action == 'add') {
|
|||||||
// on récupère les enregistrements
|
// on récupère les enregistrements
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
|
|
||||||
// on transfert les données de l'un vers l'autre
|
// on transfert les données de l'un vers l'autre
|
||||||
if ($object->socid > 0) {
|
if ($object->socid > 0) {
|
||||||
$newinter->socid=$object->socid;
|
$newinter->socid=$object->socid;
|
||||||
$newinter->fk_projet=$object->fk_projet;
|
$newinter->fk_project=$object->fk_project;
|
||||||
$newinter->fk_project=$object->fk_projet;
|
|
||||||
$newinter->fk_contrat=$object->fk_contrat;
|
$newinter->fk_contrat=$object->fk_contrat;
|
||||||
} else {
|
} else {
|
||||||
$newinter->socid=GETPOST("socid");
|
$newinter->socid=GETPOST("socid");
|
||||||
|
|||||||
@ -1271,12 +1271,12 @@ elseif ($id > 0 || ! empty($ref))
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||||
print $langs->trans('Contract');
|
print $langs->trans('Contract');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'contrat')
|
if ($action != 'contrat')
|
||||||
{
|
{
|
||||||
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=contrat&id='.$object->id.'">';
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=contrat&id='.$object->id.'">';
|
||||||
print img_edit($langs->trans('SetContract'), 1);
|
print img_edit($langs->trans('SetContract'), 1);
|
||||||
print '</a></td>';
|
print '</a></td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -701,51 +701,36 @@ class Fichinter extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Returns the label of a statut
|
* Returns the label of a status
|
||||||
*
|
*
|
||||||
* @param int $statut id statut
|
* @param int $status Id status
|
||||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
public function LibStatut($statut, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
// Init/load array of translation of status
|
// Init/load array of translation of status
|
||||||
if (empty($this->statuts) || empty($this->statuts_short))
|
if (empty($this->statuts) || empty($this->statuts_short) || empty($this->statuts_logo))
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load("fichinter");
|
$langs->load("fichinter");
|
||||||
|
|
||||||
$this->statuts[0]=$langs->trans('Draft');
|
$this->statuts[self::STATUS_DRAFT]=$langs->trans('Draft');
|
||||||
$this->statuts[1]=$langs->trans('Validated');
|
$this->statuts[self::STATUS_VALIDATED]=$langs->trans('Validated');
|
||||||
$this->statuts[2]=$langs->trans('StatusInterInvoiced');
|
$this->statuts[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced');
|
||||||
$this->statuts[3]=$langs->trans('Done');
|
$this->statuts[self::STATUS_CLOSED]=$langs->trans('Done');
|
||||||
$this->statuts_short[0]=$langs->trans('Draft');
|
$this->statuts_short[self::STATUS_DRAFT]=$langs->trans('Draft');
|
||||||
$this->statuts_short[1]=$langs->trans('Validated');
|
$this->statuts_short[self::STATUS_VALIDATED]=$langs->trans('Validated');
|
||||||
$this->statuts_short[2]=$langs->trans('StatusInterInvoiced');
|
$this->statuts_short[self::STATUS_BILLED]=$langs->trans('StatusInterInvoiced');
|
||||||
$this->statuts_short[3]=$langs->trans('Done');
|
$this->statuts_short[self::STATUS_CLOSED]=$langs->trans('Done');
|
||||||
$this->statuts_logo[0]='statut0';
|
$this->statuts_logo[self::STATUS_DRAFT]='status0';
|
||||||
$this->statuts_logo[1]='statut1';
|
$this->statuts_logo[self::STATUS_VALIDATED]='status1';
|
||||||
$this->statuts_logo[2]='statut6';
|
$this->statuts_logo[self::STATUS_BILLED]='status6';
|
||||||
$this->statuts_logo[3]='statut6';
|
$this->statuts_logo[self::STATUS_CLOSED]='status6';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 0)
|
return dolGetStatus($this->statuts[$status], $this->statuts_short[$status], '', $this->statuts_logo[$status], $mode);
|
||||||
return $this->statuts[$statut];
|
|
||||||
elseif ($mode == 1)
|
|
||||||
return $this->statuts_short[$statut];
|
|
||||||
elseif ($mode == 2)
|
|
||||||
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts_short[$statut];
|
|
||||||
elseif ($mode == 3)
|
|
||||||
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]);
|
|
||||||
elseif ($mode == 4)
|
|
||||||
return img_picto($this->statuts_short[$statut], $this->statuts_logo[$statut]).' '.$this->statuts[$statut];
|
|
||||||
elseif ($mode == 5)
|
|
||||||
return '<span class="hideonsmartphone">'.$this->statuts_short[$statut].' </span>'.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]);
|
|
||||||
elseif ($mode == 6)
|
|
||||||
return '<span class="hideonsmartphone">'.$this->statuts[$statut].' </span>'.img_picto($this->statuts[$statut], $this->statuts_logo[$statut]);
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -116,13 +116,16 @@ $arrayfields=array(
|
|||||||
'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
|
'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key => $val)
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -1106,12 +1106,19 @@ if (empty($reshook))
|
|||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
if (! empty($origin) && ! empty($originid))
|
if (! empty($origin) && ! empty($originid))
|
||||||
{
|
{
|
||||||
if ($origin == 'order' || $origin == 'commande')
|
if ($origin == 'propal' || $origin == 'proposal')
|
||||||
{
|
{
|
||||||
|
$classname = 'Propal';
|
||||||
|
$element = 'comm/propal'; $subelement = 'propal';
|
||||||
|
}
|
||||||
|
elseif ($origin == 'order' || $origin == 'commande')
|
||||||
|
{
|
||||||
|
$classname = 'Commande';
|
||||||
$element = $subelement = 'commande';
|
$element = $subelement = 'commande';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$classname = 'SupplierProposal';
|
||||||
$element = 'supplier_proposal';
|
$element = 'supplier_proposal';
|
||||||
$subelement = 'supplier_proposal';
|
$subelement = 'supplier_proposal';
|
||||||
}
|
}
|
||||||
@ -1131,7 +1138,6 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||||
|
|
||||||
$classname = 'SupplierProposal';
|
|
||||||
$srcobject = new $classname($db);
|
$srcobject = new $classname($db);
|
||||||
|
|
||||||
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
||||||
@ -1167,7 +1173,6 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
||||||
// trigger used
|
|
||||||
{
|
{
|
||||||
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
||||||
$array_option = $lines[$i]->array_options;
|
$array_option = $lines[$i]->array_options;
|
||||||
@ -1442,7 +1447,7 @@ llxHeader('', $langs->trans("Order"), $help_url);
|
|||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
if ($action=='create')
|
if ($action=='create')
|
||||||
{
|
{
|
||||||
print load_fiche_titre($langs->trans('NewOrder'));
|
print load_fiche_titre($langs->trans('NewOrderSupplier'));
|
||||||
|
|
||||||
dol_htmloutput_events();
|
dol_htmloutput_events();
|
||||||
|
|
||||||
@ -1459,17 +1464,31 @@ if ($action=='create')
|
|||||||
{
|
{
|
||||||
// Parse element/subelement (ex: project_task)
|
// Parse element/subelement (ex: project_task)
|
||||||
$element = $subelement = $origin;
|
$element = $subelement = $origin;
|
||||||
|
$regs=array();
|
||||||
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
||||||
$element = $regs [1];
|
$element = $regs[1];
|
||||||
$subelement = $regs [2];
|
$subelement = $regs[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($origin == 'propal' || $origin == 'proposal')
|
||||||
|
{
|
||||||
|
$classname = 'Propal';
|
||||||
|
$element = 'comm/propal'; $subelement = 'propal';
|
||||||
|
}
|
||||||
|
elseif ($origin == 'order' || $origin == 'commande')
|
||||||
|
{
|
||||||
|
$classname = 'Commande';
|
||||||
|
$element = $subelement = 'commande';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$classname = 'SupplierProposal';
|
||||||
$element = 'supplier_proposal';
|
$element = 'supplier_proposal';
|
||||||
$subelement = 'supplier_proposal';
|
$subelement = 'supplier_proposal';
|
||||||
|
}
|
||||||
|
|
||||||
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||||
|
|
||||||
$classname = 'SupplierProposal';
|
|
||||||
$objectsrc = new $classname($db);
|
$objectsrc = new $classname($db);
|
||||||
$objectsrc->fetch($originid);
|
$objectsrc->fetch($originid);
|
||||||
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines'))
|
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines'))
|
||||||
|
|||||||
@ -376,9 +376,9 @@ if (! $search_all)
|
|||||||
$sql.= ' country.code,';
|
$sql.= ' country.code,';
|
||||||
$sql.= " p.rowid, p.ref, p.title";
|
$sql.= " p.rowid, p.ref, p.title";
|
||||||
|
|
||||||
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) //prevent error with sql_mode=only_full_group_by
|
||||||
{
|
{
|
||||||
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
|
$sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ",ef.".$key : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -49,6 +49,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
|
|||||||
|
|
||||||
-- For v11
|
-- For v11
|
||||||
|
|
||||||
|
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_origin_line (fk_origin_line);
|
||||||
|
|
||||||
ALTER TABLE llx_rights_def ADD COLUMN module_position INTEGER NOT NULL DEFAULT 0;
|
ALTER TABLE llx_rights_def ADD COLUMN module_position INTEGER NOT NULL DEFAULT 0;
|
||||||
ALTER TABLE llx_rights_def ADD COLUMN family_position INTEGER NOT NULL DEFAULT 0;
|
ALTER TABLE llx_rights_def ADD COLUMN family_position INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
@ -378,3 +380,33 @@ create table llx_fichinterdet_rec
|
|||||||
|
|
||||||
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL AFTER product_type;
|
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_start datetime DEFAULT NULL AFTER product_type;
|
||||||
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL AFTER date_start;
|
ALTER TABLE llx_supplier_proposaldet ADD COLUMN date_end datetime DEFAULT NULL AFTER date_start;
|
||||||
|
|
||||||
|
--List of parcels details related to an expedition
|
||||||
|
create table llx_expedition_package
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_expedition integer NOT NULL,
|
||||||
|
description varchar(255), --Description of goods in the package (required by the custom)
|
||||||
|
value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom)
|
||||||
|
fk_parcel_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other)
|
||||||
|
height float, -- height
|
||||||
|
width float, -- width
|
||||||
|
size float, -- depth
|
||||||
|
size_units integer, -- unit of all sizes (height, width, depth)
|
||||||
|
weight float, -- weight
|
||||||
|
weight_units integer, -- unit of weight
|
||||||
|
dangerous_goods smallint DEFAULT 0, -- 0 = no dangerous goods or 1 = Explosives, 2 = Flammable Gases, 3 = Flammable Liquids, 4 = Flammable solids, 5 = Oxidizing, 6 = Toxic & Infectious, 7 = Radioactive, 8 = Corrosives, 9 = Miscellaneous (see https://en.wikipedia.org/wiki/Dangerous_goods). I'm not sure if just register 0 (no) or 1 (yes) is enough.
|
||||||
|
tail_lift smallint DEFAULT 0, -- 0 = no tail lift required to load/unload package(s), 1 = a tail lift is required to load/unload package(s). Sometime tail lift load can be different than tail lift delivery so maybe adding a new table line.
|
||||||
|
rang integer DEFAULT 0
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
--Dictionary of package type
|
||||||
|
create table llx_c_shipment_package_type
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
label varchar(50) NOT NULL, -- Short name
|
||||||
|
description varchar(255), -- Description
|
||||||
|
active integer DEFAULT 1 NOT NULL, -- Active or not
|
||||||
|
entity integer DEFAULT 1 NOT NULL -- Multi company id
|
||||||
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
|||||||
9
htdocs/install/mysql/tables/llx_c_shipment_package_type
Normal file
9
htdocs/install/mysql/tables/llx_c_shipment_package_type
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
--Dictionary of package type
|
||||||
|
create table llx_c_shipment_package_type
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
label varchar(50) NOT NULL, -- Short name
|
||||||
|
description varchar(255), -- Description
|
||||||
|
active integer DEFAULT 1 NOT NULL, -- Active or not
|
||||||
|
entity integer DEFAULT 1 NOT NULL -- Multi company id
|
||||||
|
)ENGINE=innodb;
|
||||||
18
htdocs/install/mysql/tables/llx_expedition_package.sql
Normal file
18
htdocs/install/mysql/tables/llx_expedition_package.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
--List of parcels details related to an expedition
|
||||||
|
create table llx_expedition_package
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_expedition integer NOT NULL,
|
||||||
|
description varchar(255), --Description of goods in the package (required by the custom)
|
||||||
|
value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom)
|
||||||
|
fk_package_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other)
|
||||||
|
height float, -- height
|
||||||
|
width float, -- width
|
||||||
|
size float, -- depth
|
||||||
|
size_units integer, -- unit of all sizes (height, width, depth)
|
||||||
|
weight float, -- weight
|
||||||
|
weight_units integer, -- unit of weight
|
||||||
|
dangerous_goods smallint DEFAULT 0, -- 0 = no dangerous goods or 1 = Explosives, 2 = Flammable Gases, 3 = Flammable Liquids, 4 = Flammable solids, 5 = Oxidizing, 6 = Toxic & Infectious, 7 = Radioactive, 8 = Corrosives, 9 = Miscellaneous (see https://en.wikipedia.org/wiki/Dangerous_goods). I'm not sure if just register 0 (no) or 1 (yes) is enough.
|
||||||
|
tail_lift smallint DEFAULT 0, -- 0 = no tail lift required to load/unload package(s), 1 = a tail lift is required to load/unload package(s). Sometime tail lift load can be different than tail lift delivery so maybe adding a new table line.
|
||||||
|
rang integer DEFAULT 0
|
||||||
|
)ENGINE=innodb;
|
||||||
@ -19,4 +19,5 @@
|
|||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_expedition (fk_expedition);
|
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_expedition (fk_expedition);
|
||||||
|
ALTER TABLE llx_expeditiondet ADD INDEX idx_expeditiondet_fk_origin_line (fk_origin_line);
|
||||||
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_expedition FOREIGN KEY (fk_expedition) REFERENCES llx_expedition (rowid);
|
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_expedition FOREIGN KEY (fk_expedition) REFERENCES llx_expedition (rowid);
|
||||||
|
|||||||
@ -66,6 +66,7 @@ NoContractedProducts=No products/services contracted
|
|||||||
NoRecordedContracts=No recorded contracts
|
NoRecordedContracts=No recorded contracts
|
||||||
NoRecordedInterventions=No recorded interventions
|
NoRecordedInterventions=No recorded interventions
|
||||||
BoxLatestSupplierOrders=Latest purchase orders
|
BoxLatestSupplierOrders=Latest purchase orders
|
||||||
|
BoxLatestSupplierOrdersAwaitingReception=Latest Purchase Orders (with a pending reception)
|
||||||
NoSupplierOrder=No recorded purchase order
|
NoSupplierOrder=No recorded purchase order
|
||||||
BoxCustomersInvoicesPerMonth=Customer Invoices per month
|
BoxCustomersInvoicesPerMonth=Customer Invoices per month
|
||||||
BoxSuppliersInvoicesPerMonth=Vendor Invoices per month
|
BoxSuppliersInvoicesPerMonth=Vendor Invoices per month
|
||||||
|
|||||||
@ -60,6 +60,7 @@ InterDateCreation=Date creation intervention
|
|||||||
InterDuration=Duration intervention
|
InterDuration=Duration intervention
|
||||||
InterStatus=Status intervention
|
InterStatus=Status intervention
|
||||||
InterNote=Note intervention
|
InterNote=Note intervention
|
||||||
|
InterLine=Line of intervention
|
||||||
InterLineId=Line id intervention
|
InterLineId=Line id intervention
|
||||||
InterLineDate=Line date intervention
|
InterLineDate=Line date intervention
|
||||||
InterLineDuration=Line duration intervention
|
InterLineDuration=Line duration intervention
|
||||||
|
|||||||
@ -169,6 +169,7 @@ ToValidate=To validate
|
|||||||
NotValidated=Not validated
|
NotValidated=Not validated
|
||||||
Save=Save
|
Save=Save
|
||||||
SaveAs=Save As
|
SaveAs=Save As
|
||||||
|
SaveAndStay=Save and stay
|
||||||
TestConnection=Test connection
|
TestConnection=Test connection
|
||||||
ToClone=Clone
|
ToClone=Clone
|
||||||
ConfirmClone=Choose data you want to clone:
|
ConfirmClone=Choose data you want to clone:
|
||||||
@ -475,7 +476,9 @@ Categories=Tags/categories
|
|||||||
Category=Tag/category
|
Category=Tag/category
|
||||||
By=By
|
By=By
|
||||||
From=From
|
From=From
|
||||||
|
FromLocation=From
|
||||||
to=to
|
to=to
|
||||||
|
To=to
|
||||||
and=and
|
and=and
|
||||||
or=or
|
or=or
|
||||||
Other=Other
|
Other=Other
|
||||||
|
|||||||
@ -60,6 +60,8 @@ HooksFile=File for hooks code
|
|||||||
ArrayOfKeyValues=Array of key-val
|
ArrayOfKeyValues=Array of key-val
|
||||||
ArrayOfKeyValuesDesc=Array of keys and values if field is a combo list with fixed values
|
ArrayOfKeyValuesDesc=Array of keys and values if field is a combo list with fixed values
|
||||||
WidgetFile=Widget file
|
WidgetFile=Widget file
|
||||||
|
CSSFile=CSS file
|
||||||
|
JSFile=Javascript file
|
||||||
ReadmeFile=Readme file
|
ReadmeFile=Readme file
|
||||||
ChangeLog=ChangeLog file
|
ChangeLog=ChangeLog file
|
||||||
TestClassFile=File for PHP Unit Test class
|
TestClassFile=File for PHP Unit Test class
|
||||||
@ -77,6 +79,7 @@ NoTrigger=No trigger
|
|||||||
NoWidget=No widget
|
NoWidget=No widget
|
||||||
GoToApiExplorer=Go to API explorer
|
GoToApiExplorer=Go to API explorer
|
||||||
ListOfMenusEntries=List of menu entries
|
ListOfMenusEntries=List of menu entries
|
||||||
|
ListOfDictionariesEntries=List of dictionaries entries
|
||||||
ListOfPermissionsDefined=List of defined permissions
|
ListOfPermissionsDefined=List of defined permissions
|
||||||
SeeExamples=See examples here
|
SeeExamples=See examples here
|
||||||
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
|
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
|
||||||
@ -86,8 +89,10 @@ SearchAllDesc=Is the field used to make a search from the quick search tool? (Ex
|
|||||||
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.
|
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.
|
||||||
LanguageDefDesc=Enter in this files, all the key and the translation for each language file.
|
LanguageDefDesc=Enter in this files, all the key and the translation for each language file.
|
||||||
MenusDefDesc=Define here the menus provided by your module
|
MenusDefDesc=Define here the menus provided by your module
|
||||||
|
DictionariesDefDesc=Define here the dictionaries provided by your module
|
||||||
PermissionsDefDesc=Define here the new permissions provided by your module
|
PermissionsDefDesc=Define here the new permissions provided by your module
|
||||||
MenusDefDescTooltip=The menus provided by your module/application are defined into the array <strong>$this->menus</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), menus are also visible into the menu editor available to administrator users on %s.
|
MenusDefDescTooltip=The menus provided by your module/application are defined into the array <strong>$this->menus</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), menus are also visible into the menu editor available to administrator users on %s.
|
||||||
|
DictionariesDefDescTooltip=The dictionaries provided by your module/application are defined into the array <strong>$this->dictionaries</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), dictionaries are also visible into the setup area to administrator users on %s.
|
||||||
PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array <strong>$this->rights</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s.
|
PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array <strong>$this->rights</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s.
|
||||||
HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code).
|
HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code).
|
||||||
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed.
|
TriggerDefDesc=Define in the trigger file the code you want to execute for each business event executed.
|
||||||
@ -109,6 +114,8 @@ ContentOfREADMECustomized=Note: The content of the README.md file has been repla
|
|||||||
RealPathOfModule=Real path of module
|
RealPathOfModule=Real path of module
|
||||||
ContentCantBeEmpty=Content of file can't be empty
|
ContentCantBeEmpty=Content of file can't be empty
|
||||||
WidgetDesc=You can generate and edit here the widgets that will be embedded with your module.
|
WidgetDesc=You can generate and edit here the widgets that will be embedded with your module.
|
||||||
|
CSSDesc=You can generate and edit here a file with personalized CSS embedded with your module.
|
||||||
|
JSDesc=You can generate and edit here a file with personalized Javascript embedded with your module.
|
||||||
CLIDesc=You can generate here some command line scripts you want to provide with your module.
|
CLIDesc=You can generate here some command line scripts you want to provide with your module.
|
||||||
CLIFile=CLI File
|
CLIFile=CLI File
|
||||||
NoCLIFile=No CLI files
|
NoCLIFile=No CLI files
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
Mrp=Manufacturing Orders
|
Mrp=Manufacturing Orders
|
||||||
|
MO=Manufacturing Order
|
||||||
MRPDescription=Module to manage Manufacturing Orders (MO).
|
MRPDescription=Module to manage Manufacturing Orders (MO).
|
||||||
MRPArea=MRP Area
|
MRPArea=MRP Area
|
||||||
MrpSetupPage=Setup of module MO
|
MrpSetupPage=Setup of module MO
|
||||||
|
|||||||
@ -11,6 +11,7 @@ OrderDate=Order date
|
|||||||
OrderDateShort=Order date
|
OrderDateShort=Order date
|
||||||
OrderToProcess=Order to process
|
OrderToProcess=Order to process
|
||||||
NewOrder=New order
|
NewOrder=New order
|
||||||
|
NewOrderSupplier=New Purchase Order
|
||||||
ToOrder=Make order
|
ToOrder=Make order
|
||||||
MakeOrder=Make order
|
MakeOrder=Make order
|
||||||
SupplierOrder=Purchase order
|
SupplierOrder=Purchase order
|
||||||
@ -70,6 +71,7 @@ DeleteOrder=Delete order
|
|||||||
CancelOrder=Cancel order
|
CancelOrder=Cancel order
|
||||||
OrderReopened= Order %s Reopened
|
OrderReopened= Order %s Reopened
|
||||||
AddOrder=Create order
|
AddOrder=Create order
|
||||||
|
AddPurchaseOrder=Create purchase order
|
||||||
AddToDraftOrders=Add to draft order
|
AddToDraftOrders=Add to draft order
|
||||||
ShowOrder=Show order
|
ShowOrder=Show order
|
||||||
OrdersOpened=Orders to process
|
OrdersOpened=Orders to process
|
||||||
|
|||||||
@ -292,6 +292,7 @@ ProductWeight=Weight for 1 product
|
|||||||
ProductVolume=Volume for 1 product
|
ProductVolume=Volume for 1 product
|
||||||
WeightUnits=Weight unit
|
WeightUnits=Weight unit
|
||||||
VolumeUnits=Volume unit
|
VolumeUnits=Volume unit
|
||||||
|
SurfaceUnits=Surface unit
|
||||||
SizeUnits=Size unit
|
SizeUnits=Size unit
|
||||||
DeleteProductBuyPrice=Delete buying price
|
DeleteProductBuyPrice=Delete buying price
|
||||||
ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price?
|
ConfirmDeleteProductBuyPrice=Are you sure you want to delete this buying price?
|
||||||
|
|||||||
@ -476,6 +476,7 @@ Category=Tag/catégorie
|
|||||||
By=Par
|
By=Par
|
||||||
From=Du
|
From=Du
|
||||||
to=au
|
to=au
|
||||||
|
To=à
|
||||||
and=et
|
and=et
|
||||||
or=ou
|
or=ou
|
||||||
Other=Autre
|
Other=Autre
|
||||||
|
|||||||
@ -1277,7 +1277,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
|
|||||||
if (GETPOSTISSET('dol_optimize_smallscreen')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int'); }
|
if (GETPOSTISSET('dol_optimize_smallscreen')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int'); }
|
||||||
if (GETPOSTISSET('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int'); }
|
if (GETPOSTISSET('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int'); }
|
||||||
if (GETPOSTISSET('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile', 'int'); }
|
if (GETPOSTISSET('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile', 'int'); }
|
||||||
if (GETPOSTISSET('THEME_AGRESSIVITY_RATIO')) { $themeparam.='&THEME_AGRESSIVITY_RATIO='.GETPOST('THEME_AGRESSIVITY_RATIO', 'int'); }
|
if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) { $themeparam.='&THEME_AGRESSIVENESS_RATIO='.GETPOST('THEME_AGRESSIVENESS_RATIO', 'int'); }
|
||||||
|
|
||||||
if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax)
|
if (! defined('DISABLE_JQUERY') && ! $disablejs && $conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -153,6 +153,12 @@ if ($dirins && $action == 'initmodule' && $modulename)
|
|||||||
dol_delete_file($destdir.'/class/api_'.strtolower($modulename).'.class.php');
|
dol_delete_file($destdir.'/class/api_'.strtolower($modulename).'.class.php');
|
||||||
dol_delete_dir($destdir.'/class');
|
dol_delete_dir($destdir.'/class');
|
||||||
|
|
||||||
|
dol_delete_file($destdir.'/css/'.strtolower($modulename).'.css.php');
|
||||||
|
dol_delete_dir($destdir.'/css');
|
||||||
|
|
||||||
|
dol_delete_file($destdir.'/js/'.strtolower($modulename).'.js.php');
|
||||||
|
dol_delete_dir($destdir.'/js');
|
||||||
|
|
||||||
dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php');
|
dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php');
|
||||||
dol_delete_dir($destdir.'/scripts');
|
dol_delete_dir($destdir.'/scripts');
|
||||||
|
|
||||||
@ -163,7 +169,7 @@ if ($dirins && $action == 'initmodule' && $modulename)
|
|||||||
dol_delete_file($destdir.'/myobject_agenda.php');
|
dol_delete_file($destdir.'/myobject_agenda.php');
|
||||||
dol_delete_file($destdir.'/myobject_list.php');
|
dol_delete_file($destdir.'/myobject_list.php');
|
||||||
dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php');
|
dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php');
|
||||||
dol_delete_file($destdir.'/test/phpunit/MyObjectFunctionnalTest.php');
|
dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php');
|
||||||
dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php');
|
dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php');
|
||||||
dol_delete_file($destdir.'/test/phpunit');
|
dol_delete_file($destdir.'/test/phpunit');
|
||||||
dol_delete_file($destdir.'/test');
|
dol_delete_file($destdir.'/test');
|
||||||
@ -259,6 +265,11 @@ if ($dirins && $action == 'initapi' && !empty($module))
|
|||||||
|
|
||||||
dolReplaceInFile($destfile, $arrayreplacement);
|
dolReplaceInFile($destfile, $arrayreplacement);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($dirins && $action == 'initphpunit' && !empty($module))
|
if ($dirins && $action == 'initphpunit' && !empty($module))
|
||||||
{
|
{
|
||||||
@ -270,9 +281,7 @@ if ($dirins && $action == 'initphpunit' && !empty($module))
|
|||||||
$srcfile = $srcdir.'/test/phpunit/MyObjectTest.php';
|
$srcfile = $srcdir.'/test/phpunit/MyObjectTest.php';
|
||||||
$destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php';
|
$destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php';
|
||||||
$result = dol_copy($srcfile, $destfile, 0, 0);
|
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||||
/*$srcfile = $srcdir.'/test/phpunit/MyModuleFunctionnalTest.class.php';
|
|
||||||
$destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($module).'FunctionnalTest.class.php';
|
|
||||||
$result = dol_copy($srcfile, $destfile, 0, 0);*/
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
//var_dump($phpfileval['fullname']);
|
//var_dump($phpfileval['fullname']);
|
||||||
@ -295,6 +304,8 @@ if ($dirins && $action == 'initphpunit' && !empty($module))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($dirins && $action == 'initsqlextrafields' && !empty($module))
|
if ($dirins && $action == 'initsqlextrafields' && !empty($module))
|
||||||
@ -327,13 +338,21 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module))
|
|||||||
'Mon module'=>$modulename,
|
'Mon module'=>$modulename,
|
||||||
'mon module'=>$modulename,
|
'mon module'=>$modulename,
|
||||||
'htdocs/modulebuilder/template'=>strtolower($modulename),
|
'htdocs/modulebuilder/template'=>strtolower($modulename),
|
||||||
|
'My Object'=>$objectname,
|
||||||
|
'MyObject'=>$objectname,
|
||||||
|
'my object'=>strtolower($objectname),
|
||||||
|
'myobject'=>strtolower($objectname),
|
||||||
'---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
|
'---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
|
||||||
);
|
);
|
||||||
|
|
||||||
dolReplaceInFile($destfile1, $arrayreplacement);
|
dolReplaceInFile($destfile1, $arrayreplacement);
|
||||||
dolReplaceInFile($destfile2, $arrayreplacement);
|
dolReplaceInFile($destfile2, $arrayreplacement);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', ''), null, 'errors');
|
||||||
|
}
|
||||||
// TODO Enable in class the property $isextrafieldmanaged = 1
|
// TODO Enable in class the property $isextrafieldmanaged = 1
|
||||||
}
|
}
|
||||||
if ($dirins && $action == 'inithook' && !empty($module))
|
if ($dirins && $action == 'inithook' && !empty($module))
|
||||||
@ -364,6 +383,11 @@ if ($dirins && $action == 'inithook' && !empty($module))
|
|||||||
|
|
||||||
dolReplaceInFile($destfile, $arrayreplacement);
|
dolReplaceInFile($destfile, $arrayreplacement);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($dirins && $action == 'inittrigger' && !empty($module))
|
if ($dirins && $action == 'inittrigger' && !empty($module))
|
||||||
{
|
{
|
||||||
@ -393,6 +417,11 @@ if ($dirins && $action == 'inittrigger' && !empty($module))
|
|||||||
|
|
||||||
dolReplaceInFile($destfile, $arrayreplacement);
|
dolReplaceInFile($destfile, $arrayreplacement);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($dirins && $action == 'initwidget' && !empty($module))
|
if ($dirins && $action == 'initwidget' && !empty($module))
|
||||||
{
|
{
|
||||||
@ -422,6 +451,79 @@ if ($dirins && $action == 'initwidget' && !empty($module))
|
|||||||
|
|
||||||
dolReplaceInFile($destfile, $arrayreplacement);
|
dolReplaceInFile($destfile, $arrayreplacement);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($dirins && $action == 'initcss' && !empty($module))
|
||||||
|
{
|
||||||
|
dol_mkdir($dirins.'/'.strtolower($module).'/css');
|
||||||
|
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||||
|
$srcfile = $srcdir.'/css/mymodule.css.php';
|
||||||
|
$destfile = $dirins.'/'.strtolower($module).'/css/'.strtolower($module).'.css.php';
|
||||||
|
//var_dump($srcfile);var_dump($destfile);
|
||||||
|
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||||
|
|
||||||
|
//var_dump($phpfileval['fullname']);
|
||||||
|
$arrayreplacement=array(
|
||||||
|
'mymodule'=>strtolower($modulename),
|
||||||
|
'MyModule'=>$modulename,
|
||||||
|
'MYMODULE'=>strtoupper($modulename),
|
||||||
|
'My module'=>$modulename,
|
||||||
|
'my module'=>$modulename,
|
||||||
|
'Mon module'=>$modulename,
|
||||||
|
'mon module'=>$modulename,
|
||||||
|
'htdocs/modulebuilder/template'=>strtolower($modulename),
|
||||||
|
'---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
|
||||||
|
);
|
||||||
|
|
||||||
|
dolReplaceInFile($destfile, $arrayreplacement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($dirins && $action == 'initjs' && !empty($module))
|
||||||
|
{
|
||||||
|
dol_mkdir($dirins.'/'.strtolower($module).'/js');
|
||||||
|
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
|
||||||
|
$srcfile = $srcdir.'/js/mymodule.js.php';
|
||||||
|
$destfile = $dirins.'/'.strtolower($module).'/js/'.strtolower($module).'.js.php';
|
||||||
|
//var_dump($srcfile);var_dump($destfile);
|
||||||
|
$result = dol_copy($srcfile, $destfile, 0, 0);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$modulename = ucfirst($module); // Force first letter in uppercase
|
||||||
|
|
||||||
|
//var_dump($phpfileval['fullname']);
|
||||||
|
$arrayreplacement=array(
|
||||||
|
'mymodule'=>strtolower($modulename),
|
||||||
|
'MyModule'=>$modulename,
|
||||||
|
'MYMODULE'=>strtoupper($modulename),
|
||||||
|
'My module'=>$modulename,
|
||||||
|
'my module'=>$modulename,
|
||||||
|
'Mon module'=>$modulename,
|
||||||
|
'mon module'=>$modulename,
|
||||||
|
'htdocs/modulebuilder/template'=>strtolower($modulename),
|
||||||
|
'---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'')
|
||||||
|
);
|
||||||
|
|
||||||
|
dolReplaceInFile($destfile, $arrayreplacement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($dirins && $action == 'initcli' && !empty($module))
|
if ($dirins && $action == 'initcli' && !empty($module))
|
||||||
{
|
{
|
||||||
@ -456,6 +558,11 @@ if ($dirins && $action == 'initcli' && !empty($module))
|
|||||||
|
|
||||||
dolReplaceInFile($destfile, $arrayreplacement);
|
dolReplaceInFile($destfile, $arrayreplacement);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($dirins && $action == 'initdoc' && !empty($module))
|
if ($dirins && $action == 'initdoc' && !empty($module))
|
||||||
{
|
{
|
||||||
@ -502,6 +609,11 @@ if ($dirins && $action == 'initdoc' && !empty($module))
|
|||||||
dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0);
|
dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0);
|
||||||
dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0);
|
dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dirins && $action == 'addlanguage' && !empty($module))
|
if ($dirins && $action == 'addlanguage' && !empty($module))
|
||||||
@ -595,12 +707,15 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
|
|||||||
// visible
|
// visible
|
||||||
$visible = -1;
|
$visible = -1;
|
||||||
if ($fieldname == 'entity') $visible = -2;
|
if ($fieldname == 'entity') $visible = -2;
|
||||||
if ($fieldname == 'model_pdf') $visible = 0;
|
if (in_array($fieldname, array('model_pdf', 'note_public', 'note_private'))) $visible = 0;
|
||||||
// enabled
|
// enabled
|
||||||
$enabled = 1;
|
$enabled = 1;
|
||||||
// default
|
// default
|
||||||
$default = '';
|
$default = '';
|
||||||
if ($fieldname == 'entity') $default=1;
|
if ($fieldname == 'entity') $default=1;
|
||||||
|
// position
|
||||||
|
$position = $i;
|
||||||
|
if (in_array($fieldname, array('status', 'statut', 'fk_status', 'fk_statut'))) $position = 500;
|
||||||
|
|
||||||
$string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',";
|
$string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',";
|
||||||
if ($default != '') $string.= " 'default'=>".$default.",";
|
if ($default != '') $string.= " 'default'=>".$default.",";
|
||||||
@ -608,7 +723,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
|
|||||||
$string.= " 'visible'=>".$visible;
|
$string.= " 'visible'=>".$visible;
|
||||||
if ($notnull) $string.= ", 'notnull'=>".$notnull;
|
if ($notnull) $string.= ", 'notnull'=>".$notnull;
|
||||||
if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1";
|
if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1";
|
||||||
$string.= ", 'position'=>".$i."),\n";
|
$string.= ", 'position'=>".$position."),\n";
|
||||||
$string.="<br>";
|
$string.="<br>";
|
||||||
$i+=5;
|
$i+=5;
|
||||||
}
|
}
|
||||||
@ -668,8 +783,9 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
|
|||||||
'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
|
'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
|
||||||
//'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
|
//'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
|
||||||
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
|
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
|
||||||
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
|
|
||||||
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
|
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
|
||||||
|
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
|
||||||
|
'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql',
|
||||||
//'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php',
|
//'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php',
|
||||||
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
|
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
|
||||||
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
|
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
|
||||||
@ -1536,6 +1652,11 @@ elseif (! empty($module))
|
|||||||
$head2[$h][2] = 'languages';
|
$head2[$h][2] = 'languages';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread?'@'.$dirread:'');
|
||||||
|
$head2[$h][1] = $langs->trans("Dictionaries");
|
||||||
|
$head2[$h][2] = 'dictionaries';
|
||||||
|
$h++;
|
||||||
|
|
||||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'');
|
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'');
|
||||||
$head2[$h][1] = $langs->trans("Objects");
|
$head2[$h][1] = $langs->trans("Objects");
|
||||||
$head2[$h][2] = 'objects';
|
$head2[$h][2] = 'objects';
|
||||||
@ -1566,6 +1687,16 @@ elseif (! empty($module))
|
|||||||
$head2[$h][2] = 'widgets';
|
$head2[$h][2] = 'widgets';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=css&module='.$module.($forceddirread?'@'.$dirread:'');
|
||||||
|
$head2[$h][1] = $langs->trans("CSS");
|
||||||
|
$head2[$h][2] = 'css';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=js&module='.$module.($forceddirread?'@'.$dirread:'');
|
||||||
|
$head2[$h][1] = $langs->trans("JS");
|
||||||
|
$head2[$h][2] = 'js';
|
||||||
|
$h++;
|
||||||
|
|
||||||
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cli&module='.$module.($forceddirread?'@'.$dirread:'');
|
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cli&module='.$module.($forceddirread?'@'.$dirread:'');
|
||||||
$head2[$h][1] = $langs->trans("CLI");
|
$head2[$h][1] = $langs->trans("CLI");
|
||||||
$head2[$h][2] = 'cli';
|
$head2[$h][2] = 'cli';
|
||||||
@ -1819,6 +1950,139 @@ elseif (! empty($module))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($tab == 'dictionaries')
|
||||||
|
{
|
||||||
|
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
||||||
|
|
||||||
|
$dicts = $moduleobj->dictionaries;
|
||||||
|
|
||||||
|
if ($action != 'editfile' || empty($file))
|
||||||
|
{
|
||||||
|
print '<span class="opacitymedium">';
|
||||||
|
$htmlhelp=$langs->trans("DictionariesDefDescTooltip", '<a href="'.DOL_URL_ROOT.'/admin/dict.php">'.$langs->trans('Setup').' - '.$langs->trans('Dictionaries').'</a>');
|
||||||
|
print $form->textwithpicto($langs->trans("DictionariesDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'<br>';
|
||||||
|
print '</span>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
|
||||||
|
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
|
print '<br>';
|
||||||
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' :</span> <strong>'.$dicts['langs'].'</strong><br>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("ListOfDictionariesEntries"), '', '');
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="addproperty">';
|
||||||
|
print '<input type="hidden" name="tab" value="objects">';
|
||||||
|
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
|
||||||
|
print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
|
print '<table class="noborder">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Table", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("SQL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("SQLSort", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("FieldsView", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("FieldsEdit", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("FieldsInsert", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Rowid", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Condition", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
if (is_array($dicts))
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$maxi = count($dicts['tabname']);
|
||||||
|
while ($i < $maxi)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print ($i + 1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $dicts['tabname'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $dicts['tablib'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $dicts['tabsql'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $dicts['tabsqlsort'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $dicts['tabfield'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $dicts['tabfieldvalue'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $dicts['tabfieldinsert'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td class="right">';
|
||||||
|
print $dicts['tabrowid'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td class="right">';
|
||||||
|
print $dicts['tabcond'][$i];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fullpathoffile=dol_buildpath($file, 0);
|
||||||
|
|
||||||
|
$content = file_get_contents($fullpathoffile);
|
||||||
|
|
||||||
|
// New module
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="savefile">';
|
||||||
|
print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">';
|
||||||
|
print '<input type="hidden" name="tab" value="'.$tab.'">';
|
||||||
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html'));
|
||||||
|
print '<br>';
|
||||||
|
print '<center>';
|
||||||
|
print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||||
|
print '</center>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($tab == 'objects')
|
if ($tab == 'objects')
|
||||||
{
|
{
|
||||||
$head3 = array();
|
$head3 = array();
|
||||||
@ -1973,14 +2237,14 @@ elseif (! empty($module))
|
|||||||
|
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass?'':'<strike>').$pathtoclass.($realpathtoclass?'':'</strike>').'</strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi?'':'<strike>').$pathtoapi.($realpathtoapi?'':'</strike>').'</strong>';
|
||||||
if ($realpathtoapi)
|
if ($realpathtoapi)
|
||||||
{
|
{
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
if (empty($conf->global->$const_name)) // If module is not activated
|
if (empty($conf->global->$const_name)) // If module is not activated
|
||||||
{
|
{
|
||||||
@ -1994,7 +2258,7 @@ elseif (! empty($module))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
|
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initapi&format=php&file='.urlencode($pathtoapi).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
|
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initapi&format=php&file='.urlencode($pathtoapi).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
|
||||||
}
|
}
|
||||||
// PHPUnit
|
// PHPUnit
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -2002,24 +2266,24 @@ elseif (! empty($module))
|
|||||||
|
|
||||||
if ($realpathtophpunit)
|
if ($realpathtophpunit)
|
||||||
{
|
{
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
|
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initphpunit&format=php&file='.urlencode($pathtophpunit).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
|
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initphpunit&format=php&file='.urlencode($pathtophpunit).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtolib?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForLib").' : <strong>'.($realpathtolib?'':'<strike>').$pathtolib.($realpathtolib?'':'</strike>').'</strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForObjLib").' : <strong>'.($realpathtoobjlib?'':'<strike>').$pathtoobjlib.($realpathtoobjlib?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForObjLib").' : <strong>'.($realpathtoobjlib?'':'<strike>').$pathtoobjlib.($realpathtoobjlib?'':'</strike>').'</strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoobjlib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoobjlib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-image-o"></span> '.$langs->trans("Image").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-image-o"></span> '.$langs->trans("Image").' : <strong>'.($realpathtopicto?'':'<strike>').$pathtopicto.($realpathtopicto?'':'</strike>').'</strong>';
|
||||||
//print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
//print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
@ -2027,34 +2291,34 @@ elseif (! empty($module))
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFile").' : <strong>'.($realpathtosql?'':'<strike>').$pathtosql.($realpathtosql?'':'</strike>').'</strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosql).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=droptable">'.$langs->trans("DropTableIfEmpty").'</a>';
|
print ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=droptable">'.$langs->trans("DropTableIfEmpty").'</a>';
|
||||||
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>';
|
||||||
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
|
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
||||||
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra?'':'<strike>').$pathtosqlextra.($realpathtosqlextra?'':'</strike>').'</strong>';
|
||||||
if ($realpathtosqlextra)
|
if ($realpathtosqlextra)
|
||||||
{
|
{
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=droptableextrafields">'.$langs->trans("DropTableIfEmpty").'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER["PHP_SELF"].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=droptableextrafields">'.$langs->trans("DropTableIfEmpty").'</a>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initsqlextrafields&format=sql&file='.urlencode($pathtosqlextra).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
|
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initsqlextrafields&format=sql&file='.urlencode($pathtosqlextra).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
|
||||||
}
|
}
|
||||||
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKey").' : <strong>'.($realpathtosqlkey?'':'<strike>').$pathtosqlkey.($realpathtosqlkey?'':'</strike>').'</strong>';
|
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
|
||||||
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
|
||||||
print '<br>';
|
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKeyExtraFields").' : <strong>'.($realpathtosqlextrakey?'':'<strike>').$pathtosqlextrakey.($realpathtosqlextrakey?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKeyExtraFields").' : <strong>'.($realpathtosqlextrakey?'':'<strike>').$pathtosqlextrakey.($realpathtosqlextrakey?'':'</strike>').'</strong>';
|
||||||
if ($realpathtosqlextrakey)
|
if ($realpathtosqlextrakey)
|
||||||
{
|
{
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlextrakey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=sql&file='.urlencode($pathtosqlextrakey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtosqlextrakey).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtosqlextrakey).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||||
}
|
}
|
||||||
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
//print ' <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -2067,33 +2331,33 @@ elseif (! empty($module))
|
|||||||
|
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtolist?'':'<strike>').$pathtolist.($realpathtolist?'':'</strike>').'</a></strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForList").' : <strong><a href="'.$urloflist.'" target="_test">'.($realpathtolist?'':'<strike>').$pathtolist.($realpathtolist?'':'</strike>').'</a></strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtolist).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForCreateEditView").' : <strong><a href="'.$urlofcard.'?action=create" target="_test">'.($realpathtocard?'':'<strike>').$pathtocard.($realpathtocard?'':'</strike>').'?action=create</a></strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtocard).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForAgendaTab").' : <strong>'.($realpathtoagenda?'':'<strike>').$pathtoagenda.($realpathtoagenda?'':'</strike>').'</strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
if ($realpathtoagenda)
|
if ($realpathtoagenda)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtoagenda).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForDocumentTab").' : <strong>'.($realpathtodocument?'':'<strike>').$pathtodocument.($realpathtodocument?'':'</strike>').'</strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
if ($realpathtodocument)
|
if ($realpathtodocument)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtodocument).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>';
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForNoteTab").' : <strong>'.($realpathtonote?'':'<strike>').$pathtonote.($realpathtonote?'':'</strike>').'</strong>';
|
||||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
|
||||||
if ($realpathtonote)
|
if ($realpathtonote)
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&file='.urlencode($pathtonote).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -2428,9 +2692,9 @@ elseif (! empty($module))
|
|||||||
print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("perms", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("UserType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("UserType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
if (count($menus))
|
if (count($menus))
|
||||||
@ -2483,7 +2747,7 @@ elseif (! empty($module))
|
|||||||
print $menu['target'];
|
print $menu['target'];
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td class="right">';
|
||||||
print $menu['user'];
|
print $menu['user'];
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -2747,6 +3011,110 @@ elseif (! empty($module))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($tab == 'css')
|
||||||
|
{
|
||||||
|
if ($action != 'editfile' || empty($file))
|
||||||
|
{
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("CSSDesc").'</span><br>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<table>';
|
||||||
|
|
||||||
|
print '<tr><td>';
|
||||||
|
$pathtohook = strtolower($module).'/css/'.strtolower($module).'.css.php';
|
||||||
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("CSSFile").' : ';
|
||||||
|
if (dol_is_file($dirins.'/'.$pathtohook))
|
||||||
|
{
|
||||||
|
print '<strong>'.$pathtohook.'</strong>';
|
||||||
|
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||||
|
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
|
||||||
|
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initcss&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fullpathoffile=dol_buildpath($file, 0);
|
||||||
|
|
||||||
|
$content = file_get_contents($fullpathoffile);
|
||||||
|
|
||||||
|
// New module
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="savefile">';
|
||||||
|
print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">';
|
||||||
|
print '<input type="hidden" name="tab" value="'.$tab.'">';
|
||||||
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html'));
|
||||||
|
print '<br>';
|
||||||
|
print '<center>';
|
||||||
|
print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||||
|
print '</center>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($tab == 'js')
|
||||||
|
{
|
||||||
|
if ($action != 'editfile' || empty($file))
|
||||||
|
{
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("JSDesc").'</span><br>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<table>';
|
||||||
|
|
||||||
|
print '<tr><td>';
|
||||||
|
$pathtohook = strtolower($module).'/js/'.strtolower($module).'.js.php';
|
||||||
|
print '<span class="fa fa-file-o"></span> '.$langs->trans("JSFile").' : ';
|
||||||
|
if (dol_is_file($dirins.'/'.$pathtohook))
|
||||||
|
{
|
||||||
|
print '<strong>'.$pathtohook.'</strong>';
|
||||||
|
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
|
||||||
|
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
|
||||||
|
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=initjs&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fullpathoffile=dol_buildpath($file, 0);
|
||||||
|
|
||||||
|
$content = file_get_contents($fullpathoffile);
|
||||||
|
|
||||||
|
// New module
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="savefile">';
|
||||||
|
print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">';
|
||||||
|
print '<input type="hidden" name="tab" value="'.$tab.'">';
|
||||||
|
print '<input type="hidden" name="module" value="'.$module.'">';
|
||||||
|
|
||||||
|
$doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
|
||||||
|
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html'));
|
||||||
|
print '<br>';
|
||||||
|
print '<center>';
|
||||||
|
print '<input type="submit" class="button buttonforacesave" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||||
|
print '</center>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($tab == 'widgets')
|
if ($tab == 'widgets')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||||
|
|||||||
2
htdocs/modulebuilder/template/.gitignore
vendored
2
htdocs/modulebuilder/template/.gitignore
vendored
@ -14,3 +14,5 @@
|
|||||||
/.settings/
|
/.settings/
|
||||||
/.buildpath
|
/.buildpath
|
||||||
/.project
|
/.project
|
||||||
|
# Other
|
||||||
|
*.back
|
||||||
@ -64,7 +64,8 @@ class MyObject extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
|
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
|
||||||
|
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||||
* 'label' the translation key.
|
* 'label' the translation key.
|
||||||
* 'enabled' is a condition when the field must be managed.
|
* 'enabled' is a condition when the field must be managed.
|
||||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||||
@ -81,6 +82,7 @@ class MyObject extends CommonObject
|
|||||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||||
|
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// BEGIN MODULEBUILDER PROPERTIES
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
@ -94,8 +96,9 @@ class MyObject extends CommonObject
|
|||||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
|
||||||
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
|
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>0, 'position'=>60),
|
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
|
||||||
|
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60),
|
||||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||||
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
|
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
|
||||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),
|
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),
|
||||||
@ -652,43 +655,22 @@ class MyObject extends CommonObject
|
|||||||
public function LibStatut($status, $mode = 0)
|
public function LibStatut($status, $mode = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
if (empty($this->labelstatus))
|
if (empty($this->labelstatus) || empty($this->labelstatusshort))
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
//$langs->load("mymodule");
|
//$langs->load("mymodule");
|
||||||
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
|
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||||
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||||
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||||
|
$this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||||
|
$this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||||
|
$this->labelstatusshort[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 0)
|
$statusType = 'status'.$status;
|
||||||
{
|
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||||
return $this->labelstatus[$status];
|
|
||||||
}
|
return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
|
||||||
elseif ($mode == 1)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 2)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 3)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
elseif ($mode == 4)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 5)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
elseif ($mode == 6)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class modMyModule extends DolibarrModules
|
|||||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||||
$this->langfiles = array("mymodule@mymodule");
|
$this->langfiles = array("mymodule@mymodule");
|
||||||
$this->phpmin = array(5,5); // Minimum version of PHP required by module
|
$this->phpmin = array(5,5); // Minimum version of PHP required by module
|
||||||
$this->need_dolibarr_version = array(8,0); // Minimum version of Dolibarr required by module
|
$this->need_dolibarr_version = array(11,-3); // Minimum version of Dolibarr required by module
|
||||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
$this->warnings_activation = 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->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||||
//$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
//$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||||
@ -183,25 +183,25 @@ class modMyModule extends DolibarrModules
|
|||||||
$this->dictionaries=array();
|
$this->dictionaries=array();
|
||||||
/* Example:
|
/* Example:
|
||||||
$this->dictionaries=array(
|
$this->dictionaries=array(
|
||||||
'langs'=>'mylangfile@mymodule',
|
'langs'=>'mymodule@mymodule',
|
||||||
// List of tables we want to see into dictonnary editor
|
// List of tables we want to see into dictonnary editor
|
||||||
'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"),
|
'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"),
|
||||||
// Label of tables
|
// Label of tables
|
||||||
'tablib'=>array("Table1","Table2","Table3"),
|
'tablib'=>array("Table1", "Table2", "Table3"),
|
||||||
// Request to select fields
|
// Request to select fields
|
||||||
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
|
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
|
||||||
// Sort order
|
// Sort order
|
||||||
'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
|
'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
|
||||||
// List of fields (result of select to show dictionary)
|
// List of fields (result of select to show dictionary)
|
||||||
'tabfield'=>array("code,label","code,label","code,label"),
|
'tabfield'=>array("code,label", "code,label", "code,label"),
|
||||||
// List of fields (list of fields to edit a record)
|
// List of fields (list of fields to edit a record)
|
||||||
'tabfieldvalue'=>array("code,label","code,label","code,label"),
|
'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
|
||||||
// List of fields (list of fields for insert)
|
// List of fields (list of fields for insert)
|
||||||
'tabfieldinsert'=>array("code,label","code,label","code,label"),
|
'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
|
||||||
// Name of columns with primary key (try to always name it 'rowid')
|
// Name of columns with primary key (try to always name it 'rowid')
|
||||||
'tabrowid'=>array("rowid","rowid","rowid"),
|
'tabrowid'=>array("rowid", "rowid", "rowid"),
|
||||||
// Condition to show each dictionary
|
// Condition to show each dictionary
|
||||||
'tabcond'=>array($conf->mymodule->enabled,$conf->mymodule->enabled,$conf->mymodule->enabled)
|
'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled)
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -246,18 +246,18 @@ class modMyModule extends DolibarrModules
|
|||||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Read objects of MyModule'; // Permission label
|
$this->rights[$r][1] = 'Read objects of MyModule'; // Permission label
|
||||||
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Create/Update objects of MyModule'; // Permission label
|
$this->rights[$r][1] = 'Create/Update objects of MyModule'; // Permission label
|
||||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||||
$this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label
|
$this->rights[$r][1] = 'Delete objects of MyModule'; // Permission label
|
||||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][4] = 'myobject'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
|
||||||
$r++;
|
$r++;
|
||||||
/* END MODULEBUILDER PERMISSIONS */
|
/* END MODULEBUILDER PERMISSIONS */
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ class modMyModule extends DolibarrModules
|
|||||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>1000+$r,
|
'position'=>1000+$r,
|
||||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||||
);
|
);
|
||||||
@ -284,6 +284,20 @@ class modMyModule extends DolibarrModules
|
|||||||
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
|
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
|
||||||
$this->menu[$r++]=array(
|
$this->menu[$r++]=array(
|
||||||
'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
|
'type'=>'left', // This is a Top menu entry
|
||||||
|
'titre'=>'MyObject',
|
||||||
|
'mainmenu'=>'mymodule',
|
||||||
|
'leftmenu'=>'myobject',
|
||||||
|
'url'=>'/mymodule/mymoduleindex.php',
|
||||||
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
|
'position'=>1000+$r,
|
||||||
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
|
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
|
'target'=>'',
|
||||||
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
);
|
||||||
|
$this->menu[$r++]=array(
|
||||||
|
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
'type'=>'left', // This is a Left menu entry
|
'type'=>'left', // This is a Left menu entry
|
||||||
'titre'=>'List MyObject',
|
'titre'=>'List MyObject',
|
||||||
'mainmenu'=>'mymodule',
|
'mainmenu'=>'mymodule',
|
||||||
@ -292,12 +306,12 @@ class modMyModule extends DolibarrModules
|
|||||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>1000+$r,
|
'position'=>1000+$r,
|
||||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||||
);
|
);
|
||||||
$this->menu[$r++]=array(
|
$this->menu[$r++]=array(
|
||||||
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
'type'=>'left', // This is a Left menu entry
|
'type'=>'left', // This is a Left menu entry
|
||||||
'titre'=>'New MyObject',
|
'titre'=>'New MyObject',
|
||||||
'mainmenu'=>'mymodule',
|
'mainmenu'=>'mymodule',
|
||||||
@ -306,7 +320,7 @@ class modMyModule extends DolibarrModules
|
|||||||
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
'position'=>1000+$r,
|
'position'=>1000+$r,
|
||||||
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
'perms'=>'$user->rights->mymodule->myobject->write', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||||
);
|
);
|
||||||
|
|||||||
@ -105,10 +105,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
|||||||
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
|
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
|
||||||
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||||
|
|
||||||
$permissionnote=$user->rights->mymodule->write; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $user->rights->mymodule->write; // Used by the include of actions_setnotes.inc.php
|
||||||
$permissiondellink=$user->rights->mymodule->write; // Used by the include of actions_dellink.inc.php
|
$permissiondellink = $user->rights->mymodule->write; // Used by the include of actions_dellink.inc.php
|
||||||
$permissionedit=$user->rights->mymodule->write; // Used by the include of actions_lineupdown.inc.php
|
$permissionedit = $user->rights->mymodule->write; // Used by the include of actions_lineupdown.inc.php
|
||||||
$permissiontoadd=$user->rights->mymodule->write; // Used by the include of actions_addupdatedelete.inc.php
|
$permissiontoadd = $user->rights->mymodule->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||||
|
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -124,10 +125,10 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
|
|
||||||
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
|
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
|
||||||
if (empty($backtopage)) {
|
|
||||||
if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
|
if (empty($backtopage) || ($cancel && empty($id))) {
|
||||||
|
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
|
||||||
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||||
}
|
}
|
||||||
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||||
@ -141,6 +142,18 @@ if (empty($reshook))
|
|||||||
// Actions when printing a doc from card
|
// Actions when printing a doc from card
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
// Action to move up and down lines of object
|
||||||
|
//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
|
if ($action == 'set_thirdparty' && $permissiontoadd)
|
||||||
|
{
|
||||||
|
$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY');
|
||||||
|
}
|
||||||
|
if ($action == 'classin' && $permissiontoadd)
|
||||||
|
{
|
||||||
|
$object->setProject(GETPOST('projectid', 'int'));
|
||||||
|
}
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$trigger_name='MYOBJECT_SENTBYMAIL';
|
$trigger_name='MYOBJECT_SENTBYMAIL';
|
||||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||||
@ -226,7 +239,7 @@ if (($id || $ref) && $action == 'edit')
|
|||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border centpercent tableforfieldcreate">'."\n";
|
print '<table class="border centpercent tableforfieldedit">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
|
||||||
@ -309,7 +322,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', 0, 1);
|
||||||
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', null, null, '', 1);
|
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mymodule->creer, 'string', '', null, null, '', 1);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
@ -354,6 +367,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
//$keyforbreak='fieldkeytoswitchonsecondcolumn';
|
//$keyforbreak='fieldkeytoswitchonsecondcolumn';
|
||||||
|
//unset($object->fields['fk_project']); // Hide field already shown in banner
|
||||||
|
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
||||||
|
|||||||
@ -53,11 +53,6 @@ $confirm=GETPOST('confirm');
|
|||||||
$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
|
$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
|
|
||||||
// Security check - Protection if external user
|
|
||||||
//if ($user->societe_id > 0) access_forbidden();
|
|
||||||
//if ($user->societe_id > 0) $socid = $user->societe_id;
|
|
||||||
//$result = restrictedArea($user, 'mymodule', $id);
|
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
@ -84,6 +79,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
|||||||
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->id);
|
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->id);
|
||||||
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->ref);
|
if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->ref);
|
||||||
|
|
||||||
|
// Security check - Protection if external user
|
||||||
|
//if ($user->societe_id > 0) access_forbidden();
|
||||||
|
//if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||||
|
//$result = restrictedArea($user, 'mymodule', $object->id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -360,7 +360,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/mymodule/myobject_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->mymodule->write);
|
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->mymodule->write);
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
|
|||||||
56
htdocs/mrp/ajax/ajax_bom.php
Normal file
56
htdocs/mrp/ajax/ajax_bom.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2019 Laurent Destailleur (eldy) <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* 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 htdocs/mrp/ajax/ajax.php
|
||||||
|
* \brief Ajax search component for Mrp. It get BOM content.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||||
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||||
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||||
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||||
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||||
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||||
|
|
||||||
|
require '../../main.inc.php'; // Load $user and permissions
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
||||||
|
|
||||||
|
$idbom = GETPOST('idbom', 'alpha');
|
||||||
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$object = new BOM($db);
|
||||||
|
$result=$object->fetch($idbom);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
// We remove properties we don't need in answer
|
||||||
|
unset($object->fields);
|
||||||
|
unset($object->db);
|
||||||
|
echo json_encode($object);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo 'Failed to load category with id='.$idbom;
|
||||||
|
}
|
||||||
@ -96,19 +96,19 @@ class Mo extends CommonObject
|
|||||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>-1, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,),
|
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>-1, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,),
|
||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
||||||
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'index'=>1, 'comment'=>"Qty to produce",),
|
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'index'=>1, 'comment'=>"Qty to produce",),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
||||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,),
|
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,),
|
||||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
|
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
|
||||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,),
|
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,),
|
||||||
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
|
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',),
|
||||||
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
|
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
|
||||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",),
|
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",),
|
||||||
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
|
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'),
|
||||||
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
|
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
|
||||||
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",),
|
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
|
||||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'Done', '-1'=>'Canceled')),
|
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'Done', '-1'=>'Canceled')),
|
||||||
);
|
);
|
||||||
public $rowid;
|
public $rowid;
|
||||||
@ -475,7 +475,7 @@ class Mo extends CommonObject
|
|||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("Mo") . '</u>';
|
$label = '<u>' . $langs->trans("MO") . '</u>';
|
||||||
$label.= '<br>';
|
$label.= '<br>';
|
||||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||||
|
|
||||||
@ -553,34 +553,10 @@ class Mo extends CommonObject
|
|||||||
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 0)
|
$statusType = 'status'.$status;
|
||||||
{
|
//if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
|
||||||
return $this->labelstatus[$status];
|
|
||||||
}
|
return dolGetStatus($this->labelstatus[$status], $this->labelstatus[$status], '', $statusType, $mode);
|
||||||
elseif ($mode == 1)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 2)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 3)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
elseif ($mode == 4)
|
|
||||||
{
|
|
||||||
return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
|
||||||
}
|
|
||||||
elseif ($mode == 5)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
elseif ($mode == 6)
|
|
||||||
{
|
|
||||||
return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -36,11 +36,16 @@ function moPrepareHead($object)
|
|||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = dol_buildpath("/mrp/mo_card.php", 1).'?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Card");
|
$head[$h][1] = $langs->trans("Card");
|
||||||
$head[$h][2] = 'card';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/mrp/mo_production.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Production");
|
||||||
|
$head[$h][2] = 'production';
|
||||||
|
$h++;
|
||||||
|
|
||||||
if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
|
if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
|
||||||
{
|
{
|
||||||
$nbNote = 0;
|
$nbNote = 0;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user