Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2014-10-08 20:57:11 +02:00
commit f9377a4715
359 changed files with 9163 additions and 2121 deletions

View File

@ -52,7 +52,7 @@ For users:
- New: [ task #1204 ] add Numering contrat module free (like leopard in product module). - New: [ task #1204 ] add Numering contrat module free (like leopard in product module).
- New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice. - New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice.
- New: Enable supplier price log table. - New: Enable supplier price log table.
- New: [ task #1204 ] add a External reference to contract. - New: [ task #1204 ] add a supplier reference to contract.
- New: [ task #1218 ] Can drag and drop an event from calendar to change its day. - New: [ task #1218 ] Can drag and drop an event from calendar to change its day.
- New: Optimize size of image static resources. - New: Optimize size of image static resources.
- New: Add hourly and daily amount on user card. Add weekly working hours and salary on user card. - New: Add hourly and daily amount on user card. Add weekly working hours and salary on user card.
@ -60,7 +60,9 @@ For users:
- New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture - New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture
onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals.
- New: Add more search field in list of cheque deposits. - New: Add more search field in list of cheque deposits.
- New: Add feature to order to invoice on supplier part
- Upgrade phpexcel lib to 1.7.8 - Upgrade phpexcel lib to 1.7.8
- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
- Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem
@ -114,6 +116,7 @@ For developers:
- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card. - New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card.
- New: renamed table llx_c_pays to llx_c_country & libelle field to label. - New: renamed table llx_c_pays to llx_c_country & libelle field to label.
- New: Added hook "formConfirm" and "doActions" for fichinter card - New: Added hook "formConfirm" and "doActions" for fichinter card
- New: Can search list of thirdparties from web service on part of name.
- Qual: Renamed table llx_c_civilite into llx_c_civility, - Qual: Renamed table llx_c_civilite into llx_c_civility,
field civilite into label in the same table, field civilite into label in the same table,
and field civilite into civility in other table. and field civilite into civility in other table.

View File

@ -24,6 +24,8 @@
"ext-mcrypt": "*", "ext-mcrypt": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-soap": "*" "ext-soap": "*",
"ext-zip": "*",
"ext-xml": "*"
} }
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -67,7 +68,7 @@ class AccountingAccount
{ {
if ($rowid || $account_number) if ($rowid || $account_number)
{ {
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, labe, fk_user_author, fk_user_modifn active"; $sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE"; $sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
if ($rowid) { if ($rowid) {
$sql .= " rowid = '" . $rowid . "'"; $sql .= " rowid = '" . $rowid . "'";

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -26,7 +26,7 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -64,22 +64,22 @@ if ($action == 'ventil') {
$cpt = 0; $cpt = 0;
foreach ( $mesCasesCochees as $maLigneCochee ) { foreach ( $mesCasesCochees as $maLigneCochee ) {
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>"; // print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
$maLigneCourante = split("_", $maLigneCochee); $maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0]; $monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1]; $monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne]; $monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId; $sql .= " WHERE rowid = " . $monId;
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) { if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>'; print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else { } else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>'; print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
} }
$cpt ++; $cpt ++;
} }
} else { } else {
@ -130,15 +130,15 @@ $result = $db->query($sql);
if ($result) { if ($result) {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$i = 0; $i = 0;
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list... // TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>'; print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n"; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>'; print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
print '<td>' . $langs->trans("Ref") . '</td>'; print '<td>' . $langs->trans("Ref") . '</td>';
@ -149,24 +149,24 @@ if ($result) {
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>'; print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
print '<td align="center">' . $langs->trans("Ventilate") . '</td>'; print '<td align="center">' . $langs->trans("Ventilate") . '</td>';
print '</tr>'; print '</tr>';
$facture_static = new Facture($db); $facture_static = new Facture($db);
$product_static = new Product($db); $product_static = new Product($db);
$form = new Form($db); $form = new Form($db);
$var = True; $var = True;
while ( $i < min($num_lines, $limit) ) { while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var = ! $var; $var = ! $var;
// product_type: 0 = service ? 1 = product // product_type: 0 = service ? 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service // if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB ! // issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
$code_sell_notset = ''; $code_sell_notset = '';
if (empty($objp->code_sell)) { if (empty($objp->code_sell)) {
$code_sell_notset = 'color:red'; $code_sell_notset = 'color:red';
if (! empty($objp->type)) { if (! empty($objp->type)) {
if ($objp->type == 1) { if ($objp->type == 1) {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
@ -175,7 +175,7 @@ if ($result) {
} }
} else { } else {
$code_sell_notset = 'color:blue'; $code_sell_notset = 'color:blue';
if ($objp->type == 1) { if ($objp->type == 1) {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
} else { } else {
@ -183,14 +183,14 @@ if ($result) {
} }
} }
} }
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
// Ref facture // Ref facture
$facture_static->ref = $objp->facnumber; $facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid; $facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>'; print '<td>' . $facture_static->getNomUrl(1) . '</td>';
// Ref produit // Ref produit
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -201,34 +201,34 @@ if ($result) {
else else
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>'; print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>'; print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">'; print '<td align="right">';
print price($objp->total_ht); print price($objp->total_ht);
print '</td>'; print '</td>';
print '<td align="center" style="' . $code_sell_notset . '">'; print '<td align="center" style="' . $code_sell_notset . '">';
print $objp->code_sell; print $objp->code_sell;
print '</td>'; print '</td>';
// Colonne choix du compte // Colonne choix du compte
print '<td align="center">'; print '<td align="center">';
print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1); print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
print '</td>'; print '</td>';
// Colonne choix ligne a ventiler // Colonne choix ligne a ventiler
print '<td align="center">'; print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$i ++; $i ++;
} }
print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></td></tr>'; print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
} else { } else {

View File

@ -189,7 +189,7 @@ if ($result) {
else if ($links[$key]['type'] == 'company') else if ($links[$key]['type'] == 'company')
{ {
$societestatic->id = $links[$key]['url_id']; $societestatic->id = $links[$key]['url_id'];
$societestatic->nom = $links[$key]['label']; $societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount; $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} }

View File

@ -171,7 +171,7 @@ if ($result) {
} else if ($links[$key]['type'] == 'company') { } else if ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id']; $societestatic->id = $links[$key]['url_id'];
$societestatic->nom = $links[$key]['label']; $societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount; $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') { } else if ($links[$key]['type'] == 'sc') {
@ -448,14 +448,14 @@ if ($action == 'export_csv') {
llxHeader('', $langs->trans("CashJournal"), ''); llxHeader('', $langs->trans("CashJournal"), '');
$nom = $langs->trans("CashJournal"); $name = $langs->trans("CashJournal");
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
$builddate = time(); $builddate = time();
$description = $langs->trans("DescCashJournal") . '<br>'; $description = $langs->trans("DescCashJournal") . '<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />'; print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
* *
@ -26,7 +26,7 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
@ -63,25 +63,25 @@ if ($action == 'ventil') {
print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
$mesCodesVentilChoisis = $codeventil; $mesCodesVentilChoisis = $codeventil;
$cpt = 0; $cpt = 0;
foreach ( $mesCasesCochees as $maLigneCochee ) { foreach ( $mesCasesCochees as $maLigneCochee ) {
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>"; // print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
$maLigneCourante = split("_", $maLigneCochee); $maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0]; $monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1]; $monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne]; $monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $monCompte; $sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId; $sql .= " WHERE rowid = " . $monId;
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql); dol_syslog('accountancy/supplier/list.php:: sql=' . $sql);
if ($db->query($sql)) { if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>'; print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else { } else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>'; print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
} }
$cpt ++; $cpt ++;
} }
} else { } else {
@ -133,15 +133,15 @@ $result = $db->query($sql);
if ($result) { if ($result) {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$i = 0; $i = 0;
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list... // TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><br><b>' . $langs->trans("DescVentilTodoSupplier") . '</b></br></td>'; print '<td align="left"><br><b>' . $langs->trans("DescVentilTodoSupplier") . '</b></br></td>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n"; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>Facture</td>'; print '<tr class="liste_titre"><td>Facture</td>';
print '<td align="left">' . $langs->trans("Ref") . '</td>'; print '<td align="left">' . $langs->trans("Ref") . '</td>';
@ -152,22 +152,22 @@ if ($result) {
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>'; print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
print '<td align="center">' . $langs->trans("Ventilate") . '</td>'; print '<td align="center">' . $langs->trans("Ventilate") . '</td>';
print "</tr>\n"; print "</tr>\n";
$facturefourn_static = new FactureFournisseur($db); $facturefourn_static = new FactureFournisseur($db);
$productfourn_static = new ProductFournisseur($db); $productfourn_static = new ProductFournisseur($db);
$form = new Form($db); $form = new Form($db);
$var = True; $var = True;
while ( $i < min($num_lines, $limit) ) { while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var = ! $var; $var = ! $var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
// Ref facture // Ref facture
$facturefourn_static->ref = $objp->ref; $facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid; $facturefourn_static->id = $objp->facid;
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>'; print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
// Ref facture supplier // Ref facture supplier
$productfourn_static->ref = $objp->product_ref; $productfourn_static->ref = $objp->product_ref;
$productfourn_static->id = $objp->product_id; $productfourn_static->id = $objp->product_id;
@ -178,23 +178,23 @@ if ($result) {
else else
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
// print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref.'</a></td>'; // print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref.'</a></td>';
// print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref_supplier.'</a></td>'; // print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref_supplier.'</a></td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>'; print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . stripslashes(nl2br($objp->description)) . '</td>'; print '<td>' . stripslashes(nl2br($objp->description)) . '</td>';
print '<td align="right">'; print '<td align="right">';
print price($objp->price); print price($objp->price);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print $objp->code_buy; print $objp->code_buy;
print '</td>'; print '</td>';
// Colonne choix du compte // Colonne choix du compte
print '<td align="center">'; print '<td align="center">';
print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1); print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
@ -203,15 +203,15 @@ if ($result) {
print '<td align="center">'; print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
$i ++; $i ++;
} }
print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventiler") . '"></td></tr>'; print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventiler") . '"></td></tr>';
print "</table>"; print "</table>";
print '</form>'; print '</form>';
} else { } else {
print $db->error(); print $db->error();

View File

@ -108,7 +108,7 @@ if ($rowid)
} }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('membercard')); $hookmanager->initHooks(array('membercard','globalcard'));
/* /*
@ -460,7 +460,7 @@ if ($action == 'add' && $user->rights->adherent->creer)
$object->email = $email; $object->email = $email;
$object->login = $login; $object->login = $login;
$object->pass = $pass; $object->pass = $pass;
$object->naiss = $birthdate; $object->birth = $birthdate;
$object->photo = $photo; $object->photo = $photo;
$object->typeid = $typeid; $object->typeid = $typeid;
//$object->note = $comment; //$object->note = $comment;
@ -883,7 +883,7 @@ else
// Birthday // Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n"; print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
$form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n"; print "</td></tr>\n";
// Profil public // Profil public

View File

@ -1090,7 +1090,7 @@ class Adherent extends CommonObject
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility; $this->civility_id = $obj->civility_id;
$this->firstname = $obj->firstname; $this->firstname = $obj->firstname;
$this->lastname = $obj->lastname; $this->lastname = $obj->lastname;
$this->login = $obj->login; $this->login = $obj->login;

View File

@ -119,7 +119,7 @@ class AdherentType extends CommonObject
if ($result) if ($result)
{ {
$action='update'; $action='update';
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('membertypedao')); $hookmanager->initHooks(array('membertypedao'));
$parameters=array('membertype'=>$this->id); $parameters=array('membertype'=>$this->id);
@ -151,21 +151,23 @@ class AdherentType extends CommonObject
* Fonction qui permet de supprimer le status de l'adherent * Fonction qui permet de supprimer le status de l'adherent
* *
* @param int $rowid Id of member type to delete * @param int $rowid Id of member type to delete
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, 0 if not found, < 0 if KO
*/ */
function delete($rowid) function delete($rowid='')
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = $rowid"; if (empty($rowid)) $rowid=$this->id;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = ".$rowid;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if ( $this->db->affected_rows($resql) ) if ($this->db->affected_rows($resql))
{ {
return 1; return 1;
} }
else else
{ {
return 0; return 0;
} }
} }

View File

@ -70,7 +70,7 @@ if (GETPOST('button_removefilter'))
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('membertypecard')); $hookmanager->initHooks(array('membertypecard','globalcard'));
/* /*
* Actions * Actions

View File

@ -142,7 +142,7 @@ print "</center>";
print "</form>\n"; print "</form>\n";
print '</div>'; dol_fiche_end();
clearstatcache(); clearstatcache();

View File

@ -396,7 +396,7 @@ if ($conf->produit->enabled)
$var = !$var; $var = !$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'.$modBarCode->nom."</td><td>\n"; print '<td>'.(isset($modBarCode->name)?$modBarCode->name:$modBarCode->nom)."</td><td>\n";
print $modBarCode->info($langs); print $modBarCode->info($langs);
print '</td>'; print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n"; print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";

View File

@ -287,7 +287,7 @@ if ($conf->product->enabled || $conf->product->service)
{ {
print $langs->trans("BarCodeNumberManager").": "; print $langs->trans("BarCodeNumberManager").": ";
$objproduct=new Product($db); $objproduct=new Product($db);
print '<b>'.$modBarCodeProduct->nom.'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>'; print '<b>'.(isset($modBarCodeProduct->name)?$modBarCodeProduct->name:$modBarCodeProduct->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeProduct->getNextValue($objproduct).'</b><br>';
$disabled=0; $disabled=0;
} }
else else

View File

@ -215,11 +215,6 @@ p.titre {
border: 1px solid #6d3f6d; border: 1px solid #6d3f6d;
} }
.bouton_login input {
background: #fff;
border: 1px solid #6d3f6d;
}
.principal { .principal {
float: left; float: left;
margin: 0 15px; margin: 0 15px;
@ -331,29 +326,6 @@ p.titre {
} }
/* -------------- Boutons --------------------- */ /* -------------- Boutons --------------------- */
.bouton_ajout_article,.bouton_mode_reglement,.bouton_validation {
border: 1px solid #999;
background: #f7f7f7;
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(80,80,80,.3)) );
}
.bouton_ajout_article:hover,.bouton_mode_reglement:hover,.bouton_validation:hover
{
background: #cccccc;
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(80,80,80,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(80,80,80,.3)) );
}
.bouton_ajout_article { .bouton_ajout_article {
margin-top: 10px; margin-top: 10px;
width: 100%; width: 100%;

View File

@ -152,7 +152,7 @@ print "</tr>\n";
</table> </table>
<br> <br>
<div align="center"><span class="bouton_login"><input name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></div> <div align="center"><span class="bouton_login"><input class="button" name="sbmtConnexion" type="submit" value=<?php echo $langs->trans("Connection"); ?> /></span></div>
</form> </form>
</fieldset> </fieldset>

View File

@ -144,7 +144,7 @@ $langs->load("cashdesk");
</tr> </tr>
</table> </table>
<input class="bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" /> <input class="button bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" />
</form> </form>
</fieldset> </fieldset>
@ -179,7 +179,7 @@ $langs->load("cashdesk");
$langs->load("errors"); $langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />'; print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
} }
else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />'; else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0) if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
@ -187,7 +187,7 @@ $langs->load("cashdesk");
$langs->load("errors"); $langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />'; print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
} }
else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />'; else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
@ -195,7 +195,7 @@ $langs->load("cashdesk");
$langs->load("errors"); $langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cheque").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />'; print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cheque").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
} }
else print '<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cheque").'" onclick="javascript: verifClic(\'CHQ\');" />'; else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cheque").'" onclick="javascript: verifClic(\'CHQ\');" />';
print '</td>'; print '</td>';
?> ?>
</tr> </tr>
@ -203,14 +203,11 @@ $langs->load("cashdesk");
<table> <table>
<tr> <tr>
<td> <td>
<input class="bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" /> <input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
<?php <?php
echo $langs->trans("DateEcheance").' :'; echo $langs->trans("DateEcheance").' :';
print $form->select_date(-1,'txtDatePaiement'); print $form->select_date(-1,'txtDatePaiement');
?> ?>
<!-- <input class="texte2" type="text" id="txtDatePaiement" name="txtDatePaiement" value="" />
<input class="bouton_cal" type="image" src="img/calendrier.png" id="btnCalendrier" value="..." title="<?php echo $langs->trans("CalTip"); ?>" />
-->
</td> </td>
</tr> </tr>

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -116,7 +116,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
} }
} }
$object->label = $label; $object->label = $label;
$object->description = dol_htmlcleanlastbr($description); $object->description = dol_htmlcleanlastbr($description);
@ -125,7 +125,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
$object->type = $type; $object->type = $type;
if ($parent != "-1") $object->fk_parent = $parent; if ($parent != "-1") $object->fk_parent = $parent;
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if (! $object->label) if (! $object->label)
@ -243,6 +243,7 @@ if ($user->rights->categorie->creer)
print $form->select_all_categories($type, $catorigin); print $form->select_all_categories($type, $catorigin);
print '</td></tr>'; print '</td></tr>';
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) if (empty($reshook))
{ {

View File

@ -93,7 +93,7 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid); $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categorycard')); $hookmanager->initHooks(array('categorycard','globalcard'));
/* /*

View File

@ -68,7 +68,7 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid); if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
$error=GETPOST("error"); $error=GETPOST("error");
$donotclearsession=0; $donotclearsession=GETPOST('donotclearsession')?GETPOST('donotclearsession'):0;
$cactioncomm = new CActionComm($db); $cactioncomm = new CActionComm($db);
$object = new ActionComm($db); $object = new ActionComm($db);
@ -81,7 +81,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
//var_dump($_POST); //var_dump($_POST);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('actioncard')); $hookmanager->initHooks(array('actioncard','globalcard'));
/* /*
@ -89,14 +89,16 @@ $hookmanager->initHooks(array('actioncard'));
*/ */
// Remove user to assigned list // Remove user to assigned list
if (! empty($_POST['removedassigned'])) if (GETPOST('removedassigned') || GETPOST('removedassigned') == '0')
{ {
$idtoremove=$_POST['removedassigned']; $idtoremove=GETPOST('removedassigned');
if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1); if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1);
else $tmpassigneduserids=array(); else $tmpassigneduserids=array();
foreach ($tmpassigneduserids as $key => $val) foreach ($tmpassigneduserids as $key => $val)
{ {
if ($val['id'] == $idtoremove) unset($tmpassigneduserids[$key]); if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]);
} }
//var_dump($_POST['removedassigned']);exit; //var_dump($_POST['removedassigned']);exit;
$_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids); $_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids);
@ -168,7 +170,7 @@ if ($action == 'add')
} }
// Initialisation objet cactioncomm // Initialisation objet cactioncomm
if (! GETPOST('actioncode') > 0) if (! GETPOST('actioncode') > 0) // actioncode is id
{ {
$error++; $donotclearsession=1; $error++; $donotclearsession=1;
$action = 'create'; $action = 'create';
@ -176,62 +178,63 @@ if ($action == 'add')
} }
else else
{ {
$result=$cactioncomm->fetch(GETPOST('actioncode')); $object->type_code = GETPOST('actioncode');
} }
// Initialisation objet actioncomm if (! $error)
$object->type_id = $cactioncomm->id;
$object->type_code = $cactioncomm->code;
$object->priority = GETPOST("priority")?GETPOST("priority"):0;
$object->fulldayevent = (! empty($fulldayevent)?1:0);
$object->location = GETPOST("location");
$object->label = trim(GETPOST('label'));
$object->fk_element = GETPOST("fk_element");
$object->elementtype = GETPOST("elementtype");
if (! GETPOST('label'))
{ {
if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs)) // Initialisation objet actioncomm
$object->priority = GETPOST("priority")?GETPOST("priority"):0;
$object->fulldayevent = (! empty($fulldayevent)?1:0);
$object->location = GETPOST("location");
$object->label = trim(GETPOST('label'));
$object->fk_element = GETPOST("fk_element");
$object->elementtype = GETPOST("elementtype");
if (! GETPOST('label'))
{ {
$object->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs)); if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs))
}
else
{
if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code)
{ {
$object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; $object->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs));
} }
else $object->label = $cactioncomm->libelle; else
{
if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code)
{
$object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n";
}
else $object->label = $cactioncomm->libelle;
}
}
$object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0;
$object->datep = $datep;
$object->datef = $datef;
$object->percentage = $percentage;
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
$listofuserid=array();
if (! empty($_SESSION['assignedtouser'])) $listofuserid=dol_json_decode($_SESSION['assignedtouser']);
$i=0;
foreach($listofuserid as $key => $value)
{
if ($i == 0) // First entry
{
$usertodo=new User($db);
if ($value['id'] > 0)
{
$usertodo->fetch($value['id']);
$object->userownerid = $usertodo->id;
}
$object->usertodo = $usertodo;
$object->transparency = (GETPOST("transparency")=='on'?1:0);
}
$object->userassigned[$value['id']]=array('id'=>$value['id'], 'transparency'=>(GETPOST("transparency")=='on'?1:0));
$i++;
} }
} }
$object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0;
$object->datep = $datep;
$object->datef = $datef;
$object->percentage = $percentage;
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
$listofuserid=array(); if (! $error && ! empty($conf->global->AGENDA_ENABLE_DONEBY))
if (! empty($_SESSION['assignedtouser'])) $listofuserid=dol_json_decode($_SESSION['assignedtouser']);
$i=0;
foreach($listofuserid as $key => $value)
{
if ($i == 0) // First entry
{
$usertodo=new User($db);
if ($value['id'] > 0)
{
$usertodo->fetch($value['id']);
$object->userownerid = $usertodo->id;
}
$object->usertodo = $usertodo;
$object->transparency = (GETPOST("transparency")=='on'?1:0);
}
$object->userassigned[$value['id']]=array('id'=>$value['id'], 'transparency'=>(GETPOST("transparency")=='on'?1:0));
$i++;
}
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
{ {
$userdone=new User($db); $userdone=new User($db);
if ($_POST["doneby"] > 0) if ($_POST["doneby"] > 0)
@ -248,10 +251,10 @@ if ($action == 'add')
if (GETPOST('socid','int') > 0) if (GETPOST('socid','int') > 0)
{ {
$societe = new Societe($db); $object->socid=GETPOST('socid','int');
$societe->fetch(GETPOST('socid','int')); $object->fetch_thirdparty();
$object->societe = $societe; // deprecated
$object->thirdparty = $societe; $object->societe = $object->thirdparty; // For backward compatibility
} }
// Special for module webcal and phenix // Special for module webcal and phenix
@ -357,23 +360,23 @@ if ($action == 'update')
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
$object->fk_action = dol_getIdFromCode($db, $_POST["actioncode"], 'c_actioncomm'); $object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
$object->label = $_POST["label"]; $object->label = GETPOST("label");
$object->datep = $datep; $object->datep = $datep;
$object->datef = $datef; $object->datef = $datef;
$object->percentage = $percentage; $object->percentage = $percentage;
$object->priority = $_POST["priority"]; $object->priority = GETPOST("priority");
$object->fulldayevent= $_POST["fullday"]?1:0; $object->fulldayevent= GETPOST("fullday")?1:0;
$object->location = GETPOST('location'); $object->location = GETPOST('location');
$object->socid = $_POST["socid"]; $object->socid = GETPOST("socid");
$object->contactid = $_POST["contactid"]; $object->contactid = GETPOST("contactid",'int');
//$object->societe->id = $_POST["socid"]; // deprecated //$object->societe->id = $_POST["socid"]; // deprecated
//$object->contact->id = $_POST["contactid"]; // deprecated //$object->contact->id = $_POST["contactid"]; // deprecated
$object->fk_project = $_POST["projectid"]; $object->fk_project = GETPOST("projectid",'int');
$object->note = $_POST["note"]; $object->note = GETPOST("note");
$object->pnote = $_POST["note"]; $object->pnote = GETPOST("note");
$object->fk_element = $_POST["fk_element"]; $object->fk_element = GETPOST("fk_element");
$object->elementtype = $_POST["elementtype"]; $object->elementtype = GETPOST("elementtype");
if (! $datef && $percentage == 100) if (! $datef && $percentage == 100)
{ {
@ -394,7 +397,7 @@ if ($action == 'update')
$tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array(); $tmplist1=dol_json_decode($_SESSION['assignedtouser'], true); $tmplist2=array();
foreach($tmplist1 as $key => $val) foreach($tmplist1 as $key => $val)
{ {
if ($val['id'] && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val;
} }
} }
@ -603,21 +606,22 @@ if ($action == 'create')
print '<form name="formaction" action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form name="formaction" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="donotclearsession" value="1">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">'; if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print '<input type="hidden" name="actioncode" value="'.dol_getIdFromCode($db, 'AC_OTH', 'c_actioncomm').'">';
if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous"));
else print_fiche_titre($langs->trans("AddAnAction")); else print_fiche_titre($langs->trans("AddAnAction"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Type d'action actifs // Type of event
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{ {
print '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>'; print '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto");
print '</td></tr>'; print '</td></tr>';
} }
else print '<input type="hidden" name="actioncode" value="AC_OTH">';
// Title // Title
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" size="60" value="'.GETPOST('label').'"></td></tr>'; print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" size="60" value="'.GETPOST('label').'"></td></tr>';
@ -676,8 +680,15 @@ if ($action == 'create')
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser,'mandatory'=>0,'transparency'=>$object->transparency); // Owner first
$_SESSION['assignedtouser']=dol_json_encode($listofuserid); $_SESSION['assignedtouser']=dol_json_encode($listofuserid);
} }
else
{
if (!empty($_SESSION['assignedtouser']))
{
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
}
}
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1);
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked="checked"':'').'> '.$langs->trans("Busy"); if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked="checked"':'').'> '.$langs->trans("Busy");
print '</td></tr>'; print '</td></tr>';
// Realised by // Realised by
@ -854,6 +865,7 @@ if ($id > 0)
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="ref_ext" value="'.$object->ref_ext.'">'; print '<input type="hidden" name="ref_ext" value="'.$object->ref_ext.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1'? $backtopage : $_SERVER["HTTP_REFERER"]).'">'; if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1'? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action');
@ -862,7 +874,7 @@ if ($id > 0)
// Ref // Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>'; print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
// Type // Type of event
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{ {
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">'; print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
@ -918,8 +930,15 @@ if ($id > 0)
} }
$_SESSION['assignedtouser']=dol_json_encode($listofuserid); $_SESSION['assignedtouser']=dol_json_encode($listofuserid);
} }
else
{
if (!empty($_SESSION['assignedtouser']))
{
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
}
}
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1);
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.($listofuserid[$user->id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy"); if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.($listofuserid[$user->id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy");
print '</td></tr>'; print '</td></tr>';
// Realised by // Realised by
@ -1081,8 +1100,15 @@ if ($id > 0)
} }
$_SESSION['assignedtouser']=dol_json_encode($listofuserid); $_SESSION['assignedtouser']=dol_json_encode($listofuserid);
} }
else
{
if (!empty($_SESSION['assignedtouser']))
{
$listofuserid=dol_json_decode($_SESSION['assignedtouser'], true);
}
}
print $form->select_dolusers_forevent('view','assignedtouser',1); print $form->select_dolusers_forevent('view','assignedtouser',1);
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
print ' </td></tr>'; print ' </td></tr>';
// Done by // Done by
@ -1225,7 +1251,7 @@ if ($id > 0)
// Link to agenda views // Link to agenda views
print '<div id="agendaviewbutton">'; print '<div id="agendaviewbutton">';
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left">'; print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">'; print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">'; print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
@ -1234,7 +1260,7 @@ if ($id > 0)
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_week">'; print '<input type="hidden" name="action" value="show_week">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">'; print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
@ -1243,7 +1269,7 @@ if ($id > 0)
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_day">'; print '<input type="hidden" name="action" value="show_day">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">'; print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
@ -1252,7 +1278,7 @@ if ($id > 0)
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left">'; print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_peruser">'; print '<input type="hidden" name="action" value="show_peruser">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">'; print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';

View File

@ -95,18 +95,21 @@ class ActionComm extends CommonObject
*/ */
function __construct($db) function __construct($db)
{ {
global $langs;
$this->db = $db; $this->db = $db;
//$this->author = new stdClass(); //$this->author = new stdClass();
//$this->usermod = new stdClass(); //$this->usermod = new stdClass();
//$this->usertodo = new stdClass(); //$this->usertodo = new stdClass();
//$this->userdone = new stdClass(); //$this->userdone = new stdClass();
$this->societe = new stdClass(); $this->societe = new stdClass(); // deprecated
$this->contact = new stdClass(); $this->contact = new stdClass(); // deprecated
} }
/** /**
* Add an action/event into database * Add an action/event into database.
* $this->type_id OR $this->type_code must be set.
* *
* @param User $user Object user making action * @param User $user Object user making action
* @param int $notrigger 1 = disable triggers, 0 = enable triggers * @param int $notrigger 1 = disable triggers, 0 = enable triggers
@ -142,24 +145,26 @@ class ActionComm extends CommonObject
$userownerid=isset($this->usertodo->id)?$this->usertodo->id:$this->userownerid; // For backward compatibility $userownerid=isset($this->usertodo->id)?$this->usertodo->id:$this->userownerid; // For backward compatibility
$userdoneid=isset($this->userdone->id)?$this->userdone->id:$this->userdoneid; // For backward compatibility $userdoneid=isset($this->userdone->id)?$this->userdone->id:$this->userdoneid; // For backward compatibility
if (! $this->type_id && $this->type_code) if (! $this->type_id || ! $this->type_code)
{ {
$key=empty($this->type_id)?$this->type_code:$this->type_id;
// Get id from code // Get id from code
$cactioncomm=new CActionComm($this->db); $cactioncomm=new CActionComm($this->db);
$result=$cactioncomm->fetch($this->type_code); $result=$cactioncomm->fetch($key);
if ($result > 0) if ($result > 0)
{ {
$this->type_id=$cactioncomm->id; $this->type_id=$cactioncomm->id;
$this->code=$cactioncomm->code; $this->type_code=$cactioncomm->code;
} }
else if ($result == 0) else if ($result == 0)
{ {
$this->error='Failed to get record with code '.$this->type_code.' from dictionary "type of events"'; $this->error='Failed to get record with id '.$this->type_id.' code '.$this->type_code.' from dictionary "type of events"';
return -1; return -1;
} }
else else
{ {
$this->error=$cactioncomm->error; $this->error=$cactioncomm->error;
return -1; return -1;
} }
@ -199,7 +204,7 @@ class ActionComm extends CommonObject
$sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").",";
$sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; // deprecated $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; // deprecated
$sql.= (isset($this->type_id)?$this->type_id:"null").","; $sql.= (isset($this->type_id)?$this->type_id:"null").",";
$sql.= (isset($this->code)?" '".$this->code."'":"null").","; $sql.= (isset($this->type_code)?" '".$this->type_code."'":"null").",";
$sql.= (isset($this->socid) && $this->socid > 0?" '".$this->socid."'":"null").","; $sql.= (isset($this->socid) && $this->socid > 0?" '".$this->socid."'":"null").",";
$sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").","; $sql.= (isset($this->fk_project) && $this->fk_project > 0?" '".$this->fk_project."'":"null").",";
$sql.= " '".$this->db->escape($this->note)."',"; $sql.= " '".$this->db->escape($this->note)."',";
@ -415,7 +420,9 @@ class ActionComm extends CommonObject
while ($obj = $this->db->fetch_object($resql2)) while ($obj = $this->db->fetch_object($resql2))
{ {
$this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency); $this->userassigned[$obj->fk_element]=array('id'=>$obj->fk_element, 'mandatory'=>$obj->mandatory, 'answer_status'=>$obj->answer_status, 'transparency'=>$obj->transparency);
if (empty($this->userownerid)) $this->userownerid=$obj->fk_element; // If not defined (should not happened, we fix this)
} }
return 1; return 1;
} }
else else
@ -524,6 +531,11 @@ class ActionComm extends CommonObject
return -1; return -1;
} }
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0));
$contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0));
$userownerid=($this->userownerid?$this->userownerid:((isset($this->usertodo->id) && $this->usertodo->id > 0) ? $this->usertodo->id : 0));
$userdoneid=($this->userdoneid?$this->userdoneid:((isset($this->userdone->id) && $this->userdone->id > 0) ? $this->userdone->id : 0));
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
@ -534,16 +546,16 @@ class ActionComm extends CommonObject
$sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null');
$sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated $sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated
$sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null"); $sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null");
$sql.= ", fk_soc =". ($this->societe->id > 0 ? "'".$this->societe->id."'":"null"); $sql.= ", fk_soc =". ($this->socid > 0 ? "'".$this->socid."'":"null");
$sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null"); $sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null");
$sql.= ", fk_contact =". ($this->contact->id > 0 ? "'".$this->contact->id."'":"null"); $sql.= ", fk_contact =". ($contactid > 0 ? "'".$this->contactid."'":"null");
$sql.= ", priority = '".$this->priority."'"; $sql.= ", priority = '".$this->priority."'";
$sql.= ", fulldayevent = '".$this->fulldayevent."'"; $sql.= ", fulldayevent = '".$this->fulldayevent."'";
$sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null"); $sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null");
$sql.= ", transparency = '".$this->transparency."'"; $sql.= ", transparency = '".$this->transparency."'";
$sql.= ", fk_user_mod = '".$user->id."'"; $sql.= ", fk_user_mod = '".$user->id."'";
$sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null"); $sql.= ", fk_user_action=".($userownerid > 0 ? "'".$userownerid."'":"null");
$sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= ", fk_user_done=".($userdoneid > 0 ? "'".$userdoneid."'":"null");
if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->fk_element:"null"); if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->fk_element:"null");
if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->elementtype."'":"null"); if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->elementtype."'":"null");
$sql.= " WHERE id=".$this->id; $sql.= " WHERE id=".$this->id;

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2006 Roman Ozana <ozana@omdesign.cz> /* Copyright (C) 2006 Roman Ozana <ozana@omdesign.cz>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -261,6 +261,7 @@ class ICal
*/ */
function ical_rrule($value) function ical_rrule($value)
{ {
$result=aray();
$rrule = explode(';',$value); $rrule = explode(';',$value);
foreach ($rrule as $line) foreach ($rrule as $line)
{ {
@ -299,6 +300,7 @@ class ICal
*/ */
function ical_dt_date($key, $value) function ical_dt_date($key, $value)
{ {
$return_value=array();
$value = $this->ical_date_to_unix($value); $value = $this->ical_date_to_unix($value);
// Analyse TZID // Analyse TZID
@ -309,8 +311,8 @@ class ICal
$value = str_replace('T', '', $value); $value = str_replace('T', '', $value);
return array($key,$value); return array($key,$value);
} }
// adding $value and $tzid
$key = $temp[0]; $key = $temp[0];
$temp = explode("=", $temp[1]); $temp = explode("=", $temp[1]);
$return_value[$temp[0]] = $temp[1]; $return_value[$temp[0]] = $temp[1];
$return_value['unixtime'] = $value; $return_value['unixtime'] = $value;
@ -330,8 +332,9 @@ class ICal
{ {
usort($temp, array(&$this, "ical_dtstart_compare")); usort($temp, array(&$this, "ical_dtstart_compare"));
return $temp; return $temp;
} else }
{ else
{
return false; return false;
} }
} }

View File

@ -320,7 +320,7 @@ $sql.= ' a.datea2,';
$sql.= ' a.percent,'; $sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; $sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact,'; $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
$sql.= ' ca.code, ca.color'; $sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@ -415,6 +415,9 @@ if ($resql)
//$event->societe->id=$obj->fk_soc; // deprecated //$event->societe->id=$obj->fk_soc; // deprecated
//$event->contact->id=$obj->fk_contact; // deprecated //$event->contact->id=$obj->fk_contact; // deprecated
$event->fk_element=$obj->fk_element;
$event->elementtype=$obj->elementtype;
// Defined date_start_in_calendar and date_end_in_calendar property // Defined date_start_in_calendar and date_end_in_calendar property
// They are date start and end of action but modified to not be outside calendar view. // They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0) if ($event->percentage <= 0)
@ -598,8 +601,13 @@ else
} }
// Load array of colors by type // Load array of colors by type
// TODO
$colorsbytype=array(); $colorsbytype=array();
$sql="SELECT code, color FROM ".MAIN_DB_PREFIX."c_actioncomm";
$resql=$db->query($sql);
while ($obj = $db->fetch_object($resql))
{
$colorsbytype[$obj->code]=$obj->color;
}
// Loop on each user to show calendar // Loop on each user to show calendar
$todayarray=dol_getdate($now,'fast'); $todayarray=dol_getdate($now,'fast');
@ -704,14 +712,15 @@ $db->close();
* @param int $showinfo Add extended information (used by day view) * @param int $showinfo Add extended information (used by day view)
* @param int $minheight Minimum height for each event. 60px by default. * @param int $minheight Minimum height for each event. 60px by default.
* @param boolean $showheader Show header * @param boolean $showheader Show header
* @param array $colorsbytype Array with colors by type
* @return void * @return void
*/ */
function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false) function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array())
{ {
global $db; global $db;
global $user, $conf, $langs; global $user, $conf, $langs, $hookmanager, $action;
global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form global $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
global $theme_datacolor; global $theme_datacolor; // Array with a list of different we can use (come from theme)
global $cachethirdparties, $cachecontacts, $colorindexused; global $cachethirdparties, $cachecontacts, $colorindexused;
global $begin_h, $end_h; global $begin_h, $end_h;
@ -743,6 +752,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if (! in_array($username->id,$keysofuserassigned)) continue; // We discard record if event is from another user than user we want to show if (! in_array($username->id,$keysofuserassigned)) continue; // We discard record if event is from another user than user we want to show
//if ($username->id != $event->userownerid) continue; // We discard record if event is from another user than user we want to show //if ($username->id != $event->userownerid) continue; // We discard record if event is from another user than user we want to show
$parameters=array();
$reshook=$hookmanager->executeHooks('formatEvent',$parameters,$event,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color (Hex string like '0088FF') and $cssclass of event // Define $color (Hex string like '0088FF') and $cssclass of event
@ -750,12 +763,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if (in_array($user->id, $keysofuserassigned)) if (in_array($user->id, $keysofuserassigned))
{ {
$nummytasks++; $cssclass='family_mytasks'; $nummytasks++; $cssclass='family_mytasks';
$color=$event->type_color; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color=$event->type_color;
} }
else if ($event->type_code == 'ICALEVENT') else if ($event->type_code == 'ICALEVENT')
{ {
$numical++; $numical++;
if (! empty($event->icalname)) { if (! empty($event->icalname))
{
if (! isset($numicals[dol_string_nospecial($event->icalname)])) { if (! isset($numicals[dol_string_nospecial($event->icalname)])) {
$numicals[dol_string_nospecial($event->icalname)] = 0; $numicals[dol_string_nospecial($event->icalname)] = 0;
} }
@ -772,7 +786,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
else else
{ {
$numother++; $cssclass='family_other'; $numother++; $cssclass='family_other';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color=$event->type_color;
} }
if ($color < 0) // Color was not forced. Set color according to color index. if ($color < 0) // Color was not forced. Set color according to color index.
{ {
// Define color index if not yet defined // Define color index if not yet defined
@ -858,8 +874,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$cases2[$h][$event->id]['string']=$event->label; $cases2[$h][$event->id]['string']=$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code; $cases1[$h][$event->id]['typecode']=$event->type_code;
$cases2[$h][$event->id]['typecode']=$event->type_code; $cases2[$h][$event->id]['typecode']=$event->type_code;
$cases1[$h][$event->id]['color']='009900'; $cases1[$h][$event->id]['color']=$color;
$cases2[$h][$event->id]['color']='009900'; $cases2[$h][$event->id]['color']=$color;
} }
} }
$i++; $i++;
@ -877,7 +893,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$title1='';$title2=''; $title1='';$title2='';
if (isset($cases1[$h]) && $cases1[$h] != '') if (isset($cases1[$h]) && $cases1[$h] != '')
{ {
$title1=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events")); //$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
if (count($cases1[$h]) > 1) $title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
$string1='&nbsp;'; $string1='&nbsp;';
$style1='peruser_notbusy'; $style1='peruser_notbusy';
foreach($cases1[$h] as $id => $ev) foreach($cases1[$h] as $id => $ev)
@ -887,7 +904,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
} }
if (isset($cases2[$h]) && $cases2[$h] != '') if (isset($cases2[$h]) && $cases2[$h] != '')
{ {
$title2=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events")); //$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
if (count($cases2[$h]) > 1) $title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
$string2='&nbsp;'; $string2='&nbsp;';
$style2='peruser_notbusy'; $style2='peruser_notbusy';
foreach($cases2[$h] as $id => $ev) foreach($cases2[$h] as $id => $ev)
@ -903,7 +921,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
{ {
$ids=array_keys($cases1[$h]); $ids=array_keys($cases1[$h]);
$output = array_slice($cases1[$h], 0, 1); $output = array_slice($cases1[$h], 0, 1);
if ($output[0]['string']) $title1.=' - '.$output[0]['string']; if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color1 = $output[0]['color']; if ($output[0]['color']) $color1 = $output[0]['color'];
} }
else if (count($cases1[$h]) > 1) $color1='222222'; else if (count($cases1[$h]) > 1) $color1='222222';
@ -912,7 +930,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
{ {
$ids=array_keys($cases2[$h]); $ids=array_keys($cases2[$h]);
$output = array_slice($cases2[$h], 0, 1); $output = array_slice($cases2[$h], 0, 1);
if ($output[0]['string']) $title2.=' - '.$output[0]['string']; if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color2 = $output[0]['color']; if ($output[0]['color']) $color2 = $output[0]['color'];
} }
else if (count($cases2[$h]) > 1) $color2='222222'; else if (count($cases2[$h]) > 1) $color2='222222';

View File

@ -68,7 +68,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="nom"; if (! $sortfield) $sortfield="nom";
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('commcard')); $hookmanager->initHooks(array('commcard','globalcard'));
$object = new Societe($db); $object = new Societe($db);

View File

@ -72,7 +72,7 @@ if ($type == "f")
* *
*/ */
$sql = "SELECT s.rowid, s.nom, st.libelle as stcomm"; $sql = "SELECT s.rowid, s.nom as name, st.libelle as stcomm";
$sql.= ", p.rowid as cidp, p.name, p.firstname, p.email, p.phone"; $sql.= ", p.rowid as cidp, p.name, p.firstname, p.email, p.phone";
$sql.= " FROM ".MAIN_DB_PREFIX."c_stcomm as st,"; $sql.= " FROM ".MAIN_DB_PREFIX."c_stcomm as st,";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
@ -159,7 +159,7 @@ if ($resql)
print "<td>$obj->firstname</TD>"; print "<td>$obj->firstname</TD>";
print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").'</a>&nbsp;'; print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").'</a>&nbsp;';
print "<a href=\"".$urlfiche."?socid=".$obj->rowid."\">$obj->nom</a></td>\n"; print "<a href=\"".$urlfiche."?socid=".$obj->rowid."\">$obj->name</a></td>\n";
print '<td>'.dol_print_phone($obj->email,$obj->cidp,$obj->rowid,'AC_EMAIL').'</td>'; print '<td>'.dol_print_phone($obj->email,$obj->cidp,$obj->rowid,'AC_EMAIL').'</td>';

View File

@ -444,7 +444,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{ {
$langs->load("propal"); $langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -497,7 +497,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print "</td>"; print "</td>";
print '<td align="left"><a href="card.php?socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,44).'</a></td>'."\n"; print '<td align="left"><a href="card.php?socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,44).'</a></td>'."\n";
print '<td align="right">'; print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n"; print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>'; print '<td align="right">'.price($obj->total_ttc).'</td>';

View File

@ -52,7 +52,7 @@ $extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('mailingcard')); $hookmanager->initHooks(array('mailingcard','globalcard'));
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$object->substitutionarray=array( $object->substitutionarray=array(

View File

@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref)) {
} }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propalcard')); $hookmanager->initHooks(array('propalcard','globalcard'));
$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php

View File

@ -381,7 +381,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
/* /*
if (! empty($conf->propal->enabled)) if (! empty($conf->propal->enabled))
{ {
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as name, s.rowid as socid";
$sql.=" FROM ".MAIN_DB_PREFIX."propal as c"; $sql.=" FROM ".MAIN_DB_PREFIX."propal as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -433,7 +433,7 @@ if (! empty($conf->propal->enabled))
print '</td>'; print '</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'</a></td>';
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>'; print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
@ -453,7 +453,7 @@ if (! empty($conf->propal->enabled))
*/ */
/*if (! empty($conf->propal->enabled)) /*if (! empty($conf->propal->enabled))
{ {
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -505,7 +505,7 @@ if (! empty($conf->propal->enabled))
print '</td>'; print '</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>'; print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';

View File

@ -142,7 +142,7 @@ if (! $sortorder) $sortorder='DESC';
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$sql = 'SELECT s.rowid, s.nom, s.town, s.client, s.code_client,'; $sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,';
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; $sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= ' u.login'; $sql.= ' u.login';
@ -246,7 +246,7 @@ if ($result)
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
if ($search_author) $param.='&search_author='.$search_author; if ($search_author) $param.='&search_author='.$search_author;
if ($search_town) $param.='&search_town='.$search_town; if ($search_town) $param.='&search_town='.$search_town;
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->nom:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -375,7 +375,7 @@ if ($result)
// Company // Company
$companystatic->id=$objp->rowid; $companystatic->id=$objp->rowid;
$companystatic->nom=$objp->nom; $companystatic->name=$objp->name;
$companystatic->client=$objp->client; $companystatic->client=$objp->client;
$companystatic->code_client=$objp->code_client; $companystatic->code_client=$objp->code_client;
print '<td>'; print '<td>';

View File

@ -178,7 +178,7 @@ if ($action == 'cstc')
$formother=new FormOther($db); $formother=new FormOther($db);
$form=new Form($db); $form=new Form($db);
$sql = "SELECT s.rowid, s.nom, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,"; $sql = "SELECT s.rowid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,";
$sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,"; $sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,";
$sql.= " d.nom as departement"; $sql.= " d.nom as departement";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $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) if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $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)
@ -402,7 +402,7 @@ if ($resql)
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
$prospectstatic->id=$obj->rowid; $prospectstatic->id=$obj->rowid;
$prospectstatic->nom=$obj->nom; $prospectstatic->name=$obj->name;
$prospectstatic->status=$obj->status; $prospectstatic->status=$obj->status;
$prospectstatic->code_client=$obj->code_client; $prospectstatic->code_client=$obj->code_client;
$prospectstatic->client=$obj->client; $prospectstatic->client=$obj->client;

View File

@ -64,8 +64,8 @@ if ($socid > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Nom // Name
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Thirdpary").'</td><td width="80%" colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
// Prefix // Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field

View File

@ -63,8 +63,8 @@ if ($socid > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Nom // Name
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Thirdparty").'</td><td width="80%" colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
// Prefix // Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field

View File

@ -167,7 +167,7 @@ if ($id > 0 || ! empty($ref))
// Client // Client
print "<tr><td>".$langs->trans("Customer")."</td>"; print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td colspan="2">'; print '<td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$soc->id.'">'.$soc->nom.'</a>'; print '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$soc->id.'">'.$soc->getNomUrl(1).'</a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -90,7 +90,7 @@ if ($id > 0 || ! empty($ref)) {
} }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('ordercard')); $hookmanager->initHooks(array('ordercard','globalcard'));
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php

View File

@ -67,7 +67,7 @@ $thirdpartystatic=new Societe($db);
* Mode List * Mode List
*/ */
$sql = "SELECT s.rowid, s.nom, s.client, s.town, s.datec, s.datea"; $sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
$sql.= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta "; $sql.= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."commande as c";
@ -161,7 +161,7 @@ if ($resql)
$lien=$lienfin=''; $lien=$lienfin='';
$lien = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">'; $lien = '<a href="'.dol_buildpath('/commande/orderstoinvoice.php',1).'?socid='.$obj->rowid.'">';
$lienfin='</a>'; $lienfin='</a>';
$name=$obj->nom; $name=$obj->name;
$result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin); $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name,'company').$lienfin);
$result.=$lien.(dol_trunc($name,$maxlen)).$lienfin; $result.=$lien.(dol_trunc($name,$maxlen)).$lienfin;

View File

@ -166,7 +166,7 @@ else
*/ */
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
$sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -195,7 +195,7 @@ if (! empty($conf->commande->enabled))
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td class="nowrap">'; print '<td class="nowrap">';
print "<a href=\"card.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>"; print "<a href=\"card.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td></tr>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'</a></td></tr>';
$i++; $i++;
} }
} }
@ -215,7 +215,7 @@ $max=5;
*/ */
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,"; $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c,";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -268,7 +268,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
print '<td>'.dol_print_date($db->jdate($obj->datem),'day').'</td>'; print '<td>'.dol_print_date($db->jdate($obj->datem),'day').'</td>';
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>'; print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
print '</tr>'; print '</tr>';
@ -285,7 +285,7 @@ else dol_print_error($db);
*/ */
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql.=" FROM ".MAIN_DB_PREFIX."commande as c"; $sql.=" FROM ".MAIN_DB_PREFIX."commande as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -337,7 +337,7 @@ if (! empty($conf->commande->enabled))
print '</td>'; print '</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).'</a></td>';
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>'; print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
@ -356,7 +356,7 @@ if (! empty($conf->commande->enabled))
*/ */
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -408,7 +408,7 @@ if (! empty($conf->commande->enabled))
print '</td>'; print '</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>'; print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';

View File

@ -112,7 +112,7 @@ $companystatic = new Societe($db);
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
llxHeader('',$langs->trans("Orders"),$help_url); llxHeader('',$langs->trans("Orders"),$help_url);
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,'; $sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee'; $sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= ', '.MAIN_DB_PREFIX.'commande as c'; $sql.= ', '.MAIN_DB_PREFIX.'commande as c';
@ -221,7 +221,7 @@ if ($resql)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($socid); $soc->fetch($socid);
$title = $langs->trans('ListOfOrders') . ' - '.$soc->nom; $title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
} }
else else
{ {
@ -367,7 +367,7 @@ if ($resql)
// Company // Company
$companystatic->id=$objp->socid; $companystatic->id=$objp->socid;
$companystatic->nom=$objp->nom; $companystatic->name=$objp->name;
$companystatic->client=$objp->client; $companystatic->client=$objp->client;
print '<td>'; print '<td>';
print $companystatic->getNomUrl(1,'customer'); print $companystatic->getNomUrl(1,'customer');
@ -380,7 +380,7 @@ if ($resql)
if (($objp->fk_statut > 0 && $objp->fk_statut < 3) || ($objp->fk_statut == 3 && $objp->facturee == 0)) if (($objp->fk_statut > 0 && $objp->fk_statut < 3) || ($objp->fk_statut == 3 && $objp->facturee == 0))
{ {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$companystatic->id.'">'; print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$companystatic->id.'">';
print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->nom, 'object_bill', 'hideonsmartphone').'</a>'; print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').'</a>';
} }
} }
} }

View File

@ -573,7 +573,7 @@ if (($action != 'create' && $action != 'add') || !$error)
{ {
// Company // Company
$companystatic->id=$socid; $companystatic->id=$socid;
$companystatic->nom=$soc->nom; $companystatic->name=$soc->name;
print '<h3>'.$companystatic->getNomUrl(1,'customer').'</h3>'; print '<h3>'.$companystatic->getNomUrl(1,'customer').'</h3>';
} }

View File

@ -680,7 +680,7 @@ if ($id > 0 || ! empty($ref))
if ($links[$key]['type']=='company') if ($links[$key]['type']=='company')
{ {
$societestatic->id=$links[$key]['url_id']; $societestatic->id=$links[$key]['url_id'];
$societestatic->nom=$links[$key]['label']; $societestatic->name=$links[$key]['label'];
print $societestatic->getNomUrl(1,'',16); print $societestatic->getNomUrl(1,'',16);
} }
else if ($links[$key]['type']=='user') else if ($links[$key]['type']=='user')

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com> * Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
@ -158,7 +158,7 @@ if ($resql)
if (GETPOST("bid")) if (GETPOST("bid"))
{ {
$result=$bankcateg->fetch(GETPOST("bid")); $result=$bankcateg->fetch(GETPOST("bid"));
print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->nom:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
} }
else else
{ {
@ -166,18 +166,18 @@ if ($resql)
} }
print '<form method="post" action="search.php" name="search_form">'; print '<form method="post" action="search.php" name="search_form">';
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': '; $moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1); $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1);
$moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1); $moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
if ($moreforfilter) { if ($moreforfilter) {
print '<div class="liste_titre">'; print '<div class="liste_titre">';
print $moreforfilter; print $moreforfilter;
print '</div>'; print '</div>';
} }
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
@ -278,7 +278,7 @@ if ($resql)
if ($objp->url_id) if ($objp->url_id)
{ {
$companystatic->id=$objp->url_id; $companystatic->id=$objp->url_id;
$companystatic->nom=$objp->labelurl; $companystatic->name=$objp->labelurl;
print $companystatic->getNomUrl(1); print $companystatic->getNomUrl(1);
} }
else else

View File

@ -148,7 +148,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Customer invoices // Customer invoices
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,"; $sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
$sql.= " s.rowid as socid, s.nom, s.fournisseur"; $sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;
@ -158,7 +158,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Supplier invoices // Supplier invoices
$sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref_supplier as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref_supplier as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,";
$sql2.= " s.rowid as socid, s.nom, s.fournisseur"; $sql2.= " s.rowid as socid, s.nom as name, s.fournisseur";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid";
$sql2.= " WHERE ff.entity = ".$conf->entity; $sql2.= " WHERE ff.entity = ".$conf->entity;
@ -265,7 +265,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$ref = $facturefournstatic->getNomUrl(1,''); $ref = $facturefournstatic->getNomUrl(1,'');
$societestatic->id = $obj->socid; $societestatic->id = $obj->socid;
$societestatic->nom = $obj->nom; $societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1,'',24); $refcomp=$societestatic->getNomUrl(1,'',24);
$paiement = -1*$facturefournstatic->getSommePaiement(); // Payment already done $paiement = -1*$facturefournstatic->getSommePaiement(); // Payment already done
@ -279,7 +279,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$ref = $facturestatic->getNomUrl(1,''); $ref = $facturestatic->getNomUrl(1,'');
$societestatic->id = $obj->socid; $societestatic->id = $obj->socid;
$societestatic->nom = $obj->nom; $societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1,'',24); $refcomp=$societestatic->getNomUrl(1,'',24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done $paiement = $facturestatic->getSommePaiement(); // Payment already done

View File

@ -73,7 +73,7 @@ if ($action == 'note')
if ($mode == 'search') { if ($mode == 'search') {
if ($modesearch == 'soc') { if ($modesearch == 'soc') {
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s "; $sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
$sql.= " WHERE lower(s.nom) LIKE '%".$db->escape(strtolower($socname))."%'"; $sql.= " WHERE s.nom LIKE '%".$db->escape(strtolower($socname))."%'";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND s.entity IN (".getEntity('societe', 1).")";
} }
@ -93,7 +93,7 @@ if ($mode == 'search') {
* Mode List * Mode List
*/ */
$sql = "SELECT s.rowid, s.nom, s.client, s.town, s.datec, s.datea"; $sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
$sql.= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta "; $sql.= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st";
@ -107,13 +107,13 @@ if (dol_strlen($stcomm))
} }
if ($socname) if ($socname)
{ {
$sql.= " AND s.nom LIKE '%".$db->escape(strtolower($socname))."%'"; $sql.= " AND s.nom LIKE '%".$db->escape($socname)."%'";
$sortfield = "s.nom"; $sortfield = "s.nom";
$sortorder = "ASC"; $sortorder = "ASC";
} }
if ($_GET["search_nom"]) if ($_GET["search_nom"])
{ {
$sql.= " AND s.nom LIKE '%".$db->escape(strtolower($_GET["search_nom"]))."%'"; $sql.= " AND s.nom LIKE '%".$db->escape($_GET["search_nom"])."%'";
} }
if ($_GET["search_compta"]) if ($_GET["search_compta"])
{ {
@ -141,7 +141,7 @@ if ($resql)
$i = 0; $i = 0;
$langs->load('commercial'); $langs->load('commercial');
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@ -188,7 +188,7 @@ if ($resql)
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td>'; print '<td>';
$thirdpartystatic->id=$obj->rowid; $thirdpartystatic->id=$obj->rowid;
$thirdpartystatic->nom=$obj->nom; $thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=$obj->client; $thirdpartystatic->client=$obj->client;
print $thirdpartystatic->getNomUrl(1,'compta'); print $thirdpartystatic->getNomUrl(1,'compta');
print '</td>'; print '</td>';

View File

@ -47,7 +47,7 @@ $confirm = GETPOST('confirm','alpha');
$object = new Deplacement($db); $object = new Deplacement($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('tripsandexpensescard')); $hookmanager->initHooks(array('tripsandexpensescard','globalcard'));
$permissionnote=$user->rights->deplacement->creer; // Used by the include of actions_setnotes.inc.php $permissionnote=$user->rights->deplacement->creer; // Used by the include of actions_setnotes.inc.php

View File

@ -231,7 +231,7 @@ class Deplacement extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
$sql.= " WHERE entity IN (".getEntity('deplacement').")"; $sql.= " WHERE entity IN (".getEntity('deplacement').")";
if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'"; if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'";
else $sql.= " AND id = ".$id; else $sql.= " AND rowid = ".$id;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -50,7 +50,7 @@ $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOS
$result = restrictedArea($user, 'don', $id); $result = restrictedArea($user, 'don', $id);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('doncard')); $hookmanager->initHooks(array('doncard','globalcard'));
/* /*

View File

@ -202,7 +202,8 @@ class Don extends CommonObject
/** /**
* Check params * Check params and init ->errors array.
* TODO This function seems to not be used by core code.
* *
* @param int $minimum Minimum * @param int $minimum Minimum
* @return int 0 if KO, >0 if OK * @return int 0 if KO, >0 if OK
@ -212,39 +213,40 @@ class Don extends CommonObject
global $langs; global $langs;
$langs->load('main'); $langs->load('main');
$langs->load('companies'); $langs->load('companies');
$error_string = array();
$err = 0; $err = 0;
if (dol_strlen(trim($this->societe)) == 0) if (dol_strlen(trim($this->societe)) == 0)
{ {
if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0)
{ {
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname'));
$err++; $err++;
} }
} }
if (dol_strlen(trim($this->address)) == 0) if (dol_strlen(trim($this->address)) == 0)
{ {
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Address')); $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Address'));
$err++; $err++;
} }
if (dol_strlen(trim($this->zip)) == 0) if (dol_strlen(trim($this->zip)) == 0)
{ {
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Zip')); $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Zip'));
$err++; $err++;
} }
if (dol_strlen(trim($this->town)) == 0) if (dol_strlen(trim($this->town)) == 0)
{ {
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Town')); $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Town'));
$err++; $err++;
} }
if (dol_strlen(trim($this->email)) == 0) if (dol_strlen(trim($this->email)) == 0)
{ {
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('EMail')); $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('EMail'));
$err++; $err++;
} }
@ -256,7 +258,7 @@ class Don extends CommonObject
{ {
if (!isset($map[substr($this->amount, $i, 1)] )) if (!isset($map[substr($this->amount, $i, 1)] ))
{ {
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount'));
$err++; $err++;
$amount_invalid = 1; $amount_invalid = 1;
break; break;
@ -267,14 +269,14 @@ class Don extends CommonObject
{ {
if ($this->amount == 0) if ($this->amount == 0)
{ {
$error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $error_string[] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount'));
$err++; $err++;
} }
else else
{ {
if ($this->amount < $minimum && $minimum > 0) if ($this->amount < $minimum && $minimum > 0)
{ {
$error_string[$err] = $langs->trans('MinimumAmount',$langs->trans('$minimum')); $error_string[] = $langs->trans('MinimumAmount',$langs->trans('$minimum'));
$err++; $err++;
} }
} }
@ -282,14 +284,13 @@ class Don extends CommonObject
if ($err) if ($err)
{ {
$this->error = $error_string; $this->errors = $error_string;
return 0; return 0;
} }
else else
{ {
return 1; return 1;
} }
} }
/** /**
@ -311,7 +312,7 @@ class Don extends CommonObject
$this->country=($this->country?$this->country:$this->country); $this->country=($this->country?$this->country:$this->country);
$now=dol_now(); $now=dol_now();
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."don ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."don (";
@ -368,7 +369,7 @@ class Don extends CommonObject
// Call trigger // Call trigger
$result=$this->call_trigger('DON_CREATE',$user); $result=$this->call_trigger('DON_CREATE',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; } if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers // End call triggers
$this->db->commit(); $this->db->commit();
@ -398,7 +399,7 @@ class Don extends CommonObject
$this->country=($this->country?$this->country:$this->country); $this->country=($this->country?$this->country:$this->country);
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."don SET ";
$sql .= "amount = " . price2num($this->amount); $sql .= "amount = " . price2num($this->amount);
$sql .= ",fk_paiement = ".($this->modepaiementid?$this->modepaiementid:"null"); $sql .= ",fk_paiement = ".($this->modepaiementid?$this->modepaiementid:"null");
@ -426,9 +427,9 @@ class Don extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('DON_UPDATE',$user); $result=$this->call_trigger('DON_UPDATE',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; } if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers // End call triggers
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@ -448,7 +449,7 @@ class Don extends CommonObject
*/ */
function delete($rowid) function delete($rowid)
{ {
$this->db-begin(); $this->db-begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;";
@ -460,9 +461,9 @@ class Don extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('DON_DELETE',$user); $result=$this->call_trigger('DON_DELETE',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; } if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers // End call triggers
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }

View File

@ -101,7 +101,7 @@ if ($id > 0 || ! empty($ref)) {
} }
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('invoicecard')); $hookmanager->initHooks(array('invoicecard','globalcard'));
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
@ -865,7 +865,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->origin_id = $originid; $object->origin_id = $originid;
// Possibility to add external linked objects with hooks // Possibility to add external linked objects with hooks
$object->linked_objects [$object->origin] = $object->origin_id; $object->linked_objects[$object->origin] = $object->origin_id;
// link with order if it is a shipping invoice // link with order if it is a shipping invoice
if ($object->origin == 'shipping') if ($object->origin == 'shipping')
{ {
@ -873,10 +873,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
$exp = new Expedition($db); $exp = new Expedition($db);
$exp->fetch($object->origin_id); $exp->fetch($object->origin_id);
$exp->fetchObjectLinked(); $exp->fetchObjectLinked();
if (count ($exp->linkedObjectsIds['commande']) > 0) $object->linked_objects['commande'] = $exp->linkedObjectsIds['commande'][0]; if (count($exp->linkedObjectsIds['commande']) > 0) $object->linked_objects['commande'] = $exp->linkedObjectsIds['commande'][0];
} }
if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) { if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects']))
{
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
} }

View File

@ -526,7 +526,7 @@ else
{ {
echo '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;socid='.$object->thirdparty->id.'&amp;fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>'; echo '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;socid='.$object->thirdparty->id.'&amp;fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
} }
if ($object->statut == 0 && $user->rights->facture->supprimer) if ($object->statut == 0 && $user->rights->facture->supprimer)
{ {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
@ -544,7 +544,7 @@ else
/* /*
* List mode * List mode
*/ */
$sql = "SELECT s.nom, s.rowid as socid, f.titre, f.total, f.rowid as facid"; $sql = "SELECT s.nom as name, s.rowid as socid, f.titre, f.total, f.rowid as facid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
@ -584,13 +584,13 @@ else
print "</a></td>\n"; print "</a></td>\n";
$companystatic->id=$objp->socid; $companystatic->id=$objp->socid;
$companystatic->name=$objp->nom; $companystatic->name=$objp->name;
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>'; print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
print '<td align="right">'.price($objp->total).'</td>'."\n"; print '<td align="right">'.price($objp->total).'</td>'."\n";
echo '<td align="center">'; echo '<td align="center">';
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
{ {
echo '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;socid='.$objp->socid.'&amp;fac_rec='.$objp->facid.'">'; echo '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;socid='.$objp->socid.'&amp;fac_rec='.$objp->facid.'">';

View File

@ -395,7 +395,7 @@ if (! $sortorder) $sortorder="ASC";
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$sql = "SELECT s.nom, s.rowid as socid, s.email"; $sql = "SELECT s.nom as name, s.rowid as socid, s.email";
$sql.= ", f.rowid as facid, f.facnumber, f.ref_client, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp"; $sql.= ", f.rowid as facid, f.facnumber, f.ref_client, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp";
$sql.= ", f.datef as df, f.date_lim_reglement as datelimite"; $sql.= ", f.datef as df, f.date_lim_reglement as datelimite";
$sql.= ", f.paye as paye, f.fk_statut, f.type, f.fk_mode_reglement"; $sql.= ", f.paye as paye, f.fk_statut, f.type, f.fk_mode_reglement";
@ -462,7 +462,7 @@ if ($resql)
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param); $urlsource.=str_replace('&amp;','&',$param);
$titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->nom):$langs->trans("BillsCustomersUnpaid")); $titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->name):$langs->trans("BillsCustomersUnpaid"));
if ($option == 'late') $titre.=' ('.$langs->trans("Late").')'; if ($option == 'late') $titre.=' ('.$langs->trans("Late").')';
else $titre.=' ('.$langs->trans("All").')'; else $titre.=' ('.$langs->trans("All").')';
@ -658,7 +658,7 @@ if ($resql)
print '<td>'; print '<td>';
$thirdparty=new Societe($db); $thirdparty=new Societe($db);
$thirdparty->id=$objp->socid; $thirdparty->id=$objp->socid;
$thirdparty->nom=$objp->nom; $thirdparty->name=$objp->name;
$thirdparty->client=$objp->client; $thirdparty->client=$objp->client;
$thirdparty->code_client=$objp->code_client; $thirdparty->code_client=$objp->code_client;
print $thirdparty->getNomUrl(1,'customer'); print $thirdparty->getNomUrl(1,'customer');

View File

@ -144,7 +144,7 @@ else $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc,'; $sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid as socid, s.code_client, s.client '; $sql.= ' s.nom as name, s.rowid as socid, s.code_client, s.client ';
if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= ', '.MAIN_DB_PREFIX.'facture as f'; $sql.= ', '.MAIN_DB_PREFIX.'facture as f';
@ -265,7 +265,7 @@ if ($resql)
if ($search_user > 0) $param.='&search_user=' .$search_user; if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht; if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc; if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc;
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->nom:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
$i = 0; $i = 0;
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";
@ -400,7 +400,7 @@ if ($resql)
print '<td>'; print '<td>';
$thirdparty=new Societe($db); $thirdparty=new Societe($db);
$thirdparty->id=$objp->socid; $thirdparty->id=$objp->socid;
$thirdparty->nom=$objp->nom; $thirdparty->name=$objp->name;
$thirdparty->client=$objp->client; $thirdparty->client=$objp->client;
$thirdparty->code_client=$objp->code_client; $thirdparty->code_client=$objp->code_client;
print $thirdparty->getNomUrl(1,'customer'); print $thirdparty->getNomUrl(1,'customer');

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com> /* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012-2014 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -38,6 +38,8 @@ $langs->load('users');
$langs->load('holidays'); $langs->load('holidays');
$langs->load('trips'); $langs->load('trips');
$socid=GETPOST("socid");
// Protection if external user // Protection if external user
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id > 0) accessforbidden();
@ -117,7 +119,7 @@ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAI
$sql.= " WHERE u.rowid = d.fk_user"; $sql.= " WHERE u.rowid = d.fk_user";
$sql.= " AND d.entity = ".$conf->entity; $sql.= " AND d.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND d.fk_soc = ".$socid; if (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid;
$sql.= $db->order("d.tms","DESC"); $sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);

View File

@ -145,7 +145,7 @@ if (! empty($conf->don->enabled) && $user->rights->don->lire)
if (! empty($conf->facture->enabled) && $user->rights->facture->lire) if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,"; $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; 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"; $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"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -185,7 +185,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</td>'; print '</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
$companystatic->id=$obj->socid; $companystatic->id=$obj->socid;
$companystatic->nom=$obj->nom; $companystatic->name=$obj->name;
$companystatic->client=1; $companystatic->client=1;
print $companystatic->getNomUrl(1,'',16); print $companystatic->getNomUrl(1,'',16);
print '</td>'; print '</td>';
@ -219,7 +219,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.type,"; $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.type,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; $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"; 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"; $sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0";
@ -254,7 +254,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$companystatic->id=$obj->socid; $companystatic->id=$obj->socid;
$companystatic->nom=$obj->nom; $companystatic->name=$obj->name;
$companystatic->client=1; $companystatic->client=1;
print $companystatic->getNomUrl(1,'',16); print $companystatic->getNomUrl(1,'',16);
print '</td>'; print '</td>';
@ -294,7 +294,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.total_ttc, f.paye, f.tms,"; $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.total_ttc, f.paye, f.tms,";
$sql.= " f.date_lim_reglement as datelimite,"; $sql.= " f.date_lim_reglement as datelimite,";
$sql.= " s.nom, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
$sql.= " sum(pf.amount) as am"; $sql.= " sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $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"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
@ -351,7 +351,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</td>'; print '</td>';
print '<td align="left">'; print '<td align="left">';
$thirdpartystatic->id=$obj->socid; $thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom; $thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=1; $thirdpartystatic->client=1;
print $thirdpartystatic->getNomUrl(1,'customer',44); print $thirdpartystatic->getNomUrl(1,'customer',44);
print '</td>'; print '</td>';
@ -392,7 +392,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$facstatic=new FactureFournisseur($db); $facstatic=new FactureFournisseur($db);
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye"; $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye";
$sql.= ", s.nom, s.rowid as socid"; $sql.= ", s.nom as name, s.rowid as socid";
$sql.= ", SUM(pf.amount) as am"; $sql.= ", SUM(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $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"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
@ -432,7 +432,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$thirdpartystatic->id=$obj->socid; $thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom; $thirdpartystatic->name=$obj->name;
$thirdpartystatic->fournisseur=1; $thirdpartystatic->fournisseur=1;
print $thirdpartystatic->getNomUrl(1,'supplier',44); print $thirdpartystatic->getNomUrl(1,'supplier',44);
print '</td>'; print '</td>';
@ -613,7 +613,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
$langs->load("orders"); $langs->load("orders");
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,"; $sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,";
$sql.= " s.nom, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
$sql.= " c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_ttc"; $sql.= " c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -675,7 +675,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
print '<td align="left">'; print '<td align="left">';
$societestatic->id=$obj->socid; $societestatic->id=$obj->socid;
$societestatic->nom=$obj->nom; $societestatic->name=$obj->name;
$societestatic->client=1; $societestatic->client=1;
print $societestatic->getNomUrl(1,'customer',44); print $societestatic->getNomUrl(1,'customer',44);
print '</a></td>'; print '</a></td>';
@ -717,7 +717,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.total_ttc, f.paye, f.tms,"; $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.total_ttc, f.paye, f.tms,";
$sql.= " f.date_lim_reglement as datelimite,"; $sql.= " f.date_lim_reglement as datelimite,";
$sql.= " s.nom, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
$sql.= " sum(pf.amount) as am"; $sql.= " sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $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"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
@ -774,7 +774,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</td>'; print '</td>';
print '<td align="left">' ; print '<td align="left">' ;
$societestatic->id=$obj->socid; $societestatic->id=$obj->socid;
$societestatic->nom=$obj->nom; $societestatic->name=$obj->name;
$societestatic->client=1; $societestatic->client=1;
print $societestatic->getNomUrl(1,'customer',44); print $societestatic->getNomUrl(1,'customer',44);
print '</a></td>'; print '</a></td>';
@ -821,7 +821,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$facstatic=new FactureFournisseur($db); $facstatic=new FactureFournisseur($db);
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
$sql.= " s.nom, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
$sql.= " sum(pf.amount) as am"; $sql.= " sum(pf.amount) as am";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $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"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
@ -863,7 +863,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
print $facstatic->getNomUrl(1,''); print $facstatic->getNomUrl(1,'');
print '</td>'; print '</td>';
$societestatic->id=$obj->socid; $societestatic->id=$obj->socid;
$societestatic->nom=$obj->nom; $societestatic->name=$obj->name;
$societestatic->client=0; $societestatic->client=0;
print '<td>'.$societestatic->getNomUrl(1, 'supplier', 44).'</td>'; print '<td>'.$societestatic->getNomUrl(1, 'supplier', 44).'</td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>'; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';

View File

@ -149,7 +149,8 @@ $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
$vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code); $vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
// IRPF that the customer has retained me // IRPF that the customer has retained me
if($conf->global->$calc ==0 || $conf->global->$calc == 2){ if($conf->global->$calc ==0 || $conf->global->$calc == 2)
{
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td align="left">'.$langs->trans("Num")."</td>"; print '<td align="left">'.$langs->trans("Num")."</td>";
@ -160,7 +161,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2){
print "</tr>\n"; print "</tr>\n";
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
$action = "tvaclient"; $action = "tvaclient";
$object = &$coll_list; $object = &$coll_list;
$parameters["mode"] = $modetax; $parameters["mode"] = $modetax;
@ -170,7 +171,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2){
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (is_array($coll_list)) if (is_array($coll_list))
{ {
$var=true; $var=true;
@ -196,7 +197,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2){
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td class="nowrap">'.$i."</td>"; print '<td class="nowrap">'.$i."</td>";
$company_static->id=$coll->socid; $company_static->id=$coll->socid;
$company_static->nom=$coll->nom; $company_static->name=$coll->name;
print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>'; print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>';
$find = array(' ','.'); $find = array(' ','.');
$replace = array('',''); $replace = array('','');
@ -210,7 +211,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2){
} }
} }
$x_coll_sum = $total; $x_coll_sum = $total;
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>'; print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
print '<td class="nowrap" align="right">'.price($totalamount).'</td>'; print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
print '<td class="nowrap" align="right">'.price($total).'</td>'; print '<td class="nowrap" align="right">'.price($total).'</td>';
@ -240,7 +241,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
print "</tr>\n"; print "</tr>\n";
$company_static=new Societe($db); $company_static=new Societe($db);
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = 'buy'; $parameters["direction"] = 'buy';
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -269,7 +270,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td class="nowrap">'.$i."</td>"; print '<td class="nowrap">'.$i."</td>";
$company_static->id=$coll->socid; $company_static->id=$coll->socid;
$company_static->nom=$coll->nom; $company_static->name=$coll->name;
print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>'; print '<td class="nowrap">'.$company_static->getNomUrl(1).'</td>';
$find = array(' ','.'); $find = array(' ','.');
$replace = array('',''); $replace = array('','');
@ -283,14 +284,14 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
} }
} }
$x_paye_sum = $total; $x_paye_sum = $total;
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>'; print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
print '<td class="nowrap" align="right">'.price($totalamount).'</td>'; print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
print '<td class="nowrap" align="right">'.price($total).'</td>'; print '<td class="nowrap" align="right">'.price($total).'</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
} }
else else
{ {

View File

@ -67,7 +67,7 @@ if ($facid > 0)
} }
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('paiementcard')); $hookmanager->initHooks(array('paiementcard','globalcard'));
$parameters=array('socid'=>$socid); $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks

View File

@ -273,7 +273,7 @@ print '</table>';
*/ */
$disable_delete = 0; $disable_delete = 0;
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom, s.rowid as socid'; $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$sql.= ' WHERE pf.fk_facture = f.rowid'; $sql.= ' WHERE pf.fk_facture = f.rowid';
$sql.= ' AND f.fk_soc = s.rowid'; $sql.= ' AND f.fk_soc = s.rowid';
@ -322,7 +322,7 @@ if ($resql)
// Third party // Third party
print '<td>'; print '<td>';
$thirdpartystatic->id=$objp->socid; $thirdpartystatic->id=$objp->socid;
$thirdpartystatic->nom=$objp->nom; $thirdpartystatic->name=$objp->name;
print $thirdpartystatic->getNomUrl(1); print $thirdpartystatic->getNomUrl(1);
print '</td>'; print '</td>';

View File

@ -221,7 +221,7 @@ class Paiement extends CommonObject
if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice. We do nothing more."); if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice. We do nothing more.");
else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more."); else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more."); else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
else else
{ {
$result=$invoice->set_paid($user,'',''); $result=$invoice->set_paid($user,'','');
if ($result<0) if ($result<0)
@ -360,8 +360,8 @@ class Paiement extends CommonObject
{ {
// Appel des triggers // Appel des triggers
$result=$this->call_trigger('PAYMENT_DELETE', $user); $result=$this->call_trigger('PAYMENT_DELETE', $user);
if ($result < 0) if ($result < 0)
{ {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -483,7 +483,7 @@ class Paiement extends CommonObject
$bank_line_id, $bank_line_id,
$fac->thirdparty->id, $fac->thirdparty->id,
DOL_URL_ROOT.'/comm/card.php?socid=', DOL_URL_ROOT.'/comm/card.php?socid=',
$fac->thirdparty->nom, $fac->thirdparty->name,
'company' 'company'
); );
if ($result <= 0) dol_print_error($this->db); if ($result <= 0) dol_print_error($this->db);
@ -501,7 +501,7 @@ class Paiement extends CommonObject
$bank_line_id, $bank_line_id,
$fac->thirdparty->id, $fac->thirdparty->id,
DOL_URL_ROOT.'/fourn/card.php?socid=', DOL_URL_ROOT.'/fourn/card.php?socid=',
$fac->thirdparty->nom, $fac->thirdparty->name,
'company' 'company'
); );
if ($result <= 0) dol_print_error($this->db); if ($result <= 0) dol_print_error($this->db);

View File

@ -85,7 +85,7 @@ else
//$sql.= " c.libelle as paiement_type,"; //$sql.= " c.libelle as paiement_type,";
$sql.= " c.code as paiement_code,"; $sql.= " c.code as paiement_code,";
$sql.= " ba.rowid as bid, ba.label,"; $sql.= " ba.rowid as bid, ba.label,";
$sql.= " s.rowid as socid, s.nom"; $sql.= " s.rowid as socid, s.nom as name";
//$sql.= " f.facnumber"; //$sql.= " f.facnumber";
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement as p)"; $sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement as p)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
@ -197,7 +197,7 @@ if ($resql)
if ($objp->socid) if ($objp->socid)
{ {
$companystatic->id=$objp->socid; $companystatic->id=$objp->socid;
$companystatic->nom=$objp->nom; $companystatic->name=$objp->name;
print $companystatic->getNomUrl(1,'',24); print $companystatic->getNomUrl(1,'',24);
} }
else print '&nbsp;'; else print '&nbsp;';

View File

@ -760,7 +760,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc"; $sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc";
$sql.= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib"; $sql.= ", pfd.code_banque, pfd.code_guichet, pfd.number, pfd.cle_rib";
$sql.= ", pfd.amount"; $sql.= ", pfd.amount";
$sql.= ", s.nom"; $sql.= ", s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
@ -829,8 +829,8 @@ class BonPrelevement extends CommonObject
} }
else else
{ {
dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->nom, LOG_ERR); dol_syslog("Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
$facture_errors[$fac[0]]="Error on default bank number RIB/IBAN for thirdparty reported by function verif() ".$fact->socid." ".$soc->nom; $facture_errors[$fac[0]]="Error on default bank number RIB/IBAN for thirdparty reported by function verif() ".$fact->socid." ".$soc->name;
} }
} }
else else
@ -1262,7 +1262,7 @@ class BonPrelevement extends CommonObject
* section Debiteur (sepa Debiteurs bloc lines) * section Debiteur (sepa Debiteurs bloc lines)
*/ */
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, c.code as country_code,"; $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; $sql.= " pl.client_nom as name, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; $sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
$sql.= " FROM"; $sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
@ -1286,7 +1286,7 @@ class BonPrelevement extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->name, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
$this->total = $this->total + $obj->somme; $this->total = $this->total + $obj->somme;
$i++; $i++;
} }
@ -1490,7 +1490,7 @@ class BonPrelevement extends CommonObject
* Write recipient of request (customer) * Write recipient of request (customer)
* *
* @param string $row_code_client soc.code_client as code, * @param string $row_code_client soc.code_client as code,
* @param string $row_nom pl.client_nom AS nom, * @param string $row_nom pl.client_nom AS name,
* @param string $row_address soc.address AS adr, * @param string $row_address soc.address AS adr,
* @param string $row_zip soc.zip * @param string $row_zip soc.zip
* @param string $row_town soc.town * @param string $row_town soc.town

View File

@ -244,7 +244,7 @@ class RejetPrelevement
$arr_mime = array(); $arr_mime = array();
$arr_name = array(); $arr_name = array();
$facref = $fac->ref; $facref = $fac->ref;
$socname = $soc->nom; $socname = $soc->name;
$amount = price($fac->total_ttc); $amount = price($fac->total_ttc);
$userinfo = $this->user->getFullName($langs); $userinfo = $this->user->getFullName($langs);

View File

@ -156,7 +156,7 @@ print '<br>';
* Invoices waiting for withdraw * Invoices waiting for withdraw
*/ */
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.rowid as socid,"; $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande"; $sql.= " pfd.date_demande";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."societe as s,";
@ -197,7 +197,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$thirdpartystatic->id=$obj->socid; $thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom; $thirdpartystatic->name=$obj->name;
print $thirdpartystatic->getNomUrl(1,'customer'); print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';

View File

@ -67,7 +67,7 @@ if (! $sortfield) $sortfield="f.facnumber";
*/ */
$sql= "SELECT f.facnumber, f.rowid, f.total_ttc,"; $sql= "SELECT f.facnumber, f.rowid, f.total_ttc,";
$sql.= " s.nom, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande as date_demande,"; $sql.= " pfd.date_demande as date_demande,";
$sql.= " pfd.fk_user_demande"; $sql.= " pfd.fk_user_demande";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
@ -137,7 +137,7 @@ if ($resql)
print '<td>'; print '<td>';
$thirdpartystatic->id=$obj->socid; $thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom; $thirdpartystatic->name=$obj->name;
print $thirdpartystatic->getNomUrl(1,'customer'); print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>'; print '</td>';

View File

@ -63,17 +63,17 @@ if ($prev_id)
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
// Status // Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>'; print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>'; print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>'; print '</tr>';
if($bon->date_trans <> 0) if($bon->date_trans <> 0)
{ {
$muser = new User($db); $muser = new User($db);
$muser->fetch($bon->user_trans); $muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>'; print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day'); print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>'; print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
@ -87,19 +87,19 @@ if ($prev_id)
print dol_print_date($bon->date_credit,'day'); print dol_print_date($bon->date_credit,'day');
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">'; print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>'; print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref; $relativepath = 'receipts/'.$bon->ref;
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>'; print '</td></tr></table>';
dol_fiche_end(); dol_fiche_end();
} }
else else
{ {
@ -114,7 +114,7 @@ $offset = $conf->liste_limit * $page ;
*/ */
$sql = "SELECT pf.rowid"; $sql = "SELECT pf.rowid";
$sql.= ",f.rowid as facid, f.facnumber as ref, f.total_ttc"; $sql.= ",f.rowid as facid, f.facnumber as ref, f.total_ttc";
$sql.= ", s.rowid as socid, s.nom, pl.statut"; $sql.= ", s.rowid as socid, s.nom as name, pl.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture as pf";
@ -166,7 +166,7 @@ if ($result)
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n"; print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">';
print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."</a></td>\n"; print img_object($langs->trans("ShowCompany"),"company"). ' '.$obj->name."</a></td>\n";
print '<td align="center">'.price($obj->total_ttc)."</td>\n"; print '<td align="center">'.price($obj->total_ttc)."</td>\n";

View File

@ -62,17 +62,17 @@ if ($prev_id)
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
// Status // Status
print '<tr><td width="20%">'.$langs->trans('Status').'</td>'; print '<tr><td width="20%">'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>'; print '<td>'.$bon->getLibStatut(1).'</td>';
print '</tr>'; print '</tr>';
if($bon->date_trans <> 0) if($bon->date_trans <> 0)
{ {
$muser = new User($db); $muser = new User($db);
$muser->fetch($bon->user_trans); $muser->fetch($bon->user_trans);
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>'; print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day'); print dol_print_date($bon->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>'; print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
@ -86,19 +86,19 @@ if ($prev_id)
print dol_print_date($bon->date_credit,'day'); print dol_print_date($bon->date_credit,'day');
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<table class="border" width="100%"><tr><td width="20%">'; print '<table class="border" width="100%"><tr><td width="20%">';
print $langs->trans("WithdrawalFile").'</td><td>'; print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref; $relativepath = 'receipts/'.$bon->ref;
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>'; print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>'; print '</td></tr></table>';
dol_fiche_end(); dol_fiche_end();
} }
else else
{ {
@ -112,7 +112,7 @@ $rej = new RejetPrelevement($db, $user);
* Liste des factures * Liste des factures
*/ */
$sql = "SELECT pl.rowid, pl.amount, pl.statut"; $sql = "SELECT pl.rowid, pl.amount, pl.statut";
$sql.= " , s.rowid as socid, s.nom"; $sql.= " , s.rowid as socid, s.nom as name";
$sql.= " , pr.motif, pr.afacturer, pr.fk_facture"; $sql.= " , pr.motif, pr.afacturer, pr.fk_facture";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@ -152,7 +152,7 @@ if ($resql)
print img_picto('', 'statut'.$obj->statut).' '; print img_picto('', 'statut'.$obj->statut).' ';
print substr('000000'.$obj->rowid, -6); print substr('000000'.$obj->rowid, -6);
print '</a></td>'; print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n"; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n"; print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td>'.$rej->motifs[$obj->motif].'</td>'; print '<td>'.$rej->motifs[$obj->motif].'</td>';

View File

@ -96,7 +96,7 @@ print '</td></tr></table><br>';
*/ */
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
$sql.= " pfd.date_demande,"; $sql.= " pfd.date_demande,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -137,7 +137,7 @@ if ($resql)
print '<td>'; print '<td>';
$thirdpartystatic->id=$obj->socid; $thirdpartystatic->id=$obj->socid;
$thirdpartystatic->nom=$obj->nom; $thirdpartystatic->name=$obj->name;
print $thirdpartystatic->getNomUrl(1,'customer'); print $thirdpartystatic->getNomUrl(1,'customer');
print '</td>'; print '</td>';

View File

@ -190,7 +190,7 @@ if ($id)
print '<td colspan="3">'.$langs->trans("WithdrawalRefused").'</td></tr>'; print '<td colspan="3">'.$langs->trans("WithdrawalRefused").'</td></tr>';
//Select yes/no //Select yes/no
print '<tr><td class="valid">'.$langs->trans("WithdrawalRefusedConfirm").' '.$soc->nom.' ?</td>'; print '<tr><td class="valid">'.$langs->trans("WithdrawalRefusedConfirm").' '.$soc->name.' ?</td>';
print '<td colspan="2" class="valid">'; print '<td colspan="2" class="valid">';
print $form->selectyesno("confirm",1,0); print $form->selectyesno("confirm",1,0);
print '</td></tr>'; print '</td></tr>';
@ -257,7 +257,7 @@ if ($id)
*/ */
$sql = "SELECT pf.rowid"; $sql = "SELECT pf.rowid";
$sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc"; $sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc";
$sql.= " , s.rowid as socid, s.nom"; $sql.= " , s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
@ -308,7 +308,7 @@ if ($id)
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n"; print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">';
print img_object($langs->trans("ShowCompany"),"company"). ' '.stripslashes($obj->nom)."</a></td>\n"; print img_object($langs->trans("ShowCompany"),"company"). ' '.$obj->name."</a></td>\n";
print '<td align="right">'.price($obj->total_ttc)."</td>\n"; print '<td align="right">'.price($obj->total_ttc)."</td>\n";

View File

@ -106,7 +106,7 @@ if ($prev_id)
print '</td></tr></table>'; print '</td></tr></table>';
dol_fiche_end(); dol_fiche_end();
} }
else else
{ {
@ -128,7 +128,7 @@ $pagenext = $page + 1;
* *
*/ */
$sql = "SELECT pl.rowid, pl.statut, pl.amount"; $sql = "SELECT pl.rowid, pl.statut, pl.amount";
$sql.= ", s.rowid as socid, s.nom"; $sql.= ", s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
@ -175,7 +175,7 @@ if ($result)
print substr('000000'.$obj->rowid, -6); print substr('000000'.$obj->rowid, -6);
print '</a></td>'; print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n"; print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
print '<td align="center">'.price($obj->amount)."</td>\n"; print '<td align="center">'.price($obj->amount)."</td>\n";

View File

@ -63,7 +63,7 @@ llxHeader('',$langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut, p.datec"; $sql = "SELECT p.rowid, p.ref, p.statut, p.datec";
$sql.= " ,f.rowid as facid, f.facnumber, f.total_ttc"; $sql.= " ,f.rowid as facid, f.facnumber, f.total_ttc";
$sql.= " , s.rowid as socid, s.nom, s.code_client"; $sql.= " , s.rowid as socid, s.nom as name, s.code_client";
$sql.= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne"; $sql.= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@ -162,7 +162,7 @@ if ($result)
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->facnumber."</a></td>\n"; print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$obj->facid.'">'.$obj->facnumber."</a></td>\n";
print '</a></td>'; print '</a></td>';
print '<td><a href="card.php?id='.$obj->rowid.'">'.$obj->nom."</a></td>\n"; print '<td><a href="card.php?id='.$obj->rowid.'">'.$obj->name."</a></td>\n";
print '<td align="center"><a href="card.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n"; print '<td align="center"><a href="card.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n";

View File

@ -64,8 +64,8 @@ if ($socid > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Nom // Name
print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->nom.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Name").'</td><td width="80%" colspan="3">'.$societe->name.'</td></tr>';
// Prefix // Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field

View File

@ -120,7 +120,7 @@ $total_ttc=0;
// Affiche en-tete de rapport // Affiche en-tete de rapport
if ($modecompta=="CREANCES-DETTES") if ($modecompta=="CREANCES-DETTES")
{ {
$nom=$langs->trans("AnnualByCompaniesDueDebtMode"); $name=$langs->trans("AnnualByCompaniesDueDebtMode");
$calcmode=$langs->trans("CalcModeDebt"); $calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
@ -132,7 +132,7 @@ if ($modecompta=="CREANCES-DETTES")
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
else { else {
$nom=$langs->trans("AnnualByCompaniesInputOutputMode"); $name=$langs->trans("AnnualByCompaniesInputOutputMode");
$calcmode=$langs->trans("CalcModeEngagement"); $calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')'; $calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month")>0?'&month='.GETPOST("month"):'').'&modecompta=CREANCES-DETTES">','</a>').')';
//$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1); //$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',1,1,0,'',1,0,1);
@ -142,7 +142,7 @@ else {
$builddate=time(); $builddate=time();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
// Show report array // Show report array
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -160,7 +160,7 @@ print '<tr><td colspan="4">'.$langs->trans("CustomersInvoices").'</td></tr>';
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
{ {
$sql = "SELECT s.nom, s.rowid as socid, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc"; $sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
@ -178,7 +178,7 @@ else
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
*/ */
$sql = "SELECT s.nom as nom, s.rowid as socid, sum(pf.amount) as amount_ttc"; $sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
@ -206,7 +206,7 @@ if ($result) {
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>"; print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print "<td>".$langs->trans("Bills").' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$objp->socid.'">'.$objp->nom."</td>\n"; print "<td>".$langs->trans("Bills").' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$objp->socid.'">'.$objp->name."</td>\n";
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
print "<td align=\"right\">".price($objp->amount_ht)."</td>\n"; print "<td align=\"right\">".price($objp->amount_ht)."</td>\n";
@ -225,7 +225,7 @@ if ($result) {
// On ajoute les paiements clients anciennes version, non lie par paiement_facture // On ajoute les paiements clients anciennes version, non lie par paiement_facture
if ($modecompta != 'CREANCES-DETTES') if ($modecompta != 'CREANCES-DETTES')
{ {
$sql = "SELECT 'Autres' as nom, '0' as idp, sum(p.amount) as amount_ttc"; $sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
@ -236,8 +236,8 @@ if ($modecompta != 'CREANCES-DETTES')
$sql.= " AND ba.entity = ".$conf->entity; $sql.= " AND ba.entity = ".$conf->entity;
if (! empty($date_start) && ! empty($date_end)) if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY nom, idp"; $sql.= " GROUP BY name, idp";
$sql.= " ORDER BY nom"; $sql.= " ORDER BY name";
dol_syslog("get old customer payments not linked to invoices", LOG_DEBUG); dol_syslog("get old customer payments not linked to invoices", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -290,7 +290,7 @@ print '</tr>';
*/ */
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
{ {
$sql = "SELECT s.nom, s.rowid as socid, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc"; $sql = "SELECT s.nom as name, s.rowid as socid, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
@ -338,7 +338,7 @@ if ($result) {
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>"; print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print "<td>".$langs->trans("Bills")." <a href=\"".DOL_URL_ROOT."/fourn/facture/list.php?socid=".$objp->socid."\">".$objp->nom."</a></td>\n"; print "<td>".$langs->trans("Bills")." <a href=\"".DOL_URL_ROOT."/fourn/facture/list.php?socid=".$objp->socid."\">".$objp->name."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
print "<td align=\"right\">".price(-$objp->amount_ht)."</td>\n"; print "<td align=\"right\">".price(-$objp->amount_ht)."</td>\n";
@ -381,7 +381,7 @@ print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->t
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
{ {
$sql = "SELECT c.id, c.libelle as nom, sum(cs.amount) as amount"; $sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " WHERE cs.fk_type = c.id"; $sql.= " WHERE cs.fk_type = c.id";
@ -391,7 +391,7 @@ if ($modecompta == 'CREANCES-DETTES')
} }
else else
{ {
$sql = "SELECT c.id, c.libelle as nom, sum(p.amount) as amount"; $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
@ -424,7 +424,7 @@ if ($result) {
$var = !$var; $var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>"; print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td>'.$obj->nom.'</td>'; print '<td>'.$obj->label.'</td>';
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount).'</td>'; if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount).'</td>';
print '<td align="right">'.price(-$obj->amount).'</td>'; print '<td align="right">'.price(-$obj->amount).'</td>';
print '</tr>'; print '</tr>';
@ -455,7 +455,7 @@ print '<tr><td colspan="4">'.$langs->trans("SocialContributions").' ('.$langs->t
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
{ {
$sql = "SELECT c.id, c.libelle as nom, sum(cs.amount) as amount"; $sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= " WHERE cs.fk_type = c.id"; $sql.= " WHERE cs.fk_type = c.id";
@ -468,7 +468,7 @@ if ($modecompta == 'CREANCES-DETTES')
} }
else else
{ {
$sql = "SELECT c.id, c.libelle as nom, sum(p.amount) as amount"; $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p";
@ -501,7 +501,7 @@ if ($result) {
$var = !$var; $var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>"; print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td>'.$obj->nom.'</td>'; print '<td>'.$obj->label.'</td>';
if ($modecompta == 'CREANCES-DETTES') if ($modecompta == 'CREANCES-DETTES')
print '<td align="right">'.price(-$obj->amount).'</td>'; print '<td align="right">'.price(-$obj->amount).'</td>';
print '<td align="right">'.price(-$obj->amount).'</td>'; print '<td align="right">'.price(-$obj->amount).'</td>';
@ -547,128 +547,135 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti
* Salaries * Salaries
*/ */
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>'; if ($conf->salaries->enabled)
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
$sql.= " WHERE p.entity = ".$conf->entity;
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
$sql.= " ORDER BY u.firstname";
dol_syslog("get payment salaries");
$result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{ {
$num = $db->num_rows($result); print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
$var=true; $sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$i = 0; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
if ($num) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
{ $sql.= " WHERE p.entity = ".$conf->entity;
while ($i < $num) if (! empty($date_start) && ! empty($date_end))
{ $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$obj = $db->fetch_object($result);
$total_ht -= $obj->amount; $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
$total_ttc -= $obj->amount; $sql.= " ORDER BY u.firstname";
$subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount;
$var = !$var; dol_syslog("get payment salaries");
print "<tr ".$bc[$var]."><td>&nbsp;</td>"; $result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{
$num = $db->num_rows($result);
$var=true;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
print "<td>".$langs->trans("Salaries")." <a href=\"".DOL_URL_ROOT."/compta/salaries/index.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n"; $total_ht -= $obj->amount;
$total_ttc -= $obj->amount;
$subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount;
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount).'</td>'; $var = !$var;
print '<td align="right">'.price(-$obj->amount).'</td>'; print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '</tr>';
$i++; print "<td>".$langs->trans("Salaries")." <a href=\"".DOL_URL_ROOT."/compta/salaries/index.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
}
} if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount).'</td>';
else print '<td align="right">'.price(-$obj->amount).'</td>';
{ print '</tr>';
$var = !$var; $i++;
print "<tr ".$bc[$var]."><td>&nbsp;</td>"; }
print '<td colspan="3">'.$langs->trans("None").'</td>'; }
print '</tr>'; else
} {
$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td colspan="3">'.$langs->trans("None").'</td>';
print '</tr>';
}
}
else
{
dol_print_error($db);
}
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
print '</tr>';
} }
else
{
dol_print_error($db);
}
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
print '</tr>';
/* /*
* Dunning * Donation
*/ */
print '<tr><td colspan="4">'.$langs->trans("Donation").'</td></tr>'; if ($conf->donation->enabled)
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND fk_statut=2";
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY p.societe, p.firstname, p.lastname";
$sql.= " ORDER BY p.societe, p.firstname, p.lastname";
dol_syslog("get dunning");
$result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{ {
$num = $db->num_rows($result); print '<tr><td colspan="4">'.$langs->trans("Donation").'</td></tr>';
$var=true; $sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
$i = 0; $sql.= " FROM ".MAIN_DB_PREFIX."don as p";
if ($num) $sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND fk_statut=2";
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
$sql.= " ORDER BY p.societe, p.firstname, p.lastname, dm";
dol_syslog("get dunning");
$result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{ {
while ($i < $num) $num = $db->num_rows($result);
$var=true;
$i = 0;
if ($num)
{ {
$obj = $db->fetch_object($result); while ($i < $num)
{
$obj = $db->fetch_object($result);
$total_ht += $obj->amount; $total_ht += $obj->amount;
$total_ttc += $obj->amount; $total_ttc += $obj->amount;
$subtotal_ht += $obj->amount; $subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount; $subtotal_ttc += $obj->amount;
$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/compta/dons/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name. " ".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price($obj->amount).'</td>';
print '<td align="right">'.price($obj->amount).'</td>';
print '</tr>';
$i++;
}
}
else
{
$var = !$var; $var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>"; print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td colspan="3">'.$langs->trans("None").'</td>';
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/compta/dons/list.php?search_company=".$obj->nom."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->nom. " ".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price($obj->amount).'</td>';
print '<td align="right">'.price($obj->amount).'</td>';
print '</tr>'; print '</tr>';
$i++;
} }
} }
else else
{ {
$var = !$var; dol_print_error($db);
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td colspan="3">'.$langs->trans("None").'</td>';
print '</tr>';
} }
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>';
print '<td colspan="3" align="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
} }
else
{
dol_print_error($db);
}
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" align="right">'.price($subtotal_ht).'</td>';
print '<td colspan="3" align="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
/* /*
* VAT * VAT

View File

@ -44,7 +44,7 @@ $result = restrictedArea($user, 'salaries', '', '', '');
$sal = new PaymentSalary($db); $sal = new PaymentSalary($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('salarycard')); $hookmanager->initHooks(array('salarycard','globalcard'));

View File

@ -153,60 +153,49 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
if ($action == 'confirm_clone' && $confirm != 'yes') { $action=''; } if ($action == 'confirm_clone' && $confirm != 'yes') { $action=''; }
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer)) if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer))
{ {
$db->begin();
$db->begin();
$originalId = $id; $originalId = $id;
$object = new ChargeSociales($db);
$object->fetch($id);
if ($object->id > 0) $object = new ChargeSociales($db);
{ $object->fetch($id);
$object->paye = 0;
$object->id = $object->ref = null;
if(GETPOST('clone_for_next_month') != '') {
$object->date_ech = strtotime('+1month', $object->date_ech);
$object->periode = strtotime('+1month', $object->periode);
}
if ($object->check())
{
$id = $object->create($user);
if ($id > 0)
{
$db->commit();
$db->close();
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); if ($object->id > 0)
exit; {
} $object->paye = 0;
else $object->id = $object->ref = null;
{
$id=$originalId; if(GETPOST('clone_for_next_month') != '') {
$db->rollback();
$object->date_ech = strtotime('+1month', $object->date_ech);
if (count($object->errors)) $object->periode = strtotime('+1month', $object->periode);
{ }
setEventMessage($object->errors, 'errors');
dol_print_error($db,$object->errors); if ($object->check())
} {
else $id = $object->create($user);
{ if ($id > 0)
setEventMessage($langs->trans($object->error), 'errors'); {
dol_print_error($db,$object->error); $db->commit();
} $db->close();
}
} header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
} exit;
else }
{ else
$db->rollback(); {
dol_print_error($db,$object->error); $id=$originalId;
} $db->rollback();
setEventMessages($object->error,$object->errors, 'errors');
}
}
}
else
{
$db->rollback();
dol_print_error($db,$object->error);
}
} }
@ -301,18 +290,18 @@ if ($id > 0)
$head=tax_prepare_head($object); $head=tax_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill');
// Clone confirmation // Clone confirmation
if ($action === 'clone') if ($action === 'clone')
{ {
$formclone=array( $formclone=array(
array('type' => 'checkbox', 'name' => 'clone_for_next_month','label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_for_next_month','label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1),
); );
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneTax'),$langs->trans('ConfirmCloneTax',$object->ref),'confirm_clone',$formclone,'yes'); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneTax'),$langs->trans('ConfirmCloneTax',$object->ref),'confirm_clone',$formclone,'yes');
} }
// Confirmation de la suppression de la charge // Confirmation de la suppression de la charge
if ($action == 'paid') if ($action == 'paid')
{ {
@ -492,7 +481,7 @@ if ($id > 0)
{ {
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/charges.php?id=$object->id&amp;action=paid\">".$langs->trans("ClassifyPaid")."</a>"; print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/charges.php?id=$object->id&amp;action=paid\">".$langs->trans("ClassifyPaid")."</a>";
} }
// Clone // Clone
if ($user->rights->tax->charges->creer) if ($user->rights->tax->charges->creer)
{ {

View File

@ -106,22 +106,23 @@ class ChargeSociales extends CommonObject
return -1; return -1;
} }
} }
/*
* Check if a social contribution can be created into database /**
* * Check if a social contribution can be created into database
*/ *
function check() { * @return boolean True or false
*/
function check()
{
$newamount=price2num($this->amount,'MT'); $newamount=price2num($this->amount,'MT');
// Validation parametres // Validation parametres
if (! $newamount > 0 || empty($this->date_ech) || empty($this->periode)) if (! $newamount > 0 || empty($this->date_ech) || empty($this->periode))
{ {
return false; return false;
} }
return true; return true;
} }
@ -138,7 +139,8 @@ class ChargeSociales extends CommonObject
// Nettoyage parametres // Nettoyage parametres
$newamount=price2num($this->amount,'MT'); $newamount=price2num($this->amount,'MT');
if(!$this->check()) { if (!$this->check())
{
$this->error="ErrorBadParameter"; $this->error="ErrorBadParameter";
return -2; return -2;
} }
@ -357,7 +359,7 @@ class ChargeSociales extends CommonObject
global $langs; global $langs;
$langs->load('customers'); $langs->load('customers');
$langs->load('bills'); $langs->load('bills');
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == 0) return $langs->trans("Unpaid"); if ($statut == 0) return $langs->trans("Unpaid");

View File

@ -42,7 +42,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
$tva = new Tva($db); $tva = new Tva($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('taxvatcard')); $hookmanager->initHooks(array('taxvatcard','globalcard'));

View File

@ -110,10 +110,10 @@ $fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
// Affiche en-tete du rapport // Affiche en-tete du rapport
if ($modetax==1) // Calculate on invoice for goods and services if ($modetax==1) // Calculate on invoice for goods and services
{ {
$nom=$langs->trans("VATReportByCustomersInDueDebtMode"); $name=$langs->trans("VATReportByCustomersInDueDebtMode");
$calcmode=$langs->trans("CalcModeVATDebt"); $calcmode=$langs->trans("CalcModeVATDebt");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
//$nom.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')'; //$name.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":""); //$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
$description=$langs->trans("RulesVATDueServices"); $description=$langs->trans("RulesVATDueServices");
@ -138,10 +138,10 @@ if ($modetax==1) // Calculate on invoice for goods and services
} }
if ($modetax==0) // Invoice for goods, payment for services if ($modetax==0) // Invoice for goods, payment for services
{ {
$nom=$langs->trans("VATReportByCustomersInInputOutputMode"); $name=$langs->trans("VATReportByCustomersInInputOutputMode");
$calcmode=$langs->trans("CalcModeVATEngagement"); $calcmode=$langs->trans("CalcModeVATEngagement");
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')'; $calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
//$nom.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</a>').')'; //$name.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</a>').')';
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
//$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":""); //$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
$description=$langs->trans("RulesVATInServices"); $description=$langs->trans("RulesVATInServices");
@ -165,7 +165,7 @@ if ($modetax==0) // Invoice for goods, payment for services
$amountsup=$langs->trans("AmountHT"); $amountsup=$langs->trans("AmountHT");
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')'; if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
} }
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode); report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
$vatcust=$langs->trans("VATReceived"); $vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid"); $vatsup=$langs->trans("VATPaid");
@ -223,7 +223,7 @@ if (is_array($coll_list))
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td class="nowrap">'.$i."</td>"; print '<td class="nowrap">'.$i."</td>";
$company_static->id=$coll->socid; $company_static->id=$coll->socid;
$company_static->nom=$coll->nom; $company_static->name=$coll->name;
$company_static->client=1; $company_static->client=1;
print '<td class="nowrap">'.$company_static->getNomUrl(1,'customer').'</td>'; print '<td class="nowrap">'.$company_static->getNomUrl(1,'customer').'</td>';
$find = array(' ','.'); $find = array(' ','.');
@ -304,7 +304,7 @@ if (is_array($coll_list))
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td class="nowrap">'.$i."</td>"; print '<td class="nowrap">'.$i."</td>";
$company_static->id=$coll->socid; $company_static->id=$coll->socid;
$company_static->nom=$coll->nom; $company_static->name=$coll->name;
$company_static->fournisseur=1; $company_static->fournisseur=1;
print '<td class="nowrap">'.$company_static->getNomUrl(1,'supplier').'</td>'; print '<td class="nowrap">'.$company_static->getNomUrl(1,'supplier').'</td>';
$find = array(' ','.'); $find = array(' ','.');

View File

@ -74,7 +74,7 @@ if (! empty($canvas))
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('contactcard')); $hookmanager->initHooks(array('contactcard','globalcard'));
/* /*

View File

@ -185,7 +185,7 @@ class Contact extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('CONTACT_CREATE',$user); $result=$this->call_trigger('CONTACT_CREATE',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -304,7 +304,7 @@ class Contact extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('CONTACT_MODIFY',$user); $result=$this->call_trigger('CONTACT_MODIFY',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -374,7 +374,7 @@ class Contact extends CommonObject
$soc = new Societe($this->db); $soc = new Societe($this->db);
$soc->fetch($this->socid); $soc->fetch($this->socid);
$info[$conf->global->LDAP_CONTACT_FIELD_COMPANY] = $soc->nom; $info[$conf->global->LDAP_CONTACT_FIELD_COMPANY] = $soc->name;
if ($soc->client == 1) $info["businessCategory"] = "Customers"; if ($soc->client == 1) $info["businessCategory"] = "Customers";
if ($soc->client == 2) $info["businessCategory"] = "Prospects"; if ($soc->client == 2) $info["businessCategory"] = "Prospects";
if ($soc->fournisseur == 1) $info["businessCategory"] = "Suppliers"; if ($soc->fournisseur == 1) $info["businessCategory"] = "Suppliers";
@ -774,7 +774,7 @@ class Contact extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('CONTACT_DELETE',$user); $result=$this->call_trigger('CONTACT_DELETE',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
@ -1060,7 +1060,7 @@ class Contact extends CommonObject
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('CONTACT_ENABLEDISABLE',$user); $result=$this->call_trigger('CONTACT_ENABLEDISABLE',$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }

View File

@ -39,6 +39,7 @@ $contactid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid,''); $result = restrictedArea($user, 'contact', $contactid,'');
$search_firstlast_only=GETPOST("search_firstlast_only");
$search_lastname=GETPOST("search_lastname"); $search_lastname=GETPOST("search_lastname");
$search_firstname=GETPOST("search_firstname"); $search_firstname=GETPOST("search_firstname");
$search_societe=GETPOST("search_societe"); $search_societe=GETPOST("search_societe");
@ -51,8 +52,8 @@ $search_fax=GETPOST("search_fax");
$search_email=GETPOST("search_email"); $search_email=GETPOST("search_email");
$search_skype=GETPOST("search_skype"); $search_skype=GETPOST("search_skype");
$search_priv=GETPOST("search_priv"); $search_priv=GETPOST("search_priv");
$search_categ = GETPOST("search_categ",'int'); $search_categ=GETPOST("search_categ",'int');
$search_status = GETPOST("search_status",'int'); $search_statu=GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first if ($search_status=='') $search_status=1; // always display activ customer first
@ -74,7 +75,12 @@ $offset = $limit * $page;
$langs->load("companies"); $langs->load("companies");
$titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); $titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses"));
if ($type == "c" || $type=="p") if ($type == "p")
{
$titre.=' ('.$langs->trans("ThirdPartyProspects").')';
$urlfiche="card.php";
}
if ($type == "c")
{ {
$titre.=' ('.$langs->trans("ThirdPartyCustomers").')'; $titre.=' ('.$langs->trans("ThirdPartyCustomers").')';
$urlfiche="card.php"; $urlfiche="card.php";
@ -92,6 +98,7 @@ else if ($type == "o")
if (GETPOST('button_removefilter')) if (GETPOST('button_removefilter'))
{ {
$search_firstlast_only="";
$search_lastname=""; $search_lastname="";
$search_firstname=""; $search_firstname="";
$search_societe=""; $search_societe="";
@ -154,6 +161,9 @@ else
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_firstlast_only) {
$sql .= natural_search(array('p.lastname','p.firstname'), $search_firstlast_only);
}
if ($search_lastname) { // filter on lastname if ($search_lastname) { // filter on lastname
$sql .= natural_search('p.lastname', $search_lastname); $sql .= natural_search('p.lastname', $search_lastname);
} }
@ -213,7 +223,7 @@ else if ($type == "p") // filtre sur type
} }
if ($sall) if ($sall)
{ {
$sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email'), $sall); $sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email', 's.nom'), $sall);
} }
if (! empty($socid)) if (! empty($socid))
{ {
@ -277,9 +287,12 @@ if ($result)
if ($sall) if ($sall)
{ {
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall; print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("ThirdParty")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall;
} }
if ($search_firstlast_only)
{
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")."): ".$search_firstlast_only;
}
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
// Ligne des titres // Ligne des titres

View File

@ -75,7 +75,7 @@ if ($company->id)
if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL"); if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL");
if ($company->email != $contact->email) $v->setEmail($company->email,'internet'); if ($company->email != $contact->email) $v->setEmail($company->email,'internet');
// Si contact lie a un tiers non de type "particulier" // Si contact lie a un tiers non de type "particulier"
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->nom); if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name);
} }
// Personal informations // Personal informations

View File

@ -29,18 +29,18 @@
*/ */
require ("../main.inc.php"); require ("../main.inc.php");
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/modules/contract/modules_contract.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
@ -66,7 +66,7 @@ $result=restrictedArea($user,'contrat',$id);
$usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0); $usehm=(! empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:0);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('contractcard')); $hookmanager->initHooks(array('contractcard','globalcard'));
$object = new Contrat($db); $object = new Contrat($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -215,7 +215,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
$object->fk_project = GETPOST('projectid','int'); $object->fk_project = GETPOST('projectid','int');
$object->remise_percent = GETPOST('remise_percent','alpha'); $object->remise_percent = GETPOST('remise_percent','alpha');
$object->ref = GETPOST('ref','alpha'); $object->ref = GETPOST('ref','alpha');
$object->ref_customer = GETPOST('ref_customer','alpha'); $object->ref_supplier = GETPOST('ref_supplier','alpha');
// If creation from another object of another module (Example: origin=propal, originid=1) // If creation from another object of another module (Example: origin=propal, originid=1)
if ($_POST['origin'] && $_POST['originid']) if ($_POST['origin'] && $_POST['originid'])
@ -718,13 +718,17 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
$action = 'edit_extras'; $action = 'edit_extras';
setEventMessage($object->error,'errors'); setEventMessage($object->error,'errors');
} }
} elseif ($action=='setref_customer') { } elseif ($action=='setref_supplier') {
$object->ref_customer=GETPOST('ref_customer','alpha'); $result = $object->fetch($id);
if ($result < 0) {
setEventMessage($object->errors,'errors');
}
$object->ref_supplier=GETPOST('ref_supplier','alpha');
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors,'errors'); setEventMessage($object->errors,'errors');
$action='editref_customer'; $action='editref_supplier';
} else { } else {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
@ -934,7 +938,7 @@ if ($action == 'create')
// Ref Int // Ref Int
print '<tr><td>'.$langs->trans('RefCustomer').'</td>'; print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td colspan="2"><input type="text" siez="5" name="ref_customer" id="ref_customer" value="'.GETPOST('ref_customer','alpha').'"></td></tr>'; print '<td colspan="2"><input type="text" siez="5" name="ref_supplier" id="ref_supplier" value="'.GETPOST('ref_supplier','alpha').'"></td></tr>';
// Customer // Customer
print '<tr>'; print '<tr>';
@ -1131,9 +1135,9 @@ else
print '<tr>'; print '<tr>';
print '<td width="20%">'; print '<td width="20%">';
print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); print $form->editfieldkey("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer);
print '</td><td>'; print '</td><td>';
print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); print $form->editfieldval("RefCustomer",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -1812,8 +1816,8 @@ else
/* /*
* Linked object block * Linked object block
*/ */
$somethingshown = $object->showLinkedObjectBlock(); $somethingshown=$object->showLinkedObjectBlock();
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -5,9 +5,9 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,9 +29,9 @@
* \brief File of class to manage contracts * \brief File of class to manage contracts
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
require_once(DOL_DOCUMENT_ROOT ."/margin/lib/margins.lib.php"); require_once DOL_DOCUMENT_ROOT . '/margin/lib/margins.lib.php';
/** /**
* Class to manage contracts * Class to manage contracts
@ -42,11 +42,12 @@ class Contrat extends CommonObject
public $table_element='contrat'; public $table_element='contrat';
public $table_element_line='contratdet'; public $table_element_line='contratdet';
public $fk_element='fk_contrat'; public $fk_element='fk_contrat';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $id; var $id;
var $ref; var $ref;
var $ref_ext; var $ref_ext;
var $ref_customer; var $ref_supplier;
var $socid; var $socid;
var $societe; // Objet societe var $societe; // Objet societe
var $statut=0; // 0=Draft, var $statut=0; // 0=Draft,
@ -403,7 +404,7 @@ class Contrat extends CommonObject
$sql.= " fk_projet,"; $sql.= " fk_projet,";
$sql.= " fk_commercial_signature, fk_commercial_suivi,"; $sql.= " fk_commercial_signature, fk_commercial_suivi,";
$sql.= " note_private, note_public, model_pdf, extraparams"; $sql.= " note_private, note_public, model_pdf, extraparams";
$sql.= " ,ref_customer"; $sql.= " ,ref_supplier";
$sql.= " ,ref_ext"; $sql.= " ,ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat";
if ($ref) if ($ref)
@ -423,7 +424,7 @@ class Contrat extends CommonObject
{ {
$this->id = $result["rowid"]; $this->id = $result["rowid"];
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"]; $this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"];
$this->ref_customer = $result["ref_customer"]; $this->ref_supplier = $result["ref_supplier"];
$this->ref_ext = $result["ref_ext"]; $this->ref_ext = $result["ref_ext"];
$this->statut = $result["statut"]; $this->statut = $result["statut"];
$this->mise_en_service = $this->db->jdate($result["datemise"]); $this->mise_en_service = $this->db->jdate($result["datemise"]);
@ -726,7 +727,7 @@ class Contrat extends CommonObject
// Insert contract // Insert contract
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,"; $sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
$sql.= " ref, entity, note_private, note_public, ref_customer, ref_ext)"; $sql.= " ref, entity, note_private, note_public, ref_supplier, ref_ext)";
$sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id; $sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
$sql.= ", '".$this->db->idate($this->date_contrat)."'"; $sql.= ", '".$this->db->idate($this->date_contrat)."'";
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL"); $sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
@ -736,7 +737,7 @@ class Contrat extends CommonObject
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_customer)?("'".$this->db->escape($this->ref_customer)."'"):"NULL"); $sql.= ", ".(!empty($this->ref_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL"); $sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
$sql.= ")"; $sql.= ")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -988,7 +989,7 @@ class Contrat extends CommonObject
// Clean parameters // Clean parameters
if (isset($this->ref)) $this->ref=trim($this->ref); if (isset($this->ref)) $this->ref=trim($this->ref);
if (isset($this->ref_customer)) $this->ref_customer=trim($this->ref_customer); if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext); if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext);
if (isset($this->entity)) $this->entity=trim($this->entity); if (isset($this->entity)) $this->entity=trim($this->entity);
if (isset($this->statut)) $this->statut=trim($this->statut); if (isset($this->statut)) $this->statut=trim($this->statut);
@ -1012,7 +1013,7 @@ class Contrat extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET";
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
$sql.= " ref_customer=".(isset($this->ref_customer)?"'".$this->db->escape($this->ref_customer)."'":"null").","; $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").",";
$sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").","; $sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").",";
$sql.= " entity=".$conf->entity.","; $sql.= " entity=".$conf->entity.",";
$sql.= " date_contrat=".(dol_strlen($this->date_contrat)!=0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').","; $sql.= " date_contrat=".(dol_strlen($this->date_contrat)!=0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').",";

View File

@ -227,7 +227,7 @@ print "</table><br>";
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{ {
$sql = "SELECT c.rowid as ref, c.rowid,"; $sql = "SELECT c.rowid as ref, c.rowid,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.rowid = c.fk_soc"; $sql.= " WHERE s.rowid = c.fk_soc";
@ -262,7 +262,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$companystatic->id=$obj->socid; $companystatic->id=$obj->socid;
$companystatic->nom=$obj->nom; $companystatic->name=$obj->name;
$companystatic->client=1; $companystatic->client=1;
print $companystatic->getNomUrl(1,'',16); print $companystatic->getNomUrl(1,'',16);
print '</td>'; print '</td>';
@ -298,7 +298,7 @@ $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.d
$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,'; $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,';
$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,'; $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,';
$sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid as socid"; $sql.= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
$sql.= " ".MAIN_DB_PREFIX."contrat as c"; $sql.= " ".MAIN_DB_PREFIX."contrat as c";
@ -342,7 +342,7 @@ if ($result)
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$staticcompany->id=$obj->socid; $staticcompany->id=$obj->socid;
$staticcompany->nom=$obj->nom; $staticcompany->name=$obj->name;
print $staticcompany->getNomUrl(1,'',20); print $staticcompany->getNomUrl(1,'',20);
print '</td>'; print '</td>';
print '<td align="center">'.dol_print_date($obj->tms,'dayhour').'</td>'; print '<td align="center">'.dol_print_date($obj->tms,'dayhour').'</td>';
@ -369,7 +369,7 @@ print '<br>';
// Last modified services // Last modified services
$sql = "SELECT c.ref, c.fk_soc, "; $sql = "SELECT c.ref, c.fk_soc, ";
$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,"; $sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
$sql.= " s.nom,"; $sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
@ -423,7 +423,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$staticcompany->id=$obj->fk_soc; $staticcompany->id=$obj->fk_soc;
$staticcompany->nom=$obj->nom; $staticcompany->name=$obj->name;
print $staticcompany->getNomUrl(1,'',20); print $staticcompany->getNomUrl(1,'',20);
print '</td>'; print '</td>';
print '<td class="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">'; print '<td class="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
@ -447,7 +447,7 @@ print '<br>';
// Not activated services // Not activated services
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,"; $sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
$sql.= " s.nom,"; $sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
@ -503,7 +503,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$staticcompany->id=$obj->fk_soc; $staticcompany->id=$obj->fk_soc;
$staticcompany->nom=$obj->nom; $staticcompany->name=$obj->name;
print $staticcompany->getNomUrl(1,'',20); print $staticcompany->getNomUrl(1,'',20);
print '</td>'; print '</td>';
print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">'; print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
@ -526,7 +526,7 @@ print '<br>';
// Expired services // Expired services
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,"; $sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
$sql.= " s.nom,"; $sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
@ -583,7 +583,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$staticcompany->id=$obj->fk_soc; $staticcompany->id=$obj->fk_soc;
$staticcompany->nom=$obj->nom; $staticcompany->name=$obj->name;
print $staticcompany->getNomUrl(1,'',20); print $staticcompany->getNomUrl(1,'',20);
print '</td>'; print '</td>';
print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">'; print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';

View File

@ -42,7 +42,7 @@ $offset = $limit * $page ;
$search_nom=GETPOST('search_nom'); $search_nom=GETPOST('search_nom');
$search_contract=GETPOST('search_contract'); $search_contract=GETPOST('search_contract');
$search_ref_customer=GETPOST('search_ref_customer','alpha'); $search_ref_supplier=GETPOST('search_ref_supplier','alpha');
$sall=GETPOST('sall'); $sall=GETPOST('sall');
$statut=GETPOST('statut')?GETPOST('statut'):1; $statut=GETPOST('statut')?GETPOST('statut'):1;
$socid=GETPOST('socid'); $socid=GETPOST('socid');
@ -75,7 +75,7 @@ $sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND
$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,"; $sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom, s.rowid as socid";
$sql.= " ,c.ref_customer"; $sql.= " ,c.ref_supplier";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."contrat as c"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c";
@ -90,15 +90,14 @@ if ($search_nom) {
if ($search_contract) { if ($search_contract) {
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
} }
if (!empty($search_ref_customer)) { if (!empty($search_ref_supplier)) {
$sql .= natural_search(array('c.ref_customer'), $search_ref_customer); $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
} }
if ($sall) { if ($sall) {
$sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall); $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
} }
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut,"; $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, s.nom, s.rowid";
$sql.= " s.nom, s.rowid"; $sql.= $db->order($sortfield,$sortorder);
$sql.= " ORDER BY $sortfield $sortorder";
$sql.= $db->plimit($conf->liste_limit + 1, $offset); $sql.= $db->plimit($conf->liste_limit + 1, $offset);
$resql=$db->query($sql); $resql=$db->query($sql);
@ -114,9 +113,9 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$param='&amp;search_contract='.$search_contract; $param='&amp;search_contract='.$search_contract;
$param.='&amp;search_nom='.$search_nom; $param.='&amp;search_nom='.$search_nom;
$param.='&amp;search_ref_customer='.$search_ref_customer; $param.='&amp;search_ref_supplier='.$search_ref_supplier;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
@ -134,7 +133,7 @@ if ($resql)
print '<input type="text" class="flat" size="3" name="search_contract" value="'.$search_contract.'">'; print '<input type="text" class="flat" size="3" name="search_contract" value="'.$search_contract.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="7" name="search_ref_customer value="'.$search_ref_customer.'">'; print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.$search_ref_supplier.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_nom" value="'.$search_nom.'">'; print '<input type="text" class="flat" size="24" name="search_nom" value="'.$search_nom.'">';
@ -156,8 +155,8 @@ if ($resql)
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'</a>'; print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'</a>';
if ($obj->nb_late) print img_warning($langs->trans("Late")); if ($obj->nb_late) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td>'.$obj->ref_customer.'</td>'; print '<td>'.$obj->ref_supplier.'</td>';
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>'; print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
//print '<td align="center">'.dol_print_date($obj->datec).'</td>'; //print '<td align="center">'.dol_print_date($obj->datec).'</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat)).'</td>'; print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat)).'</td>';
//print '<td align="center">'.$staticcontrat->LibStatut($obj->statut,3).'</td>'; //print '<td align="center">'.$staticcontrat->LibStatut($obj->statut,3).'</td>';

View File

@ -80,7 +80,7 @@ $form=new Form($db);
llxHeader(); llxHeader();
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,"; $sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
$sql.= " s.rowid as socid, s.nom,"; $sql.= " s.rowid as socid, s.nom as name,";
$sql.= " cd.rowid, cd.description, cd.statut,"; $sql.= " cd.rowid, cd.description, cd.statut,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype,"; $sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype,";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
@ -225,7 +225,7 @@ if ($resql)
// Third party // Third party
print '<td>'; print '<td>';
$companystatic->id=$obj->socid; $companystatic->id=$obj->socid;
$companystatic->nom=$obj->nom; $companystatic->name=$obj->name;
$companystatic->client=1; $companystatic->client=1;
print $companystatic->getNomUrl(1,'customer',28); print $companystatic->getNomUrl(1,'customer',28);
print '</td>'; print '</td>';

View File

@ -64,7 +64,7 @@ class box_actions extends ModeleBoxes
{ {
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,"; $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,";
$sql.= " ta.code,"; $sql.= " ta.code,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, "; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
$sql.= MAIN_DB_PREFIX."actioncomm AS a)"; $sql.= MAIN_DB_PREFIX."actioncomm AS a)";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@ -112,7 +112,7 @@ class box_actions extends ModeleBoxes
'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:'')); 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''));
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dol_trunc($objp->nom,24), 'text' => dol_trunc($objp->name,24),
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="left" class="nowrap"', $this->info_box_contents[$i][4] = array('td' => 'align="left" class="nowrap"',
@ -155,7 +155,7 @@ class box_actions extends ModeleBoxes
global $langs, $conf; global $langs, $conf;
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents);
if ($conf->global->SHOW_DIALOG_HOMEPAGE) if ($conf->global->SHOW_DIALOG_HOMEPAGE)
{ {
$actioncejour=false; $actioncejour=false;
$contents=$this->info_box_contents; $contents=$this->info_box_contents;
$nblines=count($contents); $nblines=count($contents);
@ -170,7 +170,7 @@ class box_actions extends ModeleBoxes
if (isset($contents[$i])) if (isset($contents[$i]))
{ {
// on affiche que les évènement du jours ou passé // on affiche que les évènement du jours ou passé
// qui ne sont pas à 100% // qui ne sont pas à 100%
$actioncejour=true; $actioncejour=true;
$var=!$var; $var=!$var;
// TR // TR
@ -193,8 +193,8 @@ class box_actions extends ModeleBoxes
print '</tr>'; print '</tr>';
} }
} }
print '</table>'; print '</table>';
} }
print '</div>'; print '</div>';
if ($actioncejour) if ($actioncejour)

View File

@ -63,7 +63,7 @@ class box_clients extends ModeleBoxes
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms, s.status"; $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $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"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (1, 3)"; $sql.= " WHERE s.client IN (1, 3)";
@ -93,7 +93,7 @@ class box_clients extends ModeleBoxes
'url' => $url.$objp->socid); 'url' => $url.$objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'url' => $url.$objp->socid); 'url' => $url.$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',

View File

@ -63,7 +63,7 @@ class box_commandes extends ModeleBoxes
if ($user->rights->commande->lire) if ($user->rights->commande->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.ref, c.tms, c.rowid,"; $sql.= " c.ref, c.tms, c.rowid,";
$sql.= " c.fk_statut, c.facture"; $sql.= " c.fk_statut, c.facture";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -101,7 +101,7 @@ class box_commandes extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array('td' => 'align="right"',

View File

@ -60,7 +60,7 @@ class box_contracts extends ModeleBoxes
if ($user->rights->contrat->lire) if ($user->rights->contrat->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -108,7 +108,7 @@ class box_contracts extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dol_trunc($objp->nom,40), 'text' => dol_trunc($objp->name,40),
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array('td' => 'align="right"',

View File

@ -66,7 +66,7 @@ class box_factures extends ModeleBoxes
{ {
$sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.datef as df"; $sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.datef as df";
$sql.= ", f.paye, f.fk_statut, f.datec, f.tms"; $sql.= ", f.paye, f.fk_statut, f.datec, f.tms";
$sql.= ", s.nom, s.rowid as socid"; $sql.= ", s.nom as name, s.rowid as socid";
$sql.= ", f.date_lim_reglement as datelimite"; $sql.= ", f.date_lim_reglement as datelimite";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -113,7 +113,7 @@ class box_factures extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'maxlength'=>40, 'maxlength'=>40,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);

View File

@ -63,7 +63,7 @@ class box_factures_fourn extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.amount,"; $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.amount,";
$sql.= " f.paye, f.fk_statut,"; $sql.= " f.paye, f.fk_statut,";
$sql.= ' f.datef as df,'; $sql.= ' f.datef as df,';
@ -115,7 +115,7 @@ class box_factures_fourn extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="left"', $this->info_box_contents[$i][4] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][5] = array('td' => 'align="right"', $this->info_box_contents[$i][5] = array('td' => 'align="right"',

View File

@ -60,7 +60,7 @@ class box_factures_fourn_imp extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,"; $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,";
$sql.= " f.amount, f.datef as df,"; $sql.= " f.amount, f.datef as df,";
$sql.= " f.paye, f.fk_statut, f.type"; $sql.= " f.paye, f.fk_statut, f.type";
@ -111,7 +111,7 @@ class box_factures_fourn_imp extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="left"', $this->info_box_contents[$i][4] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][5] = array('td' => 'align="right"', $this->info_box_contents[$i][5] = array('td' => 'align="right"',

View File

@ -63,7 +63,7 @@ class box_factures_imp extends ModeleBoxes
if ($user->rights->facture->lire) if ($user->rights->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
$sql.= " f.amount, f.datef as df,"; $sql.= " f.amount, f.datef as df,";
$sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= " f.paye, f.fk_statut, f.rowid as facid";
@ -110,7 +110,7 @@ class box_factures_imp extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'maxlength'=>44, 'maxlength'=>44,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);

View File

@ -65,7 +65,7 @@ class box_ficheinter extends ModeleBoxes
$sql.= " f.datec,"; $sql.= " f.datec,";
$sql.= " f.date_valid as datev,"; $sql.= " f.date_valid as datev,";
$sql.= " f.tms as datem,"; $sql.= " f.tms as datem,";
$sql.= " s.nom, s.rowid as socid, s.client"; $sql.= " s.nom as name, s.rowid as socid, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! $user->rights->societe->client->voir) if (! $user->rights->societe->client->voir)
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -109,7 +109,7 @@ class box_ficheinter extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dol_trunc($objp->nom,40), 'text' => dol_trunc($objp->name,40),
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array('td' => 'align="right"',

View File

@ -62,7 +62,7 @@ class box_fournisseurs extends ModeleBoxes
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, s.datec, s.tms, s.status"; $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $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"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fournisseur = 1"; $sql.= " WHERE s.fournisseur = 1";
@ -89,7 +89,7 @@ class box_fournisseurs extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',

View File

@ -62,7 +62,7 @@ class box_propales extends ModeleBoxes
if ($user->rights->propale->lire) if ($user->rights->propale->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture"; $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."propal as p";
@ -106,7 +106,7 @@ class box_propales extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dol_trunc($objp->nom,40), 'text' => dol_trunc($objp->name,40),
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array('td' => 'align="right"',

View File

@ -63,7 +63,7 @@ class box_prospect extends ModeleBoxes
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status"; $sql = "SELECT s.nom as name, s.rowid as socid, s.fk_stcomm, s.datec, s.tms, s.status";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $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"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.client IN (2, 3)"; $sql.= " WHERE s.client IN (2, 3)";
@ -92,7 +92,7 @@ class box_prospect extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',

View File

@ -62,7 +62,7 @@ class box_services_contracts extends ModeleBoxes
if ($user->rights->service->lire && $user->rights->contrat->lire) if ($user->rights->service->lire && $user->rights->contrat->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.rowid,"; $sql.= " c.rowid,";
$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut,"; $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut,";
$sql.= " p.rowid as pid, p.label, p.fk_product_type"; $sql.= " p.rowid as pid, p.label, p.fk_product_type";
@ -125,7 +125,7 @@ class box_services_contracts extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'maxlength' => 28, 'maxlength' => 28,
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);

View File

@ -63,7 +63,7 @@ class box_services_expired extends ModeleBoxes
// Select contracts with at least one expired service // Select contracts with at least one expired service
$sql = "SELECT "; $sql = "SELECT ";
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,";
$sql.= " s.nom, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
$sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services"; $sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -104,7 +104,7 @@ class box_services_expired extends ModeleBoxes
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dol_trunc($objp->nom,40), 'text' => dol_trunc($objp->name,40),
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][4] = array('td' => 'align="center"', $this->info_box_contents[$i][4] = array('td' => 'align="center"',

View File

@ -62,7 +62,7 @@ class box_supplier_orders extends ModeleBoxes
if ($user->rights->fournisseur->commande->lire) if ($user->rights->fournisseur->commande->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.ref, c.tms, c.rowid,"; $sql.= " c.ref, c.tms, c.rowid,";
$sql.= " c.fk_statut"; $sql.= " c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -102,7 +102,7 @@ class box_supplier_orders extends ModeleBoxes
'url' => $urls); 'url' => $urls);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->name,
'url' => $urls); 'url' => $urls);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array('td' => 'align="right"',

View File

@ -114,8 +114,8 @@ class HookManager
* *
* @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...) * @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
* @param array $parameters Array of parameters * @param array $parameters Array of parameters
* @param Object $object Object to use hooks on * @param Object $object Object to use hooks on
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO. * @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints. * For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints.
* Can also return some values into an array ->results. * Can also return some values into an array ->results.
@ -144,7 +144,8 @@ class HookManager
'moveUploadedFile', 'moveUploadedFile',
'pdf_writelinedesc', 'pdf_writelinedesc',
'paymentsupplierinvoices', 'paymentsupplierinvoices',
'printSearchForm' 'printSearchForm',
'formatEvent'
) )
)) $hooktype='addreplace'; )) $hooktype='addreplace';
@ -156,8 +157,6 @@ class HookManager
{ {
if (! empty($modules)) if (! empty($modules))
{ {
$modulealreadyexecuted[$context]=array(); // Filter by context
foreach($modules as $module => $actionclassinstance) foreach($modules as $module => $actionclassinstance)
{ {
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n"; //print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n";
@ -166,8 +165,8 @@ class HookManager
// jump to next class if method does not exists // jump to next class if method does not exists
if (! method_exists($actionclassinstance,$method)) continue; if (! method_exists($actionclassinstance,$method)) continue;
// test to avoid to run twice a hook, when a module implements several active contexts // test to avoid to run twice a hook, when a module implements several active contexts
if (in_array($module,$modulealreadyexecuted[$context])) continue; if (in_array($module,$modulealreadyexecuted)) continue;
$modulealreadyexecuted[$context][$module]=$module; // Use the $currentcontext in method for avoid to run twice $modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method for avoid to run twice
// Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; // Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
$parameters['currentcontext'] = $context; $parameters['currentcontext'] = $context;
// Hooks that must return int (hooks with type 'addreplace') // Hooks that must return int (hooks with type 'addreplace')

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