Merge branch 'develop' into NEW_Show_Region_in_company_info_&_Global_option_to_show_state_code_MAIN_SHOW_STATE_CODE

# Conflicts:
#	htdocs/core/class/commonobject.class.php
This commit is contained in:
Rui Strecht 2018-02-06 10:26:38 +00:00
commit 31372f8948
135 changed files with 10919 additions and 1611 deletions

View File

@ -2,8 +2,20 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 8.0.0 compared to 7.0.0 *****
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
'doaction' into 'sendMail'.
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
For users:
NEW: When payment is registered, PDF of invoices are also regenerated so payments
appears with no need to click on regenerate.
NEW: #5711 Add shipment line deleting and editing for draft shipments.
NEW: Accept substitution key __[ABC]__ replaced with value of const ABC
NEW: Accountancy Add variant on sell account for intracommunity sales & export sales
@ -276,6 +288,12 @@ Following changes may create regressions for some external modules, but were nec
and add 'td.' to the beginning of the dragHandle match string.
* IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported.
* If you use the external module "multicompany", you must also upgrade the module. Multicompany module for
Dolibarr v7 is required because with Dolibarr v7, payment modes and payment conditions are management as data
that are dedicated to each company. If you keep your old version of multicompany module, mode and
condition of payments will appears empty in all companies that are not the first one. By upgrading the
multicompany module to a version that support Dolibarr v7, everything should work as expected.
***** ChangeLog for 6.0.5 compared to 6.0.4 *****
FIX: security vulnerability reported by ADLab of Venustech

View File

@ -87,7 +87,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.rowid";
if ($sortfield == "") $sortfield = "t.piece_num,t.rowid";
$object = new BookKeeping($db);
@ -98,25 +98,30 @@ $form = new Form($db);
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int'))
{
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query.= " where date_start < '".$this->idate(dol_now())."' and date_end > '".$this->idate(dol_now())."' limit 1";
$res = $db->query($query);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
$search_date_end = strtotime($fiscalYear->date_end);
} else {
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
$year_start = dol_print_date(dol_now(), '%Y');
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
{
$month_end = 12;
$year_end--;
if (empty($search_date_start) && empty($search_date_end))
{
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
$res = $db->query($query);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$search_date_start = strtotime($fiscalYear->date_start);
$search_date_end = strtotime($fiscalYear->date_end);
} else {
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
{
$month_end = 12;
$year_end--;
}
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$search_date_end = dol_get_last_day($year_end, $month_end);
}
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$search_date_end = dol_get_last_day($year_end, $month_end);
}
}
@ -124,7 +129,7 @@ if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !
$arrayfields=array(
't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Docref"), 'checked'=>1),
't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
@ -430,7 +435,7 @@ else $button.= $langs->trans("ExportList");
$button.= '</a>';
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php"">' . $langs->trans("GroupByAccountAccounting") . '</a>';
$groupby = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param.'">' . $langs->trans("GroupByAccountAccounting") . '</a>';
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$addbutton, '', $limit);
@ -576,17 +581,17 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre("DateCreation", $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre("DateModification", $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
@ -677,14 +682,14 @@ if ($num > 0)
// Creation operation date
if (! empty($arrayfields['t.date_creation']['checked']))
{
print '<td align="center">' . dol_print_date($line->date_creation, 'day') . '</td>';
print '<td align="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Modification operation date
if (! empty($arrayfields['t.tms']['checked']))
{
print '<td align="center">' . dol_print_date($line->date_modification, 'day') . '</td>';
print '<td align="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
@ -704,6 +709,7 @@ if ($num > 0)
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
{
$i=0;
print '<tr class="liste_total">';
while ($i < $totalarray['nbfield'])
{
$i++;

View File

@ -68,7 +68,7 @@ $pagenext = $page + 1;
if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.rowid";
if (empty($search_date_start)) {
if (empty($search_date_start) && empty($search_date_end)) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql.= $db->plimit(1);
@ -81,6 +81,7 @@ if (empty($search_date_start)) {
} else {
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
@ -225,14 +226,13 @@ if ($action == 'delbookkeepingyear') {
}
$param=$options;
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param.'">' . $langs->trans("ViewFlatList") . '</a>';
$addbutton = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
$param=$options;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);

View File

@ -781,7 +781,8 @@ class BookKeeping extends CommonObject
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter
$sqlwhere = array ();
@ -849,7 +850,8 @@ class BookKeeping extends CommonObject
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_modification = $this->db->jdate($obj->date_modification);
$this->lines[] = $line;
}

View File

@ -271,7 +271,8 @@ if ($result) {
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
$paymentstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this
$tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id;
} else if ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
@ -303,6 +304,7 @@ if ($result) {
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
@ -319,11 +321,12 @@ if ($result) {
}
} else if ($links[$key]['type'] == 'payment_donation') {
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->ref = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentdonstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
} else if ($links[$key]['type'] == 'payment_vat') {
} else if ($links[$key]['type'] == 'payment_vat') { // Payment VAT
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$paymentvatstatic->label = $links[$key]['label'];
@ -401,7 +404,9 @@ if (! $error && $action == 'writebookkeeping') {
$now = dol_now();
$error = 0;
foreach ( $tabpay as $key => $val ) { // $key is rowid into llx_bank
foreach ( $tabpay as $key => $val ) // $key is rowid into llx_bank
{
$date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]);
@ -423,7 +428,13 @@ if (! $error && $action == 'writebookkeeping') {
// Line into bank account
foreach ( $tabbq[$key] as $k => $mt )
{
if ($mt) {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $ref;
@ -442,31 +453,8 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_create = $now;
// No subledger_account value for the bank line but add a specific label_operation
if ($tabtype[$key] == 'payment') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_supplier') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
} else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $ref;
} else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $ref;
} else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $ref;
} else if ($tabtype[$key] == 'unknown') {
// ???
$bookkeeping->subledger_account = '';
}
$bookkeeping->subledger_account = '';
$bookkeeping->label_operation = $reflabel;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
@ -491,108 +479,155 @@ if (! $error && $action == 'writebookkeeping') {
}
// Third party
if (! $errorforline && is_array($tabtp[$key]))
if (! $errorforline)
{
// Line into thirdparty account
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $ref;
$bookkeeping->doc_type = 'bank';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now;
if (is_array($tabtp[$key]))
{
// Line into thirdparty account
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
$reflabel.= dol_string_nohtmltag($val['soclib']);
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$bookkeeping->label_operation = $tabcompany[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->label_operation = $tabuser[$key]['name'] . ' - ' . $ref;
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = '';
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $objmid->labelc;
} else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'banktransfert') {
$bookkeeping->label_operation = $ref;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else {
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
{
// Temporary account
$bookkeeping->label_operation = '';
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $ref;
$bookkeeping->doc_type = 'bank';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now;
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = '';
} else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $objmid->labelc;
} else if ($tabtype[$key] == 'payment_vat') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_donation') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else if ($tabtype[$key] == 'banktransfert') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = '';
} else {
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
{
// Temporary account
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
$bookkeeping->label_compte = '';
}
}
$bookkeeping->label_operation = $reflabel;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
}
else { // If thirdparty unkown, output the waiting account
foreach ( $tabbq[$key] as $k => $mt ) {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= dol_string_nohtmltag('WaitingAccount');
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $ref;
$bookkeeping->doc_type = 'bank';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now;
$bookkeeping->label_compte = '';
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
$bookkeeping->label_operation = $reflabel;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
@ -662,101 +697,105 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$companystatic = new Client($db);
$userstatic = new User($db);
// CSV header line
print '"' . $langs->trans("BankId").'"' . $sep;
print '"' . $langs->trans("Date") . '"' . $sep;
print '"' . $langs->trans("PaymentMode") . '"' . $sep;
print '"' . $langs->trans("AccountAccounting") . '"' . $sep;
print '"' . $langs->trans("LedgerAccount") . '"' . $sep;
print '"' . $langs->trans("SubledgerAccount") . '"' . $sep;
print '"' . $langs->trans("Label"). '"' . $sep;
print '"' . $langs->trans("Amount") . '"' . $sep;
print '"' . $langs->trans("Amount") . '"' . $sep;
print '"' . $langs->trans("Journal") . '"' . $sep;
print '"' . $langs->trans("Note") . '"' . $sep;
print "\n";
foreach ( $tabpay as $key => $val ) {
foreach ( $tabpay as $key => $val )
{
$date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]);
//
if (! empty($tabcompany[$key]['id']))
{
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
}
else
{
$companystatic->id = 0;
$companystatic->name = '';
}
if (! empty($tabuser[$key]['id']))
{
$userstatic->id = $tabuser[$key]['id'];
$userstatic->lastname = $tabuser[$key]['lastname'];
$userstatic->firstname = $tabuser[$key]['firstname'];
}
else
{
$userstatic->id = 0;
$userstatic->lastname = '';
$userstatic->firstname = '';
}
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print " " . $sep;
if ($companystatic->name == '') {
print '"' . $val['bank_account_ref'] . " - " . utf8_decode($reflabel) . '"' . $sep;
} else {
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print " " . $sep;
print '"' . $reflabel . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
print "\n";
}
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print "\n";
}
// Third party
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
$reflabel.= dol_string_nohtmltag($val['soclib']);
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($tabtype[$key] == 'payment_supplier') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
} else if($tabtype[$key] == 'payment') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
} else if($tabtype[$key] == 'payment_expensereport') {
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
} else if($tabtype[$key] == 'payment_salary') {
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
} else {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
}
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
} else {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
}
print '"' . $reflabel . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
print "\n";
}
}
} else {
} else { // If thirdparty unkown, output the waiting account
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print " " . $sep;
if ($companystatic->name == '') {
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($reflabel) . '"' . $sep;
} else {
print '"' . $val['bank_account_ref'] . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
$reflabel.= dol_string_nohtmltag('WaitingAccount');
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print "" . $sep;
print '"' . $reflabel . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
print "\n";
}
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $journal . '"' . $sep;
print "\n";
}
}
}
@ -862,7 +901,8 @@ if (empty($action) || $action == 'view') {
$r = '';
foreach ( $tabpay as $key => $val ) { // $key is rowid in llx_bank
foreach ( $tabpay as $key => $val ) // $key is rowid in llx_bank
{
$date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]);
@ -870,48 +910,56 @@ if (empty($action) || $action == 'view') {
// Bank
foreach ( $tabbq[$key] as $k => $mt )
{
//var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
if ($mt)
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
$reflabel.= $langs->trans("Bank").' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) $reflabel .= " - " . $val['soclib'];
//var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
/*$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accounttoshow;*/
print "</td>";
print "<td>";
print $reflabel;
print "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
}
else print $accounttoshow;
print "</td>";
// Subledger account
print "<td>";
/*$accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
}
else print $accounttoshow;*/
print "</td>";
print "<td>";
//var_dump($tabpay[$key]);
print $langs->trans("Bank");
print ' '.$val['bank_account_ref'];
if (! empty($val['soclib'])) {
print " - " . $val['soclib'];
}
print "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
}
// Third party
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') {
if ($mt)
{
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . ($val['soclib']?" - ":"");
$reflabel.= $val['soclib'];
print '<!-- Thirdparty bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td></td>";
@ -974,42 +1022,49 @@ if (empty($action) || $action == 'view') {
}
}
print "</td>";
print "<td>" . $reflabel . ' ' . $val['soclib'] . "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
}
} else {
} else { // Waiting account
foreach ( $tabbq[$key] as $k => $mt ) {
print '<!-- Wait bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
if ($mt)
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
$reflabel = '';
if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
$reflabel.= 'WaitingAccount';
print '<!-- Wait bank.rowid='.$key.' -->';
print '<tr class="oddeven">';
print "<td></td>";
print "<td>" . $date . "</td>";
print "<td>" . $ref . "</td>";
// Ledger account
print "<td>";
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
print "</td>";
// Subledger account
print "<td>";
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/
print "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
print "</td>";
// Subledger account
print "<td>";
/*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
}
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/
print "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
}
}
@ -1089,6 +1144,13 @@ function getSourceDocRef($val, $typerecord)
$sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
$ref = $langs->trans("SalaryPayment");
}
elseif ($typerecord == 'sc')
{
$sqlmid = 'SELECT sc.rowid as ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc";
$sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"];
$ref = $langs->trans("SocialContribution");
}
elseif ($typerecord == 'payment_vat')
{
$sqlmid = 'SELECT v.rowid as ref';

View File

@ -148,10 +148,10 @@ if ($object->id > 0)
//print '</div>';
$morehtmlcenter = '';
$createbutton = '';
if (! empty($conf->agenda->enabled))
{
$morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
$createbutton.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
}
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
@ -162,7 +162,7 @@ if ($object->id > 0)
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $createbutton, '', 0, 1, 1);
// List of all actions
$filters=array();

View File

@ -70,6 +70,7 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && empty($_POST["cancel"]))
{
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"),'chaine',0,'',$conf->entity);
// Send mode parameters
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"),'chaine',0,'',$conf->entity);
@ -239,6 +240,11 @@ if ($action == 'edit')
print $form->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1);
print '</td></tr>';
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>';
print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO)?$conf->global->MAIN_MAIL_FORCE_SENDTO:'') . '" />';
print '</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
@ -478,6 +484,11 @@ else
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO;
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO) && ! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
@ -644,25 +655,7 @@ else
dol_fiche_end();
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
/*
// Warning 1
if ($linuxlike)
{
$sendmailoption=ini_get('mail.force_extra_parameters');
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
// Boutons actions
// Actions button
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
@ -689,6 +682,22 @@ else
print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
/*
// Warning 1
if ($linuxlike)
{
$sendmailoption=ini_get('mail.force_extra_parameters');
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && ! in_array($action, array('testconnect', 'test', 'testhtml')))
{
$text = $langs->trans("WarningPHPMail");

View File

@ -39,8 +39,7 @@ $action = GETPOST('action', 'alpha');
// Other parameters SALARIES_*
$list = array (
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'
'SALARIES_XXX',
);
/*
@ -97,7 +96,7 @@ print "</tr>\n";
foreach ($list as $key)
{
print '<tr class="oddeven value">';

View File

@ -87,7 +87,13 @@ foreach ($modulesdir as $dir)
$part = 'compta/facture';
$obj = 'facture';
}
if (empty($conf->$module->enabled)) $enabled=false;
if ($module == 'ficheinter') {
$obj = 'fichinter';
$part = 'fichinter';
$module='fichinter';
}
if (empty($conf->$module->enabled)) $enabled=false;
if ($enabled)
{

View File

@ -145,6 +145,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
$modulenameforenabled = $module;
if ($module == 'propale') { $modulenameforenabled='propal'; }
if ($module == 'supplierproposal') { $modulenameforenabled='supplier_proposal'; }
if ($module == 'ficheinter') { $modulenameforenabled='ficheinter'; }
dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass);
@ -217,7 +218,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$moduledirforclass = getModuleDirForApiClass($module);
// Load a dedicated API file
dol_syslog("Load a dedicated API file moduledirforclass=".$moduledirforclass);
dol_syslog("Load a dedicated API file module=".$module." moduledirforclass=".$moduledirforclass);
$tmpmodule = $module;
if ($tmpmodule != 'api')
@ -229,6 +230,11 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$classfile = 'supplier_orders';
if ($module == 'supplierinvoices')
$classfile = 'supplier_invoices';
if ($module == 'ficheinter')
$classfile = 'interventions';
if ($module == 'interventions')
$classfile = 'interventions';
$dir_part_file = dol_buildpath('/' . $moduledirforclass . '/class/api_' . $classfile . '.class.php', 0, 2);
$classname = ucwords($module);

View File

@ -453,24 +453,36 @@ if (is_array($blocks))
if (empty($search_showonlyerrors) || ! $checkresult[$block->id])
{
print '<tr class="oddeven">';
// ID
print '<td>'.$block->id.'</td>';
// Date
print '<td>'.dol_print_date($block->date_creation,'dayhour').'</td>';
// User
print '<td>';
//print $block->getUser()
print $block->user_fullname;
print '</td>';
// Action
print '<td>'.$langs->trans('log'.$block->action).'</td>';
// Ref
print '<td class="nowrap">'.$block->ref_object.'</td>';
// Link to source object
print '<td>'.$object_link.'</td>';
// Amount
print '<td align="right">'.price($block->amounts).'</td>';
// Details link
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
// Fingerprint
print '<td>';
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint');
print '</td>';

View File

@ -149,11 +149,10 @@ class BlockedLog
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY']='logMEMBER_SUBSCRIPTION_MODIFY';
if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE']='logMEMBER_SUBSCRIPTION_DELETE';
/*
$trackedevents['PAYMENT_VARIOUS_CREATE']='BlockedLogVariousPaymentCreate';
$trackedevents['PAYMENT_VARIOUS_MODIFY']='BlockedLogVariousPaymentModify';
$trackedevents['PAYMENT_VARIOUS_DELETE']='BlockedLogVariousPaymentDelete';
*/
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_CREATE']='logPAYMENT_VARIOUS_CREATE';
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_MODIFY']='logPAYMENT_VARIOUS_MODIFY';
if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_DELETE']='logPAYMENT_VARIOUS_DELETE';
}
/**
@ -218,6 +217,17 @@ class BlockedLog
$this->error++;
}
}
else if($this->element === 'payment_various') {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
$object = new PaymentVarious($this->db);
if ($object->fetch($this->fk_object)>0) {
return $object->getNomUrl(1);
}
else{
$this->error++;
}
}
else if($this->element === 'don' || $this->element === 'donation') {
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
@ -299,7 +309,7 @@ class BlockedLog
{
$this->date_object = $object->datev;
}
elseif ($object->element == 'payment_donation')
elseif ($object->element == 'payment_donation' || $object->element == 'payment_various')
{
$this->date_object = $object->datepaid?$object->datepaid:$object->datep;
}
@ -401,21 +411,26 @@ class BlockedLog
if (! empty($object->newref)) $this->object_data->ref = $object->newref;
}
elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation')
elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various')
{
$datepayment = $object->datepaye?$object->datepaye:($object->datepaid?$object->datepaid:$object->datep);
$paymenttypeid = $object->paiementid?$object->paiementid:$object->paymenttype;
$paymenttypeid = $object->paiementid?$object->paiementid:($object->paymenttype?$object->paymenttype:$object->type_payment);
$this->object_data->ref = $object->ref;
$this->object_data->date = $datepayment;
$this->object_data->type_code = dol_getIdFromCode($this->db, $paymenttypeid, 'c_paiement', 'id', 'code');
$this->object_data->payment_num = $object->num_paiement;
$this->object_data->payment_num = ($object->num_paiement?$object->num_paiement:$object->num_payment);
//$this->object_data->fk_account = $object->fk_account;
$this->object_data->note = $object->note;
//var_dump($this->object_data);exit;
$totalamount=0;
if (! is_array($object->amounts) && $object->amount)
{
$object->amounts=array($object->id => $object->amount);
}
$paymentpartnumber=0;
foreach($object->amounts as $objid => $amount)
{
@ -439,26 +454,41 @@ class BlockedLog
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
$tmpobject = new Don($this->db);
}
elseif ($this->element == 'payment_various')
{
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
$tmpobject = new PaymentVarious($this->db);
}
if (! is_object($tmpobject))
{
continue;
}
$result = $tmpobject->fetch($objid);
if ($result <= 0)
{
$this->error = $tmpobject->error;
$this->errors = $tmpobject->errors;
dol_syslog("Failed to fetch object with id ".$objid, LOG_ERR);
return -1;
}
$paymentpart = new stdClass();
$paymentpart->amount = $amount;
if ($this->element != 'payment_donation')
if (! in_array($this->element, array('payment_donation', 'payment_various')))
{
$result = $tmpobject->fetch_thirdparty();
if ($result <= 0)
if ($result == 0)
{
$this->error='Failed to fetch thirdparty for object with id '.$tmpobject->id;
$this->errors[] = $this->error;
dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR);
return -1;
}
elseif ($result < 0)
{
$this->error = $tmpobject->error;
$this->errors = $tmpobject->errors;
@ -481,21 +511,25 @@ class BlockedLog
if ($this->element == 'payment_donation') $paymentpart->donation = new stdClass();
else $paymentpart->invoice = new stdClass();
foreach($tmpobject as $key=>$value)
if ($this->element != 'payment_various')
{
if (in_array($key, array('fields'))) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list
if (!is_object($value))
foreach($tmpobject as $key=>$value)
{
if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value;
else $paymentpart->invoice->{$key} = $value;
if (in_array($key, array('fields'))) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list
if (!is_object($value))
{
if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value;
elseif ($this->element == 'payment_various') $paymentpart->various->{$key} = $value;
else $paymentpart->invoice->{$key} = $value;
}
}
}
$paymentpartnumber++;
$this->object_data->payment_part[$paymentpartnumber] = $paymentpart;
$paymentpartnumber++; // first payment will be 1
$this->object_data->payment_part[$paymentpartnumber] = $paymentpart;
}
}
$this->object_data->amount = $totalamount;

View File

@ -825,7 +825,7 @@ class Categorie extends CommonObject
$sql = "SELECT c.fk_" . $this->MAP_CAT_FK[$type];
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c";
$sql .= ", " . MAIN_DB_PREFIX . $this->MAP_OBJ_TABLE[$type] . " as o";
$sql .= " WHERE o.entity IN (" . getEntity( $obj->element, 1).")";
$sql .= " WHERE o.entity IN (" . getEntity( $obj->element).")";
$sql.= " AND c.fk_categorie = ".$this->id;
$sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid";
@ -1066,7 +1066,7 @@ class Categorie extends CommonObject
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
$sql .= " WHERE c.entity IN (" . getEntity( 'category', 1 ) . ")";
$sql .= " WHERE c.entity IN (" . getEntity( 'category') . ")";
$sql .= " AND c.type = " . $type;
dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG);
@ -1481,7 +1481,7 @@ class Categorie extends CommonObject
$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type];
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
$sql .= " AND c.entity IN (" . getEntity( 'category') . ")";
$res = $this->db->query($sql);
if ($res)
@ -1542,7 +1542,7 @@ class Categorie extends CommonObject
// Generation requete recherche
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie";
$sql .= " WHERE type = " . $this->MAP_ID[$type];
$sql .= " AND entity IN (" . getEntity( 'category', 1 ) . ")";
$sql .= " AND entity IN (" . getEntity( 'category') . ")";
if ($nom)
{
if (! $exact)

View File

@ -1633,6 +1633,7 @@ class ActionComm extends CommonObject
if (empty($conf->global->AGENDA_REMINDER_EMAIL))
{
$langs->load("agenda");
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda"));
return 0;
}

View File

@ -773,7 +773,7 @@ if ($object->id > 0)
}
/*
* Last sendings
* Last shipments
*/
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
$sendingstatic = new Expedition($db);
@ -1245,7 +1245,7 @@ if ($object->id > 0)
print '</div>';
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD))
{
// List of contacts
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);

View File

@ -470,7 +470,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (1, 2, 3)";
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = $socid";
$sql .= " ORDER BY s.tms DESC";
@ -534,7 +534,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY s.datec DESC";

View File

@ -156,6 +156,7 @@ if (empty($reshook))
$sql = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
$sql .= " ORDER BY mc.statut DESC"; // first status 0, then status -1
dol_syslog("card.php: select targets", LOG_DEBUG);
$resql=$db->query($sql);
@ -840,7 +841,7 @@ else
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
$_GET["action"]='';
}
else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1')
else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
@ -875,7 +876,16 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3)
{
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
$morehtmlright.=') &nbsp; ';
}
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
@ -903,11 +913,11 @@ else
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
if ($object->statut != 3 && is_numeric($nbemail))
$nbemail = ($object->nbemail?$object->nbemail:0);
if (is_numeric($nbemail))
{
$text='';
if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
{
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{
@ -915,9 +925,10 @@ else
}
else
{
$text.=$langs->trans('NotEnoughPermissions');
$text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
}
}
if (empty($nbemail)) $nbemail.=' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
if ($text)
{
print $form->textwithpicto($nbemail,$text,1,'warning');
@ -1008,7 +1019,11 @@ else
if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->rights->mailing->valider)
{
if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send))
if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0)
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("SendingFromWebInterfaceIsNotAllowed")).'">'.$langs->trans("SendMailing").'</a>';
}
else if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("SendMailing").'</a>';
}
@ -1183,15 +1198,30 @@ else
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
$nbemail = ($object->nbemail?$object->nbemail:0);
if (is_numeric($nbemail))
{
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->textwithpicto($nbemail,$text,1,'warning');
}
else
{
print $nbemail;
$text='';
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
{
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
}
else
{
$text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
}
}
if (empty($nbemail)) $nbemail.=' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
if ($text)
{
print $form->textwithpicto($nbemail,$text,1,'warning');
}
else
{
print $nbemail;
}
}
print '</td></tr>';

View File

@ -171,6 +171,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
/*
* View
*/
llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing');
$form = new Form($db);
@ -185,7 +186,16 @@ if ($object->fetch($id) >= 0)
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
$nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3)
{
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright.=' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error");
$morehtmlright.=') &nbsp; ';
}
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
@ -206,15 +216,30 @@ if ($object->fetch($id) >= 0)
print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">';
$nbemail = ($object->nbemail?$object->nbemail:'0');
if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && ($conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2))
$nbemail = ($object->nbemail?$object->nbemail:0);
if (is_numeric($nbemail))
{
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->textwithpicto($nbemail,$text,1,'warning');
}
else
{
print $nbemail;
$text='';
if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail)))
{
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
{
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
}
else
{
$text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed');
}
}
if (empty($nbemail)) $nbemail.=' '.img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>';
if ($text)
{
print $form->textwithpicto($nbemail,$text,1,'warning');
}
else
{
print $nbemail;
}
}
print '</td></tr>';
@ -411,6 +436,8 @@ if ($object->fetch($id) >= 0)
$num = $db->num_rows($resql);
$param = "&amp;id=".$object->id;
//if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_lastname) $param.= "&amp;search_lastname=".urlencode($search_lastname);
if ($search_firstname) $param.= "&amp;search_firstname=".urlencode($search_firstname);
if ($search_email) $param.= "&amp;search_email=".urlencode($search_email);
@ -552,7 +579,7 @@ if ($object->fetch($id) >= 0)
}
print '</td>';
// Statut pour l'email destinataire (Attentioon != statut du mailing)
// Status of recipient sending email (Warning != status of emailing)
if ($obj->statut == 0)
{
print '<td align="center">&nbsp;</td>';
@ -563,18 +590,22 @@ if ($object->fetch($id) >= 0)
{
print '<td align="center">'.$obj->date_envoi.'</td>';
print '<td align="right" class="nowrap">';
print $object::libStatutDest($obj->statut,2,$obj->error_text);
print $object::libStatutDest($obj->statut, 2, $obj->error_text);
print '</td>';
}
// Search Icon
print '<td align="right">';
if ($obj->statut == 0)
if ($obj->statut == 0) // Not sent yet
{
if ($user->rights->mailing->creer && $allowaddtarget) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
print '</tr>';

View File

@ -34,7 +34,7 @@ class Mailing extends CommonObject
public $element='mailing';
public $table_element='mailing';
public $picto='email';
var $titre;
var $sujet;
var $body;
@ -43,7 +43,7 @@ class Mailing extends CommonObject
var $bgimage;
var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely
var $email_from;
var $email_replyto;
var $email_errorsto;
@ -431,7 +431,7 @@ class Mailing extends CommonObject
return -1;
}
}
/**
* Delete targets emailing
*
@ -481,11 +481,11 @@ class Mailing extends CommonObject
}
}
/**
* Count number of target with status
*
* @param string $mode Mode ('alreadysent' = Sent success or error)
* @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error)
* @return int Nb of target with status
*/
function countNbOfTargets($mode)
@ -493,12 +493,14 @@ class Mailing extends CommonObject
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql.= " WHERE fk_mailing = ".$this->id;
if ($mode == 'alreadysent') $sql.= " AND statut <> 0";
else
elseif ($mode == 'alreadysentok') $sql.= " AND statut > 0";
elseif ($mode == 'alreadysentko') $sql.= " AND statut = -1";
else
{
$this->error='BadValueForParameterMode';
return -2;
}
$resql=$this->db->query($sql);
if ($resql)
{
@ -512,10 +514,10 @@ class Mailing extends CommonObject
}
return 0;
}
/**
* Retourne le libelle du statut d'un mailing (brouillon, validee, ...
* Return label of status of emailing (draft, validated, ...)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Label

View File

@ -2130,6 +2130,22 @@ if ($action == 'create')
print '</tr>';
}
$tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
if ($totalWeight) {
print '<tr><td>' . $langs->trans("CalculatedWeight") . '</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
}
if ($totalVolume) {
print '<tr><td>' . $langs->trans("CalculatedVolume") . '</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
print '</td></tr>';
}
// Incoterms
if (!empty($conf->incoterm->enabled))
{

View File

@ -76,7 +76,7 @@ $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.client IN (2, 3)";
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY st.id";
$sql.= " ORDER BY st.id";
@ -96,7 +96,7 @@ if ($resql)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
print '<a href="prospects.php?page=0&amp;stcomm='.$obj->id.'">';
print img_action($langs->trans("Show"),$obj->id).' ';
@ -140,7 +140,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
print '</td><td align="right">';
@ -150,7 +150,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
$total += $obj->price;
}
if ($total>0) {
print '<tr class="liste_total"><td>'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td></tr>";
}
print "</table><br>";
@ -205,7 +205,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
print '<a href="../propal.php?id='.$obj->propalid.'">';
print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a></td>';
@ -243,7 +243,7 @@ $sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = 1";
$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")";
$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " ORDER BY s.tms ASC";
$sql.= $db->plimit(15, 0);
@ -263,7 +263,7 @@ if ($resql)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td width="12%">';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;

View File

@ -2300,12 +2300,15 @@ if ($action == 'create' && $user->rights->commande->creer)
$tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
if ($totalWeight || $totalVolume)
if ($totalWeight)
{
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>';
}
if ($totalVolume)
{
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');

View File

@ -153,6 +153,7 @@ class Orders extends DolibarrApi
{
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
$i=0;
while ($i < $min)
{
$obj = $db->fetch_object($result);
@ -276,7 +277,7 @@ class Orders extends DolibarrApi
$request_data->product_type,
$request_data->rang,
$request_data->special_code,
$fk_parent_line,
$request_data->fk_parent_line,
$request_data->fk_fournprice,
$request_data->pa_ht,
$request_data->label,
@ -424,14 +425,6 @@ class Orders extends DolibarrApi
if ($this->commande->availability($this->commande->availability_id) < 0)
throw new RestException(400, 'Error while updating availability');
}
// update bank account
if(!empty($this->commande->fk_account))
{
if($this->commande->setBankAccount($this->commande->fk_account) == 0)
{
throw new RestException(400,$this->commande->error);
}
}
if ($this->commande->update(DolibarrApiAccess::$user) > 0)
{
@ -479,7 +472,7 @@ class Orders extends DolibarrApi
/**
* Validate an order
*
* If you get a bad value for param notrigger check that ou provide this in body
* If you get a bad value for param notrigger check, provide this in body
* {
* "idwarehouse": 0,
* "notrigger": 0

View File

@ -3036,6 +3036,8 @@ class Commande extends CommonOrder
*/
function update(User $user, $notrigger=0)
{
global $conf;
$error=0;
// Clean parameters
@ -3069,6 +3071,7 @@ class Commande extends CommonOrder
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
$sql.= " fk_account=".($this->fk_account>0?$this->fk_account:"null").",";
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
$sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").",";

View File

@ -387,7 +387,7 @@ if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
$options = array();
if ($id > 0 || ! empty($ref))
{
@ -398,7 +398,6 @@ if ($id > 0 || ! empty($ref))
// Load bank groups
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db);
$options = array();
foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
@ -531,7 +530,6 @@ dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$var=True;
$num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array();
@ -569,14 +567,12 @@ if ($resql)
// Form to reconcile
if ($user->rights->banque->consolidate && $action == 'reconcile')
{
// print '<table class="noborder" width="100%">';
// print '<tr '.$bcnd[false].'>';
// print '<td>';
print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
print '<input class="flat" id="num_releve" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
print '</div>';
if ($options) {
if (is_array($options) && count($options))
{
print $langs->trans("EventualyAddCategory").': ';
print Form::selectarray('cat', $options, GETPOST('cat'), 1);
}
@ -629,7 +625,6 @@ if ($resql)
';
}
print '<br><br>';
// print '</td></tr></table>';
}
// Form to add a transaction with no invoice
@ -663,7 +658,8 @@ if ($resql)
print '<tr>';
print '<td>';
print '<input name="label" class="flat minwidth200" type="text" value="'.GETPOST("label","alpha").'">';
if (is_array($options) && count($options)) {
if (is_array($options) && count($options))
{
print '<br>'.$langs->trans("Rubrique").': ';
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
}

View File

@ -34,6 +34,8 @@ class PaymentVarious extends CommonObject
public $table_element='payment_various'; //!< Name of table without prefix where object is stored
public $picto = 'bill';
var $id;
var $ref;
var $tms;
var $datep;
var $datev;
@ -87,8 +89,7 @@ class PaymentVarious extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
$sql.= " tms='".$this->db->idate($this->tms)."',";
if ($this->tms) $sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " sens=".$this->sens.",";
@ -102,7 +103,6 @@ class PaymentVarious extends CommonObject
$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
$sql.= " fk_user_author=".$this->fk_user_author.",";
$sql.= " fk_user_modif=".$this->fk_user_modif;
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -146,7 +146,6 @@ class PaymentVarious extends CommonObject
global $langs;
$sql = "SELECT";
$sql.= " v.rowid,";
$sql.= " v.tms,";
$sql.= " v.datep,";
$sql.= " v.datev,";
@ -164,7 +163,6 @@ class PaymentVarious extends CommonObject
$sql.= " b.fk_account,";
$sql.= " b.fk_type,";
$sql.= " b.rappro";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
$sql.= " WHERE v.rowid = ".$id;
@ -184,7 +182,7 @@ class PaymentVarious extends CommonObject
$this->datev = $this->db->jdate($obj->datev);
$this->sens = $obj->sens;
$this->amount = $obj->amount;
$this->type_payement = $obj->fk_typepayment;
$this->type_payment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment;
$this->label = $obj->label;
$this->note = $obj->note;
@ -350,6 +348,7 @@ class PaymentVarious extends CommonObject
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
$this->ref = $this->id;
if ($this->id > 0)
{

View File

@ -49,7 +49,7 @@ $sens=GETPOST("sens","int");
$amount=GETPOST("amount");
$paymenttype=GETPOST("paymenttype");
$accountancy_code=GETPOST("accountancy_code","int");
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
$projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : GETPOST('fk_project','int'));
// Security check
$socid = GETPOST("socid","int");
@ -96,22 +96,23 @@ if (empty($reshook))
{
$error=0;
$datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear"));
$datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
$datep=dol_mktime(12,0,0, GETPOST("datepmonth",'int'), GETPOST("datepday",'int'), GETPOST("datepyear",'int'));
$datev=dol_mktime(12,0,0, GETPOST("datevmonth",'int'), GETPOST("datevday",'int'), GETPOST("datevyear",'int'));
if (empty($datev)) $datev=$datep;
$object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0;
$object->ref=''; // TODO
$object->accountid=GETPOST("accountid",'int') > 0 ? GETPOST("accountid","int") : 0;
$object->datev=$datev;
$object->datep=$datep;
$object->amount=price2num(GETPOST("amount"));
$object->label=GETPOST("label");
$object->note=GETPOST("note");
$object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment");
$object->amount=price2num(GETPOST("amount",'alpha'));
$object->label=GETPOST("label",'none');
$object->note=GETPOST("note",'none');
$object->type_payment=GETPOST("paymenttype",'int') > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment",'alpha');
$object->fk_user_author=$user->id;
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
$object->sens=GETPOST('sens');
$object->fk_project= GETPOST('fk_project');
$object->fk_project= GETPOST('fk_project','int');
if (empty($datep) || empty($datev))
{
@ -411,7 +412,7 @@ if ($id)
print '<table class="border" width="100%">';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
// Payment date
print "<tr>";

View File

@ -108,21 +108,19 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
// Search criteria
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account;
if ($search_date) $sql.=" AND v.datep=".$search_date;
if ($search_accountancy_code) $sql.=" AND v.accountancy_code=".$search_accountancy_code;
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account;
if ($search_date) $sql.=" AND v.datep=".$search_date;
if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code;
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
$sql .= " AND ".$filtre;
}
if ($typeid) {
$sql .= " AND v.fk_typepayment=".$typeid;
}
$sql.= $db->order($sortfield,$sortorder);
$totalnboflines=0;
@ -142,10 +140,18 @@ if ($result)
$var=true;
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($typeid) $param.='&amp;typeid='.$typeid;
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_label) $param.='&search_label='.urlencode($search_label);
if ($typeid > 0) $param.='&typeid='.urlencode($typeid);
if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb);
if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred);
if ($search_account > 0) $param.='&search_amount='.urlencode($search_account);
//if ($search_date) $param.='&search_date='.$search_date;
if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -162,18 +168,6 @@ if ($result)
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
// Ref
@ -227,6 +221,20 @@ if ($result)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$totalarray=array();
while ($i < min($num,$limit))
{

View File

@ -683,7 +683,7 @@ if (empty($reshook))
$i = 0;
foreach ($object->lines as $line)
{
if ($line->total_ht!=0)
if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9
{ // no need to create discount if amount is null
$amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva;
@ -1570,7 +1570,7 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error ++;
}
if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error ++;
@ -3047,10 +3047,10 @@ else if ($id > 0 || ! empty($ref))
}
}
// Confirmation de la validation
// Confirmation of validation
if ($action == 'valid')
{
// on verifie si l'objet est en numerotation provisoire
// we check object has a draft number
$objectref = substr($object->ref, 1, 4);
if ($objectref == 'PROV') {
$savdate = $object->date;

View File

@ -60,30 +60,30 @@ class Invoices extends DolibarrApi
*
* @throws RestException
*/
function get($id)
{
function get($id)
{
if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
$result = $this->invoice->fetch($id);
if (! $result) {
throw new RestException(404, 'Invoice not found');
}
// Get payment details
$this->invoice->totalpaye = $this->invoice->getSommePaiement();
$this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
// Get payment details
$this->invoice->totalpaye = $this->invoice->getSommePaiement();
$this->invoice->totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
$this->invoice->totaldeposits = $this->invoice->getSumDepositsUsed();
$this->invoice->resteapayer = price2num($this->invoice->total_ttc - $this->invoice->totalpaye - $this->invoice->totalcreditnotes - $this->invoice->totaldeposits, 'MT');
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
if (! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->invoice->fetchObjectLinked();
return $this->_cleanObjectDatas($this->invoice);
}
}
/**
* List invoices

View File

@ -1163,9 +1163,9 @@ class Facture extends CommonInvoice
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
if (! empty($this->total_localtax1))
$label.= '<br><b>' . $langs->trans('LT1') . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
if (! empty($this->total_localtax2))
$label.= '<br><b>' . $langs->trans('LT2') . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);

View File

@ -1056,7 +1056,7 @@ if ($action == 'create')
print '<td class="tdtop">';
print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic');
print '</td>';
print '<td colspan="2">';
print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
@ -1067,7 +1067,7 @@ if ($action == 'create')
print '<td class="tdtop">';
print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate');
print '</td>';
print '<td valign="top" colspan="2">';
print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
@ -1396,7 +1396,7 @@ else
// Note public
print '<tr><td>';
print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $user->rights->facture->creer);
print '</td><td>';
print '</td><td class="wordbreak">';
print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
print '</td>';
print '</tr>';
@ -1404,7 +1404,7 @@ else
// Note private
print '<tr><td>';
print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $user->rights->facture->creer);
print '</td><td>';
print '</td><td class="wordbreak">';
print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
print '</td>';
print '</tr>';

View File

@ -140,8 +140,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client";
$sql.= ", f.type";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ",s.code_client";
$sql.= ", s.rowid as socid, s.email";
$sql.= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -177,22 +177,28 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$facturestatic->ref=$obj->facnumber;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->ref_client=$obj->ref_client;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->ref_client=$obj->ref_client;
$facturestatic->type=$obj->type;
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->email=$obj->email;
$companystatic->client = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td class="nowrap">';
print $facturestatic->getNomUrl(1,'');
print '</td>';
print '<td class="nowrap">';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
print $companystatic->getNomUrl(1,'',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td>';
@ -226,8 +232,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_fournisseur";
$sql.= ", s.rowid as socid, s.email";
$sql.= ", s.code_fournisseur, s.code_compta_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0";
@ -256,22 +262,28 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$facturesupplierstatic->ref=$obj->ref;
$facturesupplierstatic->id=$obj->rowid;
$facturesupplierstatic->total_ht=$obj->total_ht;
$facturesupplierstatic->total_tva=$obj->total_tva;
$facturesupplierstatic->total_ttc=$obj->total_ttc;
$facturesupplierstatic->ref_supplier=$obj->ref_supplier;
$facturesupplierstatic->total_ht=$obj->total_ht;
$facturesupplierstatic->total_tva=$obj->total_tva;
$facturesupplierstatic->total_ttc=$obj->total_ttc;
$facturesupplierstatic->ref_supplier=$obj->ref_supplier;
$facturesupplierstatic->type=$obj->type;
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->email=$obj->email;
$companystatic->fournisseur = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td class="nowrap">';
print $facturesupplierstatic->getNomUrl(1,'',16);
print '</td>';
print '<td>';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->fournisseur = 1;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
print $companystatic->getNomUrl(1,'supplier',16);
print '</td>';
print '<td align="right">'.price($obj->total_ttc).'</td>';
@ -311,7 +323,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql.= ", f.date_lim_reglement as datelimite";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= ", s.code_client, s.code_compta";
$sql.= ", sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
@ -325,7 +337,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerLastModified',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.code_client, s.code_compta";
$sql.= " ORDER BY f.tms DESC ";
$sql.= $db->plimit($max, 0);
@ -350,19 +363,28 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->statut = $obj->fk_statut;
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
$facturestatic->type=$obj->type;
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=1;
$thirdpartystatic->code_client = $obj->code_client;
//$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
$thirdpartystatic->code_compta = $obj->code_compta;
//$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="110" class="nobordernopadding nowrap">';
$facturestatic->ref=$obj->facnumber;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->statut = $obj->fk_statut;
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
$facturestatic->type=$obj->type;
print $facturestatic->getNomUrl(1,'');
print '</td>';
print '<td width="20" class="nobordernopadding nowrap">';
@ -379,12 +401,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</td>';
print '<td align="left">';
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=1;
$thirdpartystatic->code_client = $obj->code_client;
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
print $thirdpartystatic->getNomUrl(1,'customer',44);
print $thirdpartystatic->getNomUrl(1,'customer',44);
print '</td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
print '<td align="right">'.price($obj->total_ttc).'</td>';
@ -425,7 +442,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_fournisseur";
$sql.= ", s.code_fournisseur, s.code_compta_fournisseur";
$sql.= ", SUM(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
@ -439,7 +456,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierLastModified',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid, s.code_fournisseur";
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye,";
$sql.= " s.nom, s.rowid, s.code_fournisseur, s.code_compta_fournisseur";
$sql.= " ORDER BY ff.tms DESC ";
$sql.= $db->plimit($max, 0);
@ -463,20 +481,25 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
$facstatic->ref=$obj->ref;
$facstatic->id = $obj->rowid;
$facstatic->total_ht = $obj->total_ht;
$facstatic->total_tva = $obj->total_tva;
$facstatic->total_ttc = $obj->total_ttc;
print $facstatic->getNomUrl(1,'');
print '</td>';
print '<td>';
$facstatic->id = $obj->rowid;
$facstatic->total_ht = $obj->total_ht;
$facstatic->total_tva = $obj->total_tva;
$facstatic->total_ttc = $obj->total_ttc;
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->fournisseur=1;
$thirdpartystatic->code_client = $obj->code_client;
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
//$thirdpartystatic->code_client = $obj->code_client;
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
//$thirdpartystatic->code_compta = $obj->code_compta;
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td>';
print $facstatic->getNomUrl(1,'');
print '</td>';
print '<td>';
print $thirdpartystatic->getNomUrl(1,'supplier',44);
print '</td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
@ -673,9 +696,9 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
$langs->load("orders");
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc";
$sql.= ", s.nom as name";
$sql.= ", s.nom as name, s.email";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= ", s.code_client, s.code_compta";
$sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -693,7 +716,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerOrderToBill',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc";
$sql.= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc";
$resql = $db->query($sql);
if ( $resql )
@ -712,18 +735,28 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
print '<th align="right">'.$langs->trans("ToBill").'</th>';
print '<th align="center" width="16">&nbsp;</th>';
print '</tr>';
$tot_ht=$tot_ttc=$tot_tobill=0;
$societestatic = new Societe($db);
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
$societestatic->id=$obj->socid;
$societestatic->name=$obj->name;
$societestatic->email=$obj->email;
$societestatic->client=1;
$societestatic->code_client = $obj->code_client;
//$societestatic->code_fournisseur = $obj->code_fournisseur;
$societestatic->code_compta = $obj->code_compta;
//$societestatic->code_fournisseur = $obj->code_fournisseur;
$commandestatic->id=$obj->rowid;
$commandestatic->ref=$obj->ref;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="110" class="nobordernopadding nowrap">';
print $commandestatic->getNomUrl(1);
@ -741,11 +774,6 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
print '</td>';
print '<td align="left">';
$societestatic->id=$obj->socid;
$societestatic->name=$obj->name;
$societestatic->client=1;
$societestatic->code_client = $obj->code_client;
$societestatic->code_fournisseur = $obj->code_fournisseur;
print $societestatic->getNomUrl(1,'customer',44);
print '</td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
@ -787,8 +815,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
$sql.= ", f.date_lim_reglement as datelimite";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= ", s.rowid as socid, s.email";
$sql.= ", s.code_client, s.code_compta";
$sql.= ", sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
@ -802,7 +830,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement, s.nom, s.rowid, s.code_client";
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta";
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
$resql = $db->query($sql);
@ -829,19 +858,29 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->type=$obj->type;
$facturestatic->statut = $obj->fk_statut;
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
$societestatic->id=$obj->socid;
$societestatic->name=$obj->name;
$societestatic->email=$obj->email;
$societestatic->client=1;
$societestatic->code_client = $obj->code_client;
$societestatic->code_fournisseur = $obj->code_fournisseur;
$societestatic->code_compta = $obj->code_compta;
$societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="110" class="nobordernopadding nowrap">';
$facturestatic->ref=$obj->facnumber;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->type=$obj->type;
$facturestatic->statut = $obj->fk_statut;
$facturestatic->date_lim_reglement = $db->jdate($obj->datelimite);
print $facturestatic->getNomUrl(1,'');
print '</td>';
print '<td width="20" class="nobordernopadding nowrap">';
@ -858,11 +897,6 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</td>';
print '<td align="left">' ;
$societestatic->id=$obj->socid;
$societestatic->name=$obj->name;
$societestatic->client=1;
$societestatic->code_client = $obj->code_client;
$societestatic->code_fournisseur = $obj->code_fournisseur;
print $societestatic->getNomUrl(1,'customer',44);
print '</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datelimite),'day').'</td>';
@ -912,9 +946,9 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
$sql.= ", ff.date_lim_reglement";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= ", s.code_fournisseur";
$sql.= ", s.rowid as socid, s.email";
$sql.= ", s.code_client, s.code_compta";
$sql.= ", s.code_fournisseur, s.code_compta_fournisseur";
$sql.= ", sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
@ -930,8 +964,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$reshook=$hookmanager->executeHooks('printFieldListWhereSupplierUnpaid',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,";
$sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement";
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye, ff.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
$sql.= " ORDER BY ff.date_lim_reglement ASC";
$resql=$db->query($sql);
@ -958,19 +992,25 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
$facstatic->ref=$obj->ref;
$facstatic->id = $obj->rowid;
$facstatic->total_ht = $obj->total_ht;
$facstatic->total_tva = $obj->total_tva;
$facstatic->total_ttc = $obj->total_ttc;
$facstatic->total_ht = $obj->total_ht;
$facstatic->total_tva = $obj->total_tva;
$facstatic->total_ttc = $obj->total_ttc;
$societestatic->id=$obj->socid;
$societestatic->name=$obj->name;
$societestatic->email=$obj->email;
$societestatic->client=0;
$societestatic->fournisseur=1;
$societestatic->code_client = $obj->code_client;
$societestatic->code_fournisseur = $obj->code_fournisseur;
$societestatic->code_compta = $obj->code_compta;
$societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td>';
print $facstatic->getNomUrl(1,'');
print '</td>';
$societestatic->id=$obj->socid;
$societestatic->name=$obj->name;
$societestatic->client=0;
$societestatic->code_client = $obj->code_client;
$societestatic->code_fournisseur = $obj->code_fournisseur;
print '<td>'.$societestatic->getNomUrl(1, 'supplier', 44).'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->date_lim_reglement),'day').'</td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';

View File

@ -257,7 +257,7 @@ if (empty($reshook))
if (! $error)
{
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents
if ($paiement_id < 0)
{
setEventMessages($paiement->error, $paiement->errors, 'errors');

View File

@ -141,7 +141,7 @@ class Paiement extends CommonObject
/**
* Create payment of invoices into database.
* Use this->amounts to have list of invoices for the payment.
* For payment of a customer invoice, amounts are postive, for payment of credit note, amounts are negative
* For payment of a customer invoice, amounts are positive, for payment of credit note, amounts are negative
*
* @param User $user Object user
* @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more
@ -233,11 +233,12 @@ class Paiement extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
$invoice=new Facture($this->db);
$invoice->fetch($facid);
// If we want to closed payed invoices
if ($closepaidinvoices)
{
$invoice=new Facture($this->db);
$invoice->fetch($facid);
$paiement = $invoice->getSommePaiement();
$creditnotes=$invoice->getSumCreditNotesUsed();
$deposits=$invoice->getSumDepositsUsed();
@ -338,26 +339,25 @@ class Paiement extends CommonObject
$error++;
}
}
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $invoice->fetch($id); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
}
// Regenerate documents of invoices
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
}
else
{
@ -1042,12 +1042,15 @@ class Paiement extends CommonObject
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien
* @param string $mode 'withlistofinvoices'=Include list of invoices into tooltip
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0,$option='',$mode='withlistofinvoices')
function getNomUrl($withpicto=0, $option='', $mode='withlistofinvoices', $notooltip=0)
{
global $langs;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result='';
$label = $langs->trans("ShowPayment").': '.$this->ref;
if ($mode == 'withlistofinvoices')
@ -1064,12 +1067,31 @@ class Paiement extends CommonObject
}
}
}
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowMyObject");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$url = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id;
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
if ($withpicto) $result.=($link.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.($this->ref?$this->ref:$this->id).$linkend;
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto && $withpicto != 2) $result.= $this->ref;
$result .= $linkend;
return $result;
}

View File

@ -652,26 +652,47 @@ class Tva extends CommonObject
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option link option
* @param int $notooltip 1=Disable tooltip
* @return string Chaine with URL
*/
function getNomUrl($withpicto=0,$option='')
function getNomUrl($withpicto=0, $option='', $notooltip=0)
{
global $langs;
global $langs, $conf;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result='';
$label=$langs->trans("ShowVatPayment").': '.$this->ref;
$link = '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$url = DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id;
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowMyObject");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend ='</a>';
$picto='payment';
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
return $result;
}
/**
* Return amount of payments already done
*

View File

@ -97,7 +97,7 @@ $formother=new FormOther($db);
$tva_static = new Tva($db);
$bankstatic = new Account($db);
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
$sql = "SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")";
@ -192,8 +192,8 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateValue",$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateValue",$_SERVER["PHP_SELF"],"t.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"t.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
@ -217,10 +217,13 @@ if ($result)
$tva_static->id=$obj->rowid;
$tva_static->ref=$obj->rowid;
// Ref
print "<td>".$tva_static->getNomUrl(1)."</td>\n";
print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dv),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
// Label
print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datev),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
// Type
print $type;
// Account

View File

@ -42,6 +42,27 @@ class Contact extends CommonObject
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'contact';
// BEGIN MODULEBUILDER PROPERTIES
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
);
public $civility_id; // In fact we store civility_code
public $civility_code;
public $address;
@ -96,9 +117,15 @@ class Contact extends CommonObject
public $user_id;
public $user_login;
// END MODULEBUILDER PROPERTIES
public $oldcopy; // To contains a clone of this when we need to save old properties of object
/**
* Constructor
*
@ -131,7 +158,7 @@ class Contact extends CommonObject
$sql.= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')';
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')';
$sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
@ -657,43 +657,53 @@ if (empty($reshook))
else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha'))
{
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
{
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
$action = 'editline';
$_GET['rowid'] = GETPOST('elrowid');
$error++;
}
$error = 0;
if (!$error) {
$objectline = new ContratLigne($db);
if ($objectline->fetch(GETPOST('elrowid')))
{
$db->begin();
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
{
setEventMessages($langs->trans("Error").': '.$langs->trans("DateStartPlanned").' > '.$langs->trans("DateEndPlanned"), null, 'errors');
$action = 'editline';
$_GET['rowid'] = GETPOST('elrowid');
$error++;
}
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
if (! $error)
{
$objectline = new ContratLigne($db);
if ($objectline->fetch(GETPOST('elrowid')) < 0)
{
setEventMessages($objectline->error, $objectline->errors, 'errors');
$error++;
}
}
$vat_rate = GETPOST('eltva_tx');
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $vat_rate))
$db->begin();
if (! $error)
{
if ($date_start_real_update == '') $date_start_real_update=$objectline->date_ouverture;
if ($date_end_real_update == '') $date_end_real_update=$objectline->date_cloture;
$vat_rate = GETPOST('eltva_tx');
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $vat_rate))
$info_bits |= 0x01;
// Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
$localtax1_tx=get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_tx=get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
$txtva = $vat_rate;
$txtva = $vat_rate;
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
}
// ajout prix d'achat
$fk_fournprice = $_POST['fournprice'];
@ -704,22 +714,22 @@ if (empty($reshook))
$fk_unit = GETPOST('unit', 'alpha');
$objectline->description=GETPOST('product_desc','none');
$objectline->price_ht=GETPOST('elprice');
$objectline->subprice=GETPOST('elprice');
$objectline->qty=GETPOST('elqty');
$objectline->remise_percent=GETPOST('elremise_percent');
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code=$vat_src_code;
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
$objectline->date_ouverture_prevue=$date_start_update;
$objectline->date_ouverture=$date_start_real_update;
$objectline->date_fin_validite=$date_end_update;
$objectline->date_cloture=$date_end_real_update;
$objectline->fk_user_cloture=$user->id;
$objectline->fk_fournprice=$fk_fournprice;
$objectline->pa_ht=$pa_ht;
$objectline->description=GETPOST('product_desc','none');
$objectline->price_ht=GETPOST('elprice');
$objectline->subprice=GETPOST('elprice');
$objectline->qty=GETPOST('elqty');
$objectline->remise_percent=GETPOST('elremise_percent');
$objectline->tva_tx=($txtva?$txtva:0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code=$vat_src_code;
$objectline->localtax1_tx=is_numeric($localtax1_tx)?$localtax1_tx:0;
$objectline->localtax2_tx=is_numeric($localtax2_tx)?$localtax2_tx:0;
$objectline->date_ouverture_prevue=$date_start_update;
$objectline->date_ouverture=$date_start_real_update;
$objectline->date_fin_validite=$date_end_update;
$objectline->date_cloture=$date_end_real_update;
$objectline->fk_user_cloture=$user->id;
$objectline->fk_fournprice=$fk_fournprice;
$objectline->pa_ht=$pa_ht;
if ($fk_unit > 0) {
$objectline->fk_unit = GETPOST('unit');
@ -727,30 +737,30 @@ if (empty($reshook))
$objectline->fk_unit = null;
}
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
$objectline->array_options=$array_options;
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
$objectline->array_options=$array_options;
// TODO verifier price_min si fk_product et multiprix
// TODO verifier price_min si fk_product et multiprix
$result=$objectline->update($user);
if ($result > 0)
{
$db->commit();
}
else
{
$result=$objectline->update($user);
if ($result < 0)
{
$error++;
setEventMessages($objectline->error, $objectline->errors, 'errors');
$db->rollback();
}
}
else
{
setEventMessages($objectline->error, $objectline->errors, 'errors');
}
}
}
}
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
}
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer)
@ -771,6 +781,30 @@ if (empty($reshook))
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer)
{
$result = $object->validate($user);
if ($result > 0)
{
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
else if ($action == 'reopen' && $user->rights->contrat->creer)

View File

@ -1268,26 +1268,14 @@ class Contrat extends CommonObject
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
// Call triggers
$result=$this->call_trigger('CONTRACT_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
@ -2872,6 +2860,9 @@ class ContratLigne extends CommonObjectLine
$this->db->begin();
$this->oldcopy = new ContratLigne($this->db);
$this->oldcopy->fetch($this->id);
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
$sql.= " fk_contrat=".$this->fk_contrat.",";
@ -2911,22 +2902,14 @@ class ContratLigne extends CommonObjectLine
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$contrat=new Contrat($this->db);
$contrat->fetch($this->fk_contrat);
$result=$contrat->update_statut($user);
}
else
if (! $resql)
{
$this->error="Error ".$this->db->lasterror();
$error++;
//return -1;
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
@ -2934,19 +2917,52 @@ class ContratLigne extends CommonObjectLine
}
}
if (empty($error)) {
if (! $notrigger)
// If we change a planned date (start or end), sync dates for all services
if (! $error && ! empty($conf->global->CONTRACT_SYNC_PLANNED_DATE_OF_SERVICES))
{
// Call trigger
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
}
if ($this->date_ouverture_prevue != $this->oldcopy->date_ouverture_prevue)
{
$sql ='UPDATE '.MAIN_DB_PREFIX.'contratdet SET';
$sql.= " date_ouverture_prevue = ".($this->date_ouverture_prevue!=''?"'".$this->db->idate($this->date_ouverture_prevue)."'":"null");
$sql.= " WHERE fk_contrat = ".$this->fk_contrat;
$resql = $this->db->query($sql);
if (! $resql)
{
$error++;
$this->error="Error ".$this->db->lasterror();
}
}
if ($this->date_fin_validite != $this->oldcopy->date_fin_validite)
{
$sql ='UPDATE '.MAIN_DB_PREFIX.'contratdet SET';
$sql.= " date_fin_validite = ".($this->date_fin_validite!=''?"'".$this->db->idate($this->date_fin_validite)."'":"null");
$sql.= " WHERE fk_contrat = ".$this->fk_contrat;
$resql = $this->db->query($sql);
if (! $resql)
{
$error++;
$this->error="Error ".$this->db->lasterror();
}
}
}
if (empty($error)) {
$this->db->commit();
return 1;
if (! $error)
{
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINECONTRACT_UPDATE', $user);
if ($result < 0) { $error++; $this->db->rollback(); }
// End call triggers
}
}
if (! $error)
{
$this->db->commit();
return 1;
} else {
$this->db->rollback();
$this->errors[]=$this->error;

View File

@ -33,14 +33,14 @@ if (GETPOST('formfilteraction') == 'listafterchangingselectedfields')
$tabparam=array();
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
if (GETPOST("selectedfields")) $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=GETPOST("selectedfields");
else $tabparam["MAIN_SELECTEDFIELDS_".$varpage]='';
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$result=dol_set_user_param($db, $conf, $user, $tabparam);
//$action='list';
//var_dump($tabparam);exit;
}

View File

@ -106,7 +106,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$subject='';$actionmsg='';$actionmsg2='';
if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail");
$langs->load('mails');
if (is_object($object))
@ -321,6 +320,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// Feature to push mail sent into Sent folder
/* This code must be now included into the hook mail, method sendMailAfter
if (! empty($conf->dolimail->enabled))
{
$mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# <aaa@aaa.com>' // TODO Use a better way to define Sent dir.
@ -329,7 +329,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{
$mbid = $mailfromid[1];
/*IMAP Postbox*/
// IMAP Postbox
$mailboxconfig = new IMAP($db);
$mailboxconfig->fetch($mbid);
if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
@ -361,6 +361,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
}
}
}
*/
// Make substitution in email content
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
@ -393,7 +394,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$result=$mailfile->sendfile();
if ($result)
{
// FIXME This must be moved into the trigger for action $trigger_name
// Two hooks are available into method $mailfile->sendfile, so dedicated code is no more required
/*
if (! empty($conf->dolimail->enabled))
{
$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
@ -411,7 +413,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
}
}
}*/
// Initialisation of datas
if (is_object($object))
@ -446,12 +448,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
// This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessages($mesg, null, 'mesgs');
if ($conf->dolimail->enabled)
{
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').'&'.($paramname2?$paramname2:'mid').'='.$parm2val);
exit;
}
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:''));
$moreparam='';
if (isset($paramname2) || isset($paramval2)) $moreparam.= '&'.($paramname2?$paramname2:'mid').'='.$paramval2;
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').$moreparam);
exit;
}
else

View File

@ -84,7 +84,7 @@ class box_produits extends ModeleBoxes
{
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
// Add where from hooks

View File

@ -88,7 +88,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
$sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';

View File

@ -482,7 +482,7 @@ class CMailFile
/**
* Send mail that was prepared by constructor
* Send mail that was prepared by constructor.
*
* @return boolean True if mail sent, false otherwise
*/
@ -495,19 +495,25 @@ class CMailFile
$res=false;
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('maildao'));
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($reshook))
$hookmanager->initHooks(array('mail'));
$parameters=array(); $action='';
$reshook = $hookmanager->executeHooks('sendMail', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = "Error in hook maildao doactions " . $reshook;
$this->error = "Error in hook maildao sendMail " . $reshook;
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
return $reshook;
}
if ($reshook == 1) // Hook replace standard code
{
return true;
}
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
@ -557,6 +563,12 @@ class CMailFile
$keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING';
$keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING';
}
if(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) {
$this->addr_to = $conf->global->MAIN_MAIL_FORCE_SENDTO;
$this->addr_cc = '';
$this->addr_bcc = '';
}
// Action according to choosed sending method
if ($this->sendmode == 'mail')
@ -760,13 +772,21 @@ class CMailFile
}
else
{
// Send mail method not correctly defined
// --------------------------------------
return 'Bad value for sendmode';
}
$parameters=array(); $action='';
$reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
{
$this->error = "Error in hook maildao sendMailAfter " . $reshook;
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
return $reshook;
}
}
else
{

View File

@ -14,6 +14,7 @@
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Frederic France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -79,7 +80,7 @@ abstract class CommonObject
*/
public $array_options=array();
/**
* @var int[] Array of linked objects ids. Loaded by ->fetchObjectLinked
* @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked
*/
public $linkedObjectsIds;
/**
@ -187,7 +188,7 @@ abstract class CommonObject
* @var string
* @see getFullAddress()
*/
public $country;
public $country;
/**
* @var int
* @see getFullAddress(), country
@ -1315,14 +1316,15 @@ abstract class CommonObject
}
/**
* Load object from specific field
*
* @param string $table Table element or element line
* @param string $field Field selected
* @param string $key Import key
* @return int <0 if KO, >0 if OK
*/
function fetchObjectFrom($table,$field,$key)
* Load object from specific field
*
* @param string $table Table element or element line
* @param string $field Field selected
* @param string $key Import key
* @param string $element Element name
* @return int <0 if KO, >0 if OK
*/
function fetchObjectFrom($table, $field, $key, $element = null)
{
global $conf;
@ -1330,7 +1332,11 @@ abstract class CommonObject
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$field." = '".$key."'";
$sql.= " AND entity = ".$conf->entity;
if (! empty($element)) {
$sql.= " AND entity IN (".getEntity($element).")";
} else {
$sql.= " AND entity = ".$conf->entity;
}
dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
@ -1382,6 +1388,7 @@ abstract class CommonObject
* @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none'
* @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY')
* @return int <0 if KO, >0 if OK
* @see updateExtraField
*/
function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='')
{
@ -1831,29 +1838,57 @@ abstract class CommonObject
* Change the shipping method
*
* @param int $shipping_method_id Id of shipping method
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @param User $userused Object user
*
* @return int 1 if OK, 0 if KO
*/
function setShippingMethod($shipping_method_id)
function setShippingMethod($shipping_method_id, $notrigger=false, $userused=null)
{
global $user;
if (empty($userused)) $userused=$user;
$error = 0;
if (! $this->table_element) {
dol_syslog(get_class($this)."::setShippingMethod was called on objet with property table_element not defined",LOG_ERR);
return -1;
}
$this->db->begin();
if ($shipping_method_id<0) $shipping_method_id='NULL';
dol_syslog(get_class($this).'::setShippingMethod('.$shipping_method_id.')');
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_shipping_method = ".$shipping_method_id;
$sql.= " WHERE rowid=".$this->id;
if ($this->db->query($sql)) {
$this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id;
return 1;
} else {
$resql = $this->db->query($sql);
if (! $resql) {
dol_syslog(get_class($this).'::setShippingMethod Error ', LOG_DEBUG);
$this->error=$this->db->error();
return 0;
}
$this->error = $this->db->lasterror();
$error++;
} else {
if (!$notrigger)
{
// Call trigger
$this->context=array('shippingmethodupdate'=>1);
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
if ($result < 0) $error++;
// End call trigger
}
}
if ($error)
{
$this->db->rollback();
return -1;
} else {
$this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id;
$this->db->commit();
return 1;
}
}
@ -1929,14 +1964,24 @@ abstract class CommonObject
* Change the bank account
*
* @param int $fk_account Id of bank account
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @param User $userused Object user
* @return int 1 if OK, 0 if KO
*/
function setBankAccount($fk_account)
function setBankAccount($fk_account, $notrigger=false, $userused=null)
{
global $user;
if (empty($userused)) $userused=$user;
$error = 0;
if (! $this->table_element) {
dol_syslog(get_class($this)."::setBankAccount was called on objet with property table_element not defined",LOG_ERR);
return -1;
}
$this->db->begin();
if ($fk_account<0) $fk_account='NULL';
dol_syslog(get_class($this).'::setBankAccount('.$fk_account.')');
@ -1944,15 +1989,37 @@ abstract class CommonObject
$sql.= " SET fk_account = ".$fk_account;
$sql.= " WHERE rowid=".$this->id;
if ($this->db->query($sql)) {
$this->fk_account = ($fk_account=='NULL')?null:$fk_account;
return 1;
} else {
dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
$this->error=$this->db->error();
return 0;
}
}
$resql = $this->db->query($sql);
if (! $resql)
{
dol_syslog(get_class($this).'::setBankAccount Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->lasterror();
$error++;
}
else
{
if (!$notrigger)
{
// Call trigger
$this->context=array('bankaccountupdate'=>1);
$result = $this->call_trigger(strtoupper(get_class($this)) . '_MODIFY', $userused);
if ($result < 0) $error++;
// End call trigger
}
}
if ($error)
{
$this->db->rollback();
return -1;
}
else
{
$this->fk_account = ($fk_account=='NULL')?null:$fk_account;
$this->db->commit();
return 1;
}
}
// TODO: Move line related operations to CommonObjectLine?
@ -4433,7 +4500,7 @@ abstract class CommonObject
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
* @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
*/
function fetch_optionals($rowid=null,$optionsArray=null)
function fetch_optionals($rowid=null, $optionsArray=null)
{
if (empty($rowid)) $rowid=$this->id;
@ -4548,8 +4615,9 @@ abstract class CommonObject
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see updateExtraField, setValueFrom
*/
function insertExtraFields($trigger='',$userused=null)
function insertExtraFields($trigger='', $userused=null)
{
global $conf,$langs,$user;
@ -4578,16 +4646,30 @@ abstract class CommonObject
foreach($new_array_options as $key => $value)
{
$attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey];
$attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey];
$attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey];
$attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey];
$attributeRequired = $extrafields->attribute_required[$attributeKey];
if ($attributeRequired)
{
$mandatorypb=false;
if ($attributeType == 'link' && $this->array_options[$key] == '-1') $mandatorypb=true;
if ($this->array_options[$key] === '') $mandatorypb=true;
if ($mandatorypb)
{
$this->errors[]=$langs->trans('ErrorFieldRequired', $attributeLabel);
return -1;
}
}
switch ($attributeType)
{
case 'int':
if (!is_numeric($value) && $value!='')
{
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value=='')
@ -4611,23 +4693,27 @@ abstract class CommonObject
$new_array_options[$key] = $this->db->idate($this->array_options[$key]);
break;
case 'link':
$param_list=array_keys($attributeParam ['options']);
$param_list=array_keys($attributeParam['options']);
// 0 : ObjectName
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
if ($value)
if ($value == '-1') // -1 is key for no defined in combo list of objects
{
$new_array_options[$key]='';
}
elseif ($value)
{
$object = new $InfoFieldList[0]($this->db);
if (is_numeric($value)) $res=$object->fetch($value);
else $res=$object->fetch('',$value);
if ($res > 0) $new_array_options[$key]=$object->id;
else
{
$this->error="Ref '".$value."' for object '".$object->element."' not found";
$this->error="Id/Ref '".$value."' for object '".$object->element."' not found";
$this->db->rollback();
return -1;
}
@ -4640,6 +4726,7 @@ abstract class CommonObject
break;
}
}
$this->db->begin();
$table_element = $this->table_element;
@ -4684,16 +4771,14 @@ abstract class CommonObject
$this->error=$this->db->lasterror();
$error++;
}
else
if (! $error && $trigger)
{
if ($trigger)
{
// Call trigger
$this->context=array('extrafieldaddupdate'=>1);
$result=$this->call_trigger($trigger, $userused);
if ($result < 0) $error++;
// End call trigger
}
// Call trigger
$this->context=array('extrafieldaddupdate'=>1);
$result=$this->call_trigger($trigger, $userused);
if ($result < 0) $error++;
// End call trigger
}
if ($error)
@ -4712,15 +4797,19 @@ abstract class CommonObject
/**
* Update an exta field value for the current object.
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* This function delte record with all extrafields and insert them again from the array $this->array_options.
* Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
*
* @param string $key Key of the extrafield
* @return int -1=error, O=did nothing, 1=OK
* @param string $key Key of the extrafield
* @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY)
* @param User $userused Object user
* @return int -1=error, O=did nothing, 1=OK
* @see setValueFrom
*/
function updateExtraField($key)
function updateExtraField($key, $trigger, $userused)
{
global $conf,$langs;
global $conf,$langs,$user;
if (empty($userused)) $userused=$user;
$error=0;
@ -4772,9 +4861,9 @@ abstract class CommonObject
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
if ($value)
{
$object = new $InfoFieldList[0]($this->db);
$object->fetch(0,$value);
$this->array_options["options_".$key]=$object->id;
}
@ -4787,7 +4876,21 @@ abstract class CommonObject
$resql = $this->db->query($sql);
if (! $resql)
{
$error++;
$this->error=$this->db->lasterror();
}
if (! $error && $trigger)
{
// Call trigger
$this->context=array('extrafieldupdate'=>1);
$result=$this->call_trigger($trigger, $userused);
if ($result < 0) $error++;
// End call trigger
}
if ($error)
{
$this->db->rollback();
return -1;
}
@ -5891,7 +5994,7 @@ abstract class CommonObject
* @param int $dest_id New thirdparty id (the thirdparty that will received element of the other)
* @param string[] $tables Tables that need to be changed
* @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one)
* @return bool
* @return bool True if success, False if error
*/
public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
{
@ -6296,12 +6399,14 @@ abstract class CommonObject
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
}
// Create extrafields
if (! $error)
{
$result=$this->insertExtraFields();
if ($result < 0) $error++;
}
// Triggers
if (! $error && ! $notrigger)
{
// Call triggers
@ -6363,13 +6468,13 @@ abstract class CommonObject
/**
* Update object into database
*
* @param User $user User that modifies
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, >0 if OK
* @param User $user User that modifies
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function updateCommon(User $user, $notrigger = false)
{
global $langs;
global $conf, $langs;
$error = 0;
@ -6417,7 +6522,22 @@ abstract class CommonObject
}
}
if (! $error && ! $notrigger) {
// Update extrafield
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
}
// Triggers
if (! $error && ! $notrigger)
{
// Call triggers
$result=$this->call_trigger(strtoupper(get_class($this)).'_MODIFY',$user);
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
@ -6456,6 +6576,19 @@ abstract class CommonObject
}
}
if (! $error)
{
$sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element."_extrafields";
$sql.= " WHERE fk_object=" . $this->id;
$resql = $this->db->query($sql);
if (! $resql)
{
$this->errors[] = $this->db->lasterror();
$error++;
}
}
if (! $error)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;

File diff suppressed because it is too large Load Diff

View File

@ -259,9 +259,6 @@ class Conf
// Load translation object with current language
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
//if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1;
//if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1;
$rootfordata = DOL_DATA_ROOT;
$rootforuser = DOL_DATA_ROOT;
// If multicompany module is enabled, we redefine the root of data

View File

@ -594,7 +594,7 @@ class DolGraph
* @param string $fileurl Url path to show image if saved onto disk
* @return integer|null
*/
function draw($file,$fileurl='')
function draw($file, $fileurl='')
{
if (empty($file))
{
@ -602,12 +602,17 @@ class DolGraph
dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
return -2;
}
if (! is_array($this->data) || count($this->data) < 1)
if (! is_array($this->data))
{
$this->error="Call to draw method was made but SetData was not called or called with an empty dataset for parameters";
dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
return -1;
}
if (count($this->data) < 1)
{
$this->error="Call to draw method was made but SetData was is an empty dataset";
dol_syslog(get_class($this)."::draw ".$this->error, LOG_WARNING);
}
$call = "draw_".$this->_library;
call_user_func_array(array($this,$call), array($file,$fileurl));
}
@ -822,7 +827,7 @@ class DolGraph
$legends=array();
$nblot=count($this->data[0])-1; // -1 to remove legend
if ($nblot < 0) dol_print_error('', 'Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw');
if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING);
$firstlot=0;
// Works with line but not with bars
//if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x

View File

@ -168,7 +168,7 @@ class ExtraFields
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
{
// Add declaration of field into table
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $notused, $default, $computed, $entity, $langfile, $enabled);
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $notused, $default_value, $computed, $entity, $langfile, $enabled);
$err2=$this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
{
@ -309,7 +309,7 @@ class ExtraFields
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
{
if(is_array($param) && count($param) > 0)
if (is_array($param) && count($param) > 0)
{
$params = serialize($param);
}
@ -627,10 +627,17 @@ class ExtraFields
{
$this->db->begin();
if (is_array($param))
if (is_array($param) && count($param) > 0)
{
if (count($param) > 0) $param = $this->db->escape(serialize($param));
else $param='';
$params = serialize($param);
}
elseif (strlen($param) > 0)
{
$params = trim($param);
}
else
{
$params='';
}
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
@ -674,7 +681,7 @@ class ExtraFields
$sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").",";
$sql.= " ".$pos.",";
$sql.= " '".$this->db->escape($alwayseditable)."',";
$sql.= " '".$this->db->escape($param)."',";
$sql.= " '".$this->db->escape($params)."',";
$sql.= " ".$list.", ";
$sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").",";
$sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").",";
@ -1344,28 +1351,48 @@ class ExtraFields
/**
* Return HTML string to put an output field into a page
*
* @param string $key Key of attribute
* @param string $value Value to show
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
* @return string Formated value
* @param string $key Key of attribute
* @param string $value Value to show
* @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering)
* @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data
* @return string Formated value
*/
function showOutputField($key,$value,$moreparam='')
function showOutputField($key, $value, $moreparam='', $extrafieldsobjectkey='')
{
global $conf,$langs;
$elementtype=$this->attribute_elementtype[$key]; // seems not used
$label=$this->attribute_label[$key];
$type=$this->attribute_type[$key];
$size=$this->attribute_size[$key];
$default=$this->attribute_default[$key];
$computed=$this->attribute_computed[$key];
$unique=$this->attribute_unique[$key];
$required=$this->attribute_required[$key];
$param=$this->attribute_param[$key];
$perms=$this->attribute_perms[$key];
$langfile=$this->attribute_langfile[$key];
$list=$this->attribute_list[$key];
$hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
if (! empty($extrafieldsobjectkey))
{
$elementtype=$this->attributes[$extrafieldsobjectkey]['elementtype'][$key]; // seems not used
$label=$this->attributes[$extrafieldsobjectkey]['label'][$key];
$type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
$size=$this->attributes[$extrafieldsobjectkey]['size'][$key];
$default=$this->attributes[$extrafieldsobjectkey]['default'][$key];
$computed=$this->attributes[$extrafieldsobjectkey]['computed'][$key];
$unique=$this->attributes[$extrafieldsobjectkey]['unique'][$key];
$required=$this->attributes[$extrafieldsobjectkey]['required'][$key];
$param=$this->attributes[$extrafieldsobjectkey]['param'][$key];
$perms=$this->attributes[$extrafieldsobjectkey]['perms'][$key];
$langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key];
$list=$this->attributes[$extrafieldsobjectkey]['list'][$key];
$hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}
else
{
$elementtype=$this->attribute_elementtype[$key]; // seems not used
$label=$this->attribute_label[$key];
$type=$this->attribute_type[$key];
$size=$this->attribute_size[$key];
$default=$this->attribute_default[$key];
$computed=$this->attribute_computed[$key];
$unique=$this->attribute_unique[$key];
$required=$this->attribute_required[$key];
$param=$this->attribute_param[$key];
$perms=$this->attribute_perms[$key];
$langfile=$this->attribute_langfile[$key];
$list=$this->attribute_list[$key];
$hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}
if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method.
@ -1593,8 +1620,9 @@ class ExtraFields
elseif ($type == 'link')
{
$out='';
// only if something to display (perf)
if ($value)
// Only if something to display (perf)
if ($value) // If we have -1 here, pb is into sert, not into ouptu
{
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
@ -1641,14 +1669,16 @@ class ExtraFields
/**
* Return tag to describe alignement to use for this extrafield
*
* @param string $key Key of attribute
* @return string Formated value
* @param string $key Key of attribute
* @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data
* @return string Formated value
*/
function getAlignFlag($key)
function getAlignFlag($key, $extrafieldsobjectkey='')
{
global $conf,$langs;
$type=$this->attribute_type[$key];
if (! empty($extrafieldsobjectkey)) $type=$this->attributes[$extrafieldsobjectkey]['type'][$key];
else $type=$this->attribute_type[$key];
$align='';

View File

@ -139,6 +139,9 @@ class HookManager
'addMoreMassActions',
'addSearchEntry',
'addStatisticLine',
'createDictionaryFieldList',
'editDictionaryFieldlist',
'getFormMail',
'deleteFile',
'doActions',
'doMassActions',
@ -175,10 +178,9 @@ class HookManager
'formatEvent',
'printObjectLine',
'printObjectSubLine',
'createDictionaryFieldList',
'editDictionaryFieldlist',
'getFormMail',
'showLinkToObjectBlock'
'showLinkToObjectBlock',
'sendMail',
'sendMailAfter'
)
)) $hooktype='addreplace';

View File

@ -1726,7 +1726,7 @@ class Form
* @param int $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $finished 2=all, 1=finished, 0=raw material
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
@ -1740,7 +1740,7 @@ class Form
* 'warehouseopen' = select products from open warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @return void
*/
function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations = array())
@ -2390,7 +2390,7 @@ class Form
* Return list of suppliers products
*
* @param int $socid Id societe fournisseur (0 pour aucun filtre)
* @param int $selected Produit pre-selectionne
* @param int $selected Product price pre-selected (must be 'id' in product_fournisseur_price or 'idprod_IDPROD')
* @param string $htmlname Nom de la zone select
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param string $filtre Pour filtre sql
@ -5275,7 +5275,7 @@ class Form
$confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
$fieldstoshow='t.ref';
if (! empty($objecttmp->fields))
if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...)
{
$tmpfieldstoshow='';
foreach($objecttmp->fields as $key => $val)

View File

@ -993,7 +993,7 @@ class FormMail extends Form
$sql = "SELECT label, topic, joinfiles, content, content_lines, lang";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
$sql.= " AND entity IN (".getEntity('c_email_templates').")";
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
if ($active >= 0) $sql.=" AND active = ".$active;
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
@ -1065,7 +1065,7 @@ class FormMail extends Form
$sql = "SELECT label, topic, content, lang";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
$sql.= " AND entity IN (".getEntity('c_email_templates').")";
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
$sql.= $this->db->order("lang,label","ASC");
@ -1102,7 +1102,7 @@ class FormMail extends Form
$sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')";
$sql.= " AND entity IN (".getEntity('c_email_templates', 1).")";
$sql.= " AND entity IN (".getEntity('c_email_templates').")";
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // See all public templates or templates I own.
if ($active >= 0) $sql.=" AND active = ".$active;
//if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; // Return all languages

View File

@ -47,7 +47,7 @@ class FormProjets
* Output a combo list with projects qualified for a third party / user
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id project preselected
* @param string $selected Id project preselected ('' or id of project)
* @param string $htmlname Name of HTML field
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag

View File

@ -404,13 +404,13 @@ class Notify
break;
case 'FICHINTER_ADD_CONTACT':
$link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output;
$dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref);
break;
case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output;
$dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
break;
@ -664,8 +664,9 @@ class Notify
}
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
$sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
$sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
$sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
}
if ($sendto)

View File

@ -678,7 +678,6 @@ function isInEEC($object)
function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0, $morehtmlright='')
{
global $user;
global $bc;
$i = -1 ;
@ -806,10 +805,10 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
*/
function show_contacts($conf,$langs,$db,$object,$backtopage='')
{
global $user,$conf;
global $bc;
global $user,$conf,$extrafields,$hookmanager;
global $contextpage;
$form= new Form($db);
$form = new Form($db);
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -820,24 +819,67 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$search_addressphone = GETPOST("search_addressphone",'alpha');
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.lastname";
if (! $sortfield) $sortfield="t.lastname";
if (! empty($conf->clicktodial->enabled))
{
$user->fetch_clicktodial(); // lecture des infos de clicktodial du user
}
$contactstatic = new Contact($db);
$extralabels=$extrafields->fetch_name_optionals_label($contactstatic->table_element);
$contactstatic->fields=array(
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOfFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20),
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30),
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>40, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0,1), 1=>$contactstatic->LibStatut(1,1))),
);
// Definition of fields for list
$arrayfields=array(
't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'position'=>1),
't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10),
't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20),
't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30),
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>40, 'align'=>'center'),
);
// Extra fields
if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label']))
{
foreach($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val)
{
if (! empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$contactstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$contactstatic->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$contactstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$contactstatic->table_element]['list'][$key])!=3 && $extrafields->attributes[$contactstatic->table_element]['perms'][$key]));
}
}
// Initialize array of search criterias
$search=array();
foreach($contactstatic->fields as $key => $val)
{
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
}
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_status = '';
$search_name = '';
$search_addressphone = '';
$search_array_options=array();
foreach($contactstatic->fields as $key => $val)
{
$search[$key]='';
}
$toselect='';
}
$i=-1;
$contactstatic = new Contact($db);
if (! empty($conf->clicktodial->enabled))
{
$user->fetch_clicktodial(); // lecture des infos de clicktodial
}
$contactstatic->fields = dol_sort_array($contactstatic->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$buttoncreate='';
if ($user->rights->societe->contact->creer)
@ -853,26 +895,32 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print load_fiche_titre($title, $buttoncreate,'');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="socid" value="'.$object->id.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
//if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print "\n".'<table class="noborder" width="100%">'."\n";
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print "\n".'<table class="tagtable liste">'."\n";
$param="socid=".$object->id;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name);
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,";
$sql .= " p.civility as civility_id, p.address, p.zip, p.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
if ($search_status!='' && $search_status != '-1') $sql .= " AND p.statut = ".$db->escape($search_status);
if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')";
$sql.= " ORDER BY $sortfield $sortorder";
$sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,";
$sql .= " t.civility as civility_id, t.address, t.zip, t.town";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)";
$sql .= " WHERE t.fk_soc = ".$object->id;
if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status);
if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')";
if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder";
else $sql.= " ORDER BY $sortfield $sortorder";
dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG);
$result = $db->query($sql);
@ -880,59 +928,63 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$num = $db->num_rows($result);
$colspan=9;
print '<tr class="liste_titre">';
// Photo - Name
print '<td class="liste_titre">';
print '<input type="text" class="flat minwidth75" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>';
// Position
print '<td class="liste_titre">';
print '</td>';
// Address - Phone - Email
print '<td class="liste_titre"></td>';
// Status
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
print '</td>';
// Add to agenda
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
$colspan++;
print '<td class="liste_titre"></td>';
}
// Action
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>";
$titlefieldaddress=$langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email");
if (! empty($conf->dol_optimize_smallscreen)) $titlefieldaddress=$langs->trans("Address");
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($titlefieldaddress,$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder);
// Add to agenda
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) print_liste_field_titre('');
// Edit
print_liste_field_titre('');
print "</tr>\n";
foreach($contactstatic->fields as $key => $val)
{
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td class="liste_titre'.($align?' '.$align:'').'">';
if (in_array($key, array('lastname','name'))) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
elseif (in_array($key, array('statut'))) print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
print '</td>';
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>'."\n";
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
foreach($contactstatic->fields as $key => $val)
{
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
print '</tr>'."\n";
$i = -1;
if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
{
$i=0;
$i = 0;
while ($i < $num)
{
@ -961,46 +1013,81 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$contactstatic->country_code = $country_code;
$contactstatic->setGenderFromCivility();
$contactstatic->fetch_optionals();
if (is_array($contactstatic->array_options))
{
foreach($contactstatic->array_options as $key => $val)
{
$obj->$key = $val;
}
}
print '<tr class="oddeven">';
// ID
if (! empty($arrayfields['t.rowid']['checked']))
{
print '<td>';
print $contactstatic->id;
print '</td>';
}
// Photo - Name
print '<td>';
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1);
print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage));
print '</td>';
if (! empty($arrayfields['t.name']['checked']))
{
print '<td>';
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1);
print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage));
print '</td>';
}
// Job position
print '<td>';
if ($obj->poste) print $obj->poste;
print '</td>';
if (! empty($arrayfields['t.poste']['checked']))
{
print '<td>';
if ($obj->poste) print $obj->poste;
print '</td>';
}
// Address - Phone - Email
print '<td>';
print $contactstatic->getBannerAddress('contact', $object);
print '</td>';
if (! empty($arrayfields['t.address']['checked']))
{
print '<td>';
print $contactstatic->getBannerAddress('contact', $object);
print '</td>';
}
// Status
print '<td align="center">'.$contactstatic->getLibStatut(5).'</td>';
if (! empty($arrayfields['t.statut']['checked']))
{
print '<td align="center">'.$contactstatic->getLibStatut(5).'</td>';
}
// Add to agenda
// Extra fields
$extrafieldsobjectkey='socpeople';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Actions
print '<td align="right">';
// Add to agenda
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
print '<td align="center">';
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
print img_object($langs->trans("Event"),"action");
print '</a></td>';
print '</a> &nbsp; ';
}
// Edit
if ($user->rights->societe->contact->creer)
{
print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/contact/card.php?action=edit&amp;id='.$obj->rowid.'&amp;backtopage='.urlencode($backtopage).'">';
print img_edit();
print '</a></td>';
print '</a>';
}
else print '<td>&nbsp;</td>';
print '</td>';
print "</tr>\n";
$i++;
@ -1008,9 +1095,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
}
else
{
print '<tr class="oddeven">';
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
print "</tr>\n";
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print "\n</table>\n";
print '</div>';
@ -1033,7 +1120,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
function show_addresses($conf,$langs,$db,$object,$backtopage='')
{
global $user;
global $bc;
require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php';
@ -1125,7 +1211,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
*/
function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$actioncode='')
{
global $bc,$user,$conf;
global $user,$conf;
$out = show_actions_done($conf,$langs,$db,$filterobj,$objcon,1,$actioncode, 'todo');
@ -1152,7 +1238,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
*/
function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC')
{
global $bc,$user,$conf;
global $user,$conf;
global $form;
global $param;
@ -1180,14 +1266,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
$sql.= " WHERE u.rowid = a.fk_user_action";
$sql.= " AND a.entity IN (".getEntity('agenda').")";
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Adherent')
@ -1230,7 +1316,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
$sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
@ -1336,7 +1421,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
}
}
if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email)))
{
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
@ -1423,7 +1507,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
foreach ($histo as $key=>$value)
{
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
$out.='<tr class="oddeven">';
@ -1445,8 +1528,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
//$userstatic->id=$histo[$key]['userid'];
//$userstatic->login=$histo[$key]['login'];
//$out.=$userstatic->getLoginUrl(1);
$userstatic->fetch($histo[$key]['userid']);
$out.=$userstatic->getNomUrl(-1);
if ($histo[$key]['userid'] > 0)
{
$userstatic->fetch($histo[$key]['userid']);
$out.=$userstatic->getNomUrl(-1);
}
$out.='</td>';
// Type
@ -1598,7 +1684,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
function show_subsidiaries($conf,$langs,$db,$object)
{
global $user;
global $bc;
$i=-1;

View File

@ -1706,7 +1706,15 @@ function dol_convert_file($fileinput, $ext='png', $fileoutput='')
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
$count = $image->getNumberImages();
$ret = $image->writeImages($fileoutput, true);
if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
{
$ret = $image->writeImages($fileoutput, true);
}
else
{
dol_syslog("Warning: Failed to write cache preview file '.$fileoutput.'. Check permission on file/dir", LOG_ERR);
}
if ($ret) return $count;
else return -3;
}

View File

@ -111,7 +111,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
* 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
* 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',
* 'email_template', 'event', 'donation'
* 'c_paiement', ...
* 'c_paiement', 'c_payment_term', ...
* @param int $shared 0=Return id of current entity only,
* 1=Return id of current entity + shared entities (default)
* @param int $forceentity Entity id
@ -550,7 +550,7 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
if (! is_array($out) || empty($out)) $out=array();
break;
case 'nohtml':
$out=dol_string_nohtmltag($out);
$out=dol_string_nohtmltag($out, 0);
break;
case 'alphanohtml': // Recommended for search params
if (! is_array($out))

View File

@ -995,7 +995,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
else dol_print_error($db);
// Check if we must force counter to maskoffset
if (empty($counter) || preg_match('/[^0-9]/i',$counter)) $counter=$maskoffset;
if (empty($counter)) $counter=$maskoffset;
else if (preg_match('/[^0-9]/i',$counter))
{
$counter=0;
dol_syslog("Error, the last counter found is '".$counter."' so is not a numeric value. We will restart to 1.", LOG_ERR);
}
else if ($counter < $maskoffset && empty($conf->global->MAIN_NUMBERING_OFFSET_ONLY_FOR_FIRST)) $counter=$maskoffset;
if ($mode == 'last') // We found value for counter = last counter value. Now need to get corresponding ref of invoice.
@ -1503,7 +1508,7 @@ function dol_print_reduction($reduction,$langs)
}
else
{
$string = price($reduction).'%';
$string = vatrate($reduction,true);
}
return $string;
@ -2253,6 +2258,9 @@ function getModuleDirForApiClass($module)
elseif ($module == 'users') {
$moduledirforclass = 'user';
}
elseif ($module == 'ficheinter' || $module == 'interventions') {
$moduledirforclass = 'fichinter';
}
return $moduledirforclass;
}

View File

@ -168,23 +168,25 @@ 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->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'billing', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->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->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&amp;leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'List', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', '', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?leftmenu=suppliers_bills', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', 'suppliers_bills_payment', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills_payment', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', 'suppliers_bills_reports', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?leftmenu=suppliers_bills_reports', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills_stats&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
-- Billing - Customer invoice
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->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'billing', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?action=create&amp;leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 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->facture->enabled', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_draft&amp;search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_notpaid&amp;search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_paid&amp;search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills_canceled&amp;search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&amp;search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&amp;search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&amp;search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'billing', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&amp;search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->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->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __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->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'billing', 'customers_bills_payment', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills_payment', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
-- Billing - Orders to bill
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&amp;viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);
-- Donations

View File

@ -169,7 +169,8 @@ function print_start_menu_entry_auguria($idsel,$classname,$showmode)
if ($showmode)
{
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
//print '<div class="tmenuleft tmenusep"></div>';
print '<div class="tmenucenter">';
}
}

View File

@ -361,7 +361,8 @@ function print_start_menu_entry($idsel,$classname,$showmode)
if ($showmode)
{
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
//print '<div class="tmenuleft tmenusep"></div>';
print '<div class="tmenucenter">';
}
}
@ -802,24 +803,24 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->facture->creer);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("List"),1,$user->rights->facture->lire, '', $mainmenu, 'customers_bills_list');
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu))
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|draft|notpaid|paid|canceled)$/', $leftmenu))
{
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&amp;search_status=0",$langs->trans("BillShortStatusDraft"),2,$user->rights->facture->lire);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&amp;search_status=1",$langs->trans("BillShortStatusNotPaid"),2,$user->rights->facture->lire);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&amp;search_status=2",$langs->trans("BillShortStatusPaid"),2,$user->rights->facture->lire);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&amp;search_status=3",$langs->trans("BillShortStatusCanceled"),2,$user->rights->facture->lire);
}
$newmenu->add("/compta/facture/invoicetemplate_list.php",$langs->trans("ListOfTemplates"),1,$user->rights->facture->creer); // No need to see recurring invoices, if user has no permission to create invoice.
$newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates",$langs->trans("ListOfTemplates"),1,$user->rights->facture->creer,'',$mainmenu,'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice.
$newmenu->add("/compta/paiement/list.php",$langs->trans("Payments"),1,$user->rights->facture->lire);
$newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment",$langs->trans("Payments"),1,$user->rights->facture->lire,'',$mainmenu,'customers_bills_payment');
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
$newmenu->add("/compta/paiement/avalider.php",$langs->trans("MenuToValid"),2,$user->rights->facture->lire);
$newmenu->add("/compta/paiement/avalider.php?leftmenu=customers_bills_tovalid",$langs->trans("MenuToValid"),2,$user->rights->facture->lire,'',$mainmenu,'customer_bills_tovalid');
}
$newmenu->add("/compta/paiement/rapport.php",$langs->trans("Reportings"),2,$user->rights->facture->lire);
$newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_reports",$langs->trans("Reportings"),2,$user->rights->facture->lire,'',$mainmenu,'customers_bills_reports');
$newmenu->add("/compta/facture/stats/index.php", $langs->trans("Statistics"),1,$user->rights->facture->lire);
$newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"),1,$user->rights->facture->lire,'',$mainmenu,'customers_bills_stats');
}
// Suppliers invoices
@ -827,7 +828,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create');
$newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&amp;action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create');
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list');
if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {
@ -836,11 +837,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&amp;search_status=2", $langs->trans("BillShortStatusPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid');
}
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/paiement.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment');
$newmenu->add("/fourn/facture/rapport.php",$langs->trans("Reportings"),2,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_report",$langs->trans("Reportings"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_report');
$newmenu->add("/compta/facture/stats/index.php?mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/compta/facture/stats/index.php?mode=supplier&amp;leftmenu=suppliers_bills_stats", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats');
}
// Orders

View File

@ -536,7 +536,8 @@ function print_start_menu_entry_empty($idsel,$classname,$showmode)
if ($showmode)
{
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
//print '<div class="tmenuleft tmenusep"></div>';
print '<div class="tmenucenter">';
}
}

View File

@ -139,10 +139,10 @@ class pdf_einstein extends ModelePDFCommandes
$this->posxdesc=$this->marge_gauche+1;
if($conf->global->PRODUCT_USE_UNITS)
{
$this->posxtva=99;
$this->posxup=114;
$this->posxqty=130;
$this->posxunit=147;
$this->posxtva=101;
$this->posxup=118;
$this->posxqty=135;
$this->posxunit=151;
}
else
{
@ -423,9 +423,11 @@ class pdf_einstein extends ModelePDFCommandes
{
$pdf->commitTransaction();
}
$posYAfterDescription=$pdf->GetY();
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
@ -614,13 +616,13 @@ class pdf_einstein extends ModelePDFCommandes
}
else
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
else
{
$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
$this->error=$langs->transnoentities("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
return 0;
}
}

View File

@ -122,11 +122,10 @@ abstract class ModeleNumRefExpenseReport
/**
* Renvoie prochaine valeur attribuee
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Valeur
*/
function getNextValue($objsoc,$object)
function getNextValue($object)
{
global $langs;
return $langs->trans("NotAvailable");
@ -148,4 +147,4 @@ abstract class ModeleNumRefExpenseReport
if ($this->version) return $this->version;
return $langs->trans("NotAvailable");
}
}
}

View File

@ -121,10 +121,10 @@ class pdf_crabe extends ModelePDFFactures
$this->posxdesc=$this->marge_gauche+1;
if($conf->global->PRODUCT_USE_UNITS)
{
$this->posxtva=99;
$this->posxup=114;
$this->posxqty=130;
$this->posxunit=147;
$this->posxtva=101;
$this->posxup=118;
$this->posxqty=135;
$this->posxunit=151;
}
else
{
@ -686,7 +686,7 @@ class pdf_crabe extends ModelePDFFactures
$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
// Affiche zone versements
if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
{
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
}
@ -1294,7 +1294,7 @@ class pdf_crabe extends ModelePDFFactures
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0;
if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0)
if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
{
// Already paid + Deposits
$index++;

View File

@ -107,6 +107,21 @@ class modPaypal extends DolibarrModules
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'mainmenu'=>'billing',
'leftmenu'=>'customers_bills_payment_paypal',
'type'=>'left', // This is a Left menu entry
'titre'=>'PaypalImportPayment',
'url'=>'/paypal/importpayments.php',
'langs'=>'paypal', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>501,
'enabled'=>'$conf->paypal->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
// Add here entries to declare new menus
// Example to declare the Top Menu entry:

View File

@ -67,7 +67,8 @@ class modSalaries extends DolibarrModules
$this->dirs = array("/salaries/temp");
// Config pages
$this->config_page_url = array('salaries.php');
//$this->config_page_url = array('salaries.php');
$this->config_page_url = array();
// Dependencies
$this->depends = array();

View File

@ -92,8 +92,22 @@ class modStripe extends DolibarrModules
$r=0;
// Main menu entries
$this->menus = array(); // List of menus to add
$r=0;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'mainmenu'=>'billing',
'leftmenu'=>'customers_bills_payment_stripe',
'type'=>'left', // This is a Left menu entry
'titre'=>'StripeImportPayment',
'url'=>'/stripe/importpayments.php',
'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>500,
'enabled'=>'$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
// Exports
$r=1;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@ -19,7 +20,7 @@
/**
* \file htdocs/core/modules/project/doc/pdf_baleine.modules.php
* \ingroup project
* \brief Fichier de la classe permettant de generer les projets au modele Baleine
* \brief File of class to generate project document Baleine
* \author Regis Houssin
*/
@ -32,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* Classe permettant de generer les projets au modele Baleine
* Class to manage generation of project document Baleine
*/
class pdf_baleine extends ModelePDFProjects
@ -78,10 +79,19 @@ class pdf_baleine extends ModelePDFProjects
// Defini position des colonnes
$this->posxref=$this->marge_gauche+1;
$this->posxlabel=$this->marge_gauche+25;
$this->posxworkload=$this->marge_gauche+100;
$this->posxprogress=$this->marge_gauche+130;
$this->posxdatestart=$this->marge_gauche+150;
$this->posxworkload=$this->marge_gauche+120;
$this->posxprogress=$this->marge_gauche+140;
$this->posxdatestart=$this->marge_gauche+152;
$this->posxdateend=$this->marge_gauche+170;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxref-=20;
$this->posxlabel-=20;
$this->posxworkload-=20;
$this->posxprogress-=20;
$this->posxdatestart-=20;
$this->posxdateend-=20;
}
}
@ -136,12 +146,14 @@ class pdf_baleine extends ModelePDFProjects
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1,0);
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@ -149,15 +161,21 @@ class pdf_baleine extends ModelePDFProjects
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
// Complete object by loading several other informations
$task = new Task($this->db);
$tasksarray = $task->getTasksArray(0,0,$object->id);
if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines
{
$tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray)));
}
if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines
{
$tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray)));
}
$object->lines=$tasksarray;
$nblignes=count($object->lines);
@ -177,6 +195,7 @@ class pdf_baleine extends ModelePDFProjects
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
@ -184,21 +203,28 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetTextColor(0,0,0);
$tab_top = 50;
$tab_height = 200;
$tab_top_newpage = 40;
$tab_height_newpage = 210;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 170;
$tab_height_newpage = 190;
// Affiche notes
if (! empty($object->note_public))
// Show public note
$notetoshow=empty($object->note_public)?'':$object->note_public;
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top -= 2;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1);
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($notetoshow), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-($tab_top-2);
$height_note=$nexY-$tab_top;
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$pdf->Rect($this->marge_gauche, $tab_top-2, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+2);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY+6;
@ -208,44 +234,126 @@ class pdf_baleine extends ModelePDFProjects
$height_note=0;
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
$heightoftitleline = 10;
$iniY = $tab_top + $heightoftitleline + 1;
$curY = $tab_top + $heightoftitleline + 1;
$nexY = $tab_top + $heightoftitleline + 1;
// Boucle sur les lignes
// Loop on each lines
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
// Description of ligne
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of line
$ref=$object->lines[$i]->ref;
$libelleline=$object->lines[$i]->label;
$progress=$object->lines[$i]->progress.'%';
$progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':'');
$datestart=dol_print_date($object->lines[$i]->date_start,'day');
$dateend=dol_print_date($object->lines[$i]->date_end,'day');
$planned_workload=convertSecondToTime((int) $object->lines[$i]->planned_workload,'allhourmin');
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$showpricebeforepagebreak=1;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
$pdf->startTransaction();
// Label
$pdf->SetXY($this->posxlabel, $curY);
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label
$pdf->SetXY($this->posxlabel, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
}
}
else
{
// We found a page break
$showpricebeforepagebreak=0;
$forcedesconsamepage=1;
if ($forcedesconsamepage)
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1;
// Label
$pdf->SetXY($this->posxlabel, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
}
}
//var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak);
}
else // No pagebreak
{
$pdf->commitTransaction();
}
$posYAfterDescription=$pdf->GetY();
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
//var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak);
$pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// Ref of task
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
// Workload
$pdf->SetXY($this->posxworkload, $curY);
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload, 0, 'R');
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload?$planned_workload:'', 0, 'R');
// Progress
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
// Date
$pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C');
$pdf->SetXY($this->posxdateend, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C');
$pageposafter=$pdf->getPage();
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
@ -274,6 +382,7 @@ class pdf_baleine extends ModelePDFProjects
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
@ -290,44 +399,33 @@ class pdf_baleine extends ModelePDFProjects
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
}
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
/*
* Pied de page
*/
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file,'F');
$pdf->Output($file, 'F');
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
@ -339,9 +437,11 @@ class pdf_baleine extends ModelePDFProjects
return 0;
}
}
$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
return 0;
else
{
$this->error=$langs->transnoentities("ErrorConstantNotDefined","PROJECT_OUTPUTDIR");
return 0;
}
}
@ -361,14 +461,17 @@ class pdf_baleine extends ModelePDFProjects
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$heightoftitleline = 10;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param
// Draw rect of all tab (title + lines). Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
$pdf->line($this->marge_gauche, $tab_top+$heightoftitleline, $this->page_largeur-$this->marge_droite, $tab_top+$heightoftitleline);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size);
@ -390,7 +493,6 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetXY($this->posxdateend, $tab_top+1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
/**
@ -447,10 +549,18 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
if (is_object($object->thirdparty))
{
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R');
}
$pdf->SetTextColor(0,0,60);
// Add list of linked objects
@ -476,7 +586,6 @@ class pdf_baleine extends ModelePDFProjects
}
}
*/
}
/**
@ -496,4 +605,3 @@ class pdf_baleine extends ModelePDFProjects
}
}

View File

@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@ -48,7 +49,7 @@ if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/com
/**
* Classe permettant de generer les projets au modele Baleine
* Class to manage generation of project document Baleine
*/
class pdf_beluga extends ModelePDFProjects
@ -98,6 +99,15 @@ class pdf_beluga extends ModelePDFProjects
$this->posxamountht=$this->marge_gauche+110;
$this->posxamountttc=$this->marge_gauche+135;
$this->posxstatut=$this->marge_gauche+165;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxref-=20;
$this->posxdate-=20;
$this->posxsociete-=20;
$this->posxamountht-=20;
$this->posxamountttc-=20;
$this->posstatut-=20;
}
}
@ -110,7 +120,7 @@ class pdf_beluga extends ModelePDFProjects
*/
function write_file($object,$outputlangs)
{
global $user,$langs,$conf;
global $conf, $hookmanager, $langs, $user;
$formproject=new FormProjets($this->db);
@ -154,12 +164,14 @@ class pdf_beluga extends ModelePDFProjects
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1,0);
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@ -167,11 +179,22 @@ class pdf_beluga extends ModelePDFProjects
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
// Complete object by loading several other informations
$task = new Task($this->db);
$tasksarray = $task->getTasksArray(0,0,$object->id);
if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines
{
$tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray)));
}
$object->lines=$tasksarray;
$nblignes=count($object->lines);
@ -190,6 +213,7 @@ class pdf_beluga extends ModelePDFProjects
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
@ -197,21 +221,28 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0,0,0);
$tab_top = 50;
$tab_height = 200;
$tab_top_newpage = 40;
$tab_height_newpage = 210;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 170;
$tab_height_newpage = 190;
// Affiche notes
if (! empty($object->note_public))
// Show public note
$notetoshow=empty($object->note_public)?'':$object->note_public;
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top -= 2;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1);
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($notetoshow), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-($tab_top-2);
$height_note=$nexY-$tab_top;
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$pdf->Rect($this->marge_gauche, $tab_top-2, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+2);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY+6;
@ -221,10 +252,11 @@ class pdf_beluga extends ModelePDFProjects
$height_note=0;
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
$heightoftitleline = 10;
$iniY = $tab_top + $heightoftitleline + 1;
$curY = $tab_top + $heightoftitleline + 1;
$nexY = $tab_top + $heightoftitleline + 1;
$listofreferent=array(
'propal'=>array(
'name'=>"Proposals",
@ -335,176 +367,286 @@ class pdf_beluga extends ModelePDFProjects
$langstoload=$value['lang'];
$langs->load($langstoload);
if ($qualified)
if (! $qualified) continue;
//var_dump("$key, $tablename, $datefieldname, $dates, $datee");
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
if ($key == 'agenda')
{
//var_dump("$key, $tablename, $datefieldname, $dates, $datee");
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
//var_dump($elementarray);
// var_dump($elementarray);
}
$num = count($elementarray);
if ($num >= 0)
$num = count($elementarray);
if ($num >= 0)
{
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
$selectList = $formproject->select_element($tablename, $project->thirdparty->id);
$nexY = $pdf->GetY() + 1;
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $outputlangs->transnoentities("Ref"), 1, 'L');
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, $outputlangs->transnoentities("Date"), 1, 'C');
$pdf->SetXY($this->posxsociety, $curY);
$titlethirdparty=$outputlangs->transnoentities("ThirdParty");
if ($classname == 'ExpenseReport') $titlethirdparty=$langs->trans("User");
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $titlethirdparty, 1, 'L');
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHTShort"), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTCShort"), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R');
if (is_array($elementarray) && count($elementarray) > 0)
{
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
$nexY = $pdf->GetY();
$selectList = $formproject->select_element($tablename, $project->thirdparty->id);
$nexY = $pdf->GetY() + 1;
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $outputlangs->transnoentities("Ref"), 1, 'L');
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, $outputlangs->transnoentities("Date"), 1, 'C');
$pdf->SetXY($this->posxsociety, $curY);
$titlethirdparty=$outputlangs->transnoentities("ThirdParty");
if ($classname == 'ExpenseReport') $titlethirdparty=$langs->trans("User");
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $titlethirdparty, 1, 'L');
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHTShort"), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTCShort"), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R');
$total_ht = 0;
$total_ttc = 0;
$num = count($elementarray);
if (is_array($elementarray) && count($elementarray) > 0)
{
// Loop on each lines
for ($i = 0; $i < $num; $i ++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of line
$idofelement=$elementarray[$i];
if ($classname == 'ExpenseReport')
{
// We get id of expense report
$expensereportline=new ExpenseReportLine($this->db);
$expensereportline->fetch($idofelement);
$idofelement = $expensereportline->fk_expensereport;
}
$element = new $classname($this->db);
$element->fetch($idofelement);
$element->fetch_thirdparty();
// print $classname;
$qualifiedfortotal = true;
if ($key == 'invoice') {
if ($element->close_code == 'replaced')
$qualifiedfortotal = false; // Replacement invoice
}
$showpricebeforepagebreak=1;
$pdf->startTransaction();
// Label
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label
$pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
}
}
else
{
// We found a page break
$showpricebeforepagebreak=0;
$forcedesconsamepage=1;
if ($forcedesconsamepage)
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1;
// Label
$pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
}
}
//var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak);
}
else // No pagebreak
{
$pdf->commitTransaction();
}
$posYAfterDescription=$pdf->GetY();
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
//var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak);
$pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
$date = $element->date_commande;
else {
$date = $element->date;
if (empty($date))
$date = $element->datep;
if (empty($date))
$date = $element->date_contrat;
if (empty($date))
$date = $element->datev; // Fiche inter
}
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C');
$pdf->SetXY($this->posxsociety, $curY);
if ($classname == 'ExpenseReport')
{
$fuser=new User($this->db);
$fuser->fetch($element->fk_user_author);
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L');
}
else
{
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty)?$element->thirdparty->name:''), 1, 'L');
}
// Amount without tax
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : '&nbsp;'), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
if ($key == 'agenda')
{
$textforamount = dol_trunc($element->label, 26);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, $textforamount, 1, 'L');
}
else
{
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
}
// Status
if ($element instanceof CommonInvoice) {
// This applies for Facture and FactureFournisseur
$outputstatut = $element->getLibStatut(1, $element->getSommePaiement());
} else {
$outputstatut = $element->getLibStatut(1);
}
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputstatut, 1, 'R', false, 1, '', '', true, 0, true);
if ($qualifiedfortotal) {
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
}
$nexY = $pdf->GetY();
$curY = $nexY;
$total_ht = 0;
$total_ttc = 0;
$num = count($elementarray);
for ($i = 0; $i < $num; $i ++) {
$idofelement=$elementarray[$i];
if ($classname == 'ExpenseReport')
{
// We get id of expense report
$expensereportline=new ExpenseReportLine($this->db);
$expensereportline->fetch($idofelement);
$idofelement = $expensereportline->fk_expensereport;
}
$element = new $classname($this->db);
$element->fetch($idofelement);
$element->fetch_thirdparty();
// print $classname;
$qualifiedfortotal = true;
if ($key == 'invoice') {
if ($element->close_code == 'replaced')
$qualifiedfortotal = false; // Replacement invoice
}
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
// Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
$date = $element->date_commande;
else {
$date = $element->date;
if (empty($date))
$date = $element->datep;
if (empty($date))
$date = $element->date_contrat;
if (empty($date))
$date = $element->datev; // Fiche inter
}
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C');
$pdf->SetXY($this->posxsociety, $curY);
if (is_object($element->thirdparty))
{
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $element->thirdparty->name, 1, 'L');
}
elseif ($classname == 'ExpenseReport')
{
$fuser=new User($this->db);
$fuser->fetch($element->fk_user_author);
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L');
}
// Amount without tax
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : '&nbsp;'), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
// Status
if ($element instanceof CommonInvoice) {
// This applies for Facture and FactureFournisseur
$outputstatut = $element->getLibStatut(1, $element->getSommePaiement());
} else {
$outputstatut = $element->getLibStatut(1);
}
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputstatut, 1, 'R', false, 1, '', '', true, 0, true);
if ($qualifiedfortotal) {
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
}
$nexY = $pdf->GetY();
$curY = $nexY;
}
if (empty($value['disableamount'])) {
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxref, 3, "TOTAL", 1, 'L');
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L');
}
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
}
if (empty($value['disableamount'])) {
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxref, 3, "TOTAL", 1, 'L');
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L');
}
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
}
}
}
$nexY+=2; // Passe espace entre les lignes
/*
* Pied de page
*/
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
}
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file,'F');
$pdf->Output($file, 'F');
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
return 1; // Pas d'erreur
}
else
@ -513,9 +655,11 @@ class pdf_beluga extends ModelePDFProjects
return 0;
}
}
$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
return 0;
else
{
$this->error=$langs->transnoentities("ErrorConstantNotDefined","PROJECT_OUTPUTDIR");
return 0;
}
}
@ -535,14 +679,17 @@ class pdf_beluga extends ModelePDFProjects
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$heightoftitleline = 10;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param
// Draw rect of all tab (title + lines). Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
$pdf->line($this->marge_gauche, $tab_top+$heightoftitleline, $this->page_largeur-$this->marge_droite, $tab_top+$heightoftitleline);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size);
@ -564,7 +711,6 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($this->posxdateend, $tab_top+1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
/**
@ -621,12 +767,19 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
if (is_object($object->thirdparty))
{
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R');
}
$pdf->SetTextColor(0,0,60);
}
/**
@ -644,4 +797,5 @@ class pdf_beluga extends ModelePDFProjects
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}

View File

@ -0,0 +1,608 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.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/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/project/doc/pdf_baleine.modules.php
* \ingroup project
* \brief File of class to generate project document Baleine
* \author Regis Houssin
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* Class to manage generation of project document Baleine
*/
class pdf_timespent extends ModelePDFProjects
{
var $emetteur; // Objet societe qui emet
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("projects");
$langs->load("companies");
$this->db = $db;
$this->name = "timespent";
$this->description = $langs->trans("DocumentModelTimeSpent");
// Dimension page pour format A4
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Affiche code produit-service
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
// Defini position des colonnes
$this->posxref=$this->marge_gauche+1;
$this->posxlabel=$this->marge_gauche+25;
$this->posxtimespent=$this->marge_gauche+120;
//$this->posxprogress=$this->marge_gauche+140;
$this->posxdatestart=$this->marge_gauche+152;
$this->posxdateend=$this->marge_gauche+170;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxref-=20;
$this->posxlabel-=20;
$this->posxtimespent-=20;
//$this->posxprogress-=20;
$this->posxdatestart-=20;
$this->posxdateend-=20;
}
}
/**
* Fonction generant le projet sur le disque
*
* @param Project $object Object project a generer
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs)
{
global $conf, $hookmanager, $langs, $user;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
if ($conf->projet->dir_output)
{
//$nblignes = count($object->lines); // This is set later with array of tasks
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->projet->dir_output;
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
// Create pdf instance
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1,0);
$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
// Complete object by loading several other informations
$task = new Task($this->db);
$tasksarray = $task->getTasksArray(0,0,$object->id);
if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines
{
$tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray)));
}
$object->lines=$tasksarray;
$nblignes=count($object->lines);
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Project"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 50;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
$tab_height = 170;
$tab_height_newpage = 190;
// Show public note
$notetoshow=empty($object->note_public)?'':$object->note_public;
if ($notetoshow)
{
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
$tab_top -= 2;
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($notetoshow), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-$tab_top;
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY+6;
}
else
{
$height_note=0;
}
$heightoftitleline = 10;
$iniY = $tab_top + $heightoftitleline + 1;
$curY = $tab_top + $heightoftitleline + 1;
$nexY = $tab_top + $heightoftitleline + 1;
// Loop on each lines
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of line
$ref=$object->lines[$i]->ref;
$libelleline=$object->lines[$i]->label;
//$progress=($object->lines[$i]->progress?$object->lines[$i]->progress.'%':'');
$datestart=dol_print_date($object->lines[$i]->date_start,'day');
$dateend=dol_print_date($object->lines[$i]->date_end,'day');
$planned_timespent=convertSecondToTime((int) $object->lines[$i]->planned_timespent,'allhourmin');
$showpricebeforepagebreak=1;
$pdf->startTransaction();
// Label
$pdf->SetXY($this->posxlabel, $curY);
$pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label
$pdf->SetXY($this->posxlabel, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
{
if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
}
}
else
{
// We found a page break
$showpricebeforepagebreak=0;
$forcedesconsamepage=1;
if ($forcedesconsamepage)
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1;
// Label
$pdf->SetXY($this->posxlabel, $curY);
$posybefore=$pdf->GetY();
$pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
}
}
//var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak);
}
else // No pagebreak
{
$pdf->commitTransaction();
}
$posYAfterDescription=$pdf->GetY();
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
//var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak);
$pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
// Ref of task
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
// timespent
$pdf->SetXY($this->posxtimespent, $curY);
$pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $planned_timespent?$planned_timespent:'', 0, 'R');
// Progress
//$pdf->SetXY($this->posxprogress, $curY);
//$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
// Date
$pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C');
$pdf->SetXY($this->posxdateend, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C');
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
}
// Show square
if ($pagenb == 1)
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
else
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file, 'F');
// Add pdfgeneration hook
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$this->result = array('fullpath'=>$file);
return 1; // Pas d'erreur
}
else
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
else
{
$this->error=$langs->transnoentities("ErrorConstantNotDefined","PROJECT_OUTPUTDIR");
return 0;
}
}
/**
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
$heightoftitleline = 10;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetDrawColor(128,128,128);
// Draw rect of all tab (title + lines). Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+$heightoftitleline, $this->page_largeur-$this->marge_droite, $tab_top+$heightoftitleline);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size);
$pdf->SetXY($this->posxref, $tab_top+1);
$pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L');
$pdf->SetXY($this->posxlabel, $tab_top+1);
$pdf->MultiCell($this->posxtimespent-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
$pdf->SetXY($this->posxtimespent, $tab_top+1);
$pdf->MultiCell($this->posxdatestart-$this->posxtimespent, 3, $outputlangs->transnoentities("TimeSpent"), 0, 'R');
//$pdf->SetXY($this->posxprogress, $tab_top+1);
//$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R');
$pdf->SetXY($this->posxdatestart, $tab_top+1);
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $outputlangs->transnoentities("Date"), 0, 'C');
$pdf->SetXY($this->posxdateend, $tab_top+1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param Project $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size + 3);
$posx=$this->page_largeur-$this->marge_droite-100;
$posy=$this->marge_haute;
$pdf->SetXY($this->marge_gauche,$posy);
// Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
if ($mysoc->logo)
{
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
}
else
{
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
$pdf->SetFont('','', $default_font_size + 2);
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
if (is_object($object->thirdparty))
{
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("ThirdParty")." : " . $object->thirdparty->getFullName($outputlangs), '', 'R');
}
$pdf->SetTextColor(0,0,60);
// Add list of linked objects
/* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc....
$object->fetchObjectLinked();
foreach($object->linkedObjects as $objecttype => $objects)
{
var_dump($objects);exit;
if ($objecttype == 'commande')
{
$outputlangs->load('orders');
$num=count($objects);
for ($i=0;$i<$num;$i++)
{
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetFont('','', $default_font_size - 1);
$text=$objects[$i]->ref;
if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')';
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
}
}
}
*/
}
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param Project $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}

View File

@ -109,10 +109,10 @@ class pdf_azur extends ModelePDFPropales
$this->posxdesc=$this->marge_gauche+1;
if($conf->global->PRODUCT_USE_UNITS)
{
$this->posxtva=99;
$this->posxup=114;
$this->posxqty=130;
$this->posxunit=147;
$this->posxtva=101;
$this->posxup=118;
$this->posxqty=135;
$this->posxunit=151;
}
else
{

View File

@ -42,7 +42,7 @@ foreach($object->fields as $key => $val)
if (abs($val['visible']) != 1) continue;
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
if ($key == 'status') continue; // Status is already in dol_banner
if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner
$value=$object->$key;
@ -79,7 +79,7 @@ foreach($object->fields as $key => $val)
if (abs($val['visible']) != 1) continue; // Discard such field from form
if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! $val['enabled']) continue; // We don't want this field
if ($key == 'status') continue; // Status is alreadt in dol_banner
if (in_array($key, array('ref','status'))) continue; // Ref and status are already in dol_banner
$value=$object->$key;

View File

@ -8,32 +8,69 @@ if (empty($conf) || ! is_object($conf))
}
// Loop to show all columns of extrafields from $obj, $extrafields and $db
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
if (! empty($extrafieldsobjectkey)) // New method: $extrafieldsobject can be 'societe', 'socpeople', ...
{
foreach($extrafields->attribute_label as $key => $val)
if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
{
if (! empty($arrayfields["ef.".$key]['checked']))
foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
{
$align=$extrafields->getAlignFlag($key);
print '<td';
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp')))
if (! empty($arrayfields["ef.".$key]['checked']))
{
$value = $db->jdate($obj->$tmpkey);
$align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey);
print '<td';
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')))
{
$value = $db->jdate($obj->$tmpkey);
}
else
{
$value = $obj->$tmpkey;
}
print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey);
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
}
}
else
}
}
}
else // Old method
{
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$value = $obj->$tmpkey;
}
print $extrafields->showOutputField($key, $value, '');
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
$align=$extrafields->getAlignFlag($key);
print '<td';
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp')))
{
$value = $db->jdate($obj->$tmpkey);
}
else
{
$value = $obj->$tmpkey;
}
print $extrafields->showOutputField($key, $value, '');
print '</td>';
if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure']))
{
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
$totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
}
}
}
}

View File

@ -131,7 +131,7 @@ if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element][
}
else
{
print $extrafields->showOutputField($key, $value);
print $extrafields->showOutputField($key, $value, '', (empty($extrafieldsobjectkey)?'':$extrafieldsobjectkey));
}
print '</td></tr>' . "\n";

View File

@ -131,7 +131,7 @@ if ($nolinesbefore) {
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay=2;
?>
<td class="linecolnum" align="center" width="5">
<td class="nobottom linecolnum" align="center" width="5">
<?php
}
else {
@ -142,49 +142,54 @@ else {
<td class="nobottom linecoldescription minwidth500imp">
<?php
$forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service)
if ($object->element == 'contrat')
$freelines = false;
if (empty($conf->global->MAIN_DISABLE_FREE_LINES))
{
if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set
else $forceall=0;
}
// Free line
echo '<span class="prod_entry_mode_free">';
// Show radio free line
if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
{
echo '<label for="prod_entry_mode_free">';
echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') );
echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : '');
echo '> ';
// Show type selector
echo $langs->trans("FreeLineOfType");
echo '</label>';
echo ' ';
}
else
{
echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// Show type selector
if ($forceall >= 0)
$freelines = true;
$forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service)
if ($object->element == 'contrat')
{
if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type");
else echo $langs->trans("FreeLineOfType");
if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set
else $forceall=0;
}
// Free line
echo '<span class="prod_entry_mode_free">';
// Show radio free line
if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
{
echo '<label for="prod_entry_mode_free">';
echo '<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked':'') );
echo (GETPOST('prod_entry_mode')=='free' ? ' checked' : '');
echo '> ';
// Show type selector
echo $langs->trans("FreeLineOfType");
echo '</label>';
echo ' ';
}
else
{
echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// Show type selector
if ($forceall >= 0)
{
if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type");
else echo $langs->trans("FreeLineOfType");
echo ' ';
}
}
echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall);
echo '</span>';
}
echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type",'alpha',2):-1,'type',1,1,$forceall);
echo '</span>';
// Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
if ($forceall >= 0) echo '<br>';
if ($forceall >= 0 && $freelines) echo '<br>';
echo '<span class="prod_entry_mode_predef">';
echo '<label for="prod_entry_mode_predef">';
echo '<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked':'').'> ';
@ -403,9 +408,6 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da
{
$colspan = 6;
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$colspan++;
}
if ($this->situation_cycle_ref) {
$colspan++;
}
@ -447,6 +449,7 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da
?>
<tr id="trlinefordates" <?php echo $bcnd[$var]; ?>>
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print '<td></td>'; } ?>
<td colspan="<?php echo $colspan; ?>">
<?php
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
@ -592,6 +595,13 @@ jQuery(document).ready(function() {
setforpredef();
jQuery('#trlinefordates').show();
});
<?php
if(!$freelines) { ?>
$("#prod_entry_mode_predef").click();
<?php
}
?>
/* When changing predefined product, we reload list of supplier prices required for margin combo */
$("#idprod, #idprodfournprice").change(function()

View File

@ -51,7 +51,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing
// Test if event/record is qualified
$listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription');
$listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription','payment_various');
if (! in_array($object->element, $listofqualifiedelement)) return 1;
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -120,9 +120,10 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers
$res = $b->create($user);
if ($res<0)
if ($res < 0)
{
setEventMessages($b->error, $b->errors, 'errors');
$this->error = $b->error;
$this->errors = $b->errors;
return -1;
}
else

View File

@ -0,0 +1,457 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
/**
* API class for fichinters
*
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Interventions extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'socid',
'fk_project',
'description'
);
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDSLINE = array(
'description',
'date',
'duree'
);
/**
* @var fichinter $fichinter {@type fichinter}
*/
public $fichinter;
/**
* Constructor
*/
function __construct()
{
global $db, $conf;
$this->db = $db;
$this->fichinter = new Fichinter($this->db);
}
/**
* Get properties of a Expense Report object
*
* Return an array with Expense Report informations
*
* @param int $id ID of Expense Report
* @return array|mixed Data without useless information
*
* @throws RestException
*/
function get($id)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->lire) {
throw new RestException(401);
}
$result = $this->fichinter->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Intervention report not found');
}
if( ! DolibarrApi::_checkAccessToResource('fichinter',$this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->fichinter->fetchObjectLinked();
return $this->_cleanObjectDatas($this->fichinter);
}
/**
* List of interventions
*
* Return a list of interventions
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of order objects
*
* @throws RestException
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('fichinter').')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
$sql.= $db->plimit($limit + 1, $offset);
}
dol_syslog("API Rest request");
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$fichinter_static = new Fichinter($db);
if($fichinter_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($fichinter_static);
}
$i++;
}
}
else {
throw new RestException(503, 'Error when retrieve fichinter list : '.$db->lasterror());
}
if( ! count($obj_ret)) {
throw new RestException(404, 'No finchinter found');
}
return $obj_ret;
}
/**
* Create intervention object
*
* @param array $request_data Request data
* @return int ID of intervention
*/
function post($request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach($request_data as $field => $value) {
$this->fichinter->$field = $value;
}
if ($this->fichinter->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating fichinter", array_merge(array($this->fichinter->error), $this->fichinter->errors));
}
return $this->fichinter->id;
}
/**
* Get lines of an intervention
*
* @param int $id Id of intervention
*
* @url GET {id}/lines
*
* @return int
*/
/* TODO
function getLines($id) {
if(! DolibarrApiAccess::$user->rights->ficheinter->lire) {
throw new RestException(401);
}
$result = $this->fichinter->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Intervention not found');
}
if( ! DolibarrApi::_checkAccessToResource('fichinter',$this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->fichinter->getLinesArray();
$result = array();
foreach ($this->fichinter->lines as $line) {
array_push($result,$this->_cleanObjectDatas($line));
}
return $result;
}
*/
/**
* Add a line to given intervention
*
* @param int $id Id of intervention to update
* @param array $request_data Request data
*
* @url POST {id}/lines
*
* @return int
*/
function postLine($id, $request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->creer) {
throw new RestException(401, "Insuffisant rights");
}
// Check mandatory fields
$result = $this->_validateLine($request_data);
foreach($request_data as $field => $value) {
$this->fichinter->$field = $value;
}
if( ! $result ) {
throw new RestException(404, 'Intervention not found');
}
if( ! DolibarrApi::_checkAccessToResource('fichinter',$this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$updateRes = $this->fichinter->addLine(
DolibarrApiAccess::$user,
$id,
$this->fichinter->description,
$this->fichinter->date,
$this->fichinter->duree
);
if ($updateRes > 0) {
return $updateRes;
}
else {
throw new RestException(400, $this->fichinter->error);
}
}
/**
* Delete order
*
* @param int $id Order ID
* @return array
*/
function delete($id)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->supprimer) {
throw new RestException(401);
}
$result = $this->fichinter->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Intervention not found');
}
if( ! DolibarrApi::_checkAccessToResource('commande',$this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! $this->fichinter->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete intervention : '.$this->fichinter->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Intervention deleted'
)
);
}
/**
* Validate an intervention
*
* If you get a bad value for param notrigger check, provide this in body
* {
* "notrigger": 0
* }
*
* @param int $id Intervention ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
* @url POST {id}/validate
*
* @return array
*/
function validate($id, $notrigger=0)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->creer) {
throw new RestException(401, "Insuffisant rights");
}
$result = $this->fichinter->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Intervention not found');
}
if( ! DolibarrApi::_checkAccessToResource('fichinter',$this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->fichinter->setValid(DolibarrApiAccess::$user, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Intervention: '.$this->commande->error);
}
$this->fichinter->fetchObjectLinked();
return $this->_cleanObjectDatas($this->fichinter);
}
/**
* Close an intervention
*
* @param int $id Intervention ID
*
* @url POST {id}/close
*
* @return array
*/
function closeFichinter($id)
{
if(! DolibarrApiAccess::$user->rights->ficheinter->creer)
{
throw new RestException(401, "Insuffisant rights");
}
$result = $this->fichinter->fetch($id);
if (! $result) {
throw new RestException(404, 'Intervention not found');
}
if (! DolibarrApi::_checkAccessToResource('fichinter',$this->fichinter->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->fichinter->setStatut(3);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already closed');
}
if ($result < 0) {
throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error);
}
$this->fichinter->fetchObjectLinked();
return $this->_cleanObjectDatas($this->fichinter);
}
/**
* Validate fields before create or update object
*
* @param array $data Data to validate
* @return array
*
* @throws RestException
*/
function _validate($data)
{
$fichinter = array();
foreach (Interventions::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$fichinter[$field] = $data[$field];
}
return $fichinter;
}
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
$object = parent::_cleanObjectDatas($object);
unset($object->statuts_short);
unset($object->statuts_logo);
unset($object->statuts);
return $object;
}
/**
* Validate fields before create or update object
*
* @param array $data Data to validate
* @return array
*
* @throws RestException
*/
function _validateLine($data)
{
$fichinter = array();
foreach (Interventions::$FIELDSLINE as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$fichinter[$field] = $data[$field];
}
return $fichinter;
}
}

View File

@ -128,7 +128,7 @@ class Fichinter extends CommonObject
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= " ".$clause." fi.entity IN (".getEntity($this->element, 1).")";
$sql.= " ".$clause." fi.entity IN (".getEntity($this->element).")";
$resql=$this->db->query($sql);
if ($resql)
@ -157,7 +157,7 @@ class Fichinter extends CommonObject
*/
function create($user, $notrigger=0)
{
global $conf, $user, $langs;
global $conf, $langs;
dol_syslog(get_class($this)."::create ref=".$this->ref);

View File

@ -101,6 +101,21 @@ if (empty($reshook))
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
if ($action == 'update_extras') {
$object->fetch($id);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields();
if ($result < 0) $error++;
}
if ($error) $action = 'edit_extras';
}
}
@ -779,7 +794,7 @@ if ($object->id > 0)
print '</div>';
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD))
{
print '<br>';
// List of contacts

View File

@ -210,11 +210,12 @@ class PaiementFourn extends Paiement
$resql=$this->db->query($sql);
if ($resql)
{
$invoice=new FactureFournisseur($this->db);
$invoice->fetch($facid);
// If we want to closed payed invoices
if ($closepaidinvoices)
{
$invoice=new FactureFournisseur($this->db);
$invoice->fetch($facid);
$paiement = $invoice->getSommePaiement();
//$creditnotes=$invoice->getSumCreditNotesUsed();
$creditnotes=0;
@ -228,17 +229,34 @@ class PaiementFourn extends Paiement
}
else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
}
// Regenerate documents of invoices
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
}
else
{
dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture '.$facid);
$this->error=$this->db->lasterror();
$error++;
}
}
else
{
dol_syslog('PaiementFourn::Create Montant non numerique',LOG_ERR);
dol_syslog(get_class($this).'::Create Amount line '.$key.' not a number. We discard it.');
}
}

View File

@ -22,5 +22,12 @@
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value.
-- For 8.0
ALTER TABLE llx_societe ADD COLUMN fk_entrepot integer DEFAULT 0;
ALTER TABLE llx_projet ADD COLUMN bill_time integer DEFAULT 0;

View File

@ -39,26 +39,26 @@ create table llx_commandedet
remise real DEFAULT 0, -- montant de la remise
fk_remise_except integer NULL, -- Lien vers table des remises fixes
price real, -- prix final
subprice double(24,8) DEFAULT 0, -- P.U. HT (exemple 100)
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1
total_localtax2 double(24,8) DEFAULT 0, -- Total LocalTax2
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 0,
subprice double(24,8) DEFAULT 0, -- P.U. HT (exemple 100)
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1
total_localtax2 double(24,8) DEFAULT 0, -- Total LocalTax2
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
date_start datetime DEFAULT NULL, -- date debut si service
date_end datetime DEFAULT NULL, -- date fin si service
info_bits integer DEFAULT 0, -- TVA NPR ou non
buy_price_ht double(24,8) DEFAULT 0, -- buying price
buy_price_ht double(24,8) DEFAULT 0, -- buying price
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
special_code integer DEFAULT 0, -- code pour les lignes speciales
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0,
fk_unit integer DEFAULT NULL, -- lien vers table des unités
fk_unit integer DEFAULT NULL, -- lien vers table des unités
import_key varchar(14),
fk_commandefourndet integer DEFAULT NULL, -- link to detail line of commande fourn (resplenish)
fk_commandefourndet integer DEFAULT NULL, -- link to detail line of commande fourn (resplenish)
fk_multicurrency integer,
multicurrency_code varchar(255),

View File

@ -47,7 +47,7 @@ create table llx_facturedet
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
total_localtax2 double(24,8) DEFAULT 0, -- Total LocalTax2 for total quantity of line
total_ttc double(24,8), -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 0,
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
date_start datetime DEFAULT NULL, -- date start if service
date_end datetime DEFAULT NULL, -- date end if service
info_bits integer DEFAULT 0, -- VAT NPR or not (for france only)
@ -57,7 +57,7 @@ create table llx_facturedet
fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line
special_code integer DEFAULT 0, -- code pour les lignes speciales
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0, -- position of line
fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines
import_key varchar(14),

View File

@ -41,7 +41,8 @@ create table llx_projet
note_public text,
--budget_days real, -- budget in days is sum of field planned_workload of tasks
opp_amount double(24,8),
budget_amount double(24,8),
budget_amount double(24,8),
bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices
model_pdf varchar(255),
import_key varchar(14) -- Import key
)ENGINE=innodb;

View File

@ -44,7 +44,7 @@ create table llx_propaldet
total_localtax1 double(24,8) DEFAULT 0, -- Total localtax1
total_localtax2 double(24,8) DEFAULT 0, -- Total localtax2
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 0,
product_type integer DEFAULT 0, -- 0 or 1. Value 9 may be used by some modules (amount of line may not be included into generated discount if value is 9).
date_start datetime DEFAULT NULL, -- date debut si service
date_end datetime DEFAULT NULL, -- date fin si service
info_bits integer DEFAULT 0, -- TVA NPR ou non
@ -52,8 +52,8 @@ create table llx_propaldet
buy_price_ht double(24,8) DEFAULT 0, -- buying price
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
special_code integer DEFAULT 0, -- code pour les lignes speciales
rang integer DEFAULT 0, -- ordre affichage sur la propal
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0, -- ordre affichage sur la propal
fk_unit integer DEFAULT NULL, -- lien vers table des unités
fk_multicurrency integer,

View File

@ -33,8 +33,6 @@ create table llx_societe
statut tinyint DEFAULT 0, -- statut
parent integer,
tms timestamp,
datec datetime, -- creation date
status tinyint DEFAULT 1, -- cessation d'activité ( 1 -- en activité, 0 -- cessation d'activité)
@ -57,15 +55,15 @@ create table llx_societe
fk_typent integer DEFAULT 0, --
fk_forme_juridique integer DEFAULT 0, -- juridical status
fk_currency varchar(3), -- default currency
siren varchar(128), -- IDProf1: siren or RCS for france
siret varchar(128), -- IDProf2: siret for france
ape varchar(128), -- IDProf3: code ape for france
siren varchar(128), -- IDProf1: siren or RCS for france, ...
siret varchar(128), -- IDProf2: siret for france, ...
ape varchar(128), -- IDProf3: code ape for france, ...
idprof4 varchar(128), -- IDProf4: nu for france
idprof5 varchar(128), -- IDProf5: nu for france
idprof6 varchar(128), -- IDProf6: nu for france
tva_intra varchar(20), -- tva
capital double(24,8), -- capital de la societe
fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut
capital double(24,8) DEFAULT NULL, -- capital de la societe
fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut
note_private text, --
note_public text, --
model_pdf varchar(255),
@ -79,8 +77,6 @@ create table llx_societe
customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1
customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1)
supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1)
fk_user_creat integer NULL, -- utilisateur qui a cree l'info
fk_user_modif integer, -- utilisateur qui a modifie l'info
remise_client real DEFAULT 0, -- remise systematique pour le client
mode_reglement tinyint, -- mode de reglement
cond_reglement tinyint, -- condition de reglement
@ -99,10 +95,17 @@ create table llx_societe
default_lang varchar(6), -- default language
logo varchar(255) DEFAULT NULL,
canvas varchar(32) DEFAULT NULL, -- type of canvas if used (null by default)
import_key varchar(14), -- import key
fk_entrepot integer DEFAULT 0, -- if we need a link between third party and warehouse
webservices_url varchar(255), -- supplier webservice url
webservices_key varchar(128), -- supplier webservice key
fk_multicurrency integer,
multicurrency_code varchar(255)
tms timestamp, -- last modification date
datec datetime, -- creation date
fk_user_creat integer NULL, -- utilisateur qui a cree l'info
fk_user_modif integer, -- utilisateur qui a modifie l'info
fk_multicurrency integer,
multicurrency_code varchar(255),
import_key varchar(14) -- import key
)ENGINE=innodb;

View File

@ -269,9 +269,10 @@ MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (By default in php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix like systems)
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into PHP on Unix like systems)
MAIN_MAIL_EMAIL_FROM=Sender email for automatic emails (By default in php.ini: <b>%s</b>)
MAIN_MAIL_ERRORS_TO=Sender email used for error returns emails sent
MAIN_MAIL_ERRORS_TO=Email used as 'Errors-To' field in emails sent
MAIN_MAIL_AUTOCOPY_TO= Send systematically a hidden carbon-copy of all sent emails to
MAIN_DISABLE_ALL_MAILS=Disable all emails sendings (for test purposes or demos)
MAIN_MAIL_FORCE_SENDTO=Send all emails to (instead of real recipients, for test purposes)
MAIN_MAIL_SENDMODE=Method to use to send EMails
MAIN_MAIL_SMTPS_ID=SMTP ID if authentication required
MAIN_MAIL_SMTPS_PW=SMTP Password if authentication required
@ -415,7 +416,7 @@ ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (
ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpsellist=List of values comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>- idfilter is necessarly a primary int key<br>- filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelpchkbxlst=List of values comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list :<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax : ObjectName:Classpath<br>Example : Societe:societe/class/societe.class.php
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax : ObjectName:Classpath<br>Examples :<br>Societe:societe/class/societe.class.php<br>Contact:contact/class/contact.class.php
LibraryToBuildPDF=Library used for PDF generation
WarningUsingFPDF=Warning: Your <b>conf.php</b> contains directive <b>dolibarr_pdf_force_fpdf=1</b>. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.<br>To solve this and have a full support of PDF generation, please download <a href="http://www.tcpdf.org/" target="_blank">TCPDF library</a>, then comment or remove the line <b>$dolibarr_pdf_force_fpdf=1</b>, and add instead <b>$dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir'</b>
LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:<br>1 : local tax apply on products and services without vat (localtax is calculated on amount without tax)<br>2 : local tax apply on products and services including vat (localtax is calculated on amount + main tax)<br>3 : local tax apply on products without vat (localtax is calculated on amount without tax)<br>4 : local tax apply on products including vat (localtax is calculated on amount + main vat)<br>5 : local tax apply on services without vat (localtax is calculated on amount without tax)<br>6 : local tax apply on services including vat (localtax is calculated on amount + tax)

View File

@ -14,6 +14,9 @@ OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to prev
AddedByAuthority=Stored into remote authority
NotAddedByAuthorityYet=Not yet stored into remote authority
ShowDetails=Show stored details
logPAYMENT_VARIOUS_CREATE=Payment (not assigned to invoice) created
logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to invoice) modified
logPAYMENT_VARIOUS_DELETE=Payment (not assigned to invoice) logical deletion
logPAYMENT_ADD_TO_BANK=Payment added to bank
logPAYMENT_CUSTOMER_CREATE=Customer payment created
logPAYMENT_CUSTOMER_DELETE=Customer payment logical deletion
@ -41,7 +44,7 @@ DownloadLogCSV=Export archived logs (CSV)
logDOC_PREVIEW=Preview of a validated document in order to print or download
logDOC_DOWNLOAD=Download of a validated document in order to print or send
DataOfArchivedEvent=Full datas of archived event
ImpossibleToReloadObject=Object (type %s, id %s) removed (see 'Full data' link for unerasable saved data)
ImpossibleToReloadObject=Original object (type %s, id %s) not linked (see 'Full datas' column to get unalterable saved data)
BlockedLogAreRequiredByYourCountryLegislation=Unalterable Logs module may be required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit.
BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit.
BlockedLogDisableNotAllowedForCountry=List of countries where usage of this module is mandatory (just to prevent to disable the module by error, if your country is in this list, disable of module is not possible without editing this list first. Note also that enabling/disabling this module will keep a track into the unalterable log).

View File

@ -1,5 +1,5 @@
# Dolibarr language file - Source file is en_US - compta
MenuFinancial=Billing / Payment
MenuFinancial=Billing | Payment
TaxModuleSetupToModifyRules=Go to <a href="%s">Taxes module setup</a> to modify rules for calculation
TaxModuleSetupToModifyRulesLT=Go to <a href="%s">Company setup</a> to modify rules for calculation
OptionMode=Option for accountancy

View File

@ -87,6 +87,7 @@ MailingModuleDescEmailsFromFile=Emails from file
MailingModuleDescEmailsFromUser=Emails input by user
MailingModuleDescDolibarrUsers=Users with Emails
MailingModuleDescThirdPartiesByCategories=Third parties (by categories)
SendingFromWebInterfaceIsNotAllowed=Sending from web interface is not allowed.
# Libelle des modules de liste de destinataires mailing
LineInFile=Line %s in file

View File

@ -1,7 +1,7 @@
# Dolibarr language file - Source file is en_US - salaries
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accounting account used for user third parties
SALARIES_ACCOUNTING_ACCOUNT_PAYMENT_Desc=The dedicated accounting account defined on user card will be used for Subledger accouting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated user accouting account on user is not defined.
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for personnel expenses
SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accounting account by default for wage payments
Salary=Salary
Salaries=Salaries
NewSalaryPayment=New salary payment

View File

@ -25,8 +25,8 @@ Chartofaccounts=Plan contable
CurrentDedicatedAccountingAccount=Cuenta contable dedicada
AssignDedicatedAccountingAccount=Nueva cuenta a asignar
InvoiceLabel=Etiqueta factura
OverviewOfAmountOfLinesNotBound=Ver la cantidad de líneas no ligadas a cuentas contables
OverviewOfAmountOfLinesBound=Ver la cantidad de líneas ligadas a cuentas contables
OverviewOfAmountOfLinesNotBound=Ver la cantidad de líneas no vinculadas a una cuenta contable
OverviewOfAmountOfLinesBound=Ver la cantidad de líneas vinculadas a una cuenta contable
OtherInfo=Otra información
DeleteCptCategory=Eliminar la cuenta contable del grupo
ConfirmDeleteCptCategory=¿Está seguro de querer eliminar esta cuenta contable del grupo de cuentas contables?
@ -158,7 +158,7 @@ NumPiece=Apunte
TransactionNumShort=Núm. transacción
AccountingCategory=Grupos personalizados
GroupByAccountAccounting=Agrupar por cuenta contable
AccountingAccountGroupsDesc=You can define here some groups of accounting account. They will be used for personalized accounting reports.
AccountingAccountGroupsDesc=Puedes definir aquí algunos grupos de cuentas contables. Se usarán para informes de contabilidad personalizados.
ByAccounts=Por cuentas
ByPredefinedAccountGroups=Por grupos predefinidos
ByPersonalizedAccountGroups=Por grupos personalizados
@ -173,7 +173,7 @@ DelBookKeeping=Eliminar los registros del Libro Mayor
FinanceJournal=Diario financiero
ExpenseReportsJournal=Diario informe de gastos
DescFinanceJournal=El diario financiero incluye todos los tipos de pagos por cuenta bancaria
DescJournalOnlyBindedVisible=Esta es una vista de registros que están vinculados a una cuenta contable y pueden ser registrados en el Libro Mayor.
DescJournalOnlyBindedVisible=Esta es una vista del registro vinculado a una cuenta contable y que se puede registrar en el Libro Mayor.
VATAccountNotDefined=Cuenta contable para IVA no definida
ThirdpartyAccountNotDefined=Cuenta contable de tercero no definida
ProductAccountNotDefined=Cuenta contable de producto no definida
@ -191,7 +191,7 @@ DescThirdPartyReport=Consulte aquí el listado de clientes y proveedores y sus c
ListAccounts=Listado de cuentas contables
UnknownAccountForThirdparty=Cuenta contable de tercero desconocida, usaremos %s
UnknownAccountForThirdpartyBlocking=Cuenta contable de tercero desconocida. Error de bloqueo
UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third party account and waiting account not defined. Blocking error
UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Cuenta del terceros desconocida y cuenta de espera no definida. Error de bloqueo
Pcgtype=Grupo de cuenta
Pcgsubtype=Subgrupo de cuenta
@ -224,6 +224,8 @@ GeneralLedgerSomeRecordWasNotRecorded=Algunas de las operaciones que no podrán
NoNewRecordSaved=No hay más registros para el diario
ListOfProductsWithoutAccountingAccount=Listado de productos sin cuentas contables
ChangeBinding=Cambiar la unión
Accounted=Contabilizada en el Libro Mayor
NotYetAccounted=Aún no contabilizada en el Libro Mayor
## Admin
ApplyMassCategories=Aplicar categorías en masa

View File

@ -260,18 +260,18 @@ FontSize=Tamaño de fuente
Content=Contenido
NoticePeriod=Plazo de aviso
NewByMonth=Nuevo por mes
Emails=Emails
EMailsSetup=Configuración emails
Emails=E-Mails
EMailsSetup=Configuración e-mails
EMailsDesc=Esta página le permite sobrescribir sus parámetros de PHP para el envío de correos electrónicos. En la mayoría de los casos, en el sistema operativo Unix/Linux, su configuración de PHP es correcta y estos parámetros son inútiles.
EmailSenderProfiles=Perfiles de remitentes de e-mails
MAIN_MAIL_SMTP_PORT=Puerto del servidor SMTP (Por defecto en php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_SERVER=Nombre host o ip del servidor SMTP (Por defecto en php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=Puerto del servidor SMTP (No definido en PHP en sistemas de tipo Unix)
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=Nombre servidor o ip del servidor SMTP (No definido en PHP en sistemas de tipo Unix)
MAIN_MAIL_EMAIL_FROM=Correo electrónico del remitente para correos electrónicos automáticos (por defecto en php.ini: <b>%s</b>)
MAIN_MAIL_ERRORS_TO=Correo electrónico del remitente utilizado para los correos electrónicos de error enviados
MAIN_MAIL_EMAIL_FROM=E-mail del remitente para e-mails automáticos (por defecto en php.ini: <b>%s</b>)
MAIN_MAIL_ERRORS_TO=E-mail del remitente utilizado para los e-mails de error enviados
MAIN_MAIL_AUTOCOPY_TO= Enviar automáticamente copia oculta de los e-mails enviados a
MAIN_DISABLE_ALL_MAILS=Deshabilitar todos los envíos de correos electrónicos (para propósitos de prueba o demostraciones)
MAIN_DISABLE_ALL_MAILS=Deshabilitar todos los envíos de e-mail (para propósitos de prueba o demostraciones)
MAIN_MAIL_SENDMODE=Método de envío de e-mails
MAIN_MAIL_SMTPS_ID=ID de autentificación SMTP si se requiere autenticación SMTP
MAIN_MAIL_SMTPS_PW=Contraseña autentificación SMTP si se requiere autentificación SMTP
@ -410,11 +410,11 @@ ExtrafieldCheckBoxFromList=Casilla de selección de tabla
ExtrafieldLink=Objeto adjuntado
ComputedFormula=Campo combinado
ComputedFormulaDesc=Puede introducir aquí una fórmula utilizando otras propiedades de objeto o cualquier código PHP para obtener un valor calculado dinámico. Puede utilizar cualquier fórmula compatible con PHP, incluido el operador de condición "?" y los objetos globales siguientes: <strong>$db, $conf, $langs, $mysoc, $user, $object</strong>.<br><strong>ATENCIÓN</strong>: Sólo algunas propiedades de $object pueden estar disponibles. Si necesita propiedades no cargadas, solo busque el objeto en su fórmula como en el segundo ejemplo. <br>Usando un campo computado significa que no puede ingresar ningún valor de la interfaz. Además, si hay un error de sintaxis, la fórmula puede devolver nada. <br><br>Ejemplo de fórmula: <br>$object->id < 10 ? round($object->id / 2, 2) : ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)<br><br> Ejemlo de recarga de objeto<br> (($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5 : '-1'<br><br>Otro ejemplo de fórmula para forzar la carga del objeto y su objeto principal: <br>(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : 'Parent project not found'
ExtrafieldParamHelpselect=El listado de parámetros tiene que ser key,valor<br><br> por ejemplo: <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>Para tener una lista en funcion de atributos complementarios de lista:<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>Para tener la lista en función de otra:<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key
ExtrafieldParamHelpselect=El listado de parámetros tiene que ser key,valor<br><br> por ejemplo: <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>Para tener una lista en funcion de campos adicionales de lista:<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>Para tener la lista en función de otra:<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key
ExtrafieldParamHelpcheckbox=El listado de parámetros tiene que ser key,valor<br><br> por ejemplo: <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=El listado de parámetros tiene que ser key,valor (donde key no puede ser 0)<br><br> por ejemplo: <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpsellist=Lista de parámetros proviene de una tabla <br> Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro <br> Ejemplo: c_typent: libelle: id :: filtro <br> <br> filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo <br> También puede utilizar $ ID $ en el filtro witch es el actual id del objeto actual <br> Para hacer un SELECT en el filtro de uso $ SEL $ <br> si desea filtrar en extrafields utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de extrafield) <br> <br> Para que la lista dependa de otra lista de atributos complementarios: <br> c_typent: libelle: id: options_ <i> parent_list_code </i> | parent_column: filter <br> <br> Para que la lista dependa de otra lista: <br> c_typent: libelle: id: <i> parent_list_code </i> | parent_column: filter
ExtrafieldParamHelpchkbxlst=Lista de parámetros proviene de una tabla <br> Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro <br> Ejemplo: c_typent: libelle: id :: filtro <br> <br> filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo <br> También puede utilizar $ ID $ en el filtro witch es el id actual del objeto actual <br> Para hacer un SELECT en el filtro de uso $ SEL $ <br> si desea filtrar en extrafields utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de extrafield) <br> <br> Para que la lista dependa de otra lista de atributos complementarios: <br> c_typent: libelle: id: options_ <i> parent_list_code </i> | parent_column: filter <br> <br> Para que la lista dependa de otra lista: <br> c_typent: libelle: id: <i> parent_list_code </i> | parent_column: filter
ExtrafieldParamHelpsellist=Lista de parámetros proviene de una tabla <br> Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro <br> Ejemplo: c_typent: libelle: id :: filtro <br> <br> filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo <br> También puede utilizar $ ID $ en el filtro witch es el actual id del objeto actual <br> Para hacer un SELECT en el filtro de uso $ SEL $ <br> si desea filtrar en campos adicionales utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de campo adicional) <br> <br> Para que la lista dependa de otra lista de campos adicionales: <br> c_typent: libelle: id: options_ <i> parent_list_code </i> | parent_column: filter <br> <br> Para que la lista dependa de otra lista: <br> c_typent: libelle: id: <i> parent_list_code </i> | parent_column: filter
ExtrafieldParamHelpchkbxlst=Lista de parámetros proviene de una tabla <br> Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro <br> Ejemplo: c_typent: libelle: id :: filtro <br> <br> filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo <br> También puede utilizar $ ID $ en el filtro witch es el id actual del objeto actual <br> Para hacer un SELECT en el filtro de uso $ SEL $ <br> si desea filtrar en campos adicionales utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de campo adicional) <br> <br> Para que la lista dependa de otra lista de campos adicionales: <br> c_typent: libelle: id: options_ <i> parent_list_code </i> | parent_column: filter <br> <br> Para que la lista dependa de otra lista: <br> c_typent: libelle: id: <i> parent_list_code </i> | parent_column: filter
ExtrafieldParamHelplink=Los parámetros deben ser ObjectName: Classpath<br>Sintaxis: ObjectName:Classpath<br>Ejemplo: Societe:societe/class/societe.class.php
LibraryToBuildPDF=Libreria usada en la generación de los PDF
WarningUsingFPDF=Atención: Su archivo <b>conf.php</b> contiene la directiva <b>dolibarr_pdf_force_fpdf=1</b>. Esto hace que se use la librería FPDF para generar sus archivos PDF. Esta librería es antigua y no cubre algunas funcionalidades (Unicode, transparencia de imágenes, idiomas cirílicos, árabes o asiáticos, etc.), por lo que puede tener problemas en la generación de los PDF.<br>Para resolverlo, y disponer de un soporte completo de PDF, puede descargar la <a href="http://www.tcpdf.org/" target="_blank">librería TCPDF</a> , y a continuación comentar o eliminar la línea <b>$dolibarr_pdf_force_fpdf=1</b>, y añadir en su lugar <b>$dolibarr_lib_TCPDF_PATH='ruta_a_TCPDF'</b>
@ -551,6 +551,8 @@ Module520Desc=Gestión de créditos
Module600Name=Notificaciones
Module600Desc=Enviar notificaciones por e-mail (desencadenados por algunos eventos) a los usuarios (configuración definida para cada usuario), los contactos de terceros (configuración definida en cada tercero) o e-mails fijos
Module600Long=Tenga en cuenta que este módulo está dedicado a enviar mensajes de e-mail en tiempo real cuando se produce un evento. Si está buscando una función para enviar recordatorios por e-mail de los eventos de su agenda, vaya a la configuración del módulo Agenda.
Module610Name=Variantes de productos
Module610Desc=Permite la creación de variantes de productos en función de los atributos (color, tamaño, ...)
Module700Name=Donaciones
Module700Desc=Gestión de donaciones
Module770Name=Informes de gastos
@ -598,7 +600,7 @@ Module10000Name=Sitios web
Module10000Desc=Cree sitios web públicos con un editor WYSIWYG. Configure el servidor web (Apache, Nginx,...) para que apunte al directorio dedicado para tenerlo en línea en Internet.
Module20000Name=Gestión de días libres retribuidos
Module20000Desc=Gestión de los días libres retribuidos de los empleados
Module39000Name=Lotes de producto
Module39000Name=Lotes de productos
Module39000Desc=Gestión de lotes o series, fechas de caducidad y venta de los productos
Module50000Name=PayBox
Module50000Desc=Módulo para ofrecer pagos online aceptando pagos con tarjeta de Débito/Crédito via PayBox. Esto puede ser usado para permitir a tus clientes realizar pagos libres o pagos en un objeto de Dolibarr en particular (factura, pedido...)
@ -824,12 +826,12 @@ Permission1232=Crear facturas de proveedores
Permission1233=Validar facturas de proveedores
Permission1234=Eliminar facturas de proveedores
Permission1235=Enviar facturas de proveedores por correo
Permission1236=Exportar facturas de proveedores, atributos y pagos
Permission1236=Exportar facturas de proveedores, campos adicionales y pagos
Permission1237=Exportar pedidos de proveedores junto con sus detalles
Permission1251=Lanzar las importaciones en masa a la base de datos (carga de datos)
Permission1321=Exportar facturas a clientes, atributos y cobros
Permission1321=Exportar facturas a clientes, campos adicionales y cobros
Permission1322=Reabrir una factura pagada
Permission1421=Exportar pedidos de clientes y atributos
Permission1421=Exportar pedidos de clientes y campos adicionales
Permission20001=Leer peticiones días retribuidos (suyos y subordinados)
Permission20002=Cear/modificar sus días retribuidos
Permission20003=Eliminar peticiones de días retribuidos
@ -890,7 +892,7 @@ DictionaryStaff=Empleados
DictionaryAvailability=Tiempos de entrega
DictionaryOrderMethods=Métodos de pedido
DictionarySource=Orígenes de presupuestos/pedidos
DictionaryAccountancyCategory=Personalized groups for reports
DictionaryAccountancyCategory=Grupos personalizados para imformes
DictionaryAccountancysystem=Modelos de planes contables
DictionaryAccountancyJournal=Diarios contables
DictionaryEMailTemplates=Plantillas E-Mails
@ -1108,23 +1110,23 @@ MAIN_PROXY_HOST=Nombre/Dirección del servidor proxy
MAIN_PROXY_PORT=Puerto del servidor proxy
MAIN_PROXY_USER=Login del servidor proxy
MAIN_PROXY_PASS=Contraseña del servidor proxy
DefineHereComplementaryAttributes=Defina aquí la lista de atributos adicionales, no disponibles por defecto, y que desea gestionar para %s.
ExtraFields=Atributos adicionales
ExtraFieldsLines=Atributos adicionales (líneas)
ExtraFieldsLinesRec=Atributos complementarios (plantillas de líneas de facturas)
ExtraFieldsSupplierOrdersLines=Atributos complementarios (líneas de pedido)
ExtraFieldsSupplierInvoicesLines=Atributos complementarios (líneas de factura)
ExtraFieldsThirdParties=Atributos adicionales (terceros)
ExtraFieldsContacts=Atributos adicionales (contactos/direcciones)
ExtraFieldsMember=Atributos adicionales (miembros)
ExtraFieldsMemberType=Atributos adicionales (tipos de miembros)
ExtraFieldsCustomerInvoices=Atributos adicionales (facturas a clientes)
ExtraFieldsCustomerInvoicesRec=Atributos complementarios (plantillas de facturas)
ExtraFieldsSupplierOrders=Atributos adicionales (pedidos a proveedores)
ExtraFieldsSupplierInvoices=Atributos adicionales (facturas)
ExtraFieldsProject=Atributos adicionales (proyectos)
ExtraFieldsProjectTask=Atributos adicionales (tareas)
ExtraFieldHasWrongValue=El atributo %s tiene un valor no válido
DefineHereComplementaryAttributes=Defina aquí la lista de campos adicionales, no disponibles por defecto, y que desea gestionar para %s.
ExtraFields=Campos adicionales
ExtraFieldsLines=Campos adicionales (líneas)
ExtraFieldsLinesRec=Campos adicionales (plantillas de líneas de facturas)
ExtraFieldsSupplierOrdersLines=Campos adicionales (líneas de pedido)
ExtraFieldsSupplierInvoicesLines=Campos adicionales (líneas de factura)
ExtraFieldsThirdParties=Campos adicionales (terceros)
ExtraFieldsContacts=Campos adicionales (contactos/direcciones)
ExtraFieldsMember=Campos adicionales (miembros)
ExtraFieldsMemberType=Campos adicionales (tipos de miembros)
ExtraFieldsCustomerInvoices=Campos adicionales (facturas a clientes)
ExtraFieldsCustomerInvoicesRec=Campos adicionales (plantillas de facturas)
ExtraFieldsSupplierOrders=Campos adicionales (pedidos a proveedores)
ExtraFieldsSupplierInvoices=Campos adicionales (facturas)
ExtraFieldsProject=Campos adicionales (proyectos)
ExtraFieldsProjectTask=Campos adicionales (tareas)
ExtraFieldHasWrongValue=El campo %s tiene un valor no válido
AlphaNumOnlyLowerCharsAndNoSpace=sólo alfanuméricos y minúsculas sin espacio
SendmailOptionNotComplete=Atención, en algunos sistemas Linux, con este método de envio, para poder enviar mails en su nombre, la configuración de sendmail debe contener la opción <b>-ba</b> (parámetro <b>mail.force_extra_parameters</b> en el archivo <b>php.ini</b>). Si algunos de sus destinatarios no reciben sus mensajes, pruebe a modificar este parámetro PHP con <b>mail.force_extra_parameters=-ba</b>.
PathToDocuments=Rutas de acceso a documentos
@ -1303,17 +1305,17 @@ LDAPContactDnExample=DN completo (ej: ou=contacts,dc=example,dc=com)
LDAPMemberDn=DN de los miembros
LDAPMemberDnExample=DN completo (ex: ou=members,dc=society,dc=com)
LDAPMemberObjectClassList=Lista de objectClass
LDAPMemberObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user for active directory)
LDAPMemberObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user para active directory)
LDAPMemberTypeDn=Tipos DN de miembros de Dolibar
LDAPMemberTypepDnExample=DN completo (por ejemplo, ou=memberstypes, dc=example, dc=com)
LDAPMemberTypeObjectClassList=Lista de objectClass
LDAPMemberTypeObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,groupOfUniqueNames)
LDAPUserObjectClassList=Lista de objectClass
LDAPUserObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user for active directory)
LDAPUserObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user para active directory)
LDAPGroupObjectClassList=Lista de objectClass
LDAPGroupObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,groupOfUniqueNames)
LDAPContactObjectClassList=Lista de objectClass
LDAPContactObjectClassListExample=Lista de objectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user for active directory)
LDAPContactObjectClassListExample=Lista de objectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user para active directory)
LDAPTestConnect=Probar la conexión LDAP
LDAPTestSynchroContact=Probar la sincronización de contactos
LDAPTestSynchroUser=Probar la sincronización de usuarios
@ -1728,21 +1730,21 @@ SeeSubstitutionVars=Vea * nota para un listado de posibles variables de sustituc
SeeChangeLog=Ver archivo ChangeLog (solo inglés)
AllPublishers=Todos los editores
UnknownPublishers=Editores desconocidos
AddRemoveTabs=Añadir o eliminar pestañas
AddDataTables=Añadir tablas de objetos
AddDictionaries=Añadir diccionarios
AddData=Agregar objetos o datos de diccionarios
AddBoxes=Añadir paneles
AddSheduledJobs=Añadir tareas programadas
AddHooks=Añadir hooks
AddTriggers=Añadir triggers
AddMenus=Añadir menús
AddPermissions=Añadir permisos
AddExportProfiles=Añadir perfiles de exportación
AddImportProfiles=Añadir perfiles de importación
AddOtherPagesOrServices=Añadir otras páginas o servicios
AddModels=Añadir modelos de documentos o numeración
AddSubstitutions=Añadir substituciones de claves
AddRemoveTabs=Añade o elimina pestañas
AddDataTables=Añade tablas de objetos
AddDictionaries=Añade diccionarios
AddData=Añade objetos o datos de diccionarios
AddBoxes=Añade paneles
AddSheduledJobs=Añade tareas programadas
AddHooks=Añade hooks
AddTriggers=Añade triggers
AddMenus=Añade menús
AddPermissions=Añade permisos
AddExportProfiles=Añade perfiles de exportación
AddImportProfiles=Añade perfiles de importación
AddOtherPagesOrServices=Añade otras páginas o servicios
AddModels=Añade modelos de documentos o numeración
AddSubstitutions=Añade substituciones de claves
DetectionNotPossible=No es posible la detección
UrlToGetKeyToUseAPIs=Url para conseguir token para usar la API (una vez recibido el token se guarda en la tabla de usuarios de la base de datos y se debe proporcionar en cada llamada API)
ListOfAvailableAPIs=Listado de APIs disponibles

View File

@ -178,7 +178,7 @@ ConfirmCancelBillQuestion=¿Porqué quiere clasificar esta factura como 'abandon
ConfirmClassifyPaidPartially=¿Está seguro de querer cambiar el estado de la factura <b>%s</b> a pagado?
ConfirmClassifyPaidPartiallyQuestion=Esta factura no ha sido pagado completamente. ¿Cual es la razón para cerrar esta factura?
ConfirmClassifyPaidPartiallyReasonAvoir=El resto a pagar <b>(%s %s)</b> es un descuento otorgado por pronto pago. Regularizaré el IVA con un abono.
ConfirmClassifyPaidPartiallyReasonDiscount=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term.
ConfirmClassifyPaidPartiallyReasonDiscount=El resto a pagar <b>(%s%s)</b> es un descuento otorgado por pronto pago.
ConfirmClassifyPaidPartiallyReasonDiscountNoVat=El resto a pagar <b>(%s %s)</b> es un descuento otorgado por pronto pago. Acepto perder el IVA en este descuento.
ConfirmClassifyPaidPartiallyReasonDiscountVat=El resto a pagar <b>(%s %s)</b> es un descuento otorgado por pronto pago. Recuperaré el IVA sin usar un abono.
ConfirmClassifyPaidPartiallyReasonBadCustomer=Cliente moroso

View File

@ -78,7 +78,7 @@ CatCusLinks=Enlaces entre clientes/clientes potenciales y etiquetas/categorías
CatProdLinks=Enlaces entre productos/servicios y etiquetas/categorías
CatProJectLinks=Enlaces entre proyectos y etiquetas/categorías
DeleteFromCat=Eliminar de la etiqueta/categoría
ExtraFieldsCategories=Atributos complementarios
ExtraFieldsCategories=Campos adicionales
CategoriesSetup=Configuración de etiquetas/categorías
CategorieRecursiv=Enlazar con la etiqueta/categoría automáticamente
CategorieRecursivHelp=Si está activado, el producto se enlazará a la categoría padre si lo añadimos a una subcategoría

View File

@ -374,9 +374,9 @@ ContactNotLinkedToCompany=Contacto no vinculado a un tercero
DolibarrLogin=Login usuario
NoDolibarrAccess=Sin acceso de usuario
ExportDataset_company_1=Terceros (Empresas / asociaciones / particulares) y propiedades
ExportDataset_company_2=Contactos de terceros y atributos
ExportDataset_company_2=Contactos de terceros y campos adicionales
ImportDataset_company_1=Terceros (Empresas / asociaciones / particulares) y propiedades
ImportDataset_company_2=Contactos/Direcciones (de terceros o no) y atributos
ImportDataset_company_2=Contactos/Direcciones (de terceros o no) y campos adicionales
ImportDataset_company_3=Cuentas bancarias
ImportDataset_company_4=Terceros/Comerciales (Afecta a los usuarios comerciales de terceros)
PriceLevel=Nivel de precios

View File

@ -24,7 +24,7 @@ PaymentsNotLinkedToInvoice=Pagos vinculados a ninguna factura, por lo que ningu
PaymentsNotLinkedToUser=Pagos no vinculados a un usuario
Profit=Beneficio
AccountingResult=Resultado contable
BalanceBefore=Balance (before)
BalanceBefore=Balance (antes)
Balance=Saldo
Debit=Debe
Credit=Haber

View File

@ -31,4 +31,4 @@ DONATION_ART200=Mostrar artículo 200 del CGI si se está interesado
DONATION_ART238=Mostrar artículo 238 del CGI si se está interesado
DONATION_ART885=Mostrar artículo 885 del CGI si se está interesado
DonationPayment=Pago de donación
DonationValidated=Donation %s validated
DonationValidated=Donación %s validada

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