Merge pull request #1 from Dolibarr/develop

sync 20191022
This commit is contained in:
Cédric 2019-10-22 12:47:25 +02:00 committed by GitHub
commit 07bb968a9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 849 additions and 630 deletions

View File

@ -30,7 +30,7 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
The unit were not saved correctly in database making calculation on shipments wrong.
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to this version.
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to one of this version.
Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored.
FIX: #11702
@ -42,6 +42,7 @@ FIX: #12041
FIX: #12054
FIX: #12083
FIX: #12088
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: Alias name is not into the email recipient label.
FIX: allow standalone credit note even if no invoice
@ -92,6 +93,9 @@ FIX: Update of leave request when CSRF with token is on
FIX: Var not enough sanitized
FIX: wrong test
FIX: XSS
FIX: Payment from POS ware not recorded.
FIX: Can validate invoice with amount including tax of zero for the case of having a final invoice with
VAT that includes a deposit without vat.
***** ChangeLog for 10.0.2 compared to 10.0.1 *****
FIX: #10460 compatibility with MariaDB 10.4

View File

@ -152,7 +152,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$result=$object->create($fuser);
if ($result >= 0)
{

View File

@ -176,7 +176,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
$fuser = new User($db);
$fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$object->contactid = $contids[$socids[$socid]][0];
$object->socid = $socids[$socid];
$object->datep = $dates[mt_rand(1, count($dates)-1)];
@ -200,7 +200,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
}
$xnbp++;
}
$result=$object->valid($fuser);
if ($result > 0)
{

View File

@ -201,7 +201,7 @@
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="true"/>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">

View File

@ -29,6 +29,7 @@
require '../../main.inc.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/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
// Load translation files required by the page
@ -65,6 +66,8 @@ $year_current = $year_start;
// Validate History
$action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
/*
* Actions
@ -101,7 +104,7 @@ if ($action == 'validatehistory') {
$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
if ($db->type == 'pgsql') {
/*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$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";
@ -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 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$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');
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
$result = $db->query($sql);
if (! $result) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
} 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();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
}

View File

@ -358,6 +358,7 @@ if ($result) {
// Ref Invoice
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
// Date invoice
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// 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>' . $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>';

View File

@ -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.= " 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.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 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 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";
// Add search filter like
@ -247,7 +247,7 @@ if (strlen(trim($search_account))) {
$sql .= natural_search("aa.account_number", $search_account);
}
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);
if (strlen(trim($search_country))) {
@ -406,7 +406,7 @@ if ($result) {
$isSellerInEEC = isInEEC($mysoc);
while ( $i < min($num_lines, $limit) ) {
while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result);
$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 '</td>';
// Country
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;
print $labelcountry;

View File

@ -27,6 +27,7 @@
require '../../main.inc.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/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
// Load translation files required by the page
@ -63,6 +64,7 @@ $year_current = $year_start;
// Validate History
$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();
// 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 .= " 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";
@ -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 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
$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');
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
$result = $db->query($sql);
if (! $result) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
} 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();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
}

View File

@ -367,6 +367,7 @@ if ($result) {
print $objp->invoice_label;
print '</td>';
// Date invoice
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// 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>' . $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>';

View File

@ -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.= " 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.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.= " AND l.product_type <= 2";
// Add search filter like
@ -307,8 +307,8 @@ if ($result) {
$arrayofselected=is_array($toselect)?$toselect:array();
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
if ($search_day) $param.='&search_day='.urlencode($search_day);
if ($search_month) $param.='&search_month='.urlencode($search_month);
@ -463,7 +463,7 @@ if ($result) {
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product
// Ref Product
print '<td>';
if ($product_static->id > 0)
print $product_static->getNomUrl(1);
@ -471,7 +471,7 @@ if ($result) {
print '</td>';
// Description
print '<td>';
print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);

View File

@ -476,7 +476,7 @@ if (! empty($conf->barcode->enabled)) {
}
// 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 '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';
@ -493,7 +493,7 @@ print '</td></tr></table>';
print '</td></tr>';
// 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 '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';

View File

@ -65,27 +65,27 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
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_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"), '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_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", 'alphanohtml'), '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
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"), '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_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"), '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_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), '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_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"), '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", 'int'), '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", 'alphanohtml'), '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", 'int'), '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_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN"), '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_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY"), '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", 'alphanohtml'), '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", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
// 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_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), '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_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'), '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", 'alphanohtml'), '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', 'alphanohtml'), 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
@ -101,8 +101,8 @@ $mode='emailfortest';
$trackid=(($action == 'testhtml')?"testhtml":"test");
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test';
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->fromid=$user->id;
$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->withsubstit=1;
$formmail->withfrom=1;
@ -847,7 +847,7 @@ else
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
// Init list of files
if (GETPOST("mode")=='init')
if (GETPOST("mode", "aZ09")=='init')
{
$formmail->clear_attached_files();
}

View File

@ -290,6 +290,7 @@ class DolibarrApi
if (count($tmp) < 3) return '';
$tmpescaped=$tmp[2];
$regbis = array();
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
{
$tmpescaped = "'".$db->escape($regbis[1])."'";

View File

@ -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
$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
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
/*
@ -93,11 +94,11 @@ if (empty($reshook))
{
$error=0;
$permissiontoadd = $user->rights->bom->write;
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$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__');
}
$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(), '');
print '<table class="border centpercent">'."\n";
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
@ -252,7 +253,9 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
print '<table class="border centpercent">'."\n";
//$object->fields['keyfield']['disabled'] = 1;
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';

View File

@ -454,12 +454,12 @@ while ($i < min($num, $limit))
$cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';

View File

@ -100,7 +100,7 @@ class Boms extends DolibarrApi
$obj_ret = array();
$tmpobject = new BOM($db);
$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
$restrictonsocid = 0; // Set to 1 if there is a field socid in table of object

View File

@ -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',),
'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,),
'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'),
'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'),

View File

@ -92,9 +92,9 @@ $coldisplay++;
echo $line->efficiency;
print '</td>';
if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) {
print '<td class="linecoledit center">';
$coldisplay++;
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines' ) {
print '<td class="linecoledit center">';
$coldisplay++;
if (($line->info_bits & 2) == 2 || ! empty($disableedit)) {
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">'.img_edit().'</a>';

View File

@ -1543,7 +1543,7 @@ class ActionComm extends CommonObject
$event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"];
$event['type']=$type;
$datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600));
// fix for -> Warning: A non-numeric value encountered
if(is_numeric($this->db->jdate($obj->datep2)))
{

View File

@ -58,11 +58,11 @@ if ($object->fetch($id) >= 0)
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="underbanner clearboth"></div><br>';
//print '<table width="100%"><tr><td>';
$object->user_creation=$object->user_creat;
$object->date_creation=$object->date_creat;
@ -70,7 +70,7 @@ if ($object->fetch($id) >= 0)
$object->date_validation=$object->date_valid;
dol_print_object_info($object, 0);
//print '</td></tr></table>';
dol_fiche_end();
}

View File

@ -47,15 +47,15 @@ if ($id)
$object = new Deplacement($db);
$object->fetch($id);
$object->info($id);
$head = trip_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip');
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
}

View File

@ -278,8 +278,11 @@ if (empty($reshook))
$action = '';
}
} else {
// Si non avoir, le signe doit etre positif
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) {
// If not a credit note, amount with tax must be positive or nul.
// Note that amount excluding tax can be negative because you can have a invoice of 100 with vat of 20 that
// consumes a credit note of 100 with vat 0 (total with tax is 0 but without tax is -20).
// For some cases, credit notes can have a vat of 0 (for example when selling goods in France).
if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ttc < 0) {
setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors');
$action = '';
}
@ -2563,6 +2566,7 @@ $form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$formmargin = new FormMargin($db);
$soc = new Societe($db);
$paymentstatic=new Paiement($db);
$bankaccountstatic = new Account($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
@ -2583,7 +2587,6 @@ if ($action == 'create')
print load_fiche_titre($langs->trans('NewBill'), '', 'invoicing');
$soc = new Societe($db);
if ($socid > 0)
$res = $soc->fetch($socid);
@ -3462,7 +3465,6 @@ elseif ($id > 0 || ! empty($ref))
$result = $object->fetch_thirdparty();
$soc = new Societe($db);
$result=$soc->fetch($object->socid);
if ($result < 0) dol_print_error($db);
$selleruserevenustamp = $mysoc->useRevenueStamp();

View File

@ -34,7 +34,7 @@ class Cpaiement
* @var string Id to identify managed objects
*/
public $element = 'cpaiement';
/**
* @var string Name of table without prefix where object is stored
*/

View File

@ -114,7 +114,7 @@ if ($object->id)
$morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
$morehtmlref.='</div>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/index.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/tva/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status

View File

@ -628,7 +628,7 @@ class Contact extends CommonObject
if ($this->birthday_alert)
{
//check existing
$sql_check = "SELECT * FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
$sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
$result_check = $this->db->query($sql_check);
if (! $result_check || ($this->db->num_rows($result_check)<1))
{

View File

@ -32,6 +32,8 @@
if ($cancel)
{
/*var_dump($cancel);
var_dump($backtopage);exit;*/
if (! empty($backtopage))
{
header("Location: ".$backtopage);
@ -80,7 +82,8 @@ if ($action == 'add' && ! empty($permissiontoadd))
if ($result > 0)
{
// 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);
exit;
}

View File

@ -71,7 +71,9 @@ if (! $error && $massaction == 'confirm_presend')
$listofobjectid=array();
$listofobjectthirdparties=array();
$listofobjectcontacts = array();
$listofobjectref=array();
$contactidtosend=array();
$attachedfilesThirdpartyObj=array();
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
@ -97,11 +99,21 @@ if (! $error && $massaction == 'confirm_presend')
if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user;
if (empty($thirdpartyid)) $thirdpartyid=0;
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
}
}
}
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;
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
}
}
}
// Check mandatory parameters
if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email))
@ -248,6 +260,21 @@ if (! $error && $massaction == 'confirm_presend')
$fuser->fetch($objectobj->fk_user);
$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
{
$objectobj->fetch_thirdparty();
@ -498,8 +525,8 @@ if (! $error && $massaction == 'confirm_presend')
}
$actionmsg2='';
// Initialisation donnees
$objectobj2->sendtoid = 0;
// Initialisation donnees
$objectobj2->sendtoid = (empty($contactidtosend)?0:$contactidtosend);
$objectobj2->actionmsg = $actionmsg; // Long text
$objectobj2->actionmsg2 = $actionmsg2; // Short text
$objectobj2->fk_element = $objid2;

View File

@ -5556,16 +5556,20 @@ abstract class CommonObject
$type='';
$param = array();
$param['options']=array();
$size =$this->fields[$key]['size'];
$reg=array();
$size = $this->fields[$key]['size'];
// Because we work on extrafields
if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){
$param['options']=array($reg[1].':'.$reg[2]=>'N');
$type ='link';
} elseif(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)) {
$param['options']=array($reg[1].':'.$reg[2]=>'N');
if (preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){
$param['options']=array($reg[2].':'.$reg[3].':'.$reg[4].':'.$reg[5] => 'N');
$type ='link';
} elseif (preg_match('/^(integer|link):(.*):(.*):(.*)/i', $val['type'], $reg)){
$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';
} 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';
} elseif(preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) {
$param['options']=array();
@ -6078,16 +6082,26 @@ abstract class CommonObject
}
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);
$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
{
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);
else $url_path=dol_buildpath(dirname(dirname($classfile)).'/'.$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>';
// TODO Add Javascript code to add input fields contents to new elements urls
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]);
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)).'/'.strtolower($class).'_card.php', 1);
$paramforthenewlink = '';
$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')
@ -6167,6 +6181,7 @@ abstract class CommonObject
$label = $val['label'];
$type = $val['type'];
$size = $val['css'];
$reg = array();
// Convert var to be able to share same code than showOutputField of extrafields
if (preg_match('/varchar\((\d+)\)/', $type, $reg))
@ -6182,7 +6197,9 @@ abstract class CommonObject
$computed=$val['computed'];
$unique=$val['unique'];
$required=$val['required'];
$param=$val['param'];
$param=array();
$param['options']=array();
if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
{

View File

@ -234,8 +234,6 @@ class CUnits // extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$records=array();
$sql = 'SELECT';
$sql.= " t.rowid,";
$sql.= " t.code,";
@ -273,6 +271,7 @@ class CUnits // extends CommonObject
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit, $offset);
}
$resql = $this->db->query($sql);
if ($resql) {
$this->records=array();

View File

@ -91,13 +91,15 @@ class DiscountAbsolute
public $fk_facture;
/**
* @var int ID credit note having caused the discount
* @var int ID credit note or deposit used to create the discount
*/
public $fk_facture_source;
public $ref_facture_source; // Ref credit note or deposit used to create the discount
public $type_facture_source;
public $ref_facture_source; // Ref credit note having caused the discount
public $ref_invoice_supplier_source;
public $fk_invoice_supplier_source;
public $ref_invoice_supplier_source; // Ref credit note or deposit used to create the discount
public $type_invoice_supplier_source;
/**
* Constructor
@ -135,11 +137,12 @@ class DiscountAbsolute
$sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,";
$sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,";
$sql.= " sr.datec,";
$sql.= " f.ref as ref_facture_source, fsup.ref as ref_invoice_supplier_source";
$sql.= " f.ref as ref_facture_source, f.type as type_facture_source,";
$sql.= " fsup.ref as ref_invoice_supplier_source, fsup.type as type_invoice_supplier_source";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";
$sql.= " WHERE sr.entity IN (".getEntity('invoice').")";
$sql.= " WHERE sr.entity IN (".getEntity('invoice').")";
if ($rowid) $sql.= " AND sr.rowid=".$rowid;
if ($fk_facture_source) $sql.= " AND sr.fk_facture_source=".$fk_facture_source;
if ($fk_invoice_supplier_source) $sql.= " AND sr.fk_invoice_supplier_source=".$fk_invoice_supplier_source;
@ -168,12 +171,14 @@ class DiscountAbsolute
$this->fk_user = $obj->fk_user;
$this->fk_facture_line = $obj->fk_facture_line;
$this->fk_facture = $obj->fk_facture;
$this->fk_facture_source = $obj->fk_facture_source; // Id avoir source
$this->ref_facture_source = $obj->ref_facture_source; // Ref avoir source
$this->fk_facture_source = $obj->fk_facture_source; // Id credit note or deposit source
$this->ref_facture_source = $obj->ref_facture_source; // Ref credit note or deposit source
$this->type_facture_source = $obj->type_facture_source; // Type credit note or deposit source
$this->fk_invoice_supplier_line = $obj->fk_invoice_supplier_line;
$this->fk_invoice_supplier = $obj->fk_invoice_supplier;
$this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id avoir source
$this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref avoir source
$this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id credit note or deposit source
$this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref credit note or deposit source
$this->type_invoice_supplier_source = $obj->type_invoice_supplier_source; // Type credit note or deposit source
$this->description = $obj->description;
$this->datec = $this->db->jdate($obj->datec);
@ -688,7 +693,7 @@ class DiscountAbsolute
if ($option == 'invoice') {
$facid=! empty($this->discount_type)?$this->fk_invoice_supplier_source:$this->fk_facture_source;
$link=! empty($this->discount_type)?'/fourn/facture/card.php':'/compta/facture/card.php';
$label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source;
$label=$langs->trans("ShowSourceInvoice").': '.$this->ref_facture_source;
$link = '<a href="'.DOL_URL_ROOT.$link.'?facid='.$facid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$ref=! empty($this->discount_type)?$this->ref_invoice_supplier_source:$this->ref_facture_source;

View File

@ -5614,7 +5614,7 @@ class Form
};
var d = new Date();";
}
// Generate the date part, depending on the use or not of the javascript calendar
if($addnowlink==1) // server time expressed in user time setup
{
@ -5815,7 +5815,7 @@ class Form
* Generic method to select a component from a combo list.
* 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 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', ...)
@ -5824,10 +5824,11 @@ class Form
* @param string $morecss More CSS
* @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 $disabled 1=Html component is disabled
* @return string Return HTML string
* @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;
@ -5836,12 +5837,16 @@ class Form
$InfoFieldList = explode(":", $objectdesc);
$classname=$InfoFieldList[0];
$classpath=$InfoFieldList[1];
$addcreatebuttonornot=empty($InfoFieldList[2])?0:$InfoFieldList[2];
$filter=empty($InfoFieldList[3])?'':$InfoFieldList[3];
if (! empty($classpath))
{
dol_include_once($classpath);
if ($classname && class_exists($classname))
{
$objecttmp = new $classname($this->db);
$objecttmp->filter = $filter;
}
}
if (! is_object($objecttmp))
@ -5854,12 +5859,12 @@ class Form
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$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='';
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';
// No immediate load of all database
@ -5868,22 +5873,50 @@ class Form
$out.= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
$out.= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
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
{
// Immediate load of all database
$out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo);
// Immediate load of table record. Note: filter is inside $objecttmp->filter
$out.=$this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled);
}
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.
* 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 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', ...)
@ -5893,13 +5926,16 @@ class Form
* @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 $outputmode 0=HTML select string, 1=Array
* @param int $disabled 1=Html component is disabled
* @return string Return HTML string
* @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;
//print "$objecttmp->filter, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0, $disabled";
$prefixforautocompletemode=$objecttmp->element;
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company';
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
@ -5923,19 +5959,28 @@ class Form
// Search data
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t";
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";
if(! empty($objecttmp->ismultientitymanaged)) $sql.= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->societe_id))
{
if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->societe_id;
else $sql.= " AND t.fk_soc = ".$user->societe_id;
if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->socid)) {
if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->socid;
else $sql.= " AND t.fk_soc = ".$user->socid;
}
if ($searchkey != '') $sql.=natural_search(explode(',', $fieldstoshow), $searchkey);
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 ($objecttmp->ismultientitymanaged == 2) {
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->plimit($limit, 0);
//print $sql;
// Build output string
$resql=$this->db->query($sql);
@ -5948,7 +5993,7 @@ class Form
}
// 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 '&nbsp;' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
$textifempty='&nbsp;';

View File

@ -231,10 +231,10 @@ class FormFile
if (empty($usewithoutform))
{
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">'."\n";
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">'."\n";
}
$out .= '<div class="valignmiddle">';
@ -1168,6 +1168,7 @@ class FormFile
if (GETPOST('action', 'aZ09') == 'editfile' && $permtoeditline)
{
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="id" value="'.$object->id.'">';
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
@ -1485,6 +1486,7 @@ class FormFile
if (! empty($addfilterfields))
{
print '<form action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="module" value="'.$modulepart.'">';
}
@ -1772,10 +1774,13 @@ class FormFile
$res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder);
$param .= (isset($object->id)?'&id=' . $object->id : '');
print '<!-- listOfLinks -->'."\n";
// Show list of associated links
print load_fiche_titre($langs->trans("LinkedFiles"));
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 '<tr class="liste_titre">';

View File

@ -3900,4 +3900,4 @@ class lessc_formatter_lessjs extends lessc_formatter_classic {
public $breakSelectors = true;
public $assignSeparator = ": ";
public $selectorSeparator = ",";
}
}

View File

@ -496,10 +496,10 @@ class SMTPs
return $_retVal;
}
}
// Default authentication method is LOGIN
if (empty($conf->global->MAIL_SMTP_AUTH_TYPE)) $conf->global->MAIL_SMTP_AUTH_TYPE = 'LOGIN';
// Send Authentication to Server
// Check for errors along the way
switch ($conf->global->MAIL_SMTP_AUTH_TYPE) {

View File

@ -586,18 +586,18 @@ class Translate
/**
* 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
* et si toujours pas trouve, il est retourne tel quel
* Les parametres de cette methode peuvent contenir de balises HTML.
* If there is no match for this text, we look in alternative file and if still not found,
* it is returned as it is
* The parameters of this method can contain HTML tags
*
* @param string $key Key to translate
* @param string $param1 chaine de param1
* @param string $param2 chaine de param2
* @param string $param3 chaine de param3
* @param string $param4 chaine de param4
* @param string $param1 param1 string
* @param string $param2 param2 string
* @param string $param3 param3 string
* @param string $param4 param4 string
* @param int $maxsize Max length of text
* @return string Translated string (encoded into HTML entities and UTF8)
*/
*/
public function trans($key, $param1 = '', $param2 = '', $param3 = '', $param4 = '', $maxsize = 0)
{
global $conf;
@ -647,9 +647,9 @@ class Translate
/**
* Return translated value of a text string
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
* et si toujours pas trouve, il est retourne tel quel.
* Parameters of this method must not contains any HTML tags.
* If there is no match for this text, we look in alternative file and if still not found
* it is returned as is.
* Parameters of this method must not contain any HTML tags.
*
* @param string $key Key to translate
* @param string $param1 chaine de param1
@ -667,9 +667,9 @@ class Translate
/**
* Return translated value of a text string
* Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
* et si toujours pas trouve, il est retourne tel quel.
* No convert to encoding charset of lang object is done.
* If there is no match for this text, we look in alternative file and if still not found,
* it is returned as is.
* No conversion to encoding charset of lang object is done.
* Parameters of this method must not contains any HTML tags.
*
* @param string $key Key to translate
@ -781,7 +781,7 @@ class Translate
if (preg_match('/^[a-z]+_[A-Z]+/i', $dir))
{
$this->load("languages");
if (! empty($conf->global->MAIN_LANGUAGES_ALLOWED) && ! in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED)) ) continue;
if ($usecode == 2)

View File

@ -1004,7 +1004,7 @@ class Utils
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
$sql='SELECT * FROM '.$table;
$sql='SELECT * FROM '.$table; // Here SELECT * is allowed because we don't have definition of columns to take
$result = $db->query($sql);
while($row = $db->fetch_row($result))
{

View File

@ -5924,7 +5924,19 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__';
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
$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_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__';
}
if (! empty($conf->adherent->enabled))
{
@ -6013,14 +6025,38 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:'');
$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_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)
{
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
$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_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)
@ -7927,7 +7963,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield
if (!isset($dictvalues[$tablename]))
{
$dictvalues[$tablename] = array();
$sql = 'SELECT * FROM '.$tablename.' WHERE 1';
$sql = 'SELECT * FROM '.$tablename.' WHERE 1'; // Here select * is allowed as it is generic code and we don't have list of fields
if ($checkentity) $sql.= ' AND entity IN (0,'.getEntity($tablename).')';
$resql = $db->query($sql);

View File

@ -136,14 +136,14 @@ function invoice_admin_prepare_head()
$head[$h][1] = $langs->trans("Payments");
$head[$h][2] = 'payment';
$h++;
if($conf->global->INVOICE_USE_SITUATION){
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -40,7 +40,7 @@ function loan_prepare_head($object)
$head[$tab][1] = $langs->trans('Card');
$head[$tab][2] = 'card';
$tab++;
$head[$tab][0] = DOL_URL_ROOT.'/loan/schedule.php?loanid='.$object->id;
$head[$tab][1] = $langs->trans('FinancialCommitment');
$head[$tab][2] = 'FinancialCommitment';

View File

@ -127,7 +127,7 @@ function member_type_prepare_head(AdherentType $object)
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS))
{

View File

@ -55,7 +55,7 @@ function dol_setcache($memoryid, $data)
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$dolmemcache->add($memoryid, $data); // This fails if key already exists
@ -79,7 +79,7 @@ function dol_setcache($memoryid, $data)
$result=$dolmemcache->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result=$dolmemcache->add($memoryid, $data); // This fails if key already exists
@ -122,7 +122,7 @@ function dol_getcache($memoryid)
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
//print "Get memoryid=".$memoryid;
@ -149,7 +149,7 @@ function dol_getcache($memoryid)
$result=$m->addServer($tmparray[0], $tmparray[1]?$tmparray[1]:11211);
if (! $result) return -1;
}
$memoryid=session_name().'_'.$memoryid;
//$m->setOption(Memcached::OPT_COMPRESSION, false);
$data=$m->get($memoryid);

View File

@ -113,7 +113,7 @@ class MenuManager
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu);
$this->tabMenu=$tabMenu;
//var_dump($tabMenu);
//if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; }
}
@ -152,7 +152,7 @@ class MenuManager
if ($mode == 'top') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0);
if ($mode == 'left') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
}
if ($mode == 'topnb')
{
print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
@ -327,7 +327,7 @@ class MenuManager
}
unset($this->menu);
//print 'xx'.$mode;
return 0;
}

View File

@ -65,7 +65,7 @@ class MenuManager
public function loadMenu($forcemainmenu = '', $forceleftmenu = '')
{
global $conf, $user, $langs;
// On sauve en session le menu principal choisi
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];

View File

@ -25,7 +25,7 @@
/**
* \file htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
* \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/lib/company.lib.php';
@ -142,7 +142,7 @@ class pdf_soleil extends ModelePDFFicheinter
$this->option_condreg = 0; // Display payment terms
$this->option_codeproduitservice = 0; // Display product-service code
$this->option_multilang = 1; // Available in several languages
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
// Get source company
$this->emetteur=$mysoc;
@ -266,7 +266,7 @@ class pdf_soleil extends ModelePDFFicheinter
$tab_height = 130;
$tab_height_newpage = 150;
// Affiche notes
// Display notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
if ($notetoshow)
{
@ -394,7 +394,7 @@ class pdf_soleil extends ModelePDFFicheinter
$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
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);
}
//Prepare la suite
//Prepare next
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);

View File

@ -82,7 +82,7 @@ class mod_arctic extends ModeleNumRefFicheinter
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard"));
$tooltip.=$langs->trans("GenericMaskCodes5");
// Parametrage du prefix
// Setting the prefix
$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>';
@ -130,7 +130,7 @@ class mod_arctic extends ModeleNumRefFicheinter
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;
if (! $mask)

View File

@ -182,7 +182,9 @@ class modExpenseReport extends DolibarrModules
$this->export_permission[$r]=array(array("expensereport","export"));
$this->export_fields_array[$r]=array(
'd.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove',
'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic',
'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC',
'd.fk_statut'=>'Status','d.paid'=>'Paid',
'd.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','d.detail_cancel'=>'MOTIF_CANCEL','d.detail_refuse'=>'MOTIF_REFUS',
'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate',
'ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref',
'user_rib.iban_prefix' => 'IBAN', 'user_rib.bic' => 'BIC', 'user_rib.code_banque' => 'BankCode', 'user_rib.bank' => 'BankName', 'user_rib.proprio' => 'BankAccountOwner',
@ -190,7 +192,9 @@ class modExpenseReport extends DolibarrModules
);
$this->export_TypeFields_array[$r]=array(
'd.rowid'=>"Numeric",'d.ref'=>'Text','d.date_debut'=>'Date','d.date_fin'=>'Date','d.date_create'=>'Date','d.date_approve'=>'Date',
'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric','d.note_private'=>'Text','d.note_public'=>'Text',
'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric',
'd.fk_statut'=>"Numeric",'d.paid'=>'Numeric',
'd.note_private'=>'Text','d.note_public'=>'Text','d.detail_cancel'=>'Text','d.detail_refuse'=>'Text',
'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'ed.rowid'=>'Numeric','tf.code'=>'Code','ed.date'=>'Date','ed.tva_tx'=>'Numeric',
'ed.total_ht'=>'Numeric','ed.total_tva'=>'Numeric','ed.total_ttc'=>'Numeric','ed.comments'=>'Text','p.rowid'=>'Numeric','p.ref'=>'Text',
'user_rib.iban_prefix' => 'Text', 'user_rib.bic' => 'Text', 'user_rib.code_banque' => 'Text', 'user_rib.bank' => 'Text', 'user_rib.proprio' => 'Text',

View File

@ -85,7 +85,7 @@ class modProduct extends DolibarrModules
$this->const[$r][3] = 'Module to control product codes';
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "PRODUCT_PRICE_UNIQ";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "1";
@ -390,7 +390,7 @@ class modProduct extends DolibarrModules
'p.length' => "Length",
'p.length_units' => "LengthUnit",
'p.width' => "Width",
'p.width_units' => "VolumeUnits",
'p.width_units' => "WidthUnits",
'p.height' => "Height",
'p.height_units' => "HeightUnit",
'p.surface' => "Surface",

View File

@ -360,7 +360,7 @@ class modService extends DolibarrModules
'p.length' => "Length",
'p.length_units' => "LengthUnit",
'p.width' => "Width",
'p.width_units' => "VolumeUnits",
'p.width_units' => "WidthUnits",
'p.height' => "Height",
'p.height_units' => "HeightUnit",
'p.surface' => "Surface",

View File

@ -198,7 +198,7 @@ class pdf_cyan extends ModelePDFPropales
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
// Translations
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "propal"));

View File

@ -50,7 +50,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_
$value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1);
//var_dump($value);
}
print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey);
print '</td>';
if (! $i) $totalarray['nbfield']++;

View File

@ -131,7 +131,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$ret = 0;
// First classify billed the order to allow the proposal classify process
if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
{
@ -175,7 +175,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
}
return $ret;
}

View File

@ -1,195 +0,0 @@
<?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/expensereport/index.php
* \ingroup expensereport
* \brief Page list of expenses
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
// Load translation files required by the page
$langs->loadlangs(array('users', 'trips'));
if(!$user->rights->expensereport->export_csv) {
accessforbidden();
exit();
}
// Security check
$socid = $_GET["socid"]?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'expensereport', '', '');
$req = "SELECT * FROM ".MAIN_DB_PREFIX."rights_def WHERE id = '178'";
$result = $db->query($req);
$num = $db->num_rows($result);
if($num < 1) {
$insert = "INSERT INTO ".MAIN_DB_PREFIX."rights_def (";
$insert.= "`id` ,";
$insert.= "`libelle` ,";
$insert.= "`module` ,";
$insert.= "`entity` ,";
$insert.= "`perms` ,";
$insert.= "`subperms` ,";
$insert.= "`type` ,";
$insert.= "`bydefault`";
$insert.= ")";
$insert.= "VALUES (";
$insert.= "'178', 'Exporter les notes de frais au format CSV', 'expensereport', '1', 'export_csv', NULL , 'r', '0'";
$insert.= ")";
$req = $db->query($insert);
}
/*
* View
*/
llxHeader();
print load_fiche_titre($langs->trans("ExportTripCSV"));
print '<div class="tabBar">';
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="action" value="export"/>';
print '<p>Choisir le mois à exporter : ';
$year = date('Y', time());
$month = date('m', time());
print '<select name="mois">';
for($i=1;$i<13;$i++) {
$mois = str_pad($i, 2, "0", STR_PAD_LEFT);
if($month == $mois) {
print '<option value="'.$mois.'" selected>'.$mois.'</option>';
} else {
print '<option value="'.$mois.'">'.$mois.'</option>';
}
}
print '</select> ';
print '<select name="annee">';
for($i=2009;$i<$year+1;$i++) {
if($year == $i) {
print '<option value="'.$i.'" selected>'.$i.'</option>';
} else {
print '<option value="'.$i.'">'.$i.'</option>';
}
}
print '</select> ';
print '<input type="submit" class="button" value="Exporter" />';
print '</p>';
print '</form>'."\n";
// Si c'est une action
if (isset($_POST['action']))
{
if($_POST['action'] == 'export')
{
$dateselected = $_POST['annee'].'-'.$_POST['mois'];
//var_dump($conf->expensereport->dir_output.'/export/');
if (!file_exists($conf->expensereport->dir_output.'/export/'))
{
dol_mkdir($conf->expensereport->dir_output.'/export/');
}
$dir = $conf->expensereport->dir_output.'/export/expensereport-'.$dateselected.'.csv';
$outputlangs = $langs;
$outputlangs->charset_output = 'UTF-8';
$sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
$sql.= ' AND d.entity IN ('.getEntity('expensereport').')';
$sql.= " ORDER BY d.rowid";
$result = $db->query($sql);
$num = $db->num_rows($result);
if ($num)
{
$open = fopen($dir, "w+");
$ligne = "ID, Référence, ----, Date paiement, Montant HT, TVA, Montant TTC\n";
for ($i = 0; $i < $num; $i++)
{
$ligne.= "----, ----, ----, ----, ----, ----, ----\n";
$objet = $db->fetch_object($result);
$objet->total_ht = number_format($objet->total_ht, 2);
$objet->total_tva = number_format($objet->total_tva, 2);
$objet->total_ttc = number_format($objet->total_ttc, 2);
$objet->ref = trim($objet->ref);
$ligne.= "{$objet->rowid}, {$objet->ref}, ----, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n";
$ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n";
$sql2 = "SELECT de.rowid, t.label as libelle, de.comments, de.total_ht, de.total_tva, de.total_ttc";
$sql2.= " FROM ".MAIN_DB_PREFIX."expensereport_det as de,";
$sql2.= " ".MAIN_DB_PREFIX."c_type_fees as t";
$sql2.= " WHERE de.fk_c_type_fees = t.id";
$sql2.= " AND de.fk_expensereport = '".$objet->rowid."'";
$sql2.= " ORDER BY de.date";
$result2 = $db->query($sql2);
$num2 = $db->num_rows($result2);
if($num2) {
for ($a = 0; $a < $num2; $a++)
{
$objet2 = $db->fetch_object($result2);
$objet2->total_ht = number_format($objet2->total_ht, 2);
$objet2->total_tva = number_format($objet2->total_tva, 2);
$objet2->total_ttc = number_format($objet2->total_ttc, 2);
$objet2->comments = str_replace(',', ';', $objet2->comments);
$objet2->comments = str_replace("\r\n", ' ', $objet2->comments);
$objet2->comments = str_replace("\n", ' ', $objet2->comments);
$ligne.= "--->, {$objet2->rowid}, {$objet2->libelle}, {$objet2->comments}, {$objet2->total_ht}, {$objet2->total_tva}, {$objet2->total_ttc}\n";
}
}
}
$ligne = $outputlangs->convToOutputCharset($ligne);
fwrite($open, $ligne);
fclose($open);
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=expensereport&file=export%2Fexpensereport-'.$dateselected.'.csv" target="_blank">Télécharger le fichier expensereport-'.$dateselected.'.csv</a>';
} else {
print '<b>'.$langs->trans('NoTripsToExportCSV').'</b>';
}
}
}
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -42,15 +42,15 @@ $list = array (
*/
if ($action == 'update') {
$error = 0;
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -87,13 +87,13 @@ print "</tr>\n";
foreach ($list as $key) {
$var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">';
// Param
$label = $langs->trans($key);
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';

View File

@ -72,7 +72,7 @@ function checkLinkedElements($sourcetype, $targettype)
$out = $langs->trans('SourceType').': '.$sourcetype.' => '.$langs->trans('TargetType').': '.$targettype.' ';
$sql = 'SELECT * FROM '.MAIN_DB_PREFIX .'element_element';
$sql = 'SELECT rowid, fk_source, fk_target FROM '.MAIN_DB_PREFIX .'element_element';
$sql.= ' WHERE sourcetype="'.$sourcetype.'" AND targettype="'.$targettype.'"';
$resql=$db->query($sql);
if ($resql)

View File

@ -49,6 +49,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
-- 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 family_position INTEGER NOT NULL DEFAULT 0;

View File

@ -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_origin_line (fk_origin_line);
ALTER TABLE llx_expeditiondet ADD CONSTRAINT fk_expeditiondet_fk_expedition FOREIGN KEY (fk_expedition) REFERENCES llx_expedition (rowid);

View File

@ -151,7 +151,7 @@ ErrorBillNotFound=Invoice %s does not exist
ErrorInvoiceAlreadyReplaced=Error, you tried to validate an invoice to replace invoice %s. But this one has already been replaced by invoice %s.
ErrorDiscountAlreadyUsed=Error, discount already used
ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amount
ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have a positive amount
ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have an amount excluding tax positive (or null)
ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status
ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed.
BillFrom=From
@ -295,7 +295,8 @@ AddGlobalDiscount=Create absolute discount
EditGlobalDiscounts=Edit absolute discounts
AddCreditNote=Create credit note
ShowDiscount=Show discount
ShowReduc=Show the deduction
ShowReduc=Show the discount
ShowSourceInvoice=Show the source invoice
RelativeDiscount=Relative discount
GlobalDiscount=Global discount
CreditNote=Credit note

View File

@ -66,6 +66,7 @@ NoContractedProducts=No products/services contracted
NoRecordedContracts=No recorded contracts
NoRecordedInterventions=No recorded interventions
BoxLatestSupplierOrders=Latest purchase orders
BoxLatestSupplierOrdersAwaitingReception=Latest Purchase Orders (with a pending reception)
NoSupplierOrder=No recorded purchase order
BoxCustomersInvoicesPerMonth=Customer Invoices per month
BoxSuppliersInvoicesPerMonth=Vendor Invoices per month

View File

@ -169,6 +169,7 @@ ToValidate=To validate
NotValidated=Not validated
Save=Save
SaveAs=Save As
SaveAndStay=Save and stay
TestConnection=Test connection
ToClone=Clone
ConfirmClone=Choose data you want to clone:

View File

@ -1,4 +1,5 @@
Mrp=Manufacturing Orders
MO=Manufacturing Order
MRPDescription=Module to manage Manufacturing Orders (MO).
MRPArea=MRP Area
MrpSetupPage=Setup of module MO

View File

@ -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.
* '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)
@ -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.
* '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")
* '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
@ -94,8 +96,8 @@ 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),
'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'),
'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'),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'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'=>3, 'position'=>60),
'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),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),

View File

@ -105,10 +105,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$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
$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
$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
$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
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
@ -124,11 +125,11 @@ if (empty($reshook))
{
$error=0;
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
if (empty($backtopage)) {
if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
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__');
}
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
@ -226,7 +227,7 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
print '<table class="border centpercent tableforfieldcreate">'."\n";
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';

View 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;
}

View File

@ -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,),
'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",),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', '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_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-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'=>0, 'position'=>61, '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,),
'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_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,),
'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_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_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
'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: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')),
);
public $rowid;
@ -475,7 +475,7 @@ class Mo extends CommonObject
$result = '';
$label = '<u>' . $langs->trans("Mo") . '</u>';
$label = '<u>' . $langs->trans("MO") . '</u>';
$label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;

View File

@ -61,17 +61,9 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
if ($conf->use_javascript_ajax)
{
/* $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
$sql.= " FROM ".MAIN_DB_PREFIX."mrp_xxx as p";
$sql.= " WHERE p.entity IN (".getEntity('project').")";
$sql.= " AND p.fk_opp_status = cls.rowid";
$sql.= " AND p.fk_statut = 1"; // Opend projects only
if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
$sql.= " GROUP BY p.fk_opp_status, cls.code";
*/
$sql= "SELECT * FROM ".MAIN_DB_PREFIX."bom_bom WHERE 1 = 2";
$sql= "SELECT COUNT(t.rowid) as nb, status";
$sql.=" FROM ".MAIN_DB_PREFIX."mrp_mo as t";
$sql.=" GROUP BY t.status";
$resql = $db->query($sql);
if ($resql)
@ -80,11 +72,6 @@ if ($conf->use_javascript_ajax)
$i = 0;
$totalnb=0;
$totaloppnb=0;
$totalamount=0;
$ponderated_opp_amount=0;
$valsnb=array();
$valsamount=array();
$dataseries=array();
// -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
while ($i < $num)
@ -94,50 +81,18 @@ if ($conf->use_javascript_ajax)
{
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
{
$valsnb[$obj->opp_status]=$obj->nb;
$valsamount[$obj->opp_status]=$obj->opp_amount;
$dataseries[$obj->status]=$obj->nb;
$totalnb+=$obj->nb;
if ($obj->opp_status) $totaloppnb+=$obj->nb;
if (! in_array($obj->code, array('WON', 'LOST')))
{
$totalamount+=$obj->opp_amount;
$ponderated_opp_amount+=$obj->ponderated_opp_amount;
}
}
$total+=$row[0];
}
$i++;
}
$db->free($resql);
$ponderated_opp_amount = $ponderated_opp_amount / 100;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>'."\n";
/*$listofstatus=array_keys($listofoppstatus);
foreach ($listofstatus as $status)
{
$labelstatus = '';
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) $labelstatus = $langs->trans("OppStatus".$code);
if (empty($labelstatus)) $labelstatus=$listofopplabel[$status];
//$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';
//$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%';
$dataseries[]=array($labelstatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0));
if (! $conf->use_javascript_ajax)
{
print '<tr class="oddeven">';
print '<td>'.$labelstatus.'</td>';
print '<td class="right"><a href="list.php?statut='.$status.'">'.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'</a></td>';
print "</tr>\n";
}
}*/
if ($conf->use_javascript_ajax)
if ($conf->use_javascript_ajax)
{
print '<tr><td class="center" colspan="2">';
@ -150,11 +105,10 @@ if ($conf->use_javascript_ajax)
$dolgraph->setWidth('100%');
$dolgraph->SetHeight(180);
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($totaloppnb?0:1);
print $dolgraph->show($totalnb?0:1);
print '</td></tr>';
}
//if ($totalinprocess != $total)
print "</table>";
print "</div>";

View File

@ -142,7 +142,7 @@ if ($object->id > 0)
$head = moPrepareHead($object);
dol_fiche_head($head, 'agenda', $langs->trans("Mo"), -1, $object->picto);
dol_fiche_head($head, 'agenda', $langs->trans("MO"), -1, $object->picto);
// Object card
// ------------------------------------------------------------

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -109,7 +108,7 @@ $permissionnote=$user->rights->mrp->write; // Used by the include of actions_set
$permissiondellink=$user->rights->mrp->write; // Used by the include of actions_dellink.inc.php
$permissionedit=$user->rights->mrp->write; // Used by the include of actions_lineupdown.inc.php
$permissiontoadd=$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php
$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0);
/*
@ -126,11 +125,12 @@ if (empty($reshook))
{
$error=0;
$permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/mrp/mo_list.php', 1);
if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/mrp/mo_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
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.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__');
}
$triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record
@ -204,16 +204,37 @@ if ($action == 'create')
dol_fiche_end();
print '
?>
<script>
$(document).ready(function () {
jQuery("#fk_bom").change(function() {
console.log("We change value of BOM");
/* TODO */
jQuery('#fk_bom').change(function() {
console.log('We change value of BOM with BOM of id '+jQuery('#fk_bom').val());
$.getJSON('<?php echo DOL_URL_ROOT ?>/mrp/ajax/ajax_bom.php?action=getBoms&idbom='+jQuery('#fk_bom').val(), function(data) {
console.log(data);
if (typeof data.rowid != "undefined") {
console.log("New BOM loaded, we set values in form");
$('#qty').val(data.qty);
$("#fk_product").val(data.fk_product);
$('#fk_product').trigger('change'); // Notify any JS components that the value changed
$('#note_private').val(data.description);
$('#note_private').trigger('change'); // Notify any JS components that the value changed
if (typeof CKEDITOR != "undefined") {
if (typeof CKEDITOR.instances != "undefined") {
if (typeof CKEDITOR.instances.note_private != "undefined") {
console.log(CKEDITOR.instances.note_private);
CKEDITOR.instances.note_private.setData(data.description);
}
}
}
} else {
console.log("Failed to get BOM");
}
});
});
})
</script>
';
<?php
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
@ -237,7 +258,9 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
print '<table class="border centpercent tableforfield">'."\n";
$object->fields['fk_bom']['disabled'] = 1;
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
@ -262,7 +285,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$res = $object->fetch_optionals();
$head = moPrepareHead($object);
dol_fiche_head($head, 'card', $langs->trans("Mo"), -1, $object->picto);
dol_fiche_head($head, 'card', $langs->trans("MO"), -1, $object->picto);
$formconfirm = '';

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -111,7 +110,7 @@ if ($object->id)
*/
$head = moPrepareHead($object);
dol_fiche_head($head, 'document', $langs->trans("Mo"), -1, $object->picto);
dol_fiche_head($head, 'document', $langs->trans("MO"), -1, $object->picto);
// Build file list

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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
@ -96,7 +95,7 @@ if ($id > 0 || ! empty($ref))
$head = moPrepareHead($object);
dol_fiche_head($head, 'note', $langs->trans("Mo"), -1, $object->picto);
dol_fiche_head($head, 'note', $langs->trans("MO"), -1, $object->picto);
// Object card
// ------------------------------------------------------------

View File

@ -97,7 +97,8 @@ if ($_POST) {
* View
*/
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."product_pricerules";
$sql = "SELECT rowid, level, fk_level, var_percent, var_min_percent";
$sql.= " FROM ".MAIN_DB_PREFIX."product_pricerules";
$query = $db->query($sql);
$rules = array();

View File

@ -73,6 +73,7 @@ $ref=GETPOST('ref', 'alpha');
$type=GETPOST('type', 'int');
$action=(GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view');
$cancel=GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
$socid=GETPOST('socid', 'int');
$duration_value = GETPOST('duration_value', 'int');
@ -357,8 +358,18 @@ if (empty($reshook))
$categories = GETPOST('categories', 'array');
$object->setCategories($categories);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
if (! empty($backtopage))
{
$backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation
if (preg_match('/\?/', $backtopage)) $backtopage.='&socid='.$object->id; // Old method
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
}
else
{
@ -950,6 +961,7 @@ else
print '<input type="hidden" name="code_auto" value="1">';
if (! empty($modBarCodeProduct->code_auto))
print '<input type="hidden" name="barcode_auto" value="1">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
if ($type==1) $title=$langs->trans("NewService");
else $title=$langs->trans("NewProduct");
@ -1070,12 +1082,6 @@ else
print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1);
print '</td></tr>';
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
print '<input name="net_measure" size="4" value="'.GETPOST('net_measure').'">';
print $formproduct->selectMeasuringUnits("net_measure_units", "net_measure", GETPOSTISSET('net_measure_units')?GETPOST('net_measure_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
print '</td></tr>';
// Brut Weight
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="3">';
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
@ -1108,6 +1114,15 @@ else
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units')?GETPOST('volume_units', 'alpha'):'0', 0, 2);
print '</td></tr>';
}
if (! empty($conf->global->PRODUCT_ADD_NET_MEASURE))
{
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
print '<input name="net_measure" size="4" value="'.GETPOST('net_measure').'">';
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units')?GETPOST('net_measure_units', 'alpha'):(empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?0:$conf->global->MAIN_WEIGHT_DEFAULT_UNIT), '');
print '</td></tr>';
}
}
// Units
@ -1450,18 +1465,12 @@ else
print $form->selectarray('finished', $statutarray, $object->finished);
print '</td></tr>';
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
print '<input name="net_measure" size="5" value="'.$object->net_measure.'"> ';
print $form->selectUnits($object->net_measure_units, 'units');
//print $formproduct->selectMeasuringUnits("net_measure_units", "weight", $object->net_measure_units, 0, 2);
print '</td></tr>';
// Brut Weight
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="3">';
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
print '</td></tr>';
if (empty($conf->global->PRODUCT_DISABLE_SIZE))
{
// Brut Length
@ -1488,6 +1497,15 @@ else
print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2);
print '</td></tr>';
}
if (! empty($conf->global->PRODUCT_ADD_NET_MEASURE))
{
// Net Measure
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
print '<input name="net_measure" size="5" value="'.$object->net_measure.'"> ';
print $formproduct->selectMeasuringUnits($object->net_measure_units, '');
print '</td></tr>';
}
}
// Units
if($conf->global->PRODUCT_USE_UNITS)
@ -1863,17 +1881,6 @@ else
print $object->getLibFinished();
print '</td></tr>';
// Net Measure
print '<tr><td class="titlefield">'.$langs->trans("NetMeasure").'</td><td colspan="2">';
if ($object->net_measure != '')
{
print $object->net_measure." ".measuring_units_string(0, "weight", $object->net_measure_units);
}
else
{
print '&nbsp;';
}
// Brut Weight
print '<tr><td class="titlefield">'.$langs->trans("Weight").'</td><td colspan="2">';
if ($object->weight != '')
@ -1885,6 +1892,7 @@ else
print '&nbsp;';
}
print "</td></tr>\n";
if (empty($conf->global->PRODUCT_DISABLE_SIZE))
{
// Brut Length
@ -1930,6 +1938,20 @@ else
}
print "</td></tr>\n";
}
if (! empty($conf->global->PRODUCT_ADD_NET_MEASURE))
{
// Net Measure
print '<tr><td class="titlefield">'.$langs->trans("NetMeasure").'</td><td colspan="2">';
if ($object->net_measure != '')
{
print $object->net_measure." ".measuring_units_string(0, "weight", $object->net_measure_units);
}
else
{
print '&nbsp;';
}
}
}
// Unit

View File

@ -332,7 +332,7 @@ class FormProduct
* @param string $name Name of HTML field
* @param string $measuring_style Unit to show: weight, size, surface, volume, time
* @param string $default Preselected value
* @param int $adddefault Add empty unit called "Default"
* @param int|string $adddefault 1=Add empty unit called "Default", ''=Add empty value
* @param int $mode 1=Use short label as value, 0=Use rowid, 2=Use scale (power)
* @return string
*/
@ -346,24 +346,26 @@ class FormProduct
// TODO Use a cache
require_once DOL_DOCUMENT_ROOT . '/core/class/cunits.class.php';
$measuringUnits = new CUnits($db);
$filter = array();
$filter['t.active'] = 1;
if ($measuring_style) $filter['t.unit_type'] = $measuring_style;
$result = $measuringUnits->fetchAll(
'',
'',
0,
0,
array(
't.unit_type' => $measuring_style,
't.active' => 1,
)
$filter
);
if ($result < 0) {
dol_print_error($db);
return -1;
} else {
$return .= '<select class="flat" name="' . $name . '">';
if ($adddefault)
if ($adddefault || $adddefault === '')
{
$return .= '<option value="0">' . $langs->trans("Default") . '</option>';
$return .= '<option value="0">' . ($adddefault ? $langs->trans("Default") : ''). '</option>';
}
foreach ($measuringUnits->records as $lines)

View File

@ -940,11 +940,11 @@ class Product extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
$sql.= " SET label = '" . $this->db->escape($this->label) ."'";
if ($updatetype && ($this->isProduct() || $this->isService())) {
$sql.= ", fk_product_type = " . $this->type;
}
$sql.= ", ref = '" . $this->db->escape($this->ref) ."'";
$sql.= ", ref_ext = ".(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null");
$sql.= ", default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null");

View File

@ -102,6 +102,13 @@ if (empty($reshook))
$backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php';
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__');
}
// Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';

View File

@ -440,12 +440,12 @@ while ($i < min($num, $limit))
$cssforfield=(empty($val['css'])?'':$val['css']);
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';

View File

@ -234,7 +234,7 @@ if ($id > 0 || ! empty($ref))
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty);
$total_ht+=$objp->total_ht;

View File

@ -205,9 +205,11 @@ if (empty($reshook))
{
$db->commit();
if ($backtopage)
if (! empty($backtopage))
{
header("Location: ".$backtopage.'&projectid='.$object->id);
$backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation
$backtopage = $backtopage.'&projectid='.$object->id; // Old method
header("Location: ".$backtopage);
exit;
}
else
@ -595,7 +597,7 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1);
}
else print $text;
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
if (! GETPOSTISSET('backtopage')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
print '</td></tr>';
}

View File

@ -625,15 +625,16 @@ if (empty($reshook))
{
$db->commit();
if (! empty($backtopage))
if (! empty($backtopage))
{
if (preg_match('/\?/', $backtopage)) $backtopage.='&socid='.$object->id;
$backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation
if (preg_match('/\?/', $backtopage)) $backtopage.='&socid='.$object->id; // Old method
header("Location: ".$backtopage);
exit;
}
else
{
$url=$_SERVER["PHP_SELF"]."?socid=".$object->id;
$url=$_SERVER["PHP_SELF"]."?socid=".$object->id; // Old method
if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/card.php?socid=".$object->id;
elseif ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/card.php?socid=".$object->id;

View File

@ -72,10 +72,10 @@ class Thirdparties extends DolibarrApi
*
* @throws RestException
*/
public function get($id)
public function get($id)
{
return $this->_fetch($id);
}
return $this->_fetch($id);
}
/**
* Get properties of a thirdparty object by email.

View File

@ -821,7 +821,7 @@ class Societe extends CommonObject
* Update parameters of third party
*
* @param int $id Id of company (deprecated, use 0 here and call update on an object loaded by a fetch)
* @param User $user Utilisateur qui demande la mise a jour
* @param User $user User who requests the update
* @param int $call_trigger 0=no, 1=yes
* @param int $allowmodcodeclient Inclut modif code client et code compta
* @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
@ -1638,13 +1638,13 @@ class Societe extends CommonObject
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Definit la societe comme un client
* Defines the company as a customer
*
* @param float $remise Valeur en % de la remise
* @param string $note Note/Motif de modification de la remise
* @param User $user Utilisateur qui definie la remise
* @param float $remise Value in % of the discount
* @param string $note Note/Reason for changing the discount
* @param User $user User who sets the discount
* @return int <0 if KO, >0 if OK
*/
public function set_remise_client($remise, $note, User $user)
@ -1652,7 +1652,7 @@ class Societe extends CommonObject
// phpcs:enable
global $conf, $langs;
// Nettoyage parametres
// Parameter cleaning
$note=trim($note);
if (! $note)
{
@ -1668,7 +1668,7 @@ class Societe extends CommonObject
$now=dol_now();
// Positionne remise courante
// Position current discount
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
$sql.= " SET remise_client = '".$this->db->escape($remise)."'";
$sql.= " WHERE rowid = " . $this->id;
@ -1680,7 +1680,7 @@ class Societe extends CommonObject
return -1;
}
// Ecrit trace dans historique des remises
// Writes trace in discount history
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise";
$sql.= " (entity, datec, fk_soc, remise_client, note, fk_user_author)";
$sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',";
@ -1701,13 +1701,13 @@ class Societe extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Definit la societe comme un client
* Defines the company as a customer
*
* @param float $remise Valeur en % de la remise
* @param string $note Note/Motif de modification de la remise
* @param User $user Utilisateur qui definie la remise
* @param float $remise Value in % of the discount
* @param string $note Note/Reason for changing the discount
* @param User $user User who sets the discount
* @return int <0 if KO, >0 if OK
*/
public function set_remise_supplier($remise, $note, User $user)
@ -1715,7 +1715,7 @@ class Societe extends CommonObject
// phpcs:enable
global $conf, $langs;
// Nettoyage parametres
// Parameter cleaning
$note=trim($note);
if (! $note)
{
@ -1731,7 +1731,7 @@ class Societe extends CommonObject
$now=dol_now();
// Positionne remise courante
// Position current discount
$sql = "UPDATE ".MAIN_DB_PREFIX."societe ";
$sql.= " SET remise_supplier = '".$this->db->escape($remise)."'";
$sql.= " WHERE rowid = " . $this->id;
@ -1743,7 +1743,7 @@ class Societe extends CommonObject
return -1;
}
// Ecrit trace dans historique des remises
// Writes trace in discount history
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier";
$sql.= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)";
$sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',";
@ -1827,10 +1827,10 @@ class Societe extends CommonObject
}
/**
* Renvoie montant TTC des reductions/avoirs en cours disponibles de la societe
* Returns amount of included taxes of the current discounts/credits available from the company
*
* @param User $user Filtre sur un user auteur des remises
* @param string $filter Filtre autre
* @param User $user Filter on a user author of discounts
* @param string $filter Other filter
* @param integer $maxvalue Filter on max value for discount
* @param int $discount_type 0 => customer discount, 1 => supplier discount
* @return int <0 if KO, Credit note amount otherwise
@ -2264,13 +2264,13 @@ class Societe extends CommonObject
return $this->LibStatut($this->status, $mode);
}
// 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 Status id
* @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 Libelle du statut
* @return string Status label
*/
public function LibStatut($statut, $mode = 0)
{
@ -2429,11 +2429,11 @@ class Societe extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la liste des contacts de cette societe
* Returns the contact list of this company
*
* @return array tableau des contacts
* @return array array of contacts
*/
public function contact_array()
{
@ -2463,11 +2463,11 @@ class Societe extends CommonObject
return $contacts;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la liste des contacts de cette societe
* Returns the contact list of this company
*
* @return array $contacts tableau des contacts
* @return array $contacts array of contacts
*/
public function contact_array_objects()
{
@ -2608,9 +2608,9 @@ class Societe extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Attribut un code client a partir du module de controle des codes.
* Assigns a customer code from the code control module.
* Return value is stored into this->code_client
*
* @param Societe $objsoc Object thirdparty
@ -2640,9 +2640,9 @@ class Societe extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Attribut un code fournisseur a partir du module de controle des codes.
* Assigns a vendor code from the code control module.
* Return value is stored into this->code_fournisseur
*
* @param Societe $objsoc Object thirdparty
@ -2671,10 +2671,10 @@ class Societe extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Verifie si un code client est modifiable en fonction des parametres
* du module de controle des codes.
* Check if a client code is editable based on the parameters of the
* code control module.
*
* @return int 0=No, 1=Yes
*/
@ -2708,9 +2708,9 @@ class Societe extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes
* Check if a vendor code is editable in the code control module configuration
*
* @return int 0=No, 1=Yes
*/
@ -2818,11 +2818,11 @@ class Societe extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie un code compta, suivant le module de code compta.
* Peut etre identique a celui saisit ou genere automatiquement.
* A ce jour seule la generation automatique est implementee
* Returns an accounting code, following the accounting code module.
* May be identical to the one entered or generated automatically.
* To date only the automatic generation is implemented
*
* @param string $type Type of thirdparty ('customer' or 'supplier')
* @return string Code compta si ok, 0 si aucun, <0 si ko
@ -2847,7 +2847,7 @@ class Societe extends CommonObject
$classname = $conf->global->SOCIETE_CODECOMPTA_ADDON;
$mod = new $classname;
// Defini code compta dans $mod->code
// Set code count in $mod->code
$result = $mod->get_code($this->db, $this, $type);
if ($type == 'customer') $this->code_compta = $mod->code;
@ -2999,9 +2999,9 @@ class Societe extends CommonObject
else return false;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Verifie la validite d'un identifiant professionnel en fonction du pays de la societe (siren, siret, ...)
* Check the validity of a professional identifier according to the country of the company (siren, siret, ...)
*
* @param int $idprof 1,2,3,4 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param Societe $soc Objet societe
@ -3017,7 +3017,7 @@ class Societe extends CommonObject
if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return 1;
// Verifie SIREN si pays FR
// Check SIREN if country FR
if ($idprof == 1 && $soc->country_code == 'FR')
{
$chaine=trim($this->idprof1);
@ -3207,11 +3207,11 @@ class Societe extends CommonObject
return '';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Indique si la societe a des projets
* Indicates if the company has projects
*
* @return bool true si la societe a des projets, false sinon
* @return bool true if the company has projects, false otherwise
*/
public function has_projects()
{
@ -3313,9 +3313,9 @@ class Societe extends CommonObject
return isInEEC($this);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Charge la liste des categories fournisseurs
* Load the list of provider categories
*
* @return int 0 if success, <> 0 if error
*/
@ -3704,11 +3704,11 @@ class Societe extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set prospect level
*
* @param User $user Utilisateur qui definie la remise
* @param User $user User who sets the discount
* @return int <0 if KO, >0 if OK
* @deprecated Use update function instead
*/

View File

@ -41,12 +41,12 @@ $langs->loadLangs(array("admin", "cashdesk", "commercial"));
if (GETPOST('action', 'alpha') == 'set')
{
$db->begin();
$res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity);
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
if (! $res > 0) $error++;

View File

@ -45,18 +45,40 @@ $term = GETPOST('term', 'alpha');
if ($action=="getProducts") {
$object = new Categorie($db);
$result=$object->fetch($category);
$prods = $object->getObjectsInCateg("product");
echo json_encode($prods);
if ($result > 0)
{
$prods = $object->getObjectsInCateg("product");
// Removed properties we don't need
if (is_array($prods) && count($prods) > 0)
{
foreach($prods as $prod)
{
unset($prod->fields);
unset($prod->db);
}
}
echo json_encode($prods);
}
else
{
echo 'Failed to load category with id='.$category;
}
}
elseif ($action=="search" && $term != '') {
$sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product';
$sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product';
$sql.= ' WHERE entity IN ('.getEntity('product').')';
$sql.= ' AND tosell = 1';
$sql.= natural_search(array('ref','label','barcode'), $term);
$resql = $db->query($sql);
$rows = array();
while ($row = $db->fetch_array($resql)) {
$rows[] = $row;
}
echo json_encode($rows);
if ($resql)
{
$rows = array();
while ($row = $db->fetch_object($resql)) {
$rows[] = $row;
}
echo json_encode($rows);
}
else {
echo 'Failed to search product : '.$db->lasterror();
}
}

View File

@ -132,7 +132,7 @@ table.postablelines tr td {
div.paymentbordline
{
width:50%;
background-color:#666;
background-color:#888;
border-radius: 8px;
margin-bottom: 4px;
}

View File

@ -141,7 +141,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
$invoice = new Facture($db);
$invoice->fetch($placeid);
if($invoice->total_ttc<0){
if ($invoice->total_ttc < 0) {
$invoice->type= $invoice::TYPE_CREDIT_NOTE;
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE ";
$sql.="fk_soc = '".$invoice->socid."' ";
@ -165,8 +165,12 @@ if ($action == 'valid' && $user->rights->facture->creer)
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
if ($invoice->statut != Facture::STATUS_DRAFT)
{
dol_syslog("Sale already validated");
dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), null, 1);
//If invoice is validated but it is not fully paid is not error and make the payment
if ($invoice->getRemainToPay()>0) $res=1;
else{
dol_syslog("Sale already validated");
dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), null, 1);
}
}
elseif (count($invoice->lines)==0)
{
@ -189,15 +193,17 @@ if ($action == 'valid' && $user->rights->facture->creer)
$res = $invoice->validate($user);
}
$remaintopay = $invoice->getRemainToPay();
// Add the payment
if ($res > 0) {
if ($res >= 0 && $remaintopay > 0) {
$payment = new Paiement($db);
$payment->datepaye = $now;
$payment->fk_account = $bankaccount;
$payment->amounts[$invoice->id] = $amountofpayment;
// If user has not used change control, add total invoice payment
if ($amountofpayment == 0) $payment->amounts[$invoice->id] = $invoice->total_ttc;
if ($amountofpayment == 0) $payment->amounts[$invoice->id] = $remaintopay;
$payment->paiementid=$paiementid;
$payment->num_payment=$invoice->ref;
@ -205,9 +211,9 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
$remaintopay = $invoice->getRemainToPay();
$remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
if ($remaintopay == 0) {
dol_syslog("Invoice is paid, so we set it to pay");
dol_syslog("Invoice is paid, so we set it to status Paid");
$result = $invoice->set_paid($user);
if ($result > 0) $invoice->paye = 1;
} else {
@ -425,7 +431,6 @@ $sectionwithinvoicelink='';
if ($action=="valid" || $action=="history")
{
$sectionwithinvoicelink.='<!-- Section with invoice link -->'."\n";
$sectionwithinvoicelink.='<input type="hidden" name="invoiceid" id="invoiceid" value="'.$invoice->id.'">';
$sectionwithinvoicelink.='<span style="font-size:120%;" class="center">';
$sectionwithinvoicelink.=$invoice->getNomUrl(1, '', 0, 0, '', 0, 0, -1, '_backoffice')." - ";
$remaintopay = $invoice->getRemainToPay();
@ -580,7 +585,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
if ($mobilepage=="invoice" || $mobilepage=="") {
print $langs->trans('TotalTTC');
print ' : <b>' . price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '</b></span>';
print '<br>' . $sectionwithinvoicelink;
print '<br><input type="hidden" name="invoiceid" id="invoiceid" value="'.$invoice->id.'">' . $sectionwithinvoicelink;
print '</td>';
}
if ($_SESSION["basiclayout"]!=1)
@ -656,7 +661,7 @@ if ($placeid > 0)
{
//In Phone basic layout hide some content depends situation
if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice" && $action!="order") return;
if (is_array($invoice->lines) && count($invoice->lines))
{
$tmplines = array_reverse($invoice->lines);
@ -716,10 +721,12 @@ print '</table>';
if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]})
{
$soc = new Societe($db);
$constforcompanyid='CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"];
$soc = new Societe($db);
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]});
print '<!-- Show customer --><p style="font-size:120%;" class="right">';
else $soc->fetch($conf->global->$constforcompanyid);
print '<!-- Show customer -->';
print '<p class="right">';
print $langs->trans("Customer").': '.$soc->name;
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
@ -730,15 +737,13 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep
$warehouse->fetch($conf->global->$constantforkey);
print '<br>'.$langs->trans("Warehouse").': '.$warehouse->ref;
}
print '</p>';
// Module Adherent
if (! empty($conf->adherent->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$langs->load("members");
print '<p style="font-size:120%;" class="right">';
print $langs->trans("Member").': ';
print '<br>'.$langs->trans("Member").': ';
$adh=new Adherent($db);
$result=$adh->fetch('', '', $invoice->socid);
if ($result > 0)
@ -763,8 +768,8 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep
{
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
}
print '</p>';
}
print '</p>';
}
if ($action == "search")

View File

@ -172,9 +172,8 @@ else print "var received=0;";
}
console.log("We click on the payment mode to pay amount = "+amountpayed);
parent.$("#poslines").load("invoice.php?place=<?php echo $place;?>&action=valid&pay="+payment+"&amount="+amountpayed+"&invoiceid="+invoiceid, function() {
//parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
parent.$.colorbox.close();
//parent.setFocusOnSearchField(); // This does not have effect
if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) parent.$.colorbox.close();
else location.reload();
});
}
</script>

View File

@ -254,7 +254,7 @@ function LoadProducts(position, issubcat) {
idata=0; //product data counter
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) {
console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs");
console.log(data);
while (ishow < maxproduct) {
//console.log("ishow"+ishow+" idata="+idata);
console.log(data[idata]);
@ -419,7 +419,7 @@ function New() {
function Search2() {
console.log("Search2 Call ajax search to replace products");
pageproducts=0;
jQuery(".catwatermark").hide();
jQuery(".wrapper2 .catwatermark").hide();
$.getJSON('<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) {
for (i = 0; i < <?php echo $MAXPRODUCT ?>; i++) {
if (typeof (data[i]) == "undefined"){

View File

@ -63,6 +63,7 @@ span.butAction, span.butActionDelete {
}
.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover,
.tableforfieldedit a.butActionNew>span.fa-plus-circle, .tableforfieldedit a.butActionNew>span.fa-plus-circle:hover,
span.butActionNew>span.fa-plus-circle, span.butActionNew>span.fa-plus-circle:hover,
a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover,
span.butActionNewRefused>span.fa-plus-circle, span.butActionNewRefused>span.fa-plus-circle:hover,

View File

@ -273,8 +273,7 @@ input:-webkit-autofill {
}
::-webkit-input-placeholder { color:#ccc; }
input:-moz-placeholder { color:#ccc; }
input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], select[name=incoterm_id] { margin-right: 6px; }
input[name=surface] { margin-right: 4px; }
input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; }
fieldset { border: 1px solid #AAAAAA !important; }
.legendforfieldsetstep { padding-bottom: 10px; }
input#onlinepaymenturl, input#directdownloadlink {

View File

@ -79,6 +79,7 @@ a.butActionNew>span.fa-plus-circle { padding-left: 6px; font-size: 1.5em; }
a.butActionNewRefused>span.fa-plus-circle { padding-left: 6px; font-size: 1.5em; }
.tableforfieldcreate a.butActionNew>span.fa-plus-circle, .tableforfieldcreate a.butActionNew>span.fa-plus-circle:hover,
.tableforfieldedit a.butActionNew>span.fa-plus-circle, .tableforfieldedit a.butActionNew>span.fa-plus-circle:hover,
span.butActionNew>span.fa-plus-circle, span.butActionNew>span.fa-plus-circle:hover,
a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover,
span.butActionNewRefused>span.fa-plus-circle, span.butActionNewRefused>span.fa-plus-circle:hover,

View File

@ -500,8 +500,7 @@ input:-webkit-autofill {
::-moz-placeholder { color:#bbb; } /* firefox 19+ */
:-ms-input-placeholder { color:#ccc; } /* ie */
input:-moz-placeholder { color:#ccc; }
input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], select[name=incoterm_id] { margin-right: 6px; }
input[name=surface] { margin-right: 4px; }
input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; }
fieldset { border: 1px solid #AAAAAA !important; }
.legendforfieldsetstep { padding-bottom: 10px; }
input#onlinepaymenturl, input#directdownloadlink {

View File

@ -1236,12 +1236,18 @@ if ($action == 'updatecss')
setEventMessages($langs->trans("Saved"), null, 'mesgs');
}
$action='preview';
if ($backtopage)
if (! GETPOSTISSET('updateandstay')) // If we click on "Save And Stay", we don not make the redirect
{
header("Location: ".$backtopage);
exit;
$action='preview';
if ($backtopage)
{
header("Location: ".$backtopage);
exit;
}
}
else
{
$action = 'editcss';
}
}
}
@ -2105,6 +2111,7 @@ if (! GETPOST('hide_websitemenu'))
if (in_array($action, array('editcss','editmenu','file_manager','replacesite','replacesiteconfirm')))
{
if ($action == 'editcss' && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print '<input type="submit" id="savefilean stay" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("SaveAndStay")).'" name="updateandstay">';
if (preg_match('/^create/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if (preg_match('/^edit/', $action) && $action != 'file_manager' && $action != 'replacesite' && $action != 'replacesiteconfirm') print '<input type="submit" id="savefile" class="button buttonforacesave" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="cancel">';

View File

@ -79,7 +79,7 @@ class BOMTest extends PHPUnit\Framework\TestCase
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n";
}