develop_dict

Conflicts:
	htdocs/compta/resultat/clientfourn.php
	htdocs/core/lib/functions.lib.php
	htdocs/install/mysql/migration/6.0.0-7.0.0.sql
This commit is contained in:
Regis Houssin 2017-09-07 10:50:35 +02:00
commit 66e548427c
183 changed files with 6897 additions and 4978 deletions

View File

@ -5,6 +5,11 @@ English Dolibarr ChangeLog
***** ChangeLog for 7.0.0 compared to 6.0.* ***** ***** ChangeLog for 7.0.0 compared to 6.0.* *****
WARNING:
Following changes may create regression for some external modules, but were necessary to make Dolibarr better:
* The methode "cloture" on contact were renamed into "closeAll".
***** ChangeLog for 6.0.0 compared to 5.0.* ***** ***** ChangeLog for 6.0.0 compared to 5.0.* *****
@ -14,7 +19,7 @@ NEW: Add a payment module for Stripe.
NEW: Add module "Product variant" (like red, blue for the product shoes) NEW: Add module "Product variant" (like red, blue for the product shoes)
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC) NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
NEW: Add a tracking id into mass emailing. NEW: Add a tracking id into mass emailing.
NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST). NEW: Tax system more compatible with the new tax rollout in India (IGST / CGST / SGST).
NEW: Add calculation function for Loan schedule NEW: Add calculation function for Loan schedule
NEW: Add "depends on" and "required by" into module informations NEW: Add "depends on" and "required by" into module informations
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO

View File

@ -334,7 +334,7 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
} }
foreach my $target (sort keys %CHOOSEDPUBLISH) { foreach my $target (sort keys %CHOOSEDPUBLISH) {
if ($CHOOSEDPUBLISH{$target} < 0) { next; } if ($CHOOSEDPUBLISH{$target} < 0) { next; }
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; } if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; } if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
$nboftargetok++; $nboftargetok++;
} }

View File

@ -163,6 +163,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
%_datadir/dolibarr/htdocs/comm %_datadir/dolibarr/htdocs/comm
%_datadir/dolibarr/htdocs/commande %_datadir/dolibarr/htdocs/commande
%_datadir/dolibarr/htdocs/compta %_datadir/dolibarr/htdocs/compta

View File

@ -69,8 +69,8 @@ $arrayfields=array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0), 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
); );
@ -190,13 +190,14 @@ if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$params=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($search_account) $params.= '&search_account='.urlencode($search_account); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_label) $params.= '&search_label='.urlencode($search_label); if ($search_account) $param.= '&search_account='.urlencode($search_account);
if ($search_accountparent) $params.= '&search_accountparent='.urlencode($search_accountparent); if ($search_label) $param.= '&search_label='.urlencode($search_label);
if ($search_pcgtype) $params.= '&search_pcgtype='.urlencode($search_pcgtype); if ($search_accountparent) $param.= '&search_accountparent='.urlencode($search_accountparent);
if ($search_pcgsubtype) $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype); if ($search_pcgtype) $param.= '&search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
@ -212,7 +213,7 @@ if ($resql)
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>'; $htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd); print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
// Box to select active chart of account // Box to select active chart of account
print $langs->trans("Selectchartofaccounts") . " : "; print $langs->trans("Selectchartofaccounts") . " : ";
@ -264,8 +265,8 @@ if ($resql)
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder); if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_type']['help']);
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_subtype']['help']);
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";

View File

@ -602,6 +602,7 @@ if ($id)
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Form to add a new line // Form to add a new line
@ -1139,6 +1140,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@ -327,7 +327,7 @@ if ($action == 'create') {
print '</form>'; print '</form>';
} else { } else {
// View mode // View mode
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');

View File

@ -98,7 +98,7 @@ dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Category // Category
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>'; print '<tr><td class="titlefield">' . $langs->trans("AccountingCategory") . '</td>';
print '<td>'; print '<td>';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1); $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">'; print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
@ -110,14 +110,26 @@ if (! empty($cat_id))
if ($return < 0) { if ($return < 0) {
setEventMessages(null, $accountingcategory->errors, 'errors'); setEventMessages(null, $accountingcategory->errors, 'errors');
} }
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>'; print '<tr><td class="tdtop">' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
print '<td>'; print '<td>';
$arraykeyvalue=array();
foreach($accountingcategory->lines_cptbk as $key => $val)
{
$arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' (' . $val->label_compte . ($val->doc_ref?' '.$val->doc_ref:'').')';
}
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
print '<select class="flat minwidth200" size="' . count($obj) . '" name="cpt_bk[]" multiple>';
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
print '<br>';
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
foreach ( $accountingcategory->lines_cptbk as $cpt ) { foreach ( $accountingcategory->lines_cptbk as $cpt ) {
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>'; print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
} }
print '</select><br>'; print '</select><br>';
print ajax_combobox('cpt_bk');
*/
print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> '; print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -1,16 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -52,7 +42,7 @@ $langs->load("hrm");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int'); $id=32;
$rowid=GETPOST('rowid','alpha'); $rowid=GETPOST('rowid','alpha');
$code=GETPOST('code','alpha'); $code=GETPOST('code','alpha');
@ -100,7 +90,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
// Requests to extract data // Requests to extract data
$tabsql=array(); $tabsql=array();
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; $tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
// Criteria to sort dictionaries // Criteria to sort dictionaries
$tabsqlsort=array(); $tabsqlsort=array();
@ -108,15 +98,15 @@ $tabsqlsort[32]="position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire // Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array(); $tabfield=array();
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country"; $tabfield[32]= "code,label,range_account,category_type,formula,position,country";
// Nom des champs d'edition pour modification d'un enregistrement // Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array(); $tabfieldvalue=array();
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country"; $tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id";
// Nom des champs dans la table pour insertion d'un enregistrement // Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array(); $tabfieldinsert=array();
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country"; $tabfieldinsert[32]= "code,label,range_account,category_type,formula,position,fk_country";
// Nom du rowid si le champ n'est pas de type autoincrement // Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on // Example: "" if id field is "rowid" and has autoincrement on
@ -167,24 +157,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1; $ok=1;
foreach ($listfield as $f => $value) foreach ($listfield as $f => $value)
{ {
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'formula' && empty($_POST['formula'])) continue; if ($value == 'formula' && empty($_POST['formula'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='') if ($value == 'range_account' && empty($_POST['range_account'])) continue;
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory if ($value == 'country') continue; // country_id required but not country
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 if (! isset($_POST[$value]) || $_POST[$value]=='')
)
)
{ {
$ok=0; $ok=0;
$fieldnamekey=$listfield[$f]; $fieldnamekey=$listfield[$f];
// We take translate key of field // We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
if ($fieldnamekey == 'module') $fieldnamekey='Module';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate';
if ($fieldnamekey == 'type') $fieldnamekey = 'Type'; if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated'; if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
@ -192,11 +175,6 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
} }
} }
// Other checks
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
$ok=0;
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
if (isset($_POST["code"])) if (isset($_POST["code"]))
{ {
if ($_POST["code"]=='0') if ($_POST["code"]=='0')
@ -210,17 +188,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />'; $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
}*/ }*/
} }
if (isset($_POST["country"]) && ($_POST["country"]=='0')) if (isset($_POST["country"]) && ($_POST["country"] <= 0))
{ {
if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries $ok=0;
{ setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
$_POST["country"]='';
}
else
{
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
}
} }
// Clean some parameters // Clean some parameters
@ -262,14 +233,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i=0; $i=0;
foreach ($listfieldinsert as $f => $value) foreach ($listfieldinsert as $f => $value)
{ {
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') { if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
}
else if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity; $_POST[$listfieldvalue[$i]] = $conf->entity;
} }
if ($i) $sql.=","; if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = '' if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++; $i++;
} }
@ -310,15 +278,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0; $i = 0;
foreach ($listfieldmodify as $field) foreach ($listfieldmodify as $field)
{ {
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') { if ($field == 'fk_country' && $_POST['country'] > 0) {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = $_POST['country'];
} }
else if ($field == 'entity') { else if ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity; $_POST[$listfieldvalue[$i]] = $conf->entity;
} }
if ($i) $sql.=","; if ($i) $sql.=",";
$sql.= $field."="; $sql.= $field."=";
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = '' if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'range_account') $sql.="null"; // For range_account, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++; $i++;
} }
@ -458,11 +426,15 @@ $titlepicto='title_setup';
print load_fiche_titre($titre,$linkback,$titlepicto); print load_fiche_titre($titre,$linkback,$titlepicto);
if ($id == 32)
{
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
}
// Confirmation de la suppression de la ligne // Confirmation de la suppression de la ligne
if ($action == 'delete') if ($action == 'delete')
{ {
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id>0?'&search_country_id='.$search_country_id:''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
} }
//var_dump($elementList); //var_dump($elementList);
@ -508,6 +480,7 @@ if ($id)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Form to add a new line // Form to add a new line
@ -536,18 +509,15 @@ if ($id)
{ {
$valuetoshow=$langs->trans("Label"); $valuetoshow=$langs->trans("Label");
} }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
if ($fieldlist[$field]=='country') { if ($fieldlist[$field]=='country') {
if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
$valuetoshow=$langs->trans("Country"); $valuetoshow=$langs->trans("Country");
} }
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($valuetoshow != '') if ($valuetoshow != '')
@ -617,8 +587,7 @@ if ($id)
$paramwithsearch = $param; $paramwithsearch = $param;
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha'); if (GETPOST('from','alpha')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
// There is several pages // There is several pages
if ($num > $listlimit) if ($num > $listlimit)
{ {
@ -700,8 +669,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield)
@ -742,6 +710,7 @@ if ($id)
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>'; print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
print '<td></td>';
} }
else else
{ {
@ -759,17 +728,9 @@ if ($id)
$showfield=1; $showfield=1;
$align="left"; $align="left";
$valuetoshow=$obj->{$fieldlist[$field]}; $valuetoshow=$obj->{$fieldlist[$field]};
if ($value == 'type_template') if ($value == 'category_type')
{ {
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; $valuetoshow = yn($valuetoshow);
}
if ($value == 'element')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
else if ($value == 'source')
{
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
} }
else if ($valuetoshow=='all') { else if ($valuetoshow=='all') {
$valuetoshow=$langs->trans('All'); $valuetoshow=$langs->trans('All');
@ -785,12 +746,6 @@ if ($id)
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
} }
} }
else if ($fieldlist[$field]=='libelle_facture') {
$langs->load("bills");
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
$valuetoshow=nl2br($valuetoshow);
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
$key=$langs->trans("Country".strtoupper($obj->code)); $key=$langs->trans("Country".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
@ -804,83 +759,11 @@ if ($id)
$key=$langs->trans("Action".strtoupper($obj->code)); $key=$langs->trans("Action".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
} }
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
$key=$langs->trans(strtoupper($obj->code));
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
$key=$langs->trans(strtoupper($obj->code));
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
$key=$langs->trans("Civility".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
$langs->load('agenda');
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
$langs->load("bills");
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
$langs->load("bills");
$key=$langs->trans("PaymentType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
$langs->load("orders");
$key=$langs->trans($obj->code);
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]};
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
$langs->load("sendings");
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
{
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
{
$langs->load('trips');
$key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
$showfield=0; $showfield=0;
} }
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
$langs->load("products");
$valuetoshow=$langs->trans($obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
$langs->load("products");
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
}
else if (in_array($fieldlist[$field],array('recuperableonly')))
{
$align="center";
}
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow);
}
$class='tddict'; $class='tddict';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
// Show value for field // Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
} }
@ -891,14 +774,9 @@ if ($id)
if (isset($obj->code)) if (isset($obj->code))
{ {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; } if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
} }
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
$canbemodified=$iserasable; $canbemodified=$iserasable;
if ($obj->code == 'RECEP') $canbemodified=1;
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
if ($param) $url .= '&'.$param; if ($param) $url .= '&'.$param;
@ -909,10 +787,7 @@ if ($id)
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else else
{ {
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive"); print $langs->trans("AlwaysActive");
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
else print $langs->trans("AlwaysActive");
} }
print "</td>"; print "</td>";
@ -937,8 +812,8 @@ if ($id)
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>'; print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
} }
print '</td>'; print '</td>';
print "</tr>\n";
} }
print "</tr>\n";
$i++; $i++;
} }
} }
@ -948,6 +823,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }
@ -984,16 +860,17 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
{ {
if ($fieldlist[$field] == 'country') if ($fieldlist[$field] == 'country')
{ {
if (in_array('region_id',$fieldlist))
{
print '<td>';
//print join(',',$fieldlist);
print '</td>';
continue;
} // For state page, we do not show the country input (we link to region, not country)
print '<td>'; print '<td>';
$fieldname='country'; $fieldname='country';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); if ($context == 'add')
{
$fieldname='country_id';
print $form->select_country(GETPOST('country_id','int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
}
else
{
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
}
print '</td>'; print '</td>';
} }
elseif ($fieldlist[$field] == 'country_id') elseif ($fieldlist[$field] == 'country_id')
@ -1006,130 +883,14 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
print '</td>'; print '</td>';
} }
} }
elseif ($fieldlist[$field] == 'region') elseif ($fieldlist[$field] == 'category_type') {
{ print '<td>';
print '<td>'; print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
$formcompany->select_region($region_id,'region');
print '</td>'; print '</td>';
} }
elseif ($fieldlist[$field] == 'region_id')
{
$region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0);
print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
print '</td>';
}
elseif ($fieldlist[$field] == 'lang')
{
print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
print '</td>';
}
// Le type de template
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// Le type de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'element')
{
print '<td>';
print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// La source de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'source')
{
print '<td>';
print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
{
print '<td>';
print 'user<input type="hidden" name="type" value="user">';
print '</td>';
}
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
if ($fieldlist[$field] == 'type_cdr') print '<td align="center">';
else print '<td>';
if ($fieldlist[$field] == 'type_cdr') {
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
} else {
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
}
print '</td>';
}
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
$align="left";
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right
print '<td align="'.$align.'">';
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>';
}
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
}
elseif (in_array($fieldlist[$field], array('content')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
}
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
} }
elseif ($fieldlist[$field]=='unit') {
print '<td>';
$units = array(
'mm' => $langs->trans('SizeUnitmm'),
'cm' => $langs->trans('SizeUnitcm'),
'point' => $langs->trans('SizeUnitpoint'),
'inch' => $langs->trans('SizeUnitinch')
);
print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
print '</td>';
}
// Le type de taxe locale
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
{
print '<td align="center">';
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
{
print '<td>';
if (! empty($conf->accounting->enabled))
{
$fieldname = $fieldlist[$field];
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
}
else
{
$fieldname = $fieldlist[$field];
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname)?$obj->$fieldname:'').'" name="'.$fieldlist[$field].'">';
}
print '</td>';
}
else else
{ {
print '<td>'; print '<td>';
@ -1137,8 +898,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
if ($fieldlist[$field]=='code') $class='maxwidth100'; if ($fieldlist[$field]=='code') $class='maxwidth100';
if ($fieldlist[$field]=='position') $class='maxwidth50'; if ($fieldlist[$field]=='position') $class='maxwidth50';
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='category_type') $size='size="2" ';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">'; print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>'; print '</td>';
} }

View File

@ -423,6 +423,7 @@ if ($id)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Form to add a new line // Form to add a new line
@ -691,6 +692,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }

View File

@ -312,6 +312,7 @@ if ($result)
$texte=$langs->trans("ListOfProductsServices"); $texte=$langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">'; print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@ -448,6 +449,7 @@ if ($result)
$i ++; $i ++;
} }
print '</table>'; print '</table>';
print '</div>';
// Example : Adding jquery code // Example : Adding jquery code
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">

View File

@ -370,6 +370,7 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
print '</div>'; print '</div>';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@ -501,6 +502,7 @@ print '<td colspan="2"></td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";
print '</div>';
print '</form>'; print '</form>';

View File

@ -286,7 +286,7 @@ class AccountancyCategory
} }
if (! empty($mysoc->country_id)) { if (! empty($mysoc->country_id)) {
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens "; $sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid "; $sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
@ -316,7 +316,7 @@ class AccountancyCategory
'code' => $obj->code, 'code' => $obj->code,
'position' => $obj->position, 'position' => $obj->position,
'account_number' => $obj->account_number, 'account_number' => $obj->account_number,
'name_cpt' => $obj->name_cpt, 'account_label' => $obj->account_label,
'sens' => $obj->sens 'sens' => $obj->sens
); );
$i ++; $i ++;
@ -334,22 +334,28 @@ class AccountancyCategory
/** /**
* Function to show result of an accounting account from the ledger with a direction and a period * Function to show result of an accounting account from the ledger with a direction and a period
* *
* @param int $cpt Id accounting account * @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty * @param string $month Specifig month - Can be empty
* @param string $year Specific year * @param string $date_start Date start
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit * @param string $date_end Date end
* * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
* @return integer Result in table * @param string $thirdparty_code Thirdparty code
* @return integer Result in table
*/ */
public function getResult($cpt, $month, $year, $sens) { public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter')
{
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte = '" . $cpt."'"; $sql .= " WHERE t.numero_compte = '" . $cpt."'";
$sql .= " AND YEAR(t.doc_date) = " . $year; if (! empty($date_start) && ! empty($date_end))
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'";
if (! empty($month)) { if (! empty($month)) {
$sql .= " AND MONTH(t.doc_date) = " . $month; $sql .= " AND MONTH(t.doc_date) = " . $month;
} }
if ($thirdparty_code != 'nofilter')
{
$sql .= " AND thirdparty_code = '".$ths->db->escape($thirdparty_code)."'";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG); dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -375,62 +381,13 @@ class AccountancyCategory
} }
/** /**
* Function to call category from a specific country * Return list of personalized groups
* *
* @return array Result in table * @return int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @return array|int Array of personalized groups or < 0 if KO
*/ */
public function getCatsCal() { public function getCats($categorytype=-1)
global $db, $langs, $user, $mysoc; {
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit();
}
if (! empty($mysoc->country_id)) {
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 AND c.category_type = 1 ";
$sql .= " AND c.fk_country = " . $mysoc->country_id;
$sql .= " ORDER BY c.position ASC";
} else {
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
$sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql .= " ORDER BY c.position ASC";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array ();
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$position = $obj->position;
$data[$position] = array (
'code' => $obj->code,
'label' => $obj->label,
'formula' => $obj->formula
);
$i ++;
}
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR);
return - 1;
}
}
public function getCats() {
global $db, $langs, $user, $mysoc; global $db, $langs, $user, $mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code)) { if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
@ -442,17 +399,18 @@ class AccountancyCategory
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 "; $sql .= " WHERE c.active = 1 ";
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND c.fk_country = " . $mysoc->country_id; $sql .= " AND c.fk_country = " . $mysoc->country_id;
$sql .= " ORDER BY c.position ASC"; $sql .= " ORDER BY c.position ASC";
} else { } else { // Note: this should not happen
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid"; $sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND co.code = '" . $mysoc->country_code . "'"; $sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql .= " ORDER BY c.position ASC"; $sql .= " ORDER BY c.position ASC";
} }
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$i = 0; $i = 0;
@ -466,9 +424,9 @@ class AccountancyCategory
$data[] = array ( $data[] = array (
'rowid' => $obj->rowid, 'rowid' => $obj->rowid,
'code' => $obj->code, 'code' => $obj->code,
'position' => $obj->position,
'label' => $obj->label, 'label' => $obj->label,
'formula' => $obj->formula, 'formula' => $obj->formula,
'position' => $obj->position,
'category_type' => $obj->category_type 'category_type' => $obj->category_type
); );
$i ++; $i ++;
@ -487,13 +445,19 @@ class AccountancyCategory
// calcule // calcule
/* I try to replace this with dol_eval()
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/'; const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
const PARENTHESIS_DEPTH = 10; const PARENTHESIS_DEPTH = 10;
public function calculate($input){ public function calculate($input)
{
global $langs;
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){ if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
// Remove white spaces and invalid math chars // Remove white spaces and invalid math chars
$input = str_replace($langs->trans("ThousandSeparator"), '', $input);
$input = str_replace(',', '.', $input); $input = str_replace(',', '.', $input);
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input); $input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
@ -535,28 +499,41 @@ class AccountancyCategory
return 0; return 0;
} }
*/
/** /**
* get cpts of category * Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter)
* *
* @param int $cat_id Id accounting account category * @param int $cat_id Id if personalized accounting group/category
* * @param string $predefinedgroup Sql criteria filter to select accounting accounts
* @return array Result in table * @return array Array of accounting accounts
*/ */
public function getCptsCat($cat_id) { public function getCptsCat($cat_id, $predefinedgroupwhere='')
{
global $mysoc; global $mysoc;
$sql = ""; $sql = '';
if (empty($mysoc->country_id) && empty($mysoc->country_code)) { if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit(); exit();
} }
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt"; if (! empty($cat_id))
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; {
$sql .= " WHERE t.fk_accounting_category = ".$cat_id; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " ORDER BY t.account_number "; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " ORDER BY t.account_number ";
}
else
{
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE ".$predefinedgroupwhere;
$sql .= " ORDER BY t.account_number ";
}
//echo $sql; //echo $sql;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -564,14 +541,15 @@ class AccountancyCategory
$i = 0; $i = 0;
$obj = ''; $obj = '';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$data = array (); $data = array();
if ($num) { if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql))
{
$name_cat = $obj->name_cat; $name_cat = $obj->name_cat;
$data[] = array ( $data[] = array (
'id' => $obj->rowid, 'id' => $obj->rowid,
'account_number' => $obj->account_number, 'account_number' => $obj->account_number,
'name_cpt' => $obj->name_cpt, 'account_label' => $obj->account_label,
); );
$i ++; $i ++;
} }

View File

@ -1224,18 +1224,17 @@ class BookKeeping extends CommonObject
/** /**
* Delete bookkepping by piece number * Delete bookkepping by piece number
* *
* @param int $piecenum peicenum to delete * @param int $piecenum Piecenum to delete
* @param string $mode Mode * @return int Result
* @return int Result
*/ */
function deleteMvtNum($piecenum, $mode) { function deleteMvtNum($piecenum) {
global $conf; global $conf;
$this->db->begin(); $this->db->begin();
// first check if line not yet in bookkeeping // first check if line not yet in bookkeeping
$sql = "DELETE"; $sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element. $mode; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")"; $sql .= " AND entity IN (" . getEntity('accountancy') . ")";

View File

@ -205,6 +205,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -254,13 +255,14 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -310,7 +312,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ? if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
@ -321,6 +323,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@ -362,10 +365,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>'; print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@ -408,6 +412,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
} }
} }

View File

@ -130,6 +130,8 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
* View * View
*/ */
$form = new Form($db);
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched")); llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@ -186,6 +186,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -231,7 +232,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
print '<br>'; print '<br>';
@ -239,6 +240,7 @@ print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -284,7 +286,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
@ -296,6 +298,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@ -334,6 +337,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
} }
llxFooter(); llxFooter();

View File

@ -87,7 +87,7 @@ print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
@ -138,6 +138,9 @@ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step,
print "<br>\n"; print "<br>\n";
print '<br>';
print "<br>\n"; print "<br>\n";
print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek'); print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek');
print '<hr>'; print '<hr>';

View File

@ -1,6 +1,4 @@
<?php <?php
use Stripe\BankAccount;
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
@ -726,7 +724,7 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("FinanceJournal")); llxHeader('', $langs->trans("FinanceJournal"));
$nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1); $nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
$builddate = time(); $builddate=dol_now();
//$description = $langs->trans("DescFinanceJournal") . '<br>'; //$description = $langs->trans("DescFinanceJournal") . '<br>';
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
@ -742,7 +740,7 @@ if (empty($action) || $action == 'view') {
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' || empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
@ -774,6 +772,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@ -924,6 +923,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
llxFooter(); llxFooter();
} }

View File

@ -498,7 +498,7 @@ if (empty($action) || $action == 'view') {
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
$builddate = time(); $builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger")); $listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
@ -511,7 +511,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
@ -543,6 +543,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@ -668,6 +669,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -514,7 +514,7 @@ if (empty($action) || $action == 'view') {
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
$builddate = time(); $builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
@ -532,7 +532,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
@ -564,6 +564,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@ -692,6 +693,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -535,7 +535,7 @@ if (empty($action) || $action == 'view') {
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
$builddate = time(); $builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
@ -552,7 +552,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
} }
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
@ -584,6 +584,7 @@ if (empty($action) || $action == 'view') {
print '<br>'; print '<br>';
$i = 0; $i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td></td>"; print "<td></td>";
@ -708,6 +709,7 @@ if (empty($action) || $action == 'view') {
} }
print "</table>"; print "</table>";
print '</div>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -1,302 +0,0 @@
<?php
/* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/report/result.php
* \ingroup Advanced accountancy
* \brief Page for accounting result
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$error = 0;
// Langs
$langs->load("accountancy");
$langs->load("compta");
$mesg = '';
$action = GETPOST('action','aZ09');
$cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
$simple_report = GETPOST('simple_report');
// Filter
$year = GETPOST('year','int');
if ($year == 0) {
$year_current = strftime("%Y", time());
$year_start = $year_current;
} else {
$year_current = $year;
$year_start = $year;
}
if($cat_id == 0){
$cat_id = null;
}
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->comptarapport->lire)
accessforbidden();
$AccCat = new AccountancyCategory($db);
/*
* View
*/
llxheader('', $langs->trans('ReportInOut'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts");
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$description = '';
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
$months = array( $langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("Account").'</th>';
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
print '<th class="liste_titre" align="center">N-1</th>';
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
foreach($months as $k => $v){
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
}
print '</tr>';
//All categories
$cats = $AccCat->getCats();
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
$j=1;
$sommes = array();
foreach($cats as $cat ){
if(!empty($cat['category_type'])){ // category calculed
$formula = $cat['formula'];
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $cat['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$code = $cat['code']; // code categorie de calcule
$sommes[$code]['NP'] += $r;
// Current fiscal year (N)
if (is_array($sommes) && ! empty($sommes)){
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['N'] += $r;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['M'][$k] += $r;
}
print "</tr>\n";
}else{ // normal category
$totCat = array();
$totCat['M'] = array();
// get cpts of category
$cpts = $AccCat->getCptsCat($cat['rowid']);
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $cat['label'] . '</td>';
foreach($cpts as $i => $cpt){
$var = ! $var;
$code = $cat['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
}
}
print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>';
foreach($totCat['M'] as $k => $v){
print '<td align="right">' . price($v) . '</td>';
}
print "</tr>\n";
foreach($cpts as $i => $cpt){
$var = ! $var;
$code = $cat['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
print '<tr'. $bc[$var].'>';
if ($simple_report == 'yes') {
print '<td>' . length_accountg($cpt['account_number']) . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td align="right">' . price($resultNP) . '</td>';
print '<td align="right">' . price($resultN) . '</td>';
}
foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$sommes[$code]['M'][$k] += $resultM;
if ($simple_report == 'yes') {
print '<td align="right">' . price($resultM) . '</td>';
}
}
print "</tr>\n";
}
}
}
print "</table>";
print '</div>';
llxFooter();
$db->close();

View File

@ -182,6 +182,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -227,8 +228,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
print '<br>'; print '<br>';
@ -236,6 +236,7 @@ print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -281,7 +282,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
@ -293,6 +294,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n"; print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@ -333,6 +335,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
print '</div>';
} }

View File

@ -49,7 +49,7 @@ $error=0;
* Actions * Actions
*/ */
if ( ($action == 'update' && empty($_POST["cancel"])) if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|| ($action == 'updateedit') ) || ($action == 'updateedit') )
{ {
$tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0); $tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
@ -63,18 +63,18 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
} }
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS",$_POST["address"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN",$_POST["town"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP",$_POST["zipcode"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE",$_POST["state_id"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode",'alpha'),'chaine',0,'',$conf->entity);
$varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/'; $varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
if ($_FILES[$varforimage]["tmp_name"]) if ($_FILES[$varforimage]["tmp_name"])
@ -144,26 +144,26 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
} }
} }
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS",$_POST["MAIN_INFO_SOCIETE_MANAGERS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_PROFID5",$_POST["MAIN_INFO_PROFID5"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT",$_POST["object"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("fiscalmonthstart",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
// Local taxes // Local taxes
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", GETPOST("optionlocaltax1",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", GETPOST("optionlocaltax2",'alpha'),'chaine',0,'',$conf->entity);
if($_POST["optionlocaltax1"]=="localtax1on") if($_POST["optionlocaltax1"]=="localtax1on")
{ {
@ -173,9 +173,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
} }
else else
{ {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1','alpha'),'chaine',0,'',$conf->entity);
} }
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", $_POST["clt1"],'chaine',0,'',$conf->entity); dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1",'alpha'),'chaine',0,'',$conf->entity);
} }
if($_POST["optionlocaltax2"]=="localtax2on") if($_POST["optionlocaltax2"]=="localtax2on")
{ {
@ -185,9 +185,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
} }
else else
{ {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2','alpha'),'chaine',0,'',$conf->entity);
} }
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", $_POST["clt2"],'chaine',0,'',$conf->entity); dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2",'alpha'),'chaine',0,'',$conf->entity);
} }
if ($action != 'updateedit' && ! $error) if ($action != 'updateedit' && ! $error)
@ -311,20 +311,20 @@ if ($action == 'edit' || $action == 'updateedit')
// Name // Name
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM:$_POST["nom"]) . '" autofocus="autofocus"></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
// Addresse // Addresse
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n"; print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP:$_POST["zipcode"]) . '"></td></tr>'."\n"; print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN:$_POST["town"]) . '"></td></tr>'."\n"; print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
// Country // Country
@ -394,7 +394,7 @@ if ($action == 'edit' || $action == 'updateedit')
// Note // Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>'; print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '').'</textarea></td></tr>'; print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -1014,6 +1014,7 @@ if ($id)
$fieldlist=explode(',',$tabfield[$id]); $fieldlist=explode(',',$tabfield[$id]);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Line for title // Line for title
@ -1164,6 +1165,7 @@ if ($id)
if ($id == 4) $colspan++; if ($id == 4) $colspan++;
print '</table>'; print '</table>';
print '</div>';
/*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of * /*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
{ {
@ -1193,6 +1195,7 @@ if ($id)
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>'); print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
} }
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Title line with search boxes // Title line with search boxes
@ -1654,6 +1657,7 @@ if ($id)
} }
print '</table>'; print '</table>';
print '</div>';
} }
else { else {
dol_print_error($db); dol_print_error($db);

View File

@ -42,7 +42,7 @@ if (!$res) die("Include of main fails");
global $lang, $user, $conf; global $lang, $user, $conf;
dol_include_once('/dolistore/class/dolistore.class.php'); require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
$dolistore = new Dolistore(); $dolistore = new Dolistore();
$id_product = GETPOST('id_product', 'int'); $id_product = GETPOST('id_product', 'int');

View File

@ -48,6 +48,7 @@ class PrestaShopWebservice
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99'; const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
/** /**
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated * PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
* <code> * <code>
@ -79,6 +80,7 @@ class PrestaShopWebservice
/** /**
* Take the status code and throw an exception if the server didn't return 200 or 201 code * Take the status code and throw an exception if the server didn't return 200 or 201 code
*
* @param int $status_code Status code of an HTTP return * @param int $status_code Status code of an HTTP return
*/ */
protected function checkStatusCode($status_code) protected function checkStatusCode($status_code)
@ -86,21 +88,32 @@ class PrestaShopWebservice
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.'; $error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
switch($status_code) switch($status_code)
{ {
case 200: case 201: break; case 200:
case 204: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));break; case 201:
case 400: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));break; break;
case 401: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));break; case 204:
case 404: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));break; throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));
case 405: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));break; case 400:
case 500: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));break; throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));
default: throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code); case 401:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));
case 404:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));
case 405:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));
case 500:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));
default:
throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
} }
} }
/** /**
* Handles a CURL request to PrestaShop Webservice. Can throw exception. * Handles a CURL request to PrestaShop Webservice. Can throw exception.
* @param string $url Resource name *
* @param mixed $curl_params CURL parameters (sent to curl_set_opt) * @param string $url Resource name
* @return array status_code, response * @param mixed $curl_params CURL parameters (sent to curl_set_opt)
* @return array status_code, response
*/ */
public function executeRequest($url, $curl_params = array()) public function executeRequest($url, $curl_params = array())
{ {
@ -178,11 +191,23 @@ class PrestaShopWebservice
return array('status_code' => $status_code, 'response' => $body, 'header' => $header); return array('status_code' => $status_code, 'response' => $body, 'header' => $header);
} }
/**
* Output debug info
*
* @param string $title Title
* @param string $content Content
* @return void
*/
public function printDebug($title, $content) public function printDebug($title, $content)
{ {
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>'; echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
} }
/**
* Return version
*
* @return string Version
*/
public function getVersion() public function getVersion()
{ {
return $this->version; return $this->version;
@ -190,8 +215,9 @@ class PrestaShopWebservice
/** /**
* Load XML from string. Can throw exception * Load XML from string. Can throw exception
* @param string $response String from a CURL response *
* @return SimpleXMLElement status_code, response * @param string $response String from a CURL response
* @return SimpleXMLElement status_code, response
*/ */
protected function parseXML($response) protected function parseXML($response)
{ {
@ -268,8 +294,8 @@ class PrestaShopWebservice
* } * }
* ?> * ?>
* </code> * </code>
* @param array $options Array representing resource to get. * @param array $options Array representing resource to get.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement status_code, response
*/ */
public function get($options) public function get($options)
{ {
@ -301,8 +327,8 @@ class PrestaShopWebservice
/** /**
* Head method (HEAD) a resource * Head method (HEAD) a resource
* *
* @param array $options Array representing resource for head request. * @param array $options Array representing resource for head request.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement status_code, response
*/ */
public function head($options) public function head($options)
{ {
@ -336,7 +362,9 @@ class PrestaShopWebservice
* 'id' => ID of a resource you want to edit,<br> * 'id' => ID of a resource you want to edit,<br>
* 'putXml' => Modified XML string of a resource<br><br> * 'putXml' => Modified XML string of a resource<br><br>
* Examples are given in the tutorial</p> * Examples are given in the tutorial</p>
* @param array $options Array representing resource to edit. *
* @param array $options Array representing resource to edit.
* @return SimpleXMLElement status_code, response
*/ */
public function edit($options) public function edit($options)
{ {
@ -381,7 +409,8 @@ class PrestaShopWebservice
* } * }
* ?> * ?>
* </code> * </code>
* @param array $options Array representing resource to delete. * @param array $options Array representing resource to delete.
* @return boolean true
*/ */
public function delete($options) public function delete($options)
{ {
@ -400,8 +429,6 @@ class PrestaShopWebservice
self::checkStatusCode($request['status_code']);// check the response validity self::checkStatusCode($request['status_code']);// check the response validity
return true; return true;
} }
} }
/** /**

View File

@ -19,9 +19,145 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php'; include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
/** /**
* Class DolistoreModel * Class DolistoreModel
*/ */
class DolistoreModel
{
function get_categories($parent = 0)
{
if (!isset($this->categories)) die('not possible');
if ($parent != 0) {
$html = '<ul>';
} else {
$html = '';
}
$nbofcateg = count($this->categories);
for ($i = 0; $i < $nbofcateg; $i++)
{
$cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} else {
}
}
if ($html == '<ul>') {
return '';
}
if ($parent != 0) {
return $html.'</ul>';
} else {
return $html;
}
}
function get_products()
{
global $langs, $conf;
$html = "";
$parity = "pair";
$last_month = time() - (30 * 24 * 60 * 60);
foreach ($this->products as $product) {
$parity = ($parity == "impair") ? 'pair' : 'impair';
// check new product ?
$newapp = '';
if ($last_month < strtotime($product->date_add)) {
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
}
// check updated ?
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
}
// add image or default ?
if ($product->id_default_image != '') {
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
}
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).'&nbsp;&euro;</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
2).'" /></a>';
} else {
$price = $langs->trans('Free');
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
2).'" /></a>';
}
//checking versions
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
//compatible
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = '';
} else {
//never compatible, module expired
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
} else {
//need update
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
//output template
$html .= '<tr class="app '.$parity.' '.$compatible.'">
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
.'<br/><small>'.$version.'</small></h2>
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
<td class="margeCote" align="right">'.$price.'</td>
<td class="margeCote">'.$download_link.'</td>
</tr>';
}
return $html;
}
function get_previous_link($text = '<<')
{
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
function get_next_link($text = '>>')
{
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
}
/**
* Class Dolistore
*/
class Dolistore extends DolistoreModel class Dolistore extends DolistoreModel
{ {
// params // params
@ -182,135 +318,3 @@ class Dolistore extends DolistoreModel
} }
} }
/**
* Class DolistoreModel
*/
class DolistoreModel
{
function get_categories($parent = 0)
{
if (!isset($this->categories)) die('not possible');
if ($parent != 0) {
$html = '<ul>';
} else {
$html = '';
}
$nbofcateg = count($this->categories);
for ($i = 0; $i < $nbofcateg; $i++)
{
$cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} else {
}
}
if ($html == '<ul>') {
return '';
}
if ($parent != 0) {
return $html.'</ul>';
} else {
return $html;
}
}
function get_products()
{
global $langs, $conf;
$html = "";
$parity = "pair";
$last_month = time() - (30 * 24 * 60 * 60);
foreach ($this->products as $product) {
$parity = ($parity == "impair") ? 'pair' : 'impair';
// check new product ?
$newapp = '';
if ($last_month < strtotime($product->date_add)) {
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
}
// check updated ?
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
}
// add image or default ?
if ($product->id_default_image != '') {
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
}
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).'&nbsp;&euro;</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
2).'" /></a>';
} else {
$price = $langs->trans('Free');
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
2).'" /></a>';
}
//checking versions
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
//compatible
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = '';
} else {
//never compatible, module expired
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
} else {
//need update
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
//output template
$html .= '<tr class="app '.$parity.' '.$compatible.'">
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
.'<br/><small>'.$version.'</small></h2>
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
<td class="margeCote" align="right">'.$price.'</td>
<td class="margeCote">'.$download_link.'</td>
</tr>';
}
return $html;
}
function get_previous_link($text = '<<')
{
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
function get_next_link($text = '>>')
{
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
}

View File

@ -29,7 +29,7 @@
// Here we define constants /!\ You need to replace this parameters // Here we define constants /!\ You need to replace this parameters
//https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/ //https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/
define('DEBUG', true); // Debug mode define('DEBUG', true); // Debug mode
define('PS_SHOP_PATH', 'http://vmdevwww.dolistore.com/'); // Root path of your PrestaShop store define('PS_SHOP_PATH', 'https://www.dolistore.com/'); // Root path of your PrestaShop store
define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office) define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office)
require_once('./PSWebServiceLibrary.php'); require_once('./PSWebServiceLibrary.php');
// Here we make the WebService Call // Here we make the WebService Call

View File

@ -85,25 +85,25 @@ if ($action == 'update')
} }
$menu = new Menubase($db); $menu = new Menubase($db);
$result=$menu->fetch($_POST['menuId']); $result=$menu->fetch(GETPOST('menuId', 'int'));
if ($result > 0) if ($result > 0)
{ {
$menu->titre=$_POST['titre']; $menu->titre=GETPOST('titre', 'alpha');
$menu->leftmenu=$_POST['leftmenu']; $menu->leftmenu=GETPOST('leftmenu', 'alpha');
$menu->url=$_POST['url']; $menu->url=GETPOST('url','alpha');
$menu->langs=$_POST['langs']; $menu->langs=GETPOST('langs','alpha');
$menu->position=$_POST['position']; $menu->position=GETPOST('position','int');
$menu->enabled=$_POST['enabled']; $menu->enabled=GETPOST('enabled','alpha');
$menu->perms=$_POST['perms']; $menu->perms=GETPOST('perms','alpha');
$menu->target=$_POST['target']; $menu->target=GETPOST('target','alpha');
$menu->user=$_POST['user']; $menu->user=GETPOST('user','alpha');
if (is_numeric($_POST['menuIdParent'])) if (is_numeric(GETPOST('menuIdParent','alpha')))
{ {
$menu->fk_menu=$_POST['menuIdParent']; $menu->fk_menu=GETPOST('menuIdParent','alpha');
} }
else else
{ {
if ($_POST['type'] == 'top') $menu->fk_menu=0; if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1; else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu; $menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu; $menu->fk_leftmenu=$leftmenu;
@ -123,7 +123,6 @@ if ($action == 'update')
{ {
setEventMessages($menu->error, $menu->errors, 'errors'); setEventMessages($menu->error, $menu->errors, 'errors');
} }
$_GET["menuId"] = $_POST['menuId'];
$action = "edit"; $action = "edit";
} }
else else
@ -148,9 +147,9 @@ if ($action == 'add')
} }
$leftmenu=''; $mainmenu=''; $leftmenu=''; $mainmenu='';
if (! empty($_POST['menuId']) && ! is_numeric($_POST['menuId'])) if (GETPOST('menuId','int') && ! is_numeric(GETPOST('menuId','int')))
{ {
$tmp=explode('&',$_POST['menuId']); $tmp=explode('&',GETPOST('menuId','int'));
foreach($tmp as $s) foreach($tmp as $s)
{ {
if (preg_match('/fk_mainmenu=/',$s)) if (preg_match('/fk_mainmenu=/',$s))
@ -197,7 +196,7 @@ if ($action == 'add')
$action = 'create'; $action = 'create';
$error++; $error++;
} }
if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left') if (! $error && ! $_POST['menuId'] && $_POST['type'] == 'left')
{ {
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors'); setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
$action = 'create'; $action = 'create';
@ -207,23 +206,23 @@ if ($action == 'add')
if (! $error) if (! $error)
{ {
$menu = new Menubase($db); $menu = new Menubase($db);
$menu->menu_handler=preg_replace('/_menu$/','',$_POST['menu_handler']); $menu->menu_handler=preg_replace('/_menu$/','',GETPOST('menu_handler','aZ09'));
$menu->type=$_POST['type']; $menu->type=GETPOST('type','alpha');
$menu->titre=$_POST['titre']; $menu->titre=GETPOST('titre','alpha');
$menu->url=$_POST['url']; $menu->url=GETPOST('url','alpha');
$menu->langs=$_POST['langs']; $menu->langs=GETPOST('langs','alpha');
$menu->position=$_POST['position']; $menu->position=GETPOST('position','int');
$menu->enabled=$_POST['enabled']; $menu->enabled=GETPOST('enabled','alpha');
$menu->perms=$_POST['perms']; $menu->perms=GETPOST('perms','alpha');
$menu->target=$_POST['target']; $menu->target=GETPOST('target','alpha');
$menu->user=$_POST['user']; $menu->user=GETPOST('user','alpha');
if (is_numeric($_POST['menuId'])) if (is_numeric(GETPOST('menuId','int')))
{ {
$menu->fk_menu=$_POST['menuId']; $menu->fk_menu=GETPOST('menuId','int');
} }
else else
{ {
if ($_POST['type'] == 'top') $menu->fk_menu=0; if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1; else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu; $menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu; $menu->fk_leftmenu=$leftmenu;
@ -232,7 +231,7 @@ if ($action == 'add')
$result=$menu->create($user); $result=$menu->create($user);
if ($result > 0) if ($result > 0)
{ {
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$_POST['menu_handler']); header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler','aZ09'));
exit; exit;
} }
else else
@ -306,7 +305,7 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("NewMenu"),'','title_setup'); print load_fiche_titre($langs->trans("NewMenu"),'','title_setup');
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">'; print '<form action="./edit.php?action=add&menuId='.GETPOST('menuId', 'int').'" method="post" name="formmenucreate">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
dol_fiche_head(); dol_fiche_head();
@ -314,8 +313,8 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Id // Id
$parent_rowid = $_GET['menuId']; $parent_rowid = GETPOST('menuId', 'int');
if ($_GET['menuId']) if (GETPOST('menuId', 'int'))
{ {
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int'); $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
$res = $db->query($sql); $res = $db->query($sql);
@ -375,35 +374,35 @@ if ($action == 'create')
} }
else else
{ {
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>'; print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
} }
print '<td>'.$langs->trans('DetailMenuIdParent'); print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>'; print '</td></tr>';
// Title // Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$_POST["titre"].'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// URL // URL
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.$_POST["url"].'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Langs // Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>'; print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
// Position // Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>'; print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Target // Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">'; print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>'; print '<option value=""'.($menu->target==""?' selected':'').'>&nbsp;</option>';
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>'; print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>'; print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled // Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.$_POST["enabled"].'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>'; print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.GETPOST("enabled",'alpha').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
// Perms // Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.$_POST["perms"].'"></td><td>'.$langs->trans('DetailRight').'</td></tr>'; print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.GETPOST('perms','alpha').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
print '</table>'; print '</table>';
@ -426,14 +425,14 @@ elseif ($action == 'edit')
print '<form action="./edit.php?action=update" method="POST" name="formmenuedit">'; print '<form action="./edit.php?action=update" method="POST" name="formmenuedit">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">'; print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
print '<input type="hidden" name="menuId" value="'.$_GET['menuId'].'">'; print '<input type="hidden" name="menuId" value="'.GETPOST('menuId', 'int').'">';
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$menu = new Menubase($db); $menu = new Menubase($db);
$result=$menu->fetch($_GET['menuId']); $result=$menu->fetch(GETPOST('menuId', 'int'));
//var_dump($menu); //var_dump($menu);
// Id // Id
@ -472,20 +471,20 @@ elseif ($action == 'edit')
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>'; //print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
// Title // Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$menu->titre.'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Url // Url
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Langs // Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$menu->langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>'; print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
// Position // Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>'; print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Target // Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">'; print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>'; print '<option value=""'.($menu->target==""?' selected':'').'>&nbsp;</option>';
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>'; print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>'; print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';

View File

@ -882,115 +882,111 @@ if ($mode == 'marketplace')
if ($mode == 'deploy') if ($mode == 'deploy')
{ {
dol_fiche_head($head, $mode, '', -1); dol_fiche_head($head, $mode, '', -1);
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
$allowonlineinstall=true;
$allowfromweb=1;
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
$allowonlineinstall=true; $fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
$allowfromweb=1; $message='';
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false; if (! empty($allowonlineinstall))
{
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
{
$message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb=-1;
}
else
{
if ($dirins_ok)
{
if (! is_writable(dol_osencode($dirins)))
{
$langs->load("errors");
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
$allowfromweb=0;
}
}
else
{
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb=0;
}
}
}
else
{
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
$allowfromweb=0;
}
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>'; if ($allowfromweb < 1)
$message=''; {
if (! empty($allowonlineinstall)) print $langs->trans("SomethingMakeInstallFromWebNotPossible");
{ print $message;
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt))) //print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
{ print '<br>';
$message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); }
$allowfromweb=-1;
}
else
{
if ($dirins_ok)
{
if (! is_writable(dol_osencode($dirins)))
{
$langs->load("errors");
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
$allowfromweb=0;
}
}
else
{
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); print '<br>';
$allowfromweb=0;
}
}
}
else
{
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
$allowfromweb=0;
}
if ($allowfromweb < 1) if ($allowfromweb >= 0)
{ {
print $langs->trans("SomethingMakeInstallFromWebNotPossible"); if ($allowfromweb == 1)
print $message; {
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2"); //print $langs->trans("ThisIsProcessToFollow").'<br>';
print '<br>'; }
} else
{
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
}
print '<br>'; if ($allowfromweb == 1)
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
if ($allowfromweb >= 0) print '<br>';
{
if ($allowfromweb == 1)
{
//print $langs->trans("ThisIsProcessToFollow").'<br>';
}
else
{
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
}
if ($allowfromweb == 1) print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
{ print '<input type="hidden" name="action" value="install">';
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>'; print '<input type="hidden" name="mode" value="deploy">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>';
print '<br>'; print '<br>';
print '<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">'; print '<div class="center"><div class="logo_setup"></div></div>';
print '<input type="hidden" name="action" value="install">'; }
print '<input type="hidden" name="mode" value="deploy">'; else
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> '; {
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">'; print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '</form>'; print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
}
print '<br>'; if (! empty($result['return']))
print '<br>'; {
print '<br>';
print '<div class="center"><div class="logo_setup"></div></div>'; foreach($result['return'] as $value)
} {
else echo $value.'<br>';
{ }
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>'; }
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
}
dol_fiche_end();
if (! empty($result['return']))
{
print '<br>';
foreach($result['return'] as $value)
{
echo $value.'<br>';
}
}
dol_fiche_end();
} }
if ($mode == 'develop') if ($mode == 'develop')
{ {
dol_fiche_head($head, $mode, '', -1); dol_fiche_head($head, $mode, '', -1);

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2105 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -75,6 +75,10 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["_MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit; exit;
} }
@ -249,6 +253,40 @@ if ($action == 'edit') // Edit
print '<br>'; print '<br>';
// Localtaxes
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
$text .= '</td></tr>';
}
if ($mysoc->useLocalTax(2))
{
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
// Other // Other
print load_fiche_titre($langs->trans("Other"),'','').'<br>'; print load_fiche_titre($langs->trans("Other"),'','').'<br>';
$var=true; $var=true;
@ -444,6 +482,40 @@ else // Show
print '<br>'; print '<br>';
// Localtaxes
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
$text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1);
$text .= '</td></tr>';
}
if ($mysoc->useLocalTax(2))
{
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
$text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1);
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
// Other // Other
print load_fiche_titre($langs->trans("Other"),'',''); print load_fiche_titre($langs->trans("Other"),'','');
$var=true; $var=true;

View File

@ -260,10 +260,6 @@ p.titre {
padding: 0; padding: 0;
} }
.resultats_dhtml {
width: 400px;
position: absolute;
}
/* --------------------- Combo lists ------------------- */ /* --------------------- Combo lists ------------------- */
.select_design { .select_design {

View File

@ -51,26 +51,14 @@ function file(fichier) {
} }
// Affichage des donnees aTexte dans le bloc identifie par aId
function afficheDonnees(aId, aTexte) {
document.getElementById(aId).innerHTML = aTexte;
}
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage // aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
function verifResultat(aCible, aCode, iLimit) { function verifResultat(aCible, aCode, iLimit) {
if (aCode != '' && aCode.length >= iLimit) { if (aCode != '' && aCode.length >= iLimit) {
if (texte = file('facturation_dhtml.php?code='+escape(aCode))) { if (texte = file('facturation_dhtml.php?code='+escape(aCode))) {
document.getElementById(aCible).innerHTML = texte;
afficheDonnees (aCible, texte);
} else } else
document.getElementById(aCible).innerHTML = '';
afficheDonnees (aCible, '');
} }
} }

View File

@ -42,11 +42,10 @@ $langs->load("cashdesk");
<tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr> <tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
<tr> <tr>
<!-- Affichage de la reference et de la designation --> <!-- Affichage de la reference et de la designation -->
<!-- Suppression de l'attribut onkeyup qui causait un probleme d'emulation avec les douchettes -->
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>" <td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
onchange="javascript: setSource('REF');" onchange="javascript: setSource('REF');"
onkeyup="javascript: verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);" onfocus="javascript: this.select();" />
onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/>
</td> </td>
<td class="select_design maxwidthonsmartphone"> <td class="select_design maxwidthonsmartphone">
<?php /* <?php /*

View File

@ -936,7 +936,7 @@ class ActionComm extends CommonObject
$response->label = $langs->trans("ActionsToDo"); $response->label = $langs->trans("ActionsToDo");
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&amp;mainmenu=agenda'; $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&amp;mainmenu=agenda';
if ($user->rights->agenda->allactions->read) $response->url.='&amp;filtert=-1'; if ($user->rights->agenda->allactions->read) $response->url.='&amp;filtert=-1';
$response->img = img_object('',"action"); $response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
// This assignment in condition is not a bug. It allows walking the results. // This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))

View File

@ -206,7 +206,7 @@ if ($id > 0 && empty($object->id))
{ {
// Load data of third party // Load data of third party
$res=$object->fetch($id); $res=$object->fetch($id);
if ($object->id <= 0) dol_print_error($db,$object->error); if ($object->id <= 0) dol_print_error($db,$object->error,$object->errors);
} }
$title=$langs->trans("CustomerCard"); $title=$langs->trans("CustomerCard");

View File

@ -463,7 +463,7 @@ if (empty($reshook))
$object->email_errorsto = trim($_POST["errorsto"]); $object->email_errorsto = trim($_POST["errorsto"]);
$object->titre = trim($_POST["titre"]); $object->titre = trim($_POST["titre"]);
$object->sujet = trim($_POST["sujet"]); $object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]); $object->body = trim($_POST["bodyemail"]);
$object->bgcolor = trim($_POST["bgcolor"]); $object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]); $object->bgimage = trim($_POST["bgimage"]);
@ -560,7 +560,7 @@ if (empty($reshook))
$mesgs = array(); $mesgs = array();
$object->sujet = trim($_POST["sujet"]); $object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]); $object->body = trim($_POST["bodyemail"]);
$object->bgcolor = trim($_POST["bgcolor"]); $object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]); $object->bgimage = trim($_POST["bgimage"]);
@ -686,7 +686,13 @@ $form = new Form($db);
$htmlother = new FormOther($db); $htmlother = new FormOther($db);
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing'; $help_url='EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing';
llxHeader('',$langs->trans("Mailing"),$help_url); llxHeader('', $langs->trans("Mailing"), $help_url, '', 0, 0,
array(
'/includes/ace/ace.js',
'/includes/ace/ext-statusbar.js',
'/includes/ace/ext-language_tools.js',
//'/includes/ace/ext-chromevox.js'
), array());
if ($action == 'create') if ($action == 'create')
{ {
@ -740,7 +746,7 @@ if ($action == 'create')
print '<div style="padding-top: 10px">'; print '<div style="padding-top: 10px">';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$_POST['body'],'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); $doleditor=new DolEditor('bodyemail',GETPOST('bodyemail','none'),'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create(); $doleditor->Create();
print '</div>'; print '</div>';
@ -780,7 +786,7 @@ else
} }
if ($action != 'edit') if ($action != 'edit' && $action != 'edithtml')
{ {
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email'); dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
@ -935,7 +941,9 @@ else
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer) if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditMailing").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>';
if (! empty($conf->use_javascript_ajax)) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edithtml&amp;id='.$object->id.'">'.$langs->trans("EditHTMLSource").'</a>';
} }
//print '<a class="butAction" href="card.php?action=test&amp;id='.$object->id.'">'.$langs->trans("PreviewMailing").'</a>'; //print '<a class="butAction" href="card.php?action=test&amp;id='.$object->id.'">'.$langs->trans("PreviewMailing").'</a>';
@ -1095,7 +1103,7 @@ else
$readonly=1; $readonly=1;
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly); $doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
$doleditor->Create(); $doleditor->Create();
} }
else print dol_htmlentitiesbr($object->body); else print dol_htmlentitiesbr($object->body);
@ -1107,7 +1115,7 @@ else
else else
{ {
/* /*
* Mailing en mode edition * Mailing en mode edition (CKeditor or HTML source)
*/ */
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email'); dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
@ -1187,7 +1195,8 @@ else
// Print mail content // Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic'); print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
dol_fiche_head();
dol_fiche_head(null, '', '', -1);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -1203,6 +1212,7 @@ else
print '<td colspan="3">'; print '<td colspan="3">';
// List of files // List of files
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0); $listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n"; $out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out.= '<script type="text/javascript" language="javascript">'; $out.= '<script type="text/javascript" language="javascript">';
@ -1242,17 +1252,29 @@ else
// Message // Message
print '<div style="padding-top: 10px">'; print '<div style="padding-top: 10px">';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; if ($action == 'edit')
$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%'); {
$doleditor->Create(); // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create();
}
if ($action == 'edithtml')
{
// Editor HTML source
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',true,true,'ace',20,'90%');
$doleditor->Create(0, '', false, 'HTML Source', 'php');
}
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'" name="save">'; print '<input type="submit" class="button buttonforacesave" value="'.$langs->trans("Save").'" name="save">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">'; print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
print '</div>'; print '</div>';

View File

@ -45,7 +45,6 @@ $ref = GETPOST('ref','alpha');
$socid=''; $socid='';
if (! empty($user->societe_id)) if (! empty($user->societe_id))
{ {
$action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'propal', $id); $result = restrictedArea($user, 'propal', $id);

View File

@ -44,7 +44,6 @@ $ref = GETPOST('ref');
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
{ {
$action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result=restrictedArea($user,'commande',$id,''); $result=restrictedArea($user,'commande',$id,'');

View File

@ -30,8 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
*/ */
class PaymentVarious extends CommonObject class PaymentVarious extends CommonObject
{ {
//public $element='payment_various'; //!< Id that identify managed objects public $element='variouspayment'; //!< Id that identify managed objects
//public $table_element='payment_various'; //!< Name of table without prefix where object is stored public $table_element='payment_various'; //!< Name of table without prefix where object is stored
public $picto = 'bill';
var $tms; var $tms;
var $datep; var $datep;
@ -42,6 +43,7 @@ class PaymentVarious extends CommonObject
var $num_payment; var $num_payment;
var $label; var $label;
var $accountancy_code; var $accountancy_code;
var $fk_project;
var $fk_bank; var $fk_bank;
var $fk_user_author; var $fk_user_author;
var $fk_user_modif; var $fk_user_modif;
@ -96,6 +98,7 @@ class PaymentVarious extends CommonObject
$sql.= " label='".$this->db->escape($this->label)."',"; $sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " note='".$this->db->escape($this->note)."',"; $sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',"; $sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
$sql.= " fk_projet='".$this->db->escape($this->fk_project)."',";
$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").","; $sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
$sql.= " fk_user_author=".$this->fk_user_author.","; $sql.= " fk_user_author=".$this->fk_user_author.",";
$sql.= " fk_user_modif=".$this->fk_user_modif; $sql.= " fk_user_modif=".$this->fk_user_modif;
@ -154,6 +157,7 @@ class PaymentVarious extends CommonObject
$sql.= " v.label,"; $sql.= " v.label,";
$sql.= " v.note,"; $sql.= " v.note,";
$sql.= " v.accountancy_code,"; $sql.= " v.accountancy_code,";
$sql.= " v.fk_projet as fk_project,";
$sql.= " v.fk_bank,"; $sql.= " v.fk_bank,";
$sql.= " v.fk_user_author,"; $sql.= " v.fk_user_author,";
$sql.= " v.fk_user_modif,"; $sql.= " v.fk_user_modif,";
@ -185,6 +189,7 @@ class PaymentVarious extends CommonObject
$this->label = $obj->label; $this->label = $obj->label;
$this->note = $obj->note; $this->note = $obj->note;
$this->accountancy_code = $obj->accountancy_code; $this->accountancy_code = $obj->accountancy_code;
$this->fk_project = $obj->fk_project;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;
$this->fk_user_author = $obj->fk_user_author; $this->fk_user_author = $obj->fk_user_author;
$this->fk_user_modif = $obj->fk_user_modif; $this->fk_user_modif = $obj->fk_user_modif;
@ -317,6 +322,7 @@ class PaymentVarious extends CommonObject
if ($this->note) $sql.= ", note"; if ($this->note) $sql.= ", note";
$sql.= ", label"; $sql.= ", label";
$sql.= ", accountancy_code"; $sql.= ", accountancy_code";
$sql.= ", fk_projet";
$sql.= ", fk_user_author"; $sql.= ", fk_user_author";
$sql.= ", datec"; $sql.= ", datec";
$sql.= ", fk_bank"; $sql.= ", fk_bank";
@ -451,6 +457,63 @@ class PaymentVarious extends CommonObject
} }
/**
* Retourne le libelle du statut
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function getLibStatut($mode=0)
{
return $this->LibStatut($this->statut,$mode);
}
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function LibStatut($statut,$mode=0)
{
global $langs;
if ($mode == 0)
{
return $langs->trans($this->statuts[$statut]);
}
if ($mode == 1)
{
return $langs->trans($this->statuts_short[$statut]);
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
if ($mode == 3)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
}
if ($mode == 4)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
}
if ($mode == 5)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
}
}
/** /**
* Send name clicable (with possibly the picto) * Send name clicable (with possibly the picto)
* *

View File

@ -514,7 +514,7 @@ foreach ($accounts as $key=>$type)
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled))
{ {
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch('',$acc->fk_accountancy_journal); $accountingjournal->fetch($acc->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0,1,1,'',1); print $accountingjournal->getNomUrl(0,1,1,'',1);
} }
else else

View File

@ -29,6 +29,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
@ -44,6 +49,7 @@ $sens=GETPOST("sens","int");
$amount=GETPOST("amount"); $amount=GETPOST("amount");
$paymenttype=GETPOST("paymenttype"); $paymenttype=GETPOST("paymenttype");
$accountancy_code=GETPOST("accountancy_code","int"); $accountancy_code=GETPOST("accountancy_code","int");
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check // Security check
$socid = GETPOST("socid","int"); $socid = GETPOST("socid","int");
@ -67,6 +73,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
// Link to a project
if ($action == 'classin' && $user->rights->banque->modifier)
{
$object->fetch($id);
$object->setProject(GETPOST('projectid'));
}
if ($cancel) if ($cancel)
{ {
if ($action != 'addlink') if ($action != 'addlink')
@ -98,6 +111,7 @@ if (empty($reshook))
$object->fk_user_author=$user->id; $object->fk_user_author=$user->id;
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : ""; $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
$object->sens=GETPOST('sens'); $object->sens=GETPOST('sens');
$object->fk_project= GETPOST('fk_project');
if (empty($datep) || empty($datev)) if (empty($datep) || empty($datev))
{ {
@ -205,6 +219,7 @@ llxHeader("",$langs->trans("VariousPayment"));
$form = new Form($db); $form = new Form($db);
if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db); if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db);
if ($id) if ($id)
{ {
@ -306,6 +321,21 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Associated project
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1, $projectid,'fk_project',0,0,1,1);
print '</td></tr>';
}
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -333,19 +363,52 @@ if ($action == 'create')
if ($id) if ($id)
{ {
$head=various_payment_prepare_head($object); $head=various_payment_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), 0, 'payment'); dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment');
print '<table class="border" width="100%">';
$morehtmlref='<div class="refidno">';
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.=$langs->trans('Project') . ' ';
if ($user->rights->tax->charges->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print "<tr>"; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '<div class="fichecenter">';
print '</td></tr>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Label // Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
@ -404,6 +467,11 @@ if ($id)
print '</table>'; print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -243,7 +243,7 @@ if ($result)
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($obj->accountancy_journal); $accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code; $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
} }
$accountstatic->label=$obj->blabel; $accountstatic->label=$obj->blabel;

View File

@ -73,7 +73,7 @@ if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
if (! empty($conf->margin->enabled)) if (! empty($conf->margin->enabled))
$langs->load('margins'); $langs->load('margins');
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); $projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : 0);
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
@ -83,7 +83,7 @@ $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$lineid = GETPOST('lineid', 'int'); $lineid = GETPOST('lineid', 'int');
$userid = GETPOST('userid', 'int'); $userid = GETPOST('userid', 'int');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_ref = GETPOST('sf_ref','alpha') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_societe = GETPOST('search_societe', 'alpha'); $search_societe = GETPOST('search_societe', 'alpha');
$search_montant_ht = GETPOST('search_montant_ht', 'alpha'); $search_montant_ht = GETPOST('search_montant_ht', 'alpha');
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha'); $search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
@ -430,27 +430,52 @@ if (empty($reshook))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate))) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
) )
{ {
$idwarehouse = GETPOST('idwarehouse'); $idwarehouse = GETPOST('idwarehouse','int');
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
// Check parameters // Check parameters
// Check for mandatory prof id (but only if country is than than ours) // Check for mandatory fields defined into setup
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) $array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL');
foreach($array_to_check as $key)
{ {
for ($i = 1; $i <= 6; $i++) $keymin=strtolower($key);
{ $i=(int) preg_replace('/[^0-9]/','',$key);
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; $vallabel=$object->thirdparty->$keymin;
$idprof = 'idprof' . $i;
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) if ($i > 0)
{ {
if (! $error) $langs->load("errors"); if ($object->thirdparty->isACompany())
$error++; {
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors'); // Check for mandatory prof id (but only if country is other than ours)
} if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id)
} {
$idprof_mandatory ='SOCIETE_'.$key.'_INVOICE_MANDATORY';
if (! $vallabel && ! empty($conf->global->$idprof_mandatory))
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
}
}
}
}
else
{
//var_dump($conf->global->SOCIETE_EMAIL_MANDATORY);
if ($key == 'EMAIL')
{
// Check for mandatory
if (! empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && ! isValidEMail($object->thirdparty->email))
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
}
}
}
} }
$qualified_for_stock_change = 0; $qualified_for_stock_change = 0;
@ -2214,7 +2239,6 @@ if ($action == 'create')
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
} }
print ')'; print ')';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&fac_rec='.GETPOST('fac_rec','alpha')).'">'.$langs->trans("AddThirdParty").'</a>';
print '</td>'; print '</td>';
} }
else else
@ -4265,7 +4289,7 @@ else if ($id > 0 || ! empty($ref))
print '<br>'; print '<br>';
// Select mail models is same action as presend // Select mail models is same action as presend
if (GETPOST('modelselected')) { if (GETPOST('modelselected','alpha')) {
$action = 'presend'; $action = 'presend';
} }
if ($action != 'prerelance' && $action != 'presend') if ($action != 'prerelance' && $action != 'presend')
@ -4352,7 +4376,7 @@ else if ($id > 0 || ! empty($ref))
// Build document if it not exists // Build document if it not exists
if (! $file || ! is_readable($file)) { if (! $file || ! is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $result = $object->generateDocument(GETPOST('model','alpha') ? GETPOST('model','alpha') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) { if ($result <= 0) {
dol_print_error($db, $object->error, $object->errors); dol_print_error($db, $object->error, $object->errors);
exit(); exit();
@ -4372,7 +4396,7 @@ else if ($id > 0 || ! empty($ref))
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user')); $formmail->fromtype = (GETPOST('fromtype','alpha')?GETPOST('fromtype','alpha'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
if($formmail->fromtype === 'user'){ if($formmail->fromtype === 'user'){
$formmail->fromid = $user->id; $formmail->fromid = $user->id;

View File

@ -785,7 +785,7 @@ class Facture extends CommonInvoice
$facture->situation_final = $this->situation_final; $facture->situation_final = $this->situation_final;
// Loop on each line of new invoice // Loop on each line of new invoice
foreach($facture->lines as $i => $line) foreach($facture->lines as $i => $tmpline)
{ {
$facture->lines[$i]->fk_prev_id = $this->lines[$i]->rowid; $facture->lines[$i]->fk_prev_id = $this->lines[$i]->rowid;
if ($invertdetail) if ($invertdetail)

View File

@ -49,7 +49,6 @@ $confirm=GETPOST('confirm', 'alpha');
// Security check // Security check
if ($user->societe_id) if ($user->societe_id)
{ {
$action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result=restrictedArea($user,'facture',$id,''); $result=restrictedArea($user,'facture',$id,'');
@ -72,9 +71,11 @@ if ($object->fetch($id))
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
} }
/* /*
* Actions * Actions
*/ */
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';

View File

@ -1054,7 +1054,7 @@ if ($action == 'create')
// Bank account // Bank account
if ($object->fk_account > 0) if ($object->fk_account > 0)
{ {
print "<tr><td>".$langs->trans('RIB')."</td><td>"; print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
print "</td></tr>"; print "</td></tr>";
} }

View File

@ -84,16 +84,16 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false); $date_start=dol_get_first_day($pastmonthyear,$pastmonth,false); $date_end=dol_get_last_day($pastmonthyear,$pastmonth,false);
} }
$nom=$langs->trans("PurchasesJournal"); $name=$langs->trans("PurchasesJournal");
$nomlink='';
$periodlink=''; $periodlink='';
$exportlink=''; $exportlink='';
$builddate=time(); $builddate=dol_now();
$description=$langs->trans("DescPurchasesJournal").'<br>'; $description=$langs->trans("DescPurchasesJournal").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded"); else $description.= $langs->trans("DepositsAreIncluded");
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0]; $idpays = $p[0];

View File

@ -89,15 +89,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
} }
$nom=$langs->trans("SellsJournal"); $nom=$langs->trans("SellsJournal");
$nomlink='';
$periodlink=''; $periodlink='';
$exportlink=''; $exportlink='';
$builddate=time(); $builddate=dol_now();
$description=$langs->trans("DescSellsJournal").'<br>'; $description=$langs->trans("DescSellsJournal").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded"); else $description.= $langs->trans("DepositsAreIncluded");
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0]; $idpays = $p[0];

View File

@ -115,7 +115,7 @@ if ($calc==0 || $calc==1) // Calculate on invoice for goods and services
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded"); if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch; $description.=$fsearch;
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; $description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$builddate=time(); $builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("Description"); $productcust=$langs->trans("Description");
@ -133,7 +133,7 @@ if ($calc==2) // Invoice for goods, payment for services
if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded"); if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch; $description.=$fsearch;
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')'; $description.='<br>('.$langs->trans("TaxModuleSetupToModifyRulesLT",DOL_URL_ROOT.'/admin/company.php').')';
$builddate=time(); $builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("Description"); $productcust=$langs->trans("Description");
@ -142,7 +142,7 @@ if ($calc==2) // Invoice for goods, payment for services
$productsup=$langs->trans("Description"); $productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT"); $amountsup=$langs->trans("AmountHT");
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);

View File

@ -136,7 +136,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
else $description.='<br>'.$langs->trans("DepositsAreIncluded"); else $description.='<br>'.$langs->trans("DepositsAreIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService"); $productcust=$langs->trans("ProductOrService");
@ -164,7 +164,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
else $description.=' '.$langs->trans("DepositsAreIncluded"); else $description.=' '.$langs->trans("DepositsAreIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=dol_now();
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService"); $productcust=$langs->trans("ProductOrService");
@ -177,7 +177,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
$vatsup=$langs->trans("VATPaid"); $vatsup=$langs->trans("VATPaid");
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
if($local==1){ if($local==1){

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,463 @@
<?php
/* Copyright (C) 2016-2017 Jamal Elbaz <jamelbaz@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/resultat/result.php
* \ingroup compta, accountancy
* \brief Page for accounting result
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
$langs->loadLangs(array('compta','bills','donation','salaries','accountancy'));
$error = 0;
$mesg = '';
$action = GETPOST('action','aZ09');
$cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel','alpha');
$showaccountdetail = GETPOST('showaccountdetail','aZ09');
$date_startmonth=GETPOST('date_startmonth','int');
$date_startday=GETPOST('date_startday','int');
$date_startyear=GETPOST('date_startyear','int');
$date_endmonth=GETPOST('date_endmonth','int');
$date_endday=GETPOST('date_endday','int');
$date_endyear=GETPOST('date_endyear','int');
$nbofyear=1;
// Date range
$year=GETPOST('year','int');
if (empty($year))
{
$year_current = strftime("%Y",dol_now());
$month_current = strftime("%m",dol_now());
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
$month_current = strftime("%m",dol_now());
$year_start = $year - ($nbofyear - 1);
}
$date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=GETPOST("q")?GETPOST("q"):0;
if ($q==0)
{
// We define date_start and date_end
$year_end=$year_start + ($nbofyear - 1);
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
if (! GETPOST('month'))
{
if (! GETPOST("year") && $month_start > $month_current)
{
$year_start--;
$year_end--;
}
$month_end=$month_start-1;
if ($month_end < 1) $month_end=12;
else $year_end++;
}
else $month_end=$month_start;
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
}
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
}
if (($date_start < dol_time_plus_duree($date_end, -1, 'y')) || ($date_start > $date_end))
{
$date_end = dol_time_plus_duree($date_start - 1, 1, 'y');
}
// $date_start and $date_end are defined. We force $start_year and $nbofyear
$tmps=dol_getdate($date_start);
$start_year = $tmps['year'];
$tmpe=dol_getdate($date_end);
$year_end = $tmpe['year'];
$nbofyear = ($year_end - $start_year) + 1;
$date_start_previous = dol_time_plus_duree($date_start, -1, 'y');
$date_end_previous = dol_time_plus_duree($date_end, -1, 'y');
//var_dump($date_start." ".$date_end." ".$date_start_previous." ".$date_end_previous." ".$nbofyear);
if($cat_id == 0){
$cat_id = null;
}
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE;
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha');
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->comptarapport->lire)
accessforbidden();
$AccCat = new AccountancyCategory($db);
/*
* View
*/
$months = array(
$langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
llxheader('', $langs->trans('ReportInOut'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($start_year - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($start_year + 1) . '">' . img_next() . '</a>';
// Affiche en-tete de rapport
if ($modecompta=="CREANCES-DETTES")
{
$name=$langs->trans("AnnualByAccountDueDebtMode");
$calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
$description=$langs->trans("RulesResultDue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded");
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="RECETTES-DEPENSES") {
$name=$langs->trans("AnnualByAccountInputOutputMode");
$calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">','</a>').')';
//$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1);
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
$description=$langs->trans("RulesResultInOut");
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable");
}
else if ($modecompta=="BOOKKEEPING")
{
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups");
$calcmode=$langs->trans("CalcModeBookkeeping");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$period.=' &nbsp; &nbsp; '.$langs->trans("DetailByAccount").' '. $form->selectyesno('showaccountdetail',$showaccountdetail,0);
$periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ;
$exportlink = '';
$description=$langs->trans("RulesResultBookkeepingPersonalized").
$description.=' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->trans("AccountingCategory")).')';
//if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
//else $description.= $langs->trans("DepositsAreIncluded");
$builddate=dol_now();
}
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("AccountingCategory").'</th>';
print '<th class="liste_titre"></th>';
print '<th class="liste_titre" align="right">'.$langs->trans("PreviousPeriod").'</th>';
print '<th class="liste_titre" align="right">'.$langs->trans("SelectedPeriod").'</th>';
foreach($months as $k => $v){
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>';
}
print '</tr>';
if ($modecompta == 'CREANCES-DETTES')
{
//if (! empty($date_start) && ! empty($date_end))
// $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
}
else if ($modecompta=="RECETTES-DEPENSES")
{
//if (! empty($date_start) && ! empty($date_end))
// $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
}
else if ($modecompta=="BOOKKEEPING")
{
//All categories
$cats = $AccCat->getCats();
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
$j=1;
$sommes = array();
$totPerAccount = array();
foreach ($cats as $cat) // Loop on each group
{
if (!empty($cat['category_type'])) // category calculed
{
// When we enter here, $sommes was filled by group of accounts
$formula = $cat['formula'];
print '<tr class="liste_total">';
// Year NP
print '<td class="liste_total width200">';
print $cat['code'];
print '</td><td>';
print $cat['label'];
print '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
//var_dump($result);
//$r = $AccCat->calculate($result);
$r = dol_eval($result, 1);
//var_dump($r);
print '<td class="liste_total right">' . price($r) . '</td>';
// Year N
$code = $cat['code']; // code of categorie ('VTE', 'MAR', ...)
$sommes[$code]['NP'] += $r;
// Current fiscal year (N)
if (is_array($sommes) && ! empty($sommes)){
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
}
$result = strtr($formula, $vars);
//$r = $AccCat->calculate($result);
$r = dol_eval($result, 1);
print '<td class="liste_total right">' . price($r) . '</td>';
$sommes[$code]['N'] += $r;
// Detail by month
foreach($months as $k => $v)
{
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
//$r = $AccCat->calculate($result);
$r = dol_eval($result, 1);
print '<td class="liste_total right">' . price($r) . '</td>';
$sommes[$code]['M'][$k] += $r;
}
print "</tr>\n";
//var_dump($sommes);
}
else // normal category
{
$totCat = array();
$totCat['NP'] = 0;
$totCat['N'] = 0;
$totCat['M'] = array();
foreach($months as $k => $v)
{
$totCat['M'][$k] = 0;
}
// Get cpts of category/group
$cpts = $AccCat->getCptsCat($cat['rowid']);
print "<tr>";
// Column group
print '<td class="width200">';
print $cat['code'];
print '</td><td>';
print $cat['label'];
if (count($cpts) > 0) // Show example of 5 first accounting accounts
{
$i=0;
foreach($cpts as $cpt)
{
if ($i > 5)
{
print '...)';
break;
}
if ($i > 0) print ', ';
else print ' (';
print $cpt['account_number'];
$i++;
}
if ($i <= 5) print ')';
}
else
{
print ' - <span class="warning">'.$langs->trans("GroupIsEmptyCheckSetup").'</span>';
}
print '</td>';
$code = $cat['code'];
// Set value into column NPrevious, N and each month M ($totCat)
// This make 14 calls for each detail of account (NP, N and month m)
foreach($cpts as $i => $cpt)
{
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
$totPerAccount[$cpt['account_number']]['NP'] = $resultNP;
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
foreach($months as $k => $v)
{
$return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
$sommes[$code]['M'][$k] += $resultM;
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
}
}
// Now output columns for row $code ('VTE', 'MAR', ...)
print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>';
foreach($totCat['M'] as $k => $v){
print '<td align="right">' . price($v) . '</td>';
}
print "</tr>\n";
// Loop on detail of all accounts
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail == 'yes')
{
foreach($cpts as $i => $cpt)
{
$resultNP=$totPerAccount[$cpt['account_number']]['NP'];
$resultN=$totPerAccount[$cpt['account_number']]['N'];
print '<tr>';
print '<td></td>';
print '<td class="tdoverflowmax200">';
print ' &nbsp; &nbsp; ' . length_accountg($cpt['account_number']);
print ' - ';
print $cpt['account_label'];
print '</td>';
print '<td align="right">' . price($resultNP) . '</td>';
print '<td align="right">' . price($resultN) . '</td>';
// Make one call for each month
foreach($months as $k => $v)
{
$resultM=$totPerAccount[$cpt['account_number']]['M'][$k];
print '<td align="right">' . price($resultM) . '</td>';
}
print "</tr>\n";
}
}
}
}
}
print "</table>";
print '</div>';
llxFooter();
$db->close();

View File

@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("products"); $langs->load("products");
$langs->load("categories"); $langs->load("categories");
@ -143,12 +143,14 @@ foreach($allparams as $key => $value) {
/* /*
* View * View
*/ */
llxHeader(); llxHeader();
$form=new Form($db); $form=new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
// Show report header // Show report header
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices"); $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices");
if ($modecompta=="CREANCES-DETTES") { if ($modecompta=="CREANCES-DETTES") {
$calcmode=$langs->trans("CalcModeDebt"); $calcmode=$langs->trans("CalcModeDebt");
@ -163,7 +165,7 @@ if ($modecompta=="CREANCES-DETTES") {
$description.= $langs->trans("DepositsAreIncluded"); $description.= $langs->trans("DepositsAreIncluded");
} }
$builddate=time(); $builddate=dol_now();
} else { } else {
$calcmode=$langs->trans("CalcModeEngagement"); $calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
@ -173,17 +175,20 @@ if ($modecompta=="CREANCES-DETTES") {
$description=$langs->trans("RulesCAIn"); $description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded"); $description.= $langs->trans("DepositsAreIncluded");
$builddate=time(); $builddate=dol_now();
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{ {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }
$name=array();
// SQL request // SQL request
$catotal=0; $catotal=0;
$catotal_ht=0; $catotal_ht=0;

View File

@ -131,12 +131,11 @@ foreach($allparams as $key => $value) {
llxHeader(); llxHeader();
$form=new Form($db); $form=new Form($db);
// Show report header // Show report header
if ($modecompta=="CREANCES-DETTES") { if ($modecompta=="CREANCES-DETTES") {
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
$calcmode=$langs->trans("CalcModeDebt"); $calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@ -144,30 +143,32 @@ if ($modecompta=="CREANCES-DETTES") {
$description=$langs->trans("RulesCADue"); $description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded"); else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} else { } else {
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice");
$calcmode=$langs->trans("CalcModeEngagement"); $calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink="<a href='".$_SERVER["PHP_SELF"]."?year=".($year-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year+1)."&modecompta=".$modecompta."'>".img_next()."</a>"; //$periodlink="<a href='".$_SERVER["PHP_SELF"]."?year=".($year-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year+1)."&modecompta=".$modecompta."'>".img_next()."</a>";
$description=$langs->trans("RulesCAIn"); $description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded"); $description.= $langs->trans("DepositsAreIncluded");
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
$moreparam=array(); $moreparam=array();
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta; if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{ {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }
$name=array();
// Show array // Show array
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
// Extra parameters management // Extra parameters management

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("companies"); $langs->load("companies");
$langs->load("categories"); $langs->load("categories");
@ -165,7 +165,7 @@ $formother = new FormOther($db);
// Show report header // Show report header
if ($modecompta=="CREANCES-DETTES") if ($modecompta=="CREANCES-DETTES")
{ {
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
$calcmode=$langs->trans("CalcModeDebt"); $calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@ -173,28 +173,30 @@ if ($modecompta=="CREANCES-DETTES")
$description=$langs->trans("RulesCADue"); $description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded"); else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} else { } else {
$nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties");
$calcmode=$langs->trans("CalcModeEngagement"); $calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=CREANCES-DETTES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>'; //$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
$description=$langs->trans("RulesCAIn"); $description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded"); $description.= $langs->trans("DepositsAreIncluded");
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode); report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$tableparams,$calcmode);
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{ {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }
$name=array();
// Show Array // Show Array
$catotal=0; $catotal=0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {

View File

@ -25,21 +25,69 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->loadLangs(array('compta','bills','donation','salaries'));
$date_startmonth=GETPOST('date_startmonth');
$date_startday=GETPOST('date_startday');
$date_startyear=GETPOST('date_startyear');
$date_endmonth=GETPOST('date_endmonth');
$date_endday=GETPOST('date_endday');
$date_endyear=GETPOST('date_endyear');
$year_start=GETPOST("year_start");
$year_current = strftime("%Y",time());
$nbofyear=4; $nbofyear=4;
if (! $year_start) {
$year_start = $year_current - ($nbofyear-1); // Date range
$year_end = $year_current; $year=GETPOST('year','int');
if (empty($year))
{
$year_current = strftime("%Y",dol_now());
$month_current = strftime("%m",dol_now());
$year_start = $year_current - ($nbofyear - 1);
} else {
$year_current = $year;
$month_current = strftime("%m",dol_now());
$year_start = $year - ($nbofyear - 1);
} }
else { $date_start=dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$year_end=$year_start + ($nbofyear-1); $date_end=dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=GETPOST("q")?GETPOST("q"):0;
if ($q==0)
{
// We define date_start and date_end
$year_end=$year_start + ($nbofyear - 1);
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
if (! GETPOST('month'))
{
if (! GETPOST("year") && $month_start > $month_current)
{
$year_start--;
$year_end--;
}
$month_end=$month_start-1;
if ($month_end < 1) $month_end=12;
else $year_end++;
}
else $month_end=$month_start;
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
}
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
} }
$userid=GETPOST('userid','int'); $userid=GETPOST('userid','int');
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE; $modecompta = $conf->global->ACCOUNTING_MODE;
if (! empty($conf->accounting->enabled)) $modecompta='BOOKKEEPING';
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha'); if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta",'alpha');
// Security check // Security check
@ -55,55 +103,57 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin
*/ */
llxHeader(); llxHeader();
$form=new Form($db); $form=new Form($db);
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modecompta=="CREANCES-DETTES") if ($modecompta=="CREANCES-DETTES")
{ {
$nom=$langs->trans("SalesTurnover"); $name=$langs->trans("SalesTurnover");
$calcmode=$langs->trans("CalcModeDebt"); $calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
$period="$year_start - $year_end"; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":""); $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCADue"); $description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
else $description.= $langs->trans("DepositsAreIncluded"); else $description.= $langs->trans("DepositsAreIncluded");
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
else if ($modecompta=="RECETTES-DEPENSES") else if ($modecompta=="RECETTES-DEPENSES")
{ {
$nom=$langs->trans("SalesTurnover"); $name=$langs->trans("SalesTurnover");
$calcmode=$langs->trans("CalcModeEngagement"); $calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
$period="$year_start - $year_end"; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":""); $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCAIn"); $description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded"); $description.= $langs->trans("DepositsAreIncluded");
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
else if ($modecompta=="BOOKKEEPING") else if ($modecompta=="BOOKKEEPING")
{ {
$nom=$langs->trans("BookkeepingTurnover"); $name=$langs->trans("SalesTurnover");
$calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode=$langs->trans("CalcModeBookkeeping");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period="$year_start - $year_end"; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":""); $periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCABookkeeping"); $description=$langs->trans("RulesCADue");
$description.= $langs->trans("DepositsAreIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
$builddate=time(); else $description.= $langs->trans("DepositsAreIncluded");
$builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
$moreparam=array(); $moreparam=array();
if (! empty($modecompta)) $moreparam['modecompta']=$modecompta; if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode); report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam,$calcmode);
if (! empty($conf->accounting->enabled)) if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{ {
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }

View File

@ -160,7 +160,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services
. $langs->trans('AddExtraReport') . $langs->trans('AddExtraReport')
. '</input>' . '</input>'
. '<br>'; . '<br>';
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
@ -204,7 +204,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
. $langs->trans('AddExtraReport') . $langs->trans('AddExtraReport')
. '</input>' . '</input>'
. '<br>'; . '<br>';
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
@ -220,7 +220,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
$vatsup.=' ('.$langs->trans("ToGetBack").')'; $vatsup.=' ('.$langs->trans("ToGetBack").')';
} }
} }
report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived"); $vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid"); $vatsup=$langs->trans("VATPaid");

View File

@ -133,7 +133,7 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modetax==1) // Calculate on invoice for goods and services if ($modetax==1) // Calculate on invoice for goods and services
{ {
$nom=$langs->trans("VATReportByQuartersInDueDebtMode"); $name=$langs->trans("VATReportByQuartersInDueDebtMode");
$calcmode=$langs->trans("CalcModeVATDebt"); $calcmode=$langs->trans("CalcModeVATDebt");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@ -152,7 +152,7 @@ if ($modetax==1) // Calculate on invoice for goods and services
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
else $description.='<br>'.$langs->trans("DepositsAreIncluded"); else $description.='<br>'.$langs->trans("DepositsAreIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
// Customers invoices // Customers invoices
@ -172,7 +172,7 @@ if ($modetax==1) // Calculate on invoice for goods and services
} }
if ($modetax==0) // Invoice for goods, payment for services if ($modetax==0) // Invoice for goods, payment for services
{ {
$nom=$langs->trans("VATReportByQuartersInInputOutputMode"); $name=$langs->trans("VATReportByQuartersInInputOutputMode");
$calcmode=$langs->trans("CalcModeVATEngagement"); $calcmode=$langs->trans("CalcModeVATEngagement");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@ -192,7 +192,7 @@ if ($modetax==0) // Invoice for goods, payment for services
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded"); //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
// Customers invoices // Customers invoices
@ -210,7 +210,7 @@ if ($modetax==0) // Invoice for goods, payment for services
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived"); $vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid"); $vatsup=$langs->trans("VATPaid");

View File

@ -146,7 +146,7 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modetax==1) { // Calculate on invoice for goods and services if ($modetax==1) { // Calculate on invoice for goods and services
$nom=$langs->trans("VATReportByQuartersInDueDebtMode"); $name=$langs->trans("VATReportByQuartersInDueDebtMode");
$calcmode=$langs->trans("CalcModeVATDebt"); $calcmode=$langs->trans("CalcModeVATDebt");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@ -174,7 +174,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services
$description.='<br>'.$langs->trans("DepositsAreIncluded"); $description.='<br>'.$langs->trans("DepositsAreIncluded");
} }
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
@ -195,7 +195,7 @@ if ($modetax==1) { // Calculate on invoice for goods and services
} }
} }
if ($modetax==0) { // Invoice for goods, payment for services if ($modetax==0) { // Invoice for goods, payment for services
$nom=$langs->trans("VATReportByQuartersInInputOutputMode"); $name=$langs->trans("VATReportByQuartersInInputOutputMode");
$calcmode=$langs->trans("CalcModeVATEngagement"); $calcmode=$langs->trans("CalcModeVATEngagement");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@ -224,7 +224,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded"); //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=dol_now();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
@ -244,7 +244,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
$vatsup.=' ('.$langs->trans("ToGetBack").')'; $vatsup.=' ('.$langs->trans("ToGetBack").')';
} }
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived"); $vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid"); $vatsup=$langs->trans("VATPaid");

View File

@ -79,18 +79,18 @@ abstract class ActionsContactCardCommon
*/ */
function getObject($id) function getObject($id)
{ {
$ret = $this->getInstanceDao(); /*$ret = $this->getInstanceDao();
if (is_object($this->object) && method_exists($this->object,'fetch')) if (is_object($this->object) && method_exists($this->object,'fetch'))
{ {
if (! empty($id)) $this->object->fetch($id); if (! empty($id)) $this->object->fetch($id);
} }
else else
{ {*/
$object = new Contact($this->db); $object = new Contact($this->db);
if (! empty($id)) $object->fetch($id); if (! empty($id)) $object->fetch($id);
$this->object = $object; $this->object = $object;
} //}
} }
/** /**

View File

@ -752,7 +752,13 @@ if (empty($reshook))
// Close all lines // Close all lines
else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer)
{ {
$object->cloture($user); $object->closeAll($user);
}
// Close all lines
else if ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer)
{
$object->activateAll($user);
} }
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer)
@ -1313,6 +1319,11 @@ else
{ {
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1); print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
}
if ($action == 'activate')
{
print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ActivateAllOnContract"),$langs->trans("ConfirmActivateAllOnContract"),"confirm_activate",'',0,1);
} }
/* /*
@ -1617,7 +1628,7 @@ else
print $langs->trans("DateStartPlanned").': '; print $langs->trans("DateStartPlanned").': ';
if ($objp->date_debut) if ($objp->date_debut)
{ {
print dol_print_date($db->jdate($objp->date_debut)); print dol_print_date($db->jdate($objp->date_debut), 'day');
// Warning si date prevu passee et pas en service // Warning si date prevu passee et pas en service
if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) { if ($objp->statut == 0 && $db->jdate($objp->date_debut) < ($now - $conf->contrat->services->inactifs->warning_delay)) {
$warning_delay=$conf->contrat->services->inactifs->warning_delay / 3600 / 24; $warning_delay=$conf->contrat->services->inactifs->warning_delay / 3600 / 24;
@ -1630,7 +1641,7 @@ else
print $langs->trans("DateEndPlanned").': '; print $langs->trans("DateEndPlanned").': ';
if ($objp->date_fin) if ($objp->date_fin)
{ {
print dol_print_date($db->jdate($objp->date_fin)); print dol_print_date($db->jdate($objp->date_fin), 'day');
if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) { if ($objp->statut == 4 && $db->jdate($objp->date_fin) < ($now - $conf->contrat->services->expires->warning_delay)) {
$warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24; $warning_delay=$conf->contrat->services->expires->warning_delay / 3600 / 24;
$textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days");
@ -1849,21 +1860,21 @@ else
// Si pas encore active // Si pas encore active
if (! $objp->date_debut_reelle) { if (! $objp->date_debut_reelle) {
print $langs->trans("DateStartReal").': '; print $langs->trans("DateStartReal").': ';
if ($objp->date_debut_reelle) print dol_print_date($objp->date_debut_reelle); if ($objp->date_debut_reelle) print dol_print_date($objp->date_debut_reelle, 'day');
else print $langs->trans("ContractStatusNotRunning"); else print $langs->trans("ContractStatusNotRunning");
} }
// Si active et en cours // Si active et en cours
if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) { if ($objp->date_debut_reelle && ! $objp->date_fin_reelle) {
print $langs->trans("DateStartReal").': '; print $langs->trans("DateStartReal").': ';
print dol_print_date($objp->date_debut_reelle); print dol_print_date($objp->date_debut_reelle, 'day');
} }
// Si desactive // Si desactive
if ($objp->date_debut_reelle && $objp->date_fin_reelle) { if ($objp->date_debut_reelle && $objp->date_fin_reelle) {
print $langs->trans("DateStartReal").': '; print $langs->trans("DateStartReal").': ';
print dol_print_date($objp->date_debut_reelle); print dol_print_date($objp->date_debut_reelle, 'day');
print ' &nbsp;-&nbsp; '; print ' &nbsp;-&nbsp; ';
print $langs->trans("DateEndReal").': '; print $langs->trans("DateEndReal").': ';
print dol_print_date($objp->date_fin_reelle); print dol_print_date($objp->date_fin_reelle, 'day');
} }
if (! empty($objp->comment)) print "<br>".$objp->comment; if (! empty($objp->comment)) print "<br>".$objp->comment;
print '</td>'; print '</td>';
@ -2071,6 +2082,10 @@ else
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
} }
if ($object->nbofservicesclosed > 0)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
}
if ($object->nbofservicesclosed < $nbofservices) if ($object->nbofservicesclosed < $nbofservices)
{ {
//if (! $numactive) //if (! $numactive)
@ -2121,9 +2136,9 @@ else
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -247,13 +247,63 @@ class Contrat extends CommonObject
} }
/**
* Open all lines of a contract
*
* @param User $user Object User making action
* @param int|string $date_start Date start (now if empty)
* @return int <0 if KO, >0 if OK
*/
function activateAll($user, $date_start='')
{
if (empty($date_start)) $date_start = dol_now();
$this->db->begin();
// Load lines
$this->fetch_lines();
$ok=true;
foreach($this->lines as $contratline)
{
// Open lines not already open
if ($contratline->statut != 4)
{
$result = $contratline->active_line($user, $date_start, -1);
if ($result < 0)
{
$ok=false;
break;
}
}
}
if ($this->statut == 0)
{
$result=$this->validate($user);
if ($result < 0) $ok=false;
}
if ($ok)
{
$this->db->commit();
return 1;
}
else
{
dol_print_error($this->db,'Error in activateAll function');
$this->db->rollback();
return -1;
}
}
/** /**
* Close all lines of a contract * Close all lines of a contract
* *
* @param User $user Object User making action * @param User $user Object User making action
* @return void * @return int <0 if KO, >0 if OK
*/ */
function cloture($user) function closeAll($user)
{ {
$this->db->begin(); $this->db->begin();
@ -263,7 +313,7 @@ class Contrat extends CommonObject
$ok=true; $ok=true;
foreach($this->lines as $contratline) foreach($this->lines as $contratline)
{ {
// Close line not already closed // Close lines not already closed
if ($contratline->statut != 5) if ($contratline->statut != 5)
{ {
$contratline->date_cloture=dol_now(); $contratline->date_cloture=dol_now();
@ -287,11 +337,13 @@ class Contrat extends CommonObject
if ($ok) if ($ok)
{ {
$this->db->commit(); $this->db->commit();
return 1;
} }
else else
{ {
dol_print_error($this->db,'Error in cloture function'); dol_print_error($this->db,'Error in closeAll function');
$this->db->rollback(); $this->db->rollback();
return -1;
} }
} }
@ -920,8 +972,8 @@ class Contrat extends CommonObject
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
} }
@ -1361,7 +1413,8 @@ class Contrat extends CommonObject
if (empty($info_bits)) $info_bits=0; if (empty($info_bits)) $info_bits=0;
if (empty($pu_ht) || ! is_numeric($pu_ht)) $pu_ht=0; if (empty($pu_ht) || ! is_numeric($pu_ht)) $pu_ht=0;
if (empty($pu_ttc)) $pu_ttc=0; if (empty($pu_ttc)) $pu_ttc=0;
if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0; if (empty($txtva) || ! is_numeric($txtva)) $txtva=0;
if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0; if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0;
if ($price_base_type=='HT') if ($price_base_type=='HT')
@ -1464,6 +1517,8 @@ class Contrat extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet");
$result=$this->update_statut($user); $result=$this->update_statut($user);
if ($result > 0) if ($result > 0)
{ {
@ -1472,7 +1527,7 @@ class Contrat extends CommonObject
{ {
$contractline = new ContratLigne($this->db); $contractline = new ContratLigne($this->db);
$contractline->array_options=$array_options; $contractline->array_options=$array_options;
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element); $contractline->id=$contractlineid;
$result=$contractline->insertExtraFields(); $result=$contractline->insertExtraFields();
if ($result < 0) if ($result < 0)
{ {
@ -1486,13 +1541,20 @@ class Contrat extends CommonObject
$result=$this->call_trigger('LINECONTRACT_INSERT',$user); $result=$this->call_trigger('LINECONTRACT_INSERT',$user);
if ($result < 0) if ($result < 0)
{ {
$this->db->rollback(); $error++;
return -1;
} }
// End call triggers // End call triggers
}
if ($error)
{
$this->db->rollback();
return -1;
}
else
{
$this->db->commit(); $this->db->commit();
return 1; return $contractlineid;
} }
} }
else else
@ -1835,9 +1897,11 @@ class Contrat extends CommonObject
$text=''; $text='';
if ($mode == 4) if ($mode == 4)
{ {
$text=($this->nbofserviceswait+$this->nbofservicesopened+$this->nbofservicesexpired+$this->nbofservicesclosed); $text ='<span class="hideonsmartphone">';
$text.=($this->nbofserviceswait+$this->nbofservicesopened+$this->nbofservicesexpired+$this->nbofservicesclosed);
$text.=' '.$langs->trans("Services"); $text.=' '.$langs->trans("Services");
$text.=': &nbsp; &nbsp; '; $text.=': &nbsp; &nbsp; ';
$text.='</span>';
} }
$text.=($mode == 7?'<div class="inline-block">':''); $text.=($mode == 7?'<div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3,-1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : ''; $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3,-1,'class="paddingleft2 inline-block valigntextbottom"')).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
@ -2998,11 +3062,11 @@ class ContratLigne extends CommonObjectLine
/** /**
* Activate a contract line * Activate a contract line
* *
* @param User $user Objet User who activate contract * @param User $user Objet User who activate contract
* @param int $date Date d'ouverture * @param int $date Date activation
* @param int|string $date_end Date fin prevue * @param int|string $date_end Date planned end. Use '-1' to keep it unchanged.
* @param string $comment A comment typed by user * @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function active_line($user, $date, $date_end = '', $comment = '') function active_line($user, $date, $date_end = '', $comment = '')
{ {
@ -3021,7 +3085,7 @@ class ContratLigne extends CommonObjectLine
$sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 4,"; $sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 4,";
$sql .= " date_ouverture = " . (dol_strlen($date) != 0 ? "'" . $this->db->idate($date) . "'" : "null") . ","; $sql .= " date_ouverture = " . (dol_strlen($date) != 0 ? "'" . $this->db->idate($date) . "'" : "null") . ",";
$sql .= " date_fin_validite = " . (dol_strlen($date_end) != 0 ? "'" . $this->db->idate($date_end) . "'" : "null") . ","; if ($date_end >= 0) $sql .= " date_fin_validite = " . (dol_strlen($date_end) != 0 ? "'" . $this->db->idate($date_end) . "'" : "null") . ",";
$sql .= " fk_user_ouverture = " . $user->id . ","; $sql .= " fk_user_ouverture = " . $user->id . ",";
$sql .= " date_cloture = null,"; $sql .= " date_cloture = null,";
$sql .= " commentaire = '" . $this->db->escape($comment) . "'"; $sql .= " commentaire = '" . $this->db->escape($comment) . "'";

View File

@ -34,7 +34,7 @@
if ($action == 'builddoc' && $permissioncreate) if ($action == 'builddoc' && $permissioncreate)
{ {
if (is_numeric(GETPOST('model'))) if (is_numeric(GETPOST('model','alpha')))
{ {
$error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model")); $error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Model"));
} }
@ -50,7 +50,7 @@ if ($action == 'builddoc' && $permissioncreate)
}*/ }*/
// Save last template used to generate document // Save last template used to generate document
if (GETPOST('model')) if (GETPOST('model','alpha'))
{ {
$object->setDocModel($user, GETPOST('model','alpha')); $object->setDocModel($user, GETPOST('model','alpha'));
} }
@ -58,8 +58,8 @@ if ($action == 'builddoc' && $permissioncreate)
// Special case to force bank account // Special case to force bank account
//if (property_exists($object, 'fk_bank')) //if (property_exists($object, 'fk_bank'))
//{ //{
if (GETPOST('fk_bank')) { // this field may come from an external module if (GETPOST('fk_bank','int')) { // this field may come from an external module
$object->fk_bank = GETPOST('fk_bank'); $object->fk_bank = GETPOST('fk_bank','int');
} else if (! empty($object->fk_account)) { } else if (! empty($object->fk_account)) {
$object->fk_bank = $object->fk_account; $object->fk_bank = $object->fk_account;
} }

View File

@ -30,9 +30,9 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if ($object->id) if ($object->id)
{ {
if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask')); $result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask'));
else else
dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask')); $result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask'));
} }
} }
elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC))

View File

@ -430,7 +430,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
} }
$arrayofinclusion=array(); $arrayofinclusion=array();
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]=preg_quote($tmppdf.'.pdf','/'); foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote($tmppdf.'.pdf','/').'$';
$listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
// build list of files with full path // build list of files with full path
@ -505,8 +505,8 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
$pdf=pdf_getInstance(); $pdf=pdf_getInstance();
if (class_exists('TCPDF')) if (class_exists('TCPDF'))
{ {
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); $pdf->setPrintFooter(false);
} }
$pdf->SetFont(pdf_getPDFFont($outputlangs)); $pdf->SetFont(pdf_getPDFFont($outputlangs));
@ -515,15 +515,15 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
// Add all others // Add all others
foreach($files as $file) foreach($files as $file)
{ {
// Charge un document PDF depuis un fichier. // Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file); $pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++) for ($i = 1; $i <= $pagecount; $i++)
{ {
$tplidx = $pdf->importPage($i); $tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx); $s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx); $pdf->useTemplate($tplidx);
} }
} }
// Create output dir if not exists // Create output dir if not exists

View File

@ -42,6 +42,7 @@ class CSMSFile
var $priority; var $priority;
var $class; var $class;
var $message; var $message;
var $nostop;
/** /**
@ -81,6 +82,7 @@ class CSMSFile
$this->priority=$priority; $this->priority=$priority;
$this->class=$class; $this->class=$class;
$this->message=$msg; $this->message=$msg;
$this->nostop=false;
} }
@ -107,6 +109,7 @@ class CSMSFile
if (empty($conf->global->MAIN_DISABLE_ALL_SMS)) if (empty($conf->global->MAIN_DISABLE_ALL_SMS))
{ {
// Action according to choosed sending method // Action according to choosed sending method
if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') // Backward compatibility @deprecated if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') // Backward compatibility @deprecated
{ {
@ -118,6 +121,7 @@ class CSMSFile
$sms->deferred=$this->deferred; $sms->deferred=$this->deferred;
$sms->priority=$this->priority; $sms->priority=$this->priority;
$sms->class=$this->class; $sms->class=$this->class;
$sms->nostop=$this->nostop;
$res=$sms->SmsSend(); $res=$sms->SmsSend();
if ($res <= 0) if ($res <= 0)
@ -129,7 +133,7 @@ class CSMSFile
{ {
dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG); dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG);
//var_dump($res); // 1973128 //var_dump($res); // 1973128
$this->dump_sms_result($res); if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms_result($res);
} }
} }
else if (! empty($conf->global->MAIN_SMS_SENDMODE)) // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module' else if (! empty($conf->global->MAIN_SMS_SENDMODE)) // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module'
@ -147,6 +151,7 @@ class CSMSFile
$sms->priority=$this->priority; $sms->priority=$this->priority;
$sms->class=$this->class; $sms->class=$this->class;
$sms->message=$this->message; $sms->message=$this->message;
$sms->nostop=$this->nostop;
$res=$sms->SmsSend(); $res=$sms->SmsSend();
$this->error = $sms->error; $this->error = $sms->error;
@ -159,7 +164,7 @@ class CSMSFile
{ {
dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG); dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG);
//var_dump($res); // 1973128 //var_dump($res); // 1973128
$this->dump_sms_result($res); if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms_result($res);
} }
} }
catch(Exception $e) catch(Exception $e)
@ -207,6 +212,7 @@ class CSMSFile
fputs($fp, "Priority: ".$this->priority."\n"); fputs($fp, "Priority: ".$this->priority."\n");
fputs($fp, "Class: ".$this->class."\n"); fputs($fp, "Class: ".$this->class."\n");
fputs($fp, "Deferred: ".$this->deferred."\n"); fputs($fp, "Deferred: ".$this->deferred."\n");
fputs($fp, "DisableStop: ".$this->nostop."\n");
fputs($fp, "Message:\n".$this->message); fputs($fp, "Message:\n".$this->message);
fclose($fp); fclose($fp);

View File

@ -4349,7 +4349,7 @@ abstract class CommonObject
} }
elseif ($value=='') elseif ($value=='')
{ {
$this->array_options[$key] = null; $new_array_options[$key] = null;
} }
break; break;
/*case 'select': // Not required, we chosed value='0' for undefined values /*case 'select': // Not required, we chosed value='0' for undefined values
@ -4359,13 +4359,13 @@ abstract class CommonObject
} }
break;*/ break;*/
case 'price': case 'price':
$this->array_options[$key] = price2num($this->array_options[$key]); $new_array_options[$key] = price2num($this->array_options[$key]);
break; break;
case 'date': case 'date':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]); $new_array_options[$key] = $this->db->idate($this->array_options[$key]);
break; break;
case 'datetime': case 'datetime':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]); $new_array_options[$key] = $this->db->idate($this->array_options[$key]);
break; break;
case 'link': case 'link':
$param_list=array_keys($attributeParam ['options']); $param_list=array_keys($attributeParam ['options']);
@ -4381,7 +4381,7 @@ abstract class CommonObject
if (is_numeric($value)) $res=$object->fetch($value); if (is_numeric($value)) $res=$object->fetch($value);
else $res=$object->fetch('',$value); else $res=$object->fetch('',$value);
if ($res > 0) $this->array_options[$key]=$object->id; if ($res > 0) $new_array_options[$key]=$object->id;
else else
{ {
$this->error="Ref '".$value."' for object '".$object->element."' not found"; $this->error="Ref '".$value."' for object '".$object->element."' not found";
@ -4421,9 +4421,9 @@ abstract class CommonObject
// Add field o fattribut // Add field o fattribut
if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate) if($extrafields->attribute_type[$attributeKey] != 'separate') // Only for other type of separate)
{ {
if ($this->array_options[$key] != '') if ($new_array_options[$key] != '')
{ {
$sql.=",'".$this->db->escape($this->array_options[$key])."'"; $sql.=",'".$this->db->escape($new_array_options[$key])."'";
} }
else else
{ {
@ -4620,10 +4620,13 @@ abstract class CommonObject
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]); $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
} }
$labeltoshow = $langs->trans($label);
if($extrafields->attribute_required[$key]) if($extrafields->attribute_required[$key])
$label = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$label.'</span>'; {
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
}
$out .= '<td>'.$labeltoshow.'</td>';
$out .= '<td>'.$langs->trans($label).'</td>';
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>'; $out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';

View File

@ -48,20 +48,21 @@ class DolEditor
/** /**
* Create an object to build an HTML area to edit a large string content * Create an object to build an HTML area to edit a large string content
* *
* @param string $htmlname HTML name of WYSIWIG field * @param string $htmlname HTML name of WYSIWIG field
* @param string $content Content of WYSIWIG field * @param string $content Content of WYSIWIG field
* @param int $width Width in pixel of edit area (auto by default) * @param int $width Width in pixel of edit area (auto by default)
* @param int $height Height in pixel of edit area (200px by default) * @param int $height Height in pixel of edit area (200px by default)
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly', 'ace'). * @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly').
* @param string $toolbarlocation Where bar is stored : * @param string $toolbarlocation Where bar is stored :
* 'In' each window has its own toolbar * 'In' each window has its own toolbar
* 'Out:name' share toolbar into the div called 'name' * 'Out:name' share toolbar into the div called 'name'
* @param boolean $toolbarstartexpanded Bar is visible or not at start * @param boolean $toolbarstartexpanded Bar is visible or not at start
* @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content. * @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
* @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like fckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace. * @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
* @param int $rows Size of rows for textarea tool * Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave".
* @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%') * @param int $rows Size of rows for textarea tool
* @param int $readonly 0=Read/Edit, 1=Read only * @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%')
* @param int $readonly 0=Read/Edit, 1=Read only
*/ */
function __construct($htmlname, $content, $width='', $height=200, $toolbarname='Basic', $toolbarlocation='In', $toolbarstartexpanded=false, $uselocalbrowser=true, $okforextendededitor=true, $rows=0, $cols=0, $readonly=0) function __construct($htmlname, $content, $width='', $height=200, $toolbarname='Basic', $toolbarlocation='In', $toolbarstartexpanded=false, $uselocalbrowser=true, $okforextendededitor=true, $rows=0, $cols=0, $readonly=0)
{ {
@ -310,7 +311,7 @@ class DolEditor
'."\n"; '."\n";
$out.= 'jQuery(document).ready(function() { $out.= 'jQuery(document).ready(function() {
jQuery("#savefile").click(function() { jQuery(".buttonforacesave").click(function() {
console.log("We click on savefile button for component '.$this->htmlname.'"); console.log("We click on savefile button for component '.$this->htmlname.'");
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid") var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
console.log(aceEditor.getSession().getValue()); console.log(aceEditor.getSession().getValue());

View File

@ -528,7 +528,7 @@ class ExtraFields
$typedb=$type; $typedb=$type;
$lengthdb=$length; $lengthdb=$length;
} }
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL')); $field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required?'NOT NULL':'NULL'), 'default'=>$default);
if ($type != 'separate') // No table update when separate type if ($type != 'separate') // No table update when separate type
{ {
@ -660,7 +660,7 @@ class ExtraFields
$sql.= " '".$param."',"; $sql.= " '".$param."',";
$sql.= " ".$list.", "; $sql.= " ".$list.", ";
$sql.= " ".$ishidden.", "; $sql.= " ".$ishidden.", ";
$sql.= " ".($default?"'".$this->db->escape($default)."'":"null").","; $sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").",";
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").","; $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
$sql .= " " . $user->id . ","; $sql .= " " . $user->id . ",";
$sql .= " " . $user->id . ","; $sql .= " " . $user->id . ",";
@ -769,8 +769,8 @@ class ExtraFields
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden; $this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden;
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity; $this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
if (!empty($conf->multicompany->enabled))
if (!empty($conf->multicompany->enabled)) { {
$sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity; $sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity;
$resql_entity_name=$this->db->query($sql_entity_name); $resql_entity_name=$this->db->query($sql_entity_name);
if ($resql_entity_name) if ($resql_entity_name)
@ -785,11 +785,6 @@ class ExtraFields
} }
} }
} }
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR);
}
} }
} }
if ($elementtype) $this->attributes[$elementtype]['loaded']=1; if ($elementtype) $this->attributes[$elementtype]['loaded']=1;
@ -1133,13 +1128,13 @@ class ExtraFields
$form = new Form($db); $form = new Form($db);
$value_arr=explode(',',$value); $value_arr=explode(',',$value);
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $param['options'], $value_arr, '', 0, '', 0, '100%'); $out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
} }
elseif ($type == 'radio') elseif ($type == 'radio')
{ {
$out=''; $out='';
foreach ($param['options'] as $keyopt=>$val ) foreach ($param['options'] as $keyopt => $val)
{ {
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:''); $out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
$out.=' value="'.$keyopt.'"'; $out.=' value="'.$keyopt.'"';

View File

@ -628,9 +628,10 @@ class Form
* @param string $htmloption Options html on select object * @param string $htmloption Options html on select object
* @param integer $maxlength Max length for labels (0=no limit) * @param integer $maxlength Max length for labels (0=no limit)
* @param string $morecss More css class * @param string $morecss More css class
* @param string $usecodeaskey 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
* @return string HTML string with select * @return string HTML string with select
*/ */
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300') function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0,$morecss='minwidth300',$usecodeaskey='')
{ {
global $conf,$langs; global $conf,$langs;
@ -684,11 +685,11 @@ class Form
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
{ {
$foundselected=true; $foundselected=true;
$out.= '<option value="'.$row['rowid'].'" selected>'; $out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'" selected>';
} }
else else
{ {
$out.= '<option value="'.$row['rowid'].'">'; $out.= '<option value="'.($usecodeaskey?($usecodeaskey=='code2'?$row['code_iso']:$row['code_iso3']):$row['rowid']).'">';
} }
$out.= dol_trunc($row['label'],$maxlength,'middle'); $out.= dol_trunc($row['label'],$maxlength,'middle');
if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')'; if ($row['code_iso']) $out.= ' ('.$row['code_iso'] . ')';

View File

@ -304,7 +304,7 @@ class FormActions
} }
else else
{ {
$out.=$form->selectarray($htmlname, $arraylist, $selected); $out.=$form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', '', 1);
} }
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0) if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -217,7 +218,7 @@ class FormCompany
$out=''; $out='';
// On recherche les departements/cantons/province active d'une region et pays actif // On recherche les departements/cantons/province active d'une region et pays actif
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code FROM"; $sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c"; $sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid"; $sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1"; $sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
@ -265,7 +266,15 @@ class FormCompany
$out.= '<option value="'.$obj->rowid.'">'; $out.= '<option value="'.$obj->rowid.'">';
} }
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$out.= $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:'')); if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE) && $conf->global->MAIN_SHOW_REGION_IN_STATE == 2) {
$out.= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
}
else if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE) && $conf->global->MAIN_SHOW_REGION_IN_STATE == 1) {
$out.= $obj->region_name . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
}
else {
$out.= $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
}
$out.= '</option>'; $out.= '</option>';
} }
$i++; $i++;

View File

@ -147,7 +147,7 @@ function limitChars(textarea, limit, infodiv)
{ {
if ($this->withfromreadonly) if ($this->withfromreadonly)
{ {
print '<tr><td class="'.$morecss.'">'.$langs->trans("SmsFrom"); print '<tr><td class="titlefield '.$morecss.'">'.$langs->trans("SmsFrom");
print '<input type="hidden" name="fromsms" value="'.$this->fromsms.'">'; print '<input type="hidden" name="fromsms" value="'.$this->fromsms.'">';
print "</td><td>"; print "</td><td>";
if ($this->fromtype == 'user') if ($this->fromtype == 'user')
@ -223,7 +223,7 @@ function limitChars(textarea, limit, infodiv)
if (is_array($resultsender) && count($resultsender) > 0) if (is_array($resultsender) && count($resultsender) > 0)
{ {
print '<select name="fromsms" id="valid" class="flat">'; print '<select name="fromsms" id="fromsms" class="flat">';
foreach($resultsender as $obj) foreach($resultsender as $obj)
{ {
print '<option value="'.$obj->number.'">'.$obj->number.'</option>'; print '<option value="'.$obj->number.'">'.$obj->number.'</option>';
@ -244,7 +244,7 @@ function limitChars(textarea, limit, infodiv)
// To (target) // To (target)
if ($this->withto || is_array($this->withto)) if ($this->withto || is_array($this->withto))
{ {
print '<tr><td width="180">'; print '<tr><td>';
//$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"); //$moretext=$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients");
$moretext=''; $moretext='';
print $form->textwithpicto($langs->trans("SmsTo"),$moretext); print $form->textwithpicto($langs->trans("SmsTo"),$moretext);
@ -259,7 +259,7 @@ function limitChars(textarea, limit, infodiv)
if (! empty($this->withtosocid) && $this->withtosocid > 0) if (! empty($this->withtosocid) && $this->withtosocid > 0)
{ {
$liste=array(); $liste=array();
foreach ($soc->thirdparty_and_contact_phone_array() as $key=>$value) foreach ($soc->thirdparty_and_contact_phone_array() as $key => $value)
{ {
$liste[$key]=$value; $liste[$key]=$value;
} }
@ -285,7 +285,7 @@ function limitChars(textarea, limit, infodiv)
$defaultmessage=str_replace('\n',"\n",$defaultmessage); $defaultmessage=str_replace('\n',"\n",$defaultmessage);
print "<tr>"; print "<tr>";
print "<td width=\"180\" valign=\"top\">".$langs->trans("SmsText")."</td>"; print '<td class="tdtop">'.$langs->trans("SmsText")."</td>";
print "<td>"; print "<td>";
if ($this->withbodyreadonly) if ($this->withbodyreadonly)
{ {
@ -306,7 +306,7 @@ function limitChars(textarea, limit, infodiv)
<td> <input name="deferred" id="deferred" size="4" value="0"></td></tr> <td> <input name="deferred" id="deferred" size="4" value="0"></td></tr>
<tr><td>'.$langs->trans("Priority").' :</td><td> <tr><td>'.$langs->trans("Priority").' :</td><td>
<select name="priority" id="valid" class="flat"> <select name="priority" id="priority" class="flat">
<option value="0">high</option> <option value="0">high</option>
<option value="1">medium</option> <option value="1">medium</option>
<option value="2" selected>low</option> <option value="2" selected>low</option>
@ -314,11 +314,17 @@ function limitChars(textarea, limit, infodiv)
</select></td></tr> </select></td></tr>
<tr><td>'.$langs->trans("Type").' :</td><td> <tr><td>'.$langs->trans("Type").' :</td><td>
<select name="class" id="valid" class="flat"> <select name="class" id="class" class="flat">
<option value="0">Flash</option> <option value="0">Flash</option>
<option value="1" selected>Standard</option> <option value="1" selected>Standard</option>
<option value="2">SIM</option> <option value="2">SIM</option>
<option value="3">ToolKit</option> <option value="3">ToolKit</option>
</select></td></tr>
<tr><td>'.$langs->trans("DisableStopIfSupported").' :</td><td>
<select name="disablestop" id="disablestop" class="flat">
<option value="0" selected>No</option>
<option value="1" selected>Yes</option>
</select></td></tr>'; </select></td></tr>';
print "</table>\n"; print "</table>\n";

View File

@ -776,10 +776,31 @@ class DoliDBMysqli extends DoliDB
{ {
$sql = "ALTER TABLE ".$table; $sql = "ALTER TABLE ".$table;
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
$sql.="(".$field_desc['value'].")"; $sql.="(".$field_desc['value'].")";
} }
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL"; if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL')
{
// We will try to change format of column to NOT NULL. To be sure the ALTER works, we try to update fields that are NULL
if ($field_desc['type'] == 'varchar' || $field_desc['type'] == 'text')
{
$sqlbis="UPDATE ".$table." SET ".$field_name." = '".$this->escape($field_desc['default'] ? $field_desc['default'] : '')."' WHERE ".$field_name." IS NULL";
$this->query($sqlbis);
}
elseif ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int')
{
$sqlbis="UPDATE ".$table." SET ".$field_name." = ".((int) $this->escape($field_desc['default'] ? $field_desc['default'] : 0))." WHERE ".$field_name." IS NULL";
$this->query($sqlbis);
}
$sql.=" NOT NULL";
}
if ($field_desc['default'] != '')
{
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']);
elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields
}
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG); dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
if (! $this->query($sql)) if (! $this->query($sql))

View File

@ -1084,12 +1084,30 @@ class DoliDBPgsql extends DoliDB
{ {
$sql = "ALTER TABLE ".$table; $sql = "ALTER TABLE ".$table;
$sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type'];
if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') {
$sql.="(".$field_desc['value'].")"; $sql.="(".$field_desc['value'].")";
} }
// TODO May not work with pgsql. May need to run a second request. If it works, just remove the comment if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL')
if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') $sql.=" NOT NULL"; {
// We will try to change format of column to NOT NULL. To be sure the ALTER works, we try to update fields that are NULL
if ($field_desc['type'] == 'varchar' || $field_desc['type'] == 'text')
{
$sqlbis="UPDATE ".$table." SET ".$field_name." = '".$this->escape($field_desc['default'] ? $field_desc['default'] : '')."' WHERE ".$field_name." IS NULL";
$this->query($sqlbis);
}
elseif ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int')
{
$sqlbis="UPDATE ".$table." SET ".$field_name." = ".((int) $this->escape($field_desc['default'] ? $field_desc['default'] : 0))." WHERE ".$field_name." IS NULL";
$this->query($sqlbis);
}
}
if ($field_desc['default'] != '')
{
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']);
elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields
}
dol_syslog($sql,LOG_DEBUG); dol_syslog($sql,LOG_DEBUG);
if (! $this->query($sql)) if (! $this->query($sql))

View File

@ -201,9 +201,10 @@ function journalHead($nom,$variante,$period,$periodlink,$description,$builddate,
$head[$h][1] = $langs->trans("Journalization"); $head[$h][1] = $langs->trans("Journalization");
$head[$h][2] = 'journal'; $head[$h][2] = 'journal';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
dol_fiche_head($head, 'journal'); dol_fiche_head($head, 'journal');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
foreach($moreparam as $key => $value) foreach($moreparam as $key => $value)
{ {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'; print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
@ -251,12 +252,12 @@ function journalHead($nom,$variante,$period,$periodlink,$description,$builddate,
print '</table>'; print '</table>';
print '<br><div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>'; dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>'; print '</form>';
dol_fiche_end();
print "\n<!-- fin cartouche journal -->\n\n"; print "\n<!-- fin cartouche journal -->\n\n";
} }

View File

@ -1654,34 +1654,41 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
* @param string $fileinput Input file name * @param string $fileinput Input file name
* @param string $ext Format of target file (It is also extension added to file if fileoutput is not provided). * @param string $ext Format of target file (It is also extension added to file if fileoutput is not provided).
* @param string $fileoutput Output filename * @param string $fileoutput Output filename
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0=Nothing done, >0 if OK
*/ */
function dol_convert_file($fileinput,$ext='png',$fileoutput='') function dol_convert_file($fileinput,$ext='png',$fileoutput='')
{ {
global $langs; global $langs;
$image=new Imagick(); if (class_exists('Imagick'))
$ret = $image->readImage($fileinput);
if ($ret)
{ {
$ret = $image->setImageFormat($ext); $image=new Imagick();
$ret = $image->readImage($fileinput);
if ($ret) if ($ret)
{ {
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext; $ret = $image->setImageFormat($ext);
if ($ret)
{
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
$count = $image->getNumberImages(); $count = $image->getNumberImages();
$ret = $image->writeImages($fileoutput, true); $ret = $image->writeImages($fileoutput, true);
if ($ret) return $count; if ($ret) return $count;
else return -3; else return -3;
}
else
{
return -2;
}
} }
else else
{ {
return -2; return -1;
} }
} }
else else
{ {
return -1; return 0;
} }
} }

View File

@ -348,8 +348,20 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
} }
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname])) elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname]))
{ {
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace); {
// We made a search from quick search menu, do we still use default filter ?
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
}
}
else
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
}
} }
} }
} }
@ -1239,8 +1251,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
&& (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) && (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file)))
) )
{ {
$ret = dol_convert_file($file, 'png', $fileimage); if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
if ($ret < 0) $error++; {
$ret = dol_convert_file($file, 'png', $fileimage);
if ($ret < 0) $error++;
}
} }
$heightforphotref=70; $heightforphotref=70;
@ -3251,7 +3266,12 @@ function dol_print_error($db='',$error='',$errors=null)
} }
if (empty($dolibarr_main_prod)) print $out; if (empty($dolibarr_main_prod)) print $out;
else define("MAIN_CORE_ERROR", 1); else
{
print $langs->trans("DolibarrHasDetectedError").'. ';
print $langs->trans("YouCanSetOptionDolibarrMainProdToZero");
define("MAIN_CORE_ERROR", 1);
}
//else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported to your browser. Please read the log file for error message.'; //else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported to your browser. Please read the log file for error message.';
dol_syslog("Error ".$syslog, LOG_ERR); dol_syslog("Error ".$syslog, LOG_ERR);
} }
@ -3287,32 +3307,34 @@ function dol_print_error_email($prefixcode, $errormessage='')
* @param string $sortfield Current field used to sort * @param string $sortfield Current field used to sort
* @param string $sortorder Current sort order * @param string $sortorder Current sort order
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag. * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
* @param string $tooltip Tooltip
* @return void * @return void
*/ */
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="") function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
{ {
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix); print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix, 0, $tooltip);
} }
/** /**
* Get title line of an array * Get title line of an array
* *
* @param string $name Translation key of field * @param string $name Translation key of field
* @param int $thead 0=To use with standard table format, 1=To use inside <thead><tr>, 2=To use with <div> * @param int $thead 0=To use with standard table format, 1=To use inside <thead><tr>, 2=To use with <div>
* @param string $file Url used when we click on sort picto * @param string $file Url used when we click on sort picto
* @param string $field Field to use for new sorting. Empty if this field is not sortable. * @param string $field Field to use for new sorting. Empty if this field is not sortable.
* @param string $begin ("" by defaut) * @param string $begin ("" by defaut)
* @param string $moreparam Add more parameters on sort url links ("" by default) * @param string $moreparam Add more parameters on sort url links ("" by default)
* @param string $moreattrib Add more attributes on th ("" by defaut). To add more css class, use param $prefix. * @param string $moreattrib Add more attributes on th ("" by defaut, example: 'align="center"'). To add more css class, use param $prefix.
* @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id') * @param string $sortfield Current field used to sort (Ex: 'd.datep,d.id')
* @param string $sortorder Current sort order (Ex: 'asc,desc') * @param string $sortorder Current sort order (Ex: 'asc,desc')
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag. * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag, for example 'mycss '.
* @param string $disablesortlink 1=Disable sort link * @param string $disablesortlink 1=Disable sort link
* @param string $tooltip Tooltip
* @return string * @return string
*/ */
function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0) function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='')
{ {
global $conf, $langs; global $conf, $langs, $form;
//print "$name, $file, $field, $begin, $options, $moreattrib, $sortfield, $sortorder<br>\n"; //print "$name, $file, $field, $begin, $options, $moreattrib, $sortfield, $sortorder<br>\n";
$sortorder=strtoupper($sortorder); $sortorder=strtoupper($sortorder);
@ -3328,7 +3350,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
$field1=trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' $field1=trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep'
//var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1); //var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1);
// If field is used as sort criteria we use a specific css class liste_titre_sel // If field is used as sort criteria we use a specific css class liste_titre_sel
// Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./","",$field1))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>'; if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./","",$field1))) $out.= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '. $moreattrib.'>';
@ -3353,7 +3374,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
} }
} }
$out.=$langs->trans($name); if ($tooltip) $out.=$form->textwithpicto($langs->trans($name), $langs->trans($tooltip));
else $out.=$langs->trans($name);
if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field
{ {
@ -3576,7 +3598,9 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
$pagelist.= '<li'.(($conf->dol_use_jmobile != 4)?' class="pagination"':'').'><span '.(($conf->dol_use_jmobile != 4)?'class="active"':'').'>'.($page+1)."</li>"; $pagelist.= '<li'.(($conf->dol_use_jmobile != 4)?' class="pagination"':'').'><span '.(($conf->dol_use_jmobile != 4)?'class="active"':'').'>'.($page+1)."</li>";
} }
} }
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
print '</td>'; print '</td>';
print '</tr></table>'."\n"; print '</tr></table>'."\n";
@ -3702,7 +3726,13 @@ function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
$info_bits |= 1; $info_bits |= 1;
} }
$ret=price($rate,0,'',0,0).($addpercent?'%':''); // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price()
if (! preg_match('/\//', $rate)) $ret=price($rate,0,'',0,0).($addpercent?'%':'');
else
{
// TODO Split on / and output with a price2num to have clean numbers with ton of 000.
$ret=$rate.($addpercent?'%':'');
}
if ($info_bits & 1) $ret.=' *'; if ($info_bits & 1) $ret.=' *';
$ret.=$morelabel; $ret.=$morelabel;
return $ret; return $ret;
@ -6192,6 +6222,8 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
{ {
global $db,$langs; global $db,$langs;
$value=trim($value);
if ($mode == 0) if ($mode == 0)
{ {
$value=preg_replace('/\*/','%',$value); // Replace * with % $value=preg_replace('/\*/','%',$value); // Replace * with %

View File

@ -19,14 +19,14 @@
/** /**
* \file htdocs/core/lib/json.lib.php * \file htdocs/core/lib/json.lib.php
* \brief Functions to emulate json function for PHP < 5.3 compatibility * \brief Functions to emulate json function when there were not activated
* \ingroup core * \ingroup core
*/ */
if (! function_exists('json_encode')) if (! function_exists('json_encode'))
{ {
/** /**
* Implement json_encode for PHP that does not support it * Implement json_encode for PHP that does not have module enabled.
* *
* @param mixed $elements PHP Object to json encode * @param mixed $elements PHP Object to json encode
* @return string Json encoded string * @return string Json encoded string
@ -42,12 +42,11 @@ if (! function_exists('json_encode'))
* *
* @param mixed $elements PHP Object to json encode * @param mixed $elements PHP Object to json encode
* @return string Json encoded string * @return string Json encoded string
* @deprecated PHP >= 5.3 supports native json_encode
* @see json_encode() * @see json_encode()
*/ */
function dol_json_encode($elements) function dol_json_encode($elements)
{ {
dol_syslog('dol_json_encode() is deprecated. Please update your code to use native json_encode().', LOG_WARNING); dol_syslog("For better permorfance, enable the native json in your PHP", LOG_WARNING);
$num=0; $num=0;
if (is_object($elements)) // Count number of properties for an object if (is_object($elements)) // Count number of properties for an object

View File

@ -25,22 +25,34 @@
/** /**
* Save data into a memory area shared by all users, all sessions on server * Regenerate files .class.php
* *
* @param string $destdir Directory * @param string $destdir Directory
* @param string $module Module name * @param string $module Module name
* @param string $objectname Name of object * @param string $objectname Name of object
* @param string $newmask New mask * @param string $newmask New mask
* @param string $readdir Directory source (use $destdir when not defined) * @param string $readdir Directory source (use $destdir when not defined)
* @param string $addfieldentry Array of the field entry to add array('key'=>,'type'=>,''label'=>,'visible'=>,'enabled'=>,'position'=>,'notnull'=>','index'=>,'searchall'=>,'comment'=>,'help'=>,'isameasure')
* @param string $delfieldentry Id of field to remove
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='') function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array() ,$delfieldentry='')
{ {
global $db, $langs; global $db, $langs;
if (empty($objectname)) return -1; if (empty($objectname)) return -1;
if (empty($readdir)) $readdir=$destdir; if (empty($readdir)) $readdir=$destdir;
// Check parameters
if (count($addfieldentry) > 0)
{
if (! preg_match('/^(integer|date|timestamp|varchar|double)/', $addfieldentry['type']))
{
setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null, 'errors');
return -1;
}
}
$pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; $pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php';
$pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); $pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : '');
if (! dol_is_file($pathoffiletoeditsrc)) if (! dol_is_file($pathoffiletoeditsrc))
@ -65,10 +77,28 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
// Edit class files // Edit class files
$contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
// Update ->fields (add or remove entries)
if (count($object->fields))
{
if (is_array($addfieldentry) && count($addfieldentry))
{
$name=$addfieldentry['name'];
unset($addfieldentry['name']);
$object->fields[$name]=$addfieldentry;
}
if (! empty($delfieldentry))
{
$name=$delfieldentry;
unset($object->fields[$name]);
}
}
dol_sort_array($object->fields, 'position');
$i=0; $i=0;
$texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n"; $texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
$texttoinsert.= "\t".'/**'."\n"; $texttoinsert.= "\t".'/**'."\n";
$texttoinsert.= "\t".' * @var array Array with all fields and their property'."\n"; $texttoinsert.= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n";
$texttoinsert.= "\t".' */'."\n"; $texttoinsert.= "\t".' */'."\n";
$texttoinsert.= "\t".'public $fields=array('."\n"; $texttoinsert.= "\t".'public $fields=array('."\n";
@ -77,29 +107,31 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$i++; $i++;
$typephp='';
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; $texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
$texttoinsert.= " 'visible'=>".($val['visible']?$val['visible']:0).","; $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
$texttoinsert.= " 'enabled'=>".($val['enabled']?$val['enabled']:0).","; $texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
if ($val['position']) $texttoinsert.= " 'position'=>".$val['position'].","; $texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
if ($val['notnull']) $texttoinsert.= " 'notnull'=>".$val['notnull'].","; $texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].","; if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].","; if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',"; if ($val['comment']) $texttoinsert.= " 'comment'=>'".$val['comment']."',";
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
if ($val['help']) $texttoinsert.= " 'help'=>'".$val['help']."',";
$texttoinsert.= "),\n"; $texttoinsert.= "),\n";
} }
} }
$texttoinsert.= "\t".');'."\n";
$texttoinsert.= "\n"; $texttoinsert.= "\t".');'."\n";
if (count($object->fields)) if (count($object->fields))
{ {
foreach($object->fields as $key => $val) $typetotypephp=array('integer'=>'integer', 'varchar'=>'string');
foreach($object->fields as $key => $val)
{ {
$i++; $i++;
$typephp=''; //$typephp=$typetotypephp[$val['type']];
$texttoinsert.= "\t".'public $'.$key.$typephp.";"; $texttoinsert.= "\t".'public $'.$key.";";
//if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
//if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
//$texttoinsert.= ($val['notnull']?' NOT NULL':''); //$texttoinsert.= ($val['notnull']?' NOT NULL':'');
@ -110,6 +142,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
$texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES'; $texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES';
//print($texttoinsert);exit;
$contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass); $contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
dol_mkdir(dirname($pathoffiletoedittarget)); dol_mkdir(dirname($pathoffiletoedittarget));
@ -182,7 +216,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='')
$texttoinsert.= "\t".$key." ".$val['type']; $texttoinsert.= "\t".$key." ".$val['type'];
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
$texttoinsert.= ($val['notnull']?' NOT NULL':''); $texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':'');
if ($i < count($object->fields)) $texttoinsert.=", "; if ($i < count($object->fields)) $texttoinsert.=", ";
$texttoinsert.= "\n"; $texttoinsert.= "\n";
} }

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -1470,7 +1470,7 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
*/ */
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{ {
global $hookmanager; global $conf, $hookmanager, $mysoc;
$result=''; $result='';
$reshook=0; $reshook=0;
@ -1487,7 +1487,32 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
} }
if (empty($reshook)) if (empty($reshook))
{ {
if (empty($hidedetails) || $hidedetails > 1) $result.=vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1); if (empty($hidedetails) || $hidedetails > 1)
{
$tmpresult='';
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1);
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX))
{
if ($object->lines[$i]->total_localtax1 != 0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx),1);
}
}
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX))
{
if ($object->lines[$i]->total_localtax2 != 0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';
$tmpresult.=vatrate(abs($object->lines[$i]->localtax2_tx),1);
}
}
$result.=$tmpresult;
}
} }
return $result; return $result;
} }

View File

@ -24,10 +24,10 @@
/** /**
* Show header of a VAT report * Show header of a report
* *
* @param string $nom Name of report * @param string $reportname Name of report
* @param string $variante Link for alternate report * @param string $notused Not used
* @param string $period Period of report * @param string $period Period of report
* @param string $periodlink Link to switch period * @param string $periodlink Link to switch period
* @param string $description Description * @param string $description Description
@ -35,16 +35,16 @@
* @param string $exportlink Link for export or '' * @param string $exportlink Link for export or ''
* @param array $moreparam Array with list of params to add into form * @param array $moreparam Array with list of params to add into form
* @param string $calcmode Calculation mode * @param string $calcmode Calculation mode
* @param string $varlink Add a variable into the address of the page * @param string $varlink Add a variable into the address of the page
* @return void * @return void
*/ */
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='') function report_header($reportname,$notused,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
{ {
global $langs; global $langs;
if (empty($hselected)) $hselected='report'; if (empty($hselected)) $hselected='report';
print "\n\n<!-- debut cartouche rapport -->\n"; print "\n\n<!-- start banner of report -->\n";
if(! empty($varlink)) $varlink = '?'.$varlink; if(! empty($varlink)) $varlink = '?'.$varlink;
@ -53,23 +53,25 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
$head[$h][1] = $langs->trans("Report"); $head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report'; $head[$h][2] = 'report';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
dol_fiche_head($head, 'report'); dol_fiche_head($head, 'report');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
foreach($moreparam as $key => $value) foreach($moreparam as $key => $value)
{ {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'; print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
} }
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
$variante = ($periodlink || $exportlink);
// Ligne de titre // Ligne de titre
print '<tr>'; print '<tr>';
print '<td width="110">'.$langs->trans("ReportName").'</td>'; print '<td width="110">'.$langs->trans("ReportName").'</td>';
if (! $variantexxx) print '<td colspan="3">'; print '<td>';
else print '<td>'; print $reportname;
print $nom;
if ($variantexxx) print '</td><td colspan="2">'.$variantexxx;
print '</td>'; print '</td>';
if ($variante) print '<td></td>';
print '</tr>'; print '</tr>';
// Calculation mode // Calculation mode
@ -77,10 +79,9 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
{ {
print '<tr>'; print '<tr>';
print '<td width="110">'.$langs->trans("CalculationMode").'</td>'; print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
if (! $variante) print '<td colspan="3">'; print '<td>';
else print '<td>';
print $calcmode; print $calcmode;
if ($variante) print '</td><td colspan="2">'.$variante; if ($variante) print '<td></td>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -88,35 +89,37 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
// Ligne de la periode d'analyse du rapport // Ligne de la periode d'analyse du rapport
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("ReportPeriod").'</td>'; print '<td>'.$langs->trans("ReportPeriod").'</td>';
if (! $periodlink) print '<td colspan="3">'; print '<td>';
else print '<td>';
if ($period) print $period; if ($period) print $period;
if ($periodlink) print '</td><td colspan="2">'.$periodlink; if ($variante) print '<td>'.$periodlink.'</td>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Ligne de description // Ligne de description
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("ReportDescription").'</td>'; print '<td>'.$langs->trans("ReportDescription").'</td>';
print '<td colspan="3">'.$description.'</td>'; print '<td>'.$description.'</td>';
if ($variante) print '<td></td>';
print '</tr>'; print '</tr>';
// Ligne d'export // Ligne d'export
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("GeneratedOn").'</td>'; print '<td>'.$langs->trans("GeneratedOn").'</td>';
if (! $exportlink) print '<td colspan="3">'; print '<td>';
else print '<td>'; print dol_print_date($builddate, 'dayhour');
print dol_print_date($builddate); print '</td>';
if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink; if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
print '</td></tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br><div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
dol_fiche_end(); dol_fiche_end();
print "\n<!-- fin cartouche rapport -->\n\n"; print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
print '<br>';
print "\n<!-- end banner of report -->\n\n";
} }

View File

@ -184,3 +184,96 @@ function dolIncludeHtmlContent($contentfile)
$includehtmlcontentopened--; $includehtmlcontentopened--;
} }
/**
* Generate a zip with all data of web site.
*
* @param Website $website Object website
* @return void
*/
function exportWebSite($website)
{
global $db, $conf;
dol_mkdir($conf->websites->dir_temp);
$srcdir = $conf->websites->dir_output.'/'.$website->ref;
$destdir = $conf->websites->dir_temp.'/'.$website->ref;
$arrayreplacement=array();
dolCopyDir($srcdir, $destdir, 0, 1, $arrayreplacement);
$srcdir = DOL_DATA_ROOT.'/medias/images/'.$website->ref;
$destdir = $conf->websites->dir_temp.'/'.$website->ref.'/medias/images/'.$website->ref;
dolCopyDir($srcdir, $destdir, 0, 1, $arrayreplacement);
// Build sql file
dol_mkdir($conf->websites->dir_temp.'/'.$website->ref.'/export');
$filesql = $conf->websites->dir_temp.'/'.$website->ref.'/export/pages.sql';
$fp = fopen($filesql,"w");
$objectpages = new WebsitePage($db);
$listofpages = $objectpages->fetchAll($website->id);
// Assign ->newid and ->newfk_page
$i=1;
foreach($listofpages as $pageid => $objectpageold)
{
$objectpageold->newid=$i;
$i++;
}
$i=1;
foreach($listofpages as $pageid => $objectpageold)
{
// Search newid
$newfk_page=0;
foreach($listofpages as $pageid2 => $objectpageold2)
{
if ($pageid2 == $objectpageold->fk_page)
{
$newfk_page = $objectpageold2->newid;
break;
}
}
$objectpageold->newfk_page=$newfk_page;
$i++;
}
foreach($listofpages as $pageid => $objectpageold)
{
$line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, title, description, keyword, status, date_creation, tms, lang, import_key, grabbed_from, content)';
$line.= " VALUES(";
$line.= $objectpageold->newid."+__MAXROWID__, ";
$line.= ($objectpageold->newfk_page ? $db->escape($objectpageold->newfk_page)."+__MAXROWID__" : "null").", ";
$line.= "__WEBSITE_ID__, ";
$line.= "'".$db->escape($objectpageold->pageurl)."', ";
$line.= "'".$db->escape($objectpageold->title)."', ";
$line.= "'".$db->escape($objectpageold->description)."', ";
$line.= "'".$db->escape($objectpageold->keyword)."', ";
$line.= "'".$db->escape($objectpageold->status)."', ";
$line.= "'".$db->idate($objectpageold->date_creation)."', ";
$line.= "'".$db->idate($objectpageold->date_modification)."', ";
$line.= "'".$db->escape($objectpageold->lang)."', ";
$line.= ($objectpageold->import_key ? "'".$db->escape($objectpageold->import_key)."'" : "null").", ";
$line.= "'".$db->escape($objectpageold->grabbed_from)."', ";
$line.= "'".$db->escape($objectpageold->content)."'";
$line.= ");";
$line.= "\n";
fputs($fp, $line);
}
fclose($fp);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filesql, octdec($conf->global->MAIN_UMASK));
// Build zip file
$filedir = $conf->websites->dir_temp.'/'.$website->ref;
$fileglob = $conf->websites->dir_temp.'/'.$website->ref.'/export/'.$website->ref.'_export_*.zip';
$filename = $conf->websites->dir_temp.'/'.$website->ref.'/export/'.$website->ref.'_export_'.dol_print_date(dol_now(),'dayhourlog').'.zip';
dol_delete_file($fileglob, 0);
dol_compress_file($filedir, $filename, 'zip');
return $filename;
}

View File

@ -249,10 +249,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Balance -- Balance
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
-- Reports -- Reports
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByAccounts', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByPredefinedAccountGroups', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2441__+MAX_llx_menu__, '/compta/resultat/result.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByPersonalizedAccountGroups', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2444__+MAX_llx_menu__, '/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy_report', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);
@ -292,16 +292,16 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3603__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3603__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3704__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS', __HANDLER__, 'left', 3400__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 0, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
-- Project - Categories -- Project - Categories
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 7__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&amp;type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3200__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3804__+MAX_llx_menu__, '/categories/card.php?action=create&amp;type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
-- Tools -- Tools
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);

View File

@ -1118,11 +1118,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Reports // Reports
$langs->load("compta"); $langs->load("compta");
$newmenu->add("/accountancy/report/result.php?mainmenu=accountancy&amp;leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); $newmenu->add("/compta/resultat/index.php?mainmenu=accountancy&amp;leftmenu=accountancy_report",$langs->trans("Reportings"),1,$user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("ReportInOut"),2,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/accountancy/report/result.php?leftmenu=accountancy_report",$langs->trans("ByAccounts"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByPredefinedAccountGroups"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report",$langs->trans("ByPersonalizedAccountGroups"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);

View File

@ -950,7 +950,7 @@ class pdf_einstein extends ModelePDFCommandes
$tvakey=str_replace('*','',$tvakey); $tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
} }
$totalvat =$outputlangs->transnoentities("TotalVAT").' '; $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1032,7 +1032,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }

View File

@ -88,9 +88,12 @@ class mod_commande_saphir extends ModeleNumRefCommandes
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
$old_code_client=$mysoc->code_client; $old_code_client=$mysoc->code_client;
$old_code_type=$mysoc->typent_code;
$mysoc->code_client='CCCCCCCCCC'; $mysoc->code_client='CCCCCCCCCC';
$mysoc->typent_code='TTTTTTTTTT';
$numExample = $this->getNextValue($mysoc,''); $numExample = $this->getNextValue($mysoc,'');
$mysoc->code_client=$old_code_client; $mysoc->code_client=$old_code_client;
$mysoc->typent_code=$old_code_type;
if (! $numExample) if (! $numExample)
{ {
@ -121,7 +124,9 @@ class mod_commande_saphir extends ModeleNumRefCommandes
return 0; return 0;
} }
$numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc,$object->date); $date = ($object->date_commande ? $object->date_commande : $object->date);
$numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc,$date);
return $numFinal; return $numFinal;
} }

View File

@ -79,9 +79,12 @@ class mod_expedition_ribera extends ModelNumRefExpedition
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
$old_code_client=$mysoc->code_client; $old_code_client=$mysoc->code_client;
$old_code_type=$mysoc->typent_code;
$mysoc->code_client='CCCCCCCCCC'; $mysoc->code_client='CCCCCCCCCC';
$mysoc->typent_code='TTTTTTTTTT';
$numExample = $this->getNextValue($mysoc,''); $numExample = $this->getNextValue($mysoc,'');
$mysoc->code_client=$old_code_client; $mysoc->code_client=$old_code_client;
$mysoc->typent_code=$old_code_type;
if (! $numExample) if (! $numExample)
{ {
@ -111,7 +114,9 @@ class mod_expedition_ribera extends ModelNumRefExpedition
return 0; return 0;
} }
$numFinal=get_next_value($db,$mask,'expedition','ref','',$objsoc->code_client,$shipment->date_expedition); $date = $shipment->date_expedition;
$numFinal=get_next_value($db,$mask,'expedition','ref','',$objsoc,$date);
return $numFinal; return $numFinal;
} }

View File

@ -1178,7 +1178,7 @@ class pdf_crabe extends ModelePDFFactures
$tvakey=str_replace('*','',$tvakey); $tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
} }
$totalvat =$outputlangs->transnoentities("TotalVAT").' '; $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1272,7 +1272,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }

View File

@ -97,8 +97,8 @@ class modCron extends DolibarrModules
// Cronjobs // Cronjobs
$this->cronjobs = array( $this->cronjobs = array(
0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>10, 'status'=>1, 'test'=>true), 0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>20, 'status'=>0, 'test'=>in_array($db->type, array('mysql','mysqli'))), 1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>in_array($db->type, array('mysql','mysqli'))),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
); );

View File

@ -117,15 +117,9 @@ class modFacture extends DolibarrModules
// Cronjobs // Cronjobs
$this->cronjobs = array( $this->cronjobs = array(
0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600*24), 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600*24, 'priority'=>50, 'status'=>1, 'test'=>true),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600) // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
); );
// List of cron jobs entries to add
// Example:
// $this->cronjobs=array(
// 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600)
// );
// Permissions // Permissions
$this->rights = array(); $this->rights = array();

View File

@ -99,13 +99,6 @@ class modGravatar extends DolibarrModules
//$r++; //$r++;
// Cronjobs
$this->cronjobs = array(); // List of cron jobs entries to add
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
// );
$r=0;
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;

View File

@ -175,12 +175,6 @@ class modMultiCurrency extends DolibarrModules
// 2=>array('file'=>'myboxc.php@multicurrency','note'=>'') // 2=>array('file'=>'myboxc.php@multicurrency','note'=>'')
//); //);
// Cronjobs
$this->cronjobs = array(); // List of cron jobs entries to add
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
// );
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;

View File

@ -1105,7 +1105,7 @@ class pdf_azur extends ModelePDFPropales
$tvakey=str_replace('*','',$tvakey); $tvakey=str_replace('*','',$tvakey);
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
} }
$totalvat =$outputlangs->transnoentities("TotalVAT").' '; $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -1188,7 +1188,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
} }

View File

@ -88,9 +88,12 @@ class mod_propale_saphir extends ModeleNumRefPropales
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
$old_code_client=$mysoc->code_client; $old_code_client=$mysoc->code_client;
$old_code_type=$mysoc->typent_code;
$mysoc->code_client='CCCCCCCCCC'; $mysoc->code_client='CCCCCCCCCC';
$mysoc->typent_code='TTTTTTTTTT';
$numExample = $this->getNextValue($mysoc,''); $numExample = $this->getNextValue($mysoc,'');
$mysoc->code_client=$old_code_client; $mysoc->code_client=$old_code_client;
$mysoc->typent_code=$old_code_type;
if (! $numExample) if (! $numExample)
{ {
@ -121,8 +124,8 @@ class mod_propale_saphir extends ModeleNumRefPropales
return 0; return 0;
} }
$date=$propal->datep; $date = $propal->date;
$customercode=$objsoc->code_client;
$numFinal=get_next_value($db,$mask,'propal','ref','',$objsoc,$date); $numFinal=get_next_value($db,$mask,'propal','ref','',$objsoc,$date);
return $numFinal; return $numFinal;

View File

@ -622,7 +622,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
} }
$totalvat =$outputlangs->transnoentities("TotalVAT").' '; $totalvat =$outputlangs->transcountrynoentities("TotalVAT",$mysoc->country_code).' ';
$totalvat.=vatrate($tvakey,1).$tvacompl; $totalvat.=vatrate($tvakey,1).$tvacompl;
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
@ -634,7 +634,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{ {
$index++; $index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
@ -725,7 +725,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetFillColor(224,224,224); $pdf->SetFillColor(224,224,224);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
$total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $total_ttc = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);

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