Merge remote-tracking branch 'upstream/develop' into develop

Conflicts:
	htdocs/core/lib/functions.lib.php
This commit is contained in:
Marcos García de La Fuente 2015-03-04 10:16:25 +01:00
commit 0170d409d3
317 changed files with 10617 additions and 6276 deletions

View File

@ -22,7 +22,7 @@ odtPHP 1.0.1 GPL-2+ b Yes
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
TCPDF 6.0.093 LGPL-3+ Yes PDF generation TCPDF 6.2.6 LGPL-3+ Yes PDF generation
JS libraries: JS libraries:
jQuery 1.8.2 MIT License Yes JS library jQuery 1.8.2 MIT License Yes JS library

View File

@ -222,6 +222,7 @@ Dolibarr better:
- Fix: [ bug #1830 ] Salaries payment only allows checking accounts - Fix: [ bug #1830 ] Salaries payment only allows checking accounts
- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work - Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work
- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key - Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key
- Fix: Bad SEPA xml file creation
***** ChangeLog for 3.6.2 compared to 3.6.1 ***** ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.

View File

@ -21,8 +21,9 @@ vous devez vous réorienter vers DoliWamp (la version tout-en-un
de Dolibarr pour Windows), DoliDeb (la version tout-en-un pour Debian ou de Dolibarr pour Windows), DoliDeb (la version tout-en-un pour Debian ou
Ubuntu) ou DoliRpm (la version tout-en-un de Dolibarr pour Fedora, Redhat, Ubuntu) ou DoliRpm (la version tout-en-un de Dolibarr pour Fedora, Redhat,
OpenSuse, Mandriva ou Mageia). OpenSuse, Mandriva ou Mageia).
Vous pouvez les télécharger à l'adresse:
http://www.dolibarr.org/downloads/ Vous pouvez les télécharger depuis la rubrique *download* du portail officiel:
http://www.dolibarr.org/
Si vous avez déjà installé un serveur Web avec PHP et une base de donnée (Mysql), Si vous avez déjà installé un serveur Web avec PHP et une base de donnée (Mysql),
vous pouvez installer Dolibarr avec cette version de la manière suivante: vous pouvez installer Dolibarr avec cette version de la manière suivante:

View File

@ -22,7 +22,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](COPYRIGHT)
### Download ### Download
Official releases are available on the [website](http://www.dolibarr.org/downloads). Releases can be downloaded from [official website](http://www.dolibarr.org/).
### Simple setup ### Simple setup

View File

@ -23,6 +23,21 @@ Replace call to serialize_val with no bugged value
FPDI:
-----
Replace:
$this->_readXref($this->_xref, $this->_findXref());
with:
try {
$this->_readXref($this->_xref, $this->_findXref());
}
catch(Exception $e)
{
print $e->getMessage();
exit;
}
TCPDF: TCPDF:
------ ------
* Removed all fonts except * Removed all fonts except
@ -47,6 +62,19 @@ In htdocs/includes/tcpdf/tcpdf.php
* Renamed getmypid into dol_getmypid(). * Renamed getmypid into dol_getmypid().
TCPDI:
------
Add fpdf_tpl.php 1.2
Add tcpdi.php
Add tcpdi_parser.php and replace:
require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
with:
require_once(dirname(__FILE__).'/../tcpdf/include/tcpdf_filters.php');
JSGANTT: JSGANTT:
-------- --------
* Replace in function JSGantt.taskLink * Replace in function JSGantt.taskLink

View File

@ -136,7 +136,7 @@ class Skeleton_Class extends CommonObject
* *
* @param int $id Id object * @param int $id Id object
* @param string $ref Ref * @param string $ref Ref
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
function fetch($id,$ref='') function fetch($id,$ref='')
{ {
@ -154,7 +154,8 @@ class Skeleton_Class extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) $numrows = $this->db->num_rows($resql);
if ($numrows)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -165,7 +166,7 @@ class Skeleton_Class extends CommonObject
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return ($numrows?1:0);
} }
else else
{ {

View File

@ -103,9 +103,7 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
// To isolate the cash of the other accounts $sql .= " WHERE ba.rowid=".$id_accountancy_journal;
$sql .= " WHERE ba.courant <> 2";
$sql .= " AND ba.rowid=".$id_accountancy_journal;
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND ba.entity = " . $conf->entity; $sql .= " AND ba.entity = " . $conf->entity;
} }
@ -143,9 +141,9 @@ if ($result) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$tabcompany[$obj->rowid] = array( $tabcompany[$obj->rowid] = array(
'id' => $obj->socid, 'id' => $obj->socid,
'name' => $obj->name, 'name' => $obj->name,
'code_client' => $obj->code_compta 'code_client' => $obj->code_compta
); );
// Controls // Controls
@ -172,133 +170,96 @@ if ($result) {
// get_url may return -1 which is not traversable // get_url may return -1 which is not traversable
if (is_array($links)) if (is_array($links))
{ {
foreach ($links as $key => $val)
foreach ( $links as $key => $val )
{
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment')
{ {
$tabtype[$obj->rowid] = $links[$key]['type']; $paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
if ($links[$key]['type'] == 'payment')
{
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'payment_supplier')
{
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
}
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
}
else
{
$chargestatic->lib = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid)
{
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
} }
} else if ($links[$key]['type'] == 'payment_supplier')
{
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
}
else
{
$chargestatic->lib = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid)
{
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount; $tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount; // if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$i ++; $i++;
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -306,17 +267,16 @@ if ($result) {
/* /*
* Actions * Actions
* FIXME Action should be before any view
*/ */
// Write bookkeeping // Write bookkeeping
if ($action == 'writeBookKeeping') if ($action == 'writeBookKeeping')
{ {
$error = 0; $error = 0;
foreach ($tabpay as $key => $val) foreach ( $tabpay as $key => $val )
{ {
// Bank // Bank
foreach ($tabbq[$key] as $k => $mt) foreach ( $tabbq[$key] as $k => $mt )
{ {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
@ -368,7 +328,7 @@ if ($action == 'writeBookKeeping')
} }
} }
// Third party // Third party
foreach ($tabtp[$key] as $k => $mt) foreach ( $tabtp[$key] as $k => $mt )
{ {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
@ -467,6 +427,7 @@ if ($action == 'export_csv')
foreach ( $tabpay as $key => $val ) { foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
@ -484,21 +445,44 @@ if ($action == 'export_csv')
} }
// Third party // Third party
foreach ( $tabtp[$key] as $k => $mt ) { if (is_array ( $tabtp[$key]))
if ($mt) { {
print $date . $sep; foreach ( $tabtp[$key] as $k => $mt )
print $bank_journal . $sep; {
if ($val["lib"] == '(SupplierInvoicePayment)') { if ($mt)
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; {
} else { print $date . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; print $bank_journal . $sep;
if ($val["lib"] == '(SupplierInvoicePayment)') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
} else {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
}
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print "\n";
}
}
}
else
{
foreach ( $tabbq[$key] as $k => $mt )
{
if (1)
{
print $date . $sep;
print $bank_journal . $sep;
print $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print "\n";
} }
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print "\n";
} }
} }
} }
@ -522,15 +506,35 @@ if ($action == 'export_csv')
} }
// Third party // Third party
foreach ( $tabtp[$key] as $k => $mt ) { if (is_array ( $tabtp[$key]))
if ($mt) { {
print '"' . $date . '"' . $sep; foreach ( $tabtp[$key] as $k => $mt )
print '"' . $val["type_payment"] . '"' . $sep; {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; if ($mt) {
print '"' . $companystatic->name . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print "\n"; print '"' . $companystatic->name . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
}
}
}
else
{
foreach ( $tabbq[$key] as $k => $mt )
{
if (1)
{
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . '"' . $sep;
print '"' . $langs->trans("Bank") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
}
} }
} }
} }
@ -544,13 +548,53 @@ else
llxHeader('', $langs->trans("BankJournal")); llxHeader('', $langs->trans("BankJournal"));
$namereport = $langs->trans("BankJournal"); $namereport = $langs->trans("BankJournal");
$namelink = ''; $description = $langs->trans("DescBankJournal");
$periodlink = '';
$exportlink = '';
$builddate = time();
$description = $langs->trans("DescBankJournal") . '<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($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
// Report
$h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal;
$head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report';
dol_fiche_head($head, $hselected);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal.'">';
print '<table width="100%" class="border">';
// Title
print '<tr>';
print '<td valign="top" width="110">'.$langs->trans("ReportName").'</td>';
print '<td colspan="3">'.$namereport.'</td>';
print '</td>';
print '</tr>';
// Period report
print '<tr>';
print '<td>'.$langs->trans("ReportPeriod").'</td>';
if (! $periodlink) print '<td colspan="3">';
else print '<td>';
if ($period) print $period;
if ($periodlink) print '</td><td colspan="2">'.$periodlink;
print '</td>';
print '</tr>';
// Description
print '<tr>';
print '<td valign="top">'.$langs->trans("ReportDescription").'</td>';
print '<td colspan="3">'.$description.'</td>';
print '</tr>';
print '<tr>';
print '<td colspan="4" align="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '</div>';
// End report
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
@ -611,20 +655,36 @@ else
} }
// Third party // Third party
foreach ( $tabtp[$key] as $k => $mt ) { if (is_array ( $tabtp[$key]))
if ($k != 'type') { {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $val["soclib"] . "</td>";
print "<td>" . length_accounta($k) . "</td>";
print "<td>" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
}
}
else
{
foreach ( $tabbq[$key] as $k => $mt )
{
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $val["soclib"] . "</td>"; print "<td>" . $reflabel . "</td>";
print "<td>" . length_accounta($k) . "</td>"; print "<td>" . $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . "</td>";
print "<td>" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")</td>"; print "<td>" . $langs->trans('ThirdParty') . "</td>";
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";
} }
} }
$var = ! $var; $var = ! $var;
} }

View File

@ -1,533 +0,0 @@
<?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/journal/cashjournal.php
* \ingroup Accounting Expert
* \brief Page with cash journal
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Langs
$langs->load("companies");
$langs->load("other");
$langs->load("compta");
$langs->load("bank");
$langs->load("accountancy");
$date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday');
$date_startyear = GETPOST('date_startyear');
$date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear');
// Security check
if ($user->societe_id > 0)
accessforbidden();
$action = GETPOST('action');
/*
* View
*/
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear --;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
}
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];
$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,";
$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
// Code opération type caisse
$sql .= " WHERE ba.courant = 2";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND ba.entity = " . $conf->entity;
}
if ($date_start && $date_end)
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
$sql .= " ORDER BY b.datev";
$object = new Account($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$societestatic = new Societe($db);
$chargestatic = new ChargeSociales($db);
$paymentvatstatic = new TVA($db);
dol_syslog("accountancy/journal/cashjournal.php:: sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
// les variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
$cptsociale = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
$tabpay = array ();
$tabbq = array ();
$tabtp = array ();
$tabcompany = array ();
$tabtype = array ();
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($result);
// controls
$compta_bank = $obj->account_number;
if ($obj->label == '(SupplierInvoicePayment)')
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $cptfour);
if ($obj->label == '(CustomerInvoicePayment)')
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli);
if ($obj->typeop == '(BankTransfert)')
$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
// variable bookkeeping
$tabpay[$obj->rowid]["date"] = $obj->do;
$tabpay[$obj->rowid]["ref"] = $obj->label;
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
} else {
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
}
$links = $object->get_url($obj->rowid);
// get_url may return -1 which is not traversable
if (is_array($links))
{
foreach ( $links as $key => $val )
{
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
} else {
$chargestatic->lib = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$cptsociale] += $obj->amount;
}*/
}
}
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$i ++;
}
} else {
dol_print_error($db);
}
/*
* Actions
*/
// write bookkeeping
if ($action == 'writeBookKeeping')
{
$error = 0;
foreach ( $tabpay as $key => $val )
{
// cash
foreach ( $tabbq[$key] as $k => $mt )
{
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->doc_type = 'cash';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $compte->label;
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
if ($tabtype[$key] == 'payment')
{
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
$sqlmid .= " WHERE pay.fk_bank=" . $key;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber;
}
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
$sqlmid .= " WHERE payf.fk_bank=" . $key;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber;
}
}
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
}
// third party
foreach ( $tabtp[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->doc_type = 'cash';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0 ? $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
if ($tabtype[$key] == 'sc') {
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
$sqlmid .= " WHERE pay.fk_bank=" . $key;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber;
}
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
$sqlmid .= " WHERE payf.fk_bank=" . $key;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber;
}
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
} else if ($tabtype[$key] == 'company') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
$sqlmid .= " WHERE pay.fk_bank=" . $key;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber;
}
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
} else {
$bookkeeping->doc_ref = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
}
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
}
}
if (empty($error)) {
setEventMessage($langs->trans('Success'), 'mesgs');
}
}
// Export
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$cash_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
header('Content-Type: text/csv');
header('Content-Disposition:attachment;filename=journal_caisse.csv');
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
{
$sep = ";";
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
// Cash
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
print $cash_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print "\n";
}
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $cash_journal . $sep;
if ($val["lib"] == '(SupplierInvoicePayment)') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
} else {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
}
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print "\n";
}
}
}
} else // Model Classic Export
{
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
// Cash
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Cash") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("ThirdParty") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
}
}
}
}
} else {
$form = new Form($db);
llxHeader('', $langs->trans("CashJournal"), '');
$name = $langs->trans("CashJournal");
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$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);
report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
print '
<script type="text/javascript">
function launch_export() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
function writeBookKeeping() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("writeBookKeeping");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
/*
* Show result array
*/
print '<br><br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td>" . $langs->trans("Date") . "</td>";
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
print "<td>" . $langs->trans("Account") . "</td>";
print "<td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
// Cash
foreach ( $tabbq[$key] as $k => $mt ) {
if (1) {
print "<tr " . $bc[$var] . " >";
print "<td>" . $date . "</td>";
print "<td>" . $val["lib"] . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
}
}
// third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $val["soclib"] . "</td>";
print "<td>" . length_accounta($k) . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
}
}
$var = ! $var;
}
print "</table>";
// End of page
llxFooter();
}
$db->close();

View File

@ -58,6 +58,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject = $langs->transnoentitiesnoconv("Members");
$help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'; $help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('',$langs->trans("MembersSetup"),$help_url); llxHeader('',$langs->trans("MembersSetup"),$help_url);
@ -70,42 +72,7 @@ $head = member_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Members"), 0, 'user'); dol_fiche_head($head, 'attributes', $langs->trans("Members"), 0, 'user');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes", $langs->transnoentitiesnoconv("Members")).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=".$key."\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -74,42 +74,7 @@ $head = member_admin_prepare_head();
dol_fiche_head($head, 'attributes_type', $langs->trans("Members"), 0, 'user'); dol_fiche_head($head, 'attributes_type', $langs->trans("Members"), 0, 'user');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=".$key."\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -302,6 +302,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
// Check if we need to also synchronize user information // Check if we need to also synchronize user information
$nosyncuser=0; $nosyncuser=0;
@ -471,6 +472,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
// Check parameters // Check parameters
if (empty($morphy) || $morphy == "-1") { if (empty($morphy) || $morphy == "-1") {

View File

@ -89,6 +89,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht); $ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
if ($ret < 0) $error++;
if ($adht->libelle) if ($adht->libelle)
{ {
@ -126,6 +127,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht); $ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
if ($ret < 0) $error++;
$adht->update($user); $adht->update($user);

View File

@ -76,41 +76,7 @@ $head=agenda_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Agenda"), 0, 'action'); dol_fiche_head($head, 'attributes', $langs->trans("Agenda"), 0, 'action');
print $langs->trans("DefineHereComplementaryAttributes", $langs->transnoentitiesnoconv("Agenda")).'<br>'."\n"; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -41,7 +41,7 @@ $actiontest=GETPOST('test','alpha');
$actionsave=GETPOST('save','alpha'); $actionsave=GETPOST('save','alpha');
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=empty($conf->global->AGENDA_EXT_NB)?5:$conf->global->AGENDA_EXT_NB; $MAXAGENDA=$conf->global->AGENDA_EXT_NB;
// List of aviable colors // List of aviable colors
$colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5'); $colorlist=array('BECEDD','DDBECE','BFDDBE','F598B4','F68654','CBF654','A4A4A5');

View File

@ -59,6 +59,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject = $langs->transnoentitiesnoconv("Bank");
llxHeader('',$langs->trans("BankSetupModule"),$help_url); llxHeader('',$langs->trans("BankSetupModule"),$help_url);
@ -70,45 +72,7 @@ $head = bank_admin_prepare_head(null);
dol_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), 0, 'account'); dol_fiche_head($head, 'attributes', $langs->trans("BankSetupModule"), 0, 'account');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -77,42 +77,7 @@ $head = order_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Orders"), 0, 'order'); dol_fiche_head($head, 'attributes', $langs->trans("Orders"), 0, 'order');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -66,7 +66,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Orders"); $textobject=$langs->transnoentitiesnoconv("OrderLines");
llxHeader('',$langs->trans("OrdersSetup")); llxHeader('',$langs->trans("OrdersSetup"));
@ -76,44 +76,9 @@ print "<br>\n";
$head = order_admin_prepare_head(); $head = order_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("Orders"), 0, 'order'); dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), 0, 'order');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -51,7 +51,7 @@ if ($action == 'update')
{ {
dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity);
@ -222,7 +222,7 @@ if ($action == 'edit') // Edit
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1); print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
print '</td></tr>'; print '</td></tr>';
// Hide Tva Intra on adress // Hide Tva Intra on adress
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>'; print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
@ -385,14 +385,14 @@ else // Show
print '<table summary="more" class="noborder" width="100%">'; print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
// Hide any PDF informations // Hide any PDF informations
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1); print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
print '</td></tr>'; print '</td></tr>';
// Encrypt and protect PDF // Encrypt and protect PDF
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -417,16 +417,16 @@ else // Show
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_pdfsecurity">'.$langs->trans("Disable").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_pdfsecurity">'.$langs->trans("Disable").'</a>';
} }
print "</td>"; print "</td>";
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
// Hide Tva Intra on adress // Hide Tva Intra on adress
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">';
print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1); print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
print '</td></tr>'; print '</td></tr>';
//Desc //Desc
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">'; print '<tr '.$bc[$var].'><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
@ -501,6 +501,13 @@ else // Show
print ' ('.@constant('FPDI_PATH').')'; print ' ('.@constant('FPDI_PATH').')';
$i++; $i++;
} }
if (class_exists('TCPDI'))
{
if ($i) print ' + ';
print 'TCPDI';
print ' ('.@constant('TCPDI_PATH').')';
$i++;
}
print '<!-- $conf->global->MAIN_USE_FPDF = '.$conf->global->MAIN_USE_FPDF.' -->'; print '<!-- $conf->global->MAIN_USE_FPDF = '.$conf->global->MAIN_USE_FPDF.' -->';
print '</td>'."\n"; print '</td>'."\n";
print '</tr>'."\n"; print '</tr>'."\n";

View File

@ -139,6 +139,8 @@ print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$var=true; $var=true;
$found=0;
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
$var=!$var; $var=!$var;
@ -151,6 +153,7 @@ if (! empty($conf->facture->enabled))
print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
@ -165,6 +168,7 @@ if (! empty($conf->commande->enabled))
print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
@ -179,7 +183,17 @@ if (! empty($conf->expedition->enabled))
print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! $found)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2">'.$langs->trans("NoModueToManageStockDecrease").'</td>';
print "</tr>\n";
}
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -192,6 +206,8 @@ print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$var=true; $var=true;
$found=0;
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
$var=!$var; $var=!$var;
@ -204,6 +220,7 @@ if (! empty($conf->fournisseur->enabled))
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
@ -218,6 +235,7 @@ if (! empty($conf->fournisseur->enabled))
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
@ -231,65 +249,76 @@ if (! empty($conf->fournisseur->enabled))
print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
}
if (! $found)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2">'.$langs->trans("NoModueToManageStockIncrease").'</td>';
print "</tr>\n";
} }
print '</table>'; print '</table>';
// Optio to force stock to be enough before adding a line into document // Optio to force stock to be enough before adding a line into document
print '<br>'; if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled)
print '<table class="noborder" width="100%">'; {
print '<tr class="liste_titre">'; print '<br>';
print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n"; print '<table class="noborder" width="100%">';
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n"; print '<tr class="liste_titre">';
print '</tr>'."\n"; print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
if($conf->invoice->enabled) { if($conf->invoice->enabled) {
$var = !$var; $var = !$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForInvoice").'</td>'; print '<td width="60%">'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
print '<td width="160" align="right">'; print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">"; print "<form method=\"post\" action=\"stock.php\">";
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=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>'; print '</form>';
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
}
if($conf->order->enabled) {
$var = !$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print "</td>\n";
print "</tr>\n";
}
if($conf->expedition->enabled) {
$var = !$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print "</td>\n";
print "</tr>\n";
}
print '</table>';
} }
if($conf->order->enabled) {
$var = !$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print "</td>\n";
print "</tr>\n";
}
if($conf->expedition->enabled) {
$var = !$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print "</td>\n";
print "</tr>\n";
}
print '</table>';
$virtualdiffersfromphysical=0; $virtualdiffersfromphysical=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)

View File

@ -81,42 +81,7 @@ $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -81,42 +81,7 @@ $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), 0, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -77,42 +77,7 @@ $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -78,42 +78,7 @@ $head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), 0, 'company'); dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), 0, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -44,7 +44,7 @@ llxHeader();
print_fiche_titre($langs->trans("InfoBrowser"),'','setup'); print_fiche_titre($langs->trans("InfoBrowser"),'','setup');
$tmp=getBrowserInfo(); $tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
// Browser // Browser
$var=true; $var=true;

View File

@ -73,8 +73,10 @@ $configfileparameters=array(
'?dolibarr_main_auth_ldap_debug', '?dolibarr_main_auth_ldap_debug',
'separator', 'separator',
'?dolibarr_lib_ADODB_PATH', '?dolibarr_lib_ADODB_PATH',
'?dolibarr_lib_TCPDF_PATH', '?dolibarr_lib_FPDF_PATH',
'?dolibarr_lib_FPDI_PATH', '?dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_TCPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH', '?dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_PHPEXCEL_PATH', '?dolibarr_lib_PHPEXCEL_PATH',
'?dolibarr_lib_GEOIP_PATH', '?dolibarr_lib_GEOIP_PATH',

View File

@ -266,9 +266,10 @@ $configfileparameters=array(
'?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug', '?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug',
'separator3' => '', 'separator3' => '',
'?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH', '?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH',
'?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDF_PATH' => 'dolibarr_lib_FPDF_PATH', '?dolibarr_lib_FPDF_PATH' => 'dolibarr_lib_FPDF_PATH',
'?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH', '?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_TCPDI_PATH' => 'dolibarr_lib_TCPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH', '?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_PHPEXCEL_PATH' => 'dolibarr_lib_PHPEXCEL_PATH', '?dolibarr_lib_PHPEXCEL_PATH' => 'dolibarr_lib_PHPEXCEL_PATH',
'?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH', '?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH',
@ -332,7 +333,7 @@ foreach($configfileparameters as $key => $value)
{ {
if ($i > 0) print ', '; if ($i > 0) print ', ';
print $value2; print $value2;
if (! is_readable($value2)) if (! is_readable($value2))
{ {
$langs->load("errors"); $langs->load("errors");
print ' '.img_warning($langs->trans("ErrorCantReadDir",$value2)); print ' '.img_warning($langs->trans("ErrorCantReadDir",$value2));

View File

@ -69,42 +69,7 @@ $head = categoriesadmin_prepare_head();
dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category'); dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n"; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -127,6 +127,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
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 ($ret < 0) $error++;
if (! $object->label) if (! $object->label)
{ {

View File

@ -90,7 +90,8 @@ if ($action == 'update' && $user->rights->categorie->creer)
if (empty($categorie->error)) if (empty($categorie->error))
{ {
$ret = $extrafields->setOptionalsFromPost($extralabels,$categorie); $ret = $extrafields->setOptionalsFromPost($extralabels,$categorie);
if ($ret < 0) $error++;
if ($categorie->update($user) > 0) if ($categorie->update($user) > 0)
{ {
header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$categorie->id.'&type='.$type); header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$categorie->id.'&type='.$type);

View File

@ -275,6 +275,7 @@ if ($action == 'add')
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
if (! $error) if (! $error)
{ {
@ -430,6 +431,7 @@ if ($action == 'update')
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
if (! $error) if (! $error)
{ {

View File

@ -185,12 +185,12 @@ class ActionComm extends CommonObject
$now=dol_now(); $now=dol_now();
// Check parameters // Check parameters
if (empty($this->userownerid)) if (empty($this->userownerid))
{ {
$this->errors[]='ErrorPropertyUserowneridNotDefined'; $this->errors[]='ErrorPropertyUserowneridNotDefined';
return -1; return -1;
} }
// Clean parameters // Clean parameters
$this->label=dol_trunc(trim($this->label),128); $this->label=dol_trunc(trim($this->label),128);
$this->location=dol_trunc(trim($this->location),128); $this->location=dol_trunc(trim($this->location),128);
@ -222,7 +222,7 @@ class ActionComm extends CommonObject
$userdoneid=$this->userdoneid; $userdoneid=$this->userdoneid;
// Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...). // Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...).
if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned)) if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned))
$this->userassigned = array($userownerid=>array('id'=>$userownerid)); $this->userassigned = array($userownerid=>array('id'=>$userownerid));
if (! $this->type_id || ! $this->type_code) if (! $this->type_id || ! $this->type_code)
@ -314,9 +314,9 @@ class ActionComm extends CommonObject
{ {
$val=array('id'=>$val); $val=array('id'=>$val);
} }
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['mandatory']?$val['mandatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")"; $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory'])?'0':$val['mandatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
@ -680,7 +680,7 @@ class ActionComm extends CommonObject
foreach($this->userassigned as $key => $val) foreach($this->userassigned as $key => $val)
{ {
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['manadatory']?$val['manadatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")"; $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['manadatory'])?'0':$val['manadatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com> * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
@ -39,6 +39,9 @@ if (! empty($conf->projet->enabled)) {
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
$filter=GETPOST("filter",'',3); $filter=GETPOST("filter",'',3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3); $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("usergroup","int",3);
@ -170,7 +173,7 @@ $listofextcals=array();
if (empty($conf->global->AGENDA_DISABLE_EXT)) if (empty($conf->global->AGENDA_DISABLE_EXT))
{ {
$i=0; $i=0;
while($i < $conf->global->AGENDA_EXT_NB) while($i < $MAXAGENDA)
{ {
$i++; $i++;
$source='AGENDA_EXT_SRC'.$i; $source='AGENDA_EXT_SRC'.$i;
@ -188,7 +191,7 @@ if (empty($conf->global->AGENDA_DISABLE_EXT))
if (empty($user->conf->AGENDA_DISABLE_EXT)) if (empty($user->conf->AGENDA_DISABLE_EXT))
{ {
$i=0; $i=0;
while($i < $conf->global->AGENDA_EXT_NB) while($i < $MAXAGENDA)
{ {
$i++; $i++;
$source='AGENDA_EXT_SRC_'.$user->id.'_'.$i; $source='AGENDA_EXT_SRC_'.$user->id.'_'.$i;

View File

@ -61,10 +61,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$textobject=$langs->transnoentitiesnoconv("Proposals"); $textobject=$langs->transnoentitiesnoconv("Proposals");
llxHeader('',$langs->trans("PropalSetup")); llxHeader('',$langs->trans("PropalSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("PropalSetup"),$linkback,'setup');
@ -73,45 +71,7 @@ $head = propal_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), 0, 'propal'); dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), 0, 'propal');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -78,42 +78,7 @@ $head = propal_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), 0, 'propal'); dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), 0, 'propal');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -57,7 +57,7 @@ class Mailing extends CommonObject
var $date_creat; var $date_creat;
var $date_valid; var $date_valid;
var $extraparams=array(); var $extraparams=array();
public $statut_dest=array(); public $statut_dest=array();
@ -78,12 +78,12 @@ class Mailing extends CommonObject
$this->statuts[1] = 'MailingStatusValidated'; $this->statuts[1] = 'MailingStatusValidated';
$this->statuts[2] = 'MailingStatusSentPartialy'; $this->statuts[2] = 'MailingStatusSentPartialy';
$this->statuts[3] = 'MailingStatusSentCompletely'; $this->statuts[3] = 'MailingStatusSentCompletely';
$this->statut_dest[-1] = 'MailingStatusError'; $this->statut_dest[-1] = 'MailingStatusError';
$this->statut_dest[1] = 'MailingStatusSent'; $this->statut_dest[1] = 'MailingStatusSent';
$this->statut_dest[2] = 'MailingStatusRead'; $this->statut_dest[2] = 'MailingStatusRead';
$this->statut_dest[3] = 'MailingStatusNotContact'; $this->statut_dest[3] = 'MailingStatusNotContact';
} }
/** /**
@ -186,7 +186,7 @@ class Mailing extends CommonObject
function fetch($rowid) function fetch($rowid)
{ {
global $conf; global $conf;
$sql = "SELECT m.rowid, m.titre, m.sujet, m.body, m.bgcolor, m.bgimage"; $sql = "SELECT m.rowid, m.titre, m.sujet, m.body, m.bgcolor, m.bgimage";
$sql.= ", m.email_from, m.email_replyto, m.email_errorsto"; $sql.= ", m.email_from, m.email_replyto, m.email_errorsto";
$sql.= ", m.statut, m.nbemail"; $sql.= ", m.statut, m.nbemail";
@ -211,14 +211,14 @@ class Mailing extends CommonObject
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->nbemail = $obj->nbemail; $this->nbemail = $obj->nbemail;
$this->titre = $obj->titre; $this->titre = $obj->titre;
$this->sujet = $obj->sujet; $this->sujet = $obj->sujet;
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401))) { if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401))) {
$this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401); $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401);
}else { }else {
$this->body = $obj->body; $this->body = $obj->body;
} }
$this->bgcolor = $obj->bgcolor; $this->bgcolor = $obj->bgcolor;
$this->bgimage = $obj->bgimage; $this->bgimage = $obj->bgimage;
@ -232,7 +232,7 @@ class Mailing extends CommonObject
$this->date_creat = $this->db->jdate($obj->date_creat); $this->date_creat = $this->db->jdate($obj->date_creat);
$this->date_valid = $this->db->jdate($obj->date_valid); $this->date_valid = $this->db->jdate($obj->date_valid);
$this->date_envoi = $this->db->jdate($obj->date_envoi); $this->date_envoi = $this->db->jdate($obj->date_envoi);
$this->extraparams = (array) json_decode($obj->extraparams, true); $this->extraparams = (array) json_decode($obj->extraparams, true);
return 1; return 1;
@ -267,6 +267,8 @@ class Mailing extends CommonObject
$object=new Mailing($this->db); $object=new Mailing($this->db);
$object->context['createfromclone']='createfromclone';
$this->db->begin(); $this->db->begin();
// Load source object // Load source object
@ -313,13 +315,13 @@ class Mailing extends CommonObject
{ {
//Clone target //Clone target
if (!empty($option2)) { if (!empty($option2)) {
require_once DOL_DOCUMENT_ROOT .'/core/modules/mailings/modules_mailings.php'; require_once DOL_DOCUMENT_ROOT .'/core/modules/mailings/modules_mailings.php';
$mailing_target = new MailingTargets($this->db); $mailing_target = new MailingTargets($this->db);
$target_array=array(); $target_array=array();
$sql = "SELECT fk_contact, "; $sql = "SELECT fk_contact, ";
$sql.=" lastname, "; $sql.=" lastname, ";
$sql.=" firstname,"; $sql.=" firstname,";
@ -330,7 +332,7 @@ class Mailing extends CommonObject
$sql.=" source_type "; $sql.=" source_type ";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles "; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles ";
$sql.= " WHERE fk_mailing = ".$fromid; $sql.= " WHERE fk_mailing = ".$fromid;
dol_syslog(get_class($this)."::createFromClone", LOG_DEBUG); dol_syslog(get_class($this)."::createFromClone", LOG_DEBUG);
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
@ -338,17 +340,17 @@ class Mailing extends CommonObject
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))
{ {
while ($obj = $this->db->fetch_object($result)) { while ($obj = $this->db->fetch_object($result)) {
$target_array[]=array('fk_contact'=>$obj->fk_contact, $target_array[]=array('fk_contact'=>$obj->fk_contact,
'lastname'=>$obj->lastname, 'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname, 'firstname'=>$obj->firstname,
'email'=>$obj->email, 'email'=>$obj->email,
'other'=>$obj->other, 'other'=>$obj->other,
'source_url'=>$obj->source_url, 'source_url'=>$obj->source_url,
'source_id'=>$obj->source_id, 'source_id'=>$obj->source_id,
'source_type'=>$obj->source_type); 'source_type'=>$obj->source_type);
} }
} }
} }
else else
@ -356,12 +358,14 @@ class Mailing extends CommonObject
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
$mailing_target->add_to_target($object->id, $target_array); $mailing_target->add_to_target($object->id, $target_array);
} }
} }
unset($object->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {
@ -514,7 +518,7 @@ class Mailing extends CommonObject
} }
} }
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@ -526,7 +530,7 @@ class Mailing extends CommonObject
{ {
global $langs; global $langs;
$langs->load('mails'); $langs->load('mails');
if ($mode == 0) if ($mode == 0)
{ {
return $langs->trans($this->statut_dest[$statut]); return $langs->trans($this->statut_dest[$statut]);
@ -563,10 +567,10 @@ class Mailing extends CommonObject
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
} }
} }
} }

View File

@ -435,12 +435,12 @@ if (empty($reshook))
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid); $lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_option = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }
$tva_tx=get_default_tva($mysoc, $object->thirdparty); $tva_tx=get_default_tva($mysoc, $object->thirdparty);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_option); $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options);
if ($result > 0) { if ($result > 0) {
$lineid = $result; $lineid = $result;
@ -652,7 +652,7 @@ if (empty($reshook))
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
// Unset extrafield // Unset extrafield
if (is_array($extralabelsline)) { if (is_array($extralabelsline)) {
// Get extra fields // Get extra fields
@ -812,7 +812,7 @@ if (empty($reshook))
setEventMessage($mesg, 'errors'); setEventMessage($mesg, 'errors');
} else { } else {
// Insert line // Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_option); $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options);
if ($result > 0) { if ($result > 0) {
$db->commit(); $db->commit();
@ -895,7 +895,7 @@ if (empty($reshook))
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield // Unset extrafield
if (is_array($extralabelsline)) { if (is_array($extralabelsline)) {
// Get extra fields // Get extra fields
@ -940,7 +940,7 @@ if (empty($reshook))
if (! $error) { if (! $error) {
$db->begin(); $db->begin();
$result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_option); $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options);
if ($result >= 0) { if ($result >= 0) {
$db->commit(); $db->commit();
@ -987,6 +987,11 @@ if (empty($reshook))
if (GETPOST('model')) { if (GETPOST('model')) {
$object->setDocModel($user, GETPOST('model')); $object->setDocModel($user, GETPOST('model'));
} }
if (GETPOST('fk_bank')) { // this field may come from an external module
$object->fk_bank = GETPOST('fk_bank');
} else {
$object->fk_bank = $object->fk_account;
}
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -1110,10 +1115,10 @@ if (empty($reshook))
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) if ($ret < 0) $error++;
$error ++;
if (! $error) { if (! $error)
{
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! // FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao')); $hookmanager->initHooks(array('propaldao'));

View File

@ -235,27 +235,30 @@ class Propal extends CommonObject
return -5; return -5;
} }
$propalligne=new PropaleLigne($this->db); $line=new PropaleLigne($this->db);
$propalligne->fk_propal=$this->id;
$propalligne->fk_remise_except=$remise->id; $this->line->context = $this->context;
$propalligne->desc=$remise->description; // Description ligne
$propalligne->tva_tx=$remise->tva_tx; $line->fk_propal=$this->id;
$propalligne->subprice=-$remise->amount_ht; $line->fk_remise_except=$remise->id;
$propalligne->fk_product=0; // Id produit predefini $line->desc=$remise->description; // Description ligne
$propalligne->qty=1; $line->tva_tx=$remise->tva_tx;
$propalligne->remise=0; $line->subprice=-$remise->amount_ht;
$propalligne->remise_percent=0; $line->fk_product=0; // Id produit predefini
$propalligne->rang=-1; $line->qty=1;
$propalligne->info_bits=2; $line->remise=0;
$line->remise_percent=0;
$line->rang=-1;
$line->info_bits=2;
// TODO deprecated // TODO deprecated
$propalligne->price=-$remise->amount_ht; $line->price=-$remise->amount_ht;
$propalligne->total_ht = -$remise->amount_ht; $line->total_ht = -$remise->amount_ht;
$propalligne->total_tva = -$remise->amount_tva; $line->total_tva = -$remise->amount_tva;
$propalligne->total_ttc = -$remise->amount_ttc; $line->total_ttc = -$remise->amount_ttc;
$result=$propalligne->insert(); $result=$line->insert();
if ($result > 0) if ($result > 0)
{ {
$result=$this->update_price(1); $result=$this->update_price(1);
@ -272,7 +275,7 @@ class Propal extends CommonObject
} }
else else
{ {
$this->error=$propalligne->error; $this->error=$line->error;
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@ -311,12 +314,12 @@ class Propal extends CommonObject
* @param string $label ??? * @param string $label ???
* @param int $date_start Start date of the line * @param int $date_start Start date of the line
* @param int $date_end End date of the line * @param int $date_end End date of the line
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* *
* @see add_product * @see add_product
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0)
{ {
global $mysoc; global $mysoc;
@ -389,6 +392,8 @@ class Propal extends CommonObject
// Insert line // Insert line
$this->line=new PropaleLigne($this->db); $this->line=new PropaleLigne($this->db);
$this->line->context = $this->context;
$this->line->fk_propal=$this->id; $this->line->fk_propal=$this->id;
$this->line->label=$label; $this->line->label=$label;
$this->line->desc=$desc; $this->line->desc=$desc;
@ -435,8 +440,8 @@ class Propal extends CommonObject
$this->line->price=$price; $this->line->price=$price;
$this->line->remise=$remise; $this->line->remise=$remise;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_option; $this->line->array_options=$array_options;
} }
$result=$this->line->insert(); $result=$this->line->insert();
@ -491,10 +496,10 @@ class Propal extends CommonObject
* @param int $type 0/1=Product/service * @param int $type 0/1=Product/service
* @param int $date_start Start date of the line * @param int $date_start Start date of the line
* @param int $date_end End date of the line * @param int $date_end End date of the line
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @return int 0 if OK, <0 if KO * @return int 0 if OK, <0 if KO
*/ */
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0) function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0)
{ {
global $mysoc; global $mysoc;
@ -541,6 +546,8 @@ class Propal extends CommonObject
// Update line // Update line
$this->line=new PropaleLigne($this->db); $this->line=new PropaleLigne($this->db);
$this->line->context = $this->context;
// Stock previous line records // Stock previous line records
$staticline=new PropaleLigne($this->db); $staticline=new PropaleLigne($this->db);
$staticline->fetch($rowid); $staticline->fetch($rowid);
@ -594,8 +601,8 @@ class Propal extends CommonObject
$this->line->price=$price; $this->line->price=$price;
$this->line->remise=$remise; $this->line->remise=$remise;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_option; $this->line->array_options=$array_options;
} }
$result=$this->line->update(); $result=$this->line->update();
@ -949,6 +956,8 @@ class Propal extends CommonObject
{ {
global $user,$langs,$conf,$hookmanager; global $user,$langs,$conf,$hookmanager;
$this->context['createfromclone']='createfromclone';
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
@ -1042,6 +1051,8 @@ class Propal extends CommonObject
// End call triggers // End call triggers
} }
unset($this->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {
@ -3112,6 +3123,7 @@ class PropaleLigne extends CommonObject
if (empty($this->special_code)) $this->special_code=0; if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0; if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
if (empty($this->subprice)) $this->subprice=0;
if (empty($this->pa_ht)) $this->pa_ht=0; if (empty($this->pa_ht)) $this->pa_ht=0;

View File

@ -93,6 +93,9 @@ if ($id > 0 || ! empty($ref)) {
$hookmanager->initHooks(array('ordercard','globalcard')); $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
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
/* /*
* Actions * Actions
@ -104,7 +107,11 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once if ($cancel) $action='';
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer) if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
@ -281,8 +288,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) if ($ret < 0) $error++;
$error ++;
if (! $error) if (! $error)
{ {
@ -338,10 +344,10 @@ if (empty($reshook))
// trigger used // trigger used
{ {
$lines[$i]->fetch_optionals($lines[$i]->rowid); $lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_option = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options);
if ($result < 0) { if ($result < 0) {
$error ++; $error ++;
@ -375,10 +381,10 @@ if (empty($reshook))
} else { } else {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) if ($ret < 0) $error++;
$error ++;
if (! $error) { if (! $error)
{
$object_id = $object->create($user); $object_id = $object->create($user);
// If some invoice's lines already known // If some invoice's lines already known
@ -556,7 +562,7 @@ if (empty($reshook))
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
// Unset extrafield // Unset extrafield
if (is_array($extralabelsline)) { if (is_array($extralabelsline)) {
// Get extra fields // Get extra fields
@ -729,7 +735,7 @@ if (empty($reshook))
setEventMessage($mesg, 'errors'); setEventMessage($mesg, 'errors');
} else { } else {
// Insert line // Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_option); $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options);
if ($result > 0) { if ($result > 0) {
$ret = $object->fetch($object->id); // Reload to get new records $ret = $object->fetch($object->id); // Reload to get new records
@ -786,9 +792,10 @@ if (empty($reshook))
} }
/* /*
* Mise a jour d'une ligne dans la commande * Update a line
*/ */
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) { else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save'))
{
// Clean parameters // Clean parameters
$date_start=''; $date_start='';
$date_end=''; $date_end='';
@ -815,7 +822,7 @@ if (empty($reshook))
// Extrafields Lines // Extrafields Lines
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield POST Data // Unset extrafield POST Data
if (is_array($extralabelsline)) { if (is_array($extralabelsline)) {
foreach ($extralabelsline as $key => $value) { foreach ($extralabelsline as $key => $value) {
@ -853,7 +860,7 @@ if (empty($reshook))
} }
if (! $error) { if (! $error) {
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_option); $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_options);
if ($result >= 0) { if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -891,7 +898,7 @@ if (empty($reshook))
} }
} }
else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) { else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }
@ -1045,67 +1052,18 @@ if (empty($reshook))
} }
} }
/* if ($action == 'builddoc') // In get or post
* Ordonnancement des lignes
*/
else if ($action == 'up' && $user->rights->commande->creer) {
$object->line_up(GETPOST('rowid'));
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
$newlang = $_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
exit();
}
else if ($action == 'down' && $user->rights->commande->creer) {
$object->line_down(GETPOST('rowid'));
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
$newlang = $_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
exit();
}
else if ($action == 'builddoc') // In get or post
{ {
/*
* Generate order document
* define into /core/modules/commande/modules_commande.php
*/
// Save last template used to generate document // Save last template used to generate document
if (GETPOST('model')) if (GETPOST('model'))
$object->setDocModel($user, GETPOST('model', 'alpha')); $object->setDocModel($user, GETPOST('model', 'alpha'));
if (GETPOST('fk_bank')) { // this field may come from an external module
$object->fk_bank = GETPOST('fk_bank');
} else {
$object->fk_bank = $object->fk_account;
}
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
@ -1125,8 +1083,10 @@ if (empty($reshook))
} }
// Remove file in doc form // Remove file in doc form
else if ($action == 'remove_file') { if ($action == 'remove_file')
if ($object->id > 0) { {
if ($object->id > 0)
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$langs->load("other"); $langs->load("other");
@ -1141,14 +1101,15 @@ if (empty($reshook))
} }
} }
else if ($action == 'update_extras') { if ($action == 'update_extras')
{
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) if ($ret < 0) $error++;
$error ++;
if (! $error) { if (! $error)
{
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! // FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao')); $hookmanager->initHooks(array('orderdao'));
@ -1727,9 +1688,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1);
} }
/* // Confirmation to delete line
* Confirmation de la suppression d'une ligne produit
*/
if ($action == 'ask_deleteline') if ($action == 'ask_deleteline')
{ {
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
@ -2101,7 +2060,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST"> print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '"> <input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateligne') . '"> <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
<input type="hidden" name="mode" value=""> <input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id . '"> <input type="hidden" name="id" value="' . $object->id . '">
'; ';

View File

@ -877,6 +877,8 @@ class Commande extends CommonOrder
$error=0; $error=0;
$this->context['createfromclone'] = 'createfromclone';
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone // get extrafields so they will be clone
@ -941,6 +943,8 @@ class Commande extends CommonOrder
// End call triggers // End call triggers
} }
unset($this->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {
@ -1088,8 +1092,8 @@ class Commande extends CommonOrder
* @param int $fk_remise_except Id remise * @param int $fk_remise_except Id remise
* @param string $price_base_type HT or TTC * @param string $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC * @param float $pu_ttc Prix unitaire TTC
* @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html) * @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $rang Position of line * @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!) * @param int $special_code Special code (also used by externals modules!)
@ -1097,7 +1101,7 @@ class Commande extends CommonOrder
* @param int $fk_fournprice Id supplier price * @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price (without tax) * @param int $pa_ht Buying price (without tax)
* @param string $label Label * @param string $label Label
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* *
* @see add_product * @see add_product
@ -1107,7 +1111,7 @@ class Commande extends CommonOrder
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0)
{ {
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
@ -1200,6 +1204,8 @@ class Commande extends CommonOrder
// Insert line // Insert line
$this->line=new OrderLine($this->db); $this->line=new OrderLine($this->db);
$this->line->context = $this->context;
$this->line->fk_commande=$this->id; $this->line->fk_commande=$this->id;
$this->line->label=$label; $this->line->label=$label;
$this->line->desc=$desc; $this->line->desc=$desc;
@ -1244,8 +1250,8 @@ class Commande extends CommonOrder
$this->line->price=$price; $this->line->price=$price;
$this->line->remise=$remise; $this->line->remise=$remise;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_option; $this->line->array_options=$array_options;
} }
$result=$this->line->insert(); $result=$this->line->insert();
@ -1314,6 +1320,8 @@ class Commande extends CommonOrder
$line=new OrderLine($this->db); $line=new OrderLine($this->db);
$line->context = $this->context;
$line->fk_product=$idproduct; $line->fk_product=$idproduct;
$line->desc=$prod->description; $line->desc=$prod->description;
$line->qty=$qty; $line->qty=$qty;
@ -2338,10 +2346,10 @@ class Commande extends CommonOrder
* @param int $pa_ht Price (without tax) of product when it was bought * @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label Label * @param string $label Label
* @param int $special_code Special code (also used by externals modules!) * @param int $special_code Special code (also used by externals modules!)
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0)
{ {
global $conf, $mysoc; global $conf, $mysoc;
@ -2396,6 +2404,8 @@ class Commande extends CommonOrder
// Update line // Update line
$this->line=new OrderLine($this->db); $this->line=new OrderLine($this->db);
$this->line->context = $this->context;
// Stock previous line records // Stock previous line records
$staticline=new OrderLine($this->db); $staticline=new OrderLine($this->db);
$staticline->fetch($rowid); $staticline->fetch($rowid);
@ -2448,8 +2458,8 @@ class Commande extends CommonOrder
$this->line->price=$price; $this->line->price=$price;
$this->line->remise=$remise; $this->line->remise=$remise;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_option; $this->line->array_options=$array_options;
} }
$result=$this->line->update(); $result=$this->line->update();
@ -3506,7 +3516,7 @@ class OrderLine extends CommonOrderLine
} }
} }
if (! $notrigger) if (! $error && ! $notrigger)
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('LINEORDER_INSERT',$user); $result=$this->call_trigger('LINEORDER_INSERT',$user);

View File

@ -366,19 +366,22 @@ if ($resql)
// stock order and stock order_supplier // stock order and stock order_supplier
$stock_order=0; $stock_order=0;
$stock_order_supplier=0; $stock_order_supplier=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
if (! empty($conf->commande->enabled)) { {
if (! empty($conf->commande->enabled))
{
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
$generic_product->load_stats_commande(0,'1,2',true); $generic_product->load_stats_commande(0,'1,2');
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
} else { } else {
$generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'];
} }
$stock_order=$generic_product->stats_commande['qty']; $stock_order=$generic_product->stats_commande['qty'];
} }
if (! empty($conf->fournisseur->enabled)) { if (! empty($conf->fournisseur->enabled))
{
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
$generic_product->load_stats_commande_fournisseur(0,'3',true); $generic_product->load_stats_commande_fournisseur(0,'3');
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
} else { } else {
$generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'];

View File

@ -300,7 +300,9 @@ class BankCateg // extends CommonObject
$object=new BankCateg($this->db); $object=new BankCateg($this->db);
$this->db->begin(); $object->context['createfromclone'] = 'createfromclone';
$this->db->begin();
// Load source object // Load source object
$object->fetch($fromid); $object->fetch($fromid);
@ -327,6 +329,8 @@ class BankCateg // extends CommonObject
} }
unset($object->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {

View File

@ -646,7 +646,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error ++; if ($ret < 0) $error++;
// Replacement invoice // Replacement invoice
if ($_POST['type'] == Facture::TYPE_REPLACEMENT) if ($_POST['type'] == Facture::TYPE_REPLACEMENT)
@ -1061,10 +1061,10 @@ if (empty($reshook))
// Extrafields // Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid); $lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_option = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id); $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id);
if ($result > 0) { if ($result > 0) {
$lineid = $result; $lineid = $result;
@ -1196,7 +1196,7 @@ if (empty($reshook))
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
// Unset extrafield // Unset extrafield
if (is_array($extralabelsline)) { if (is_array($extralabelsline)) {
// Get extra fields // Get extra fields
@ -1374,7 +1374,7 @@ if (empty($reshook))
setEventMessage($mesg, 'errors'); setEventMessage($mesg, 'errors');
} else { } else {
// Insert line // Insert line
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_option, $_POST['progress']); $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress']);
if ($result > 0) if ($result > 0)
{ {
@ -1469,7 +1469,7 @@ if (empty($reshook))
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield // Unset extrafield
if (is_array($extralabelsline)) { if (is_array($extralabelsline)) {
// Get extra fields // Get extra fields
@ -1528,7 +1528,7 @@ if (empty($reshook))
// Update line // Update line
if (! $error) { if (! $error) {
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_option, GETPOST('progress')); $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, 0, $array_options, GETPOST('progress'));
if ($result >= 0) { if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -1788,8 +1788,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) if ($ret < 0) $error++;
$error ++;
if (! $error) { if (! $error) {
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
@ -3858,13 +3857,13 @@ if ($action == 'create')
$formmail->withdeliveryreceipt = 1; $formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1; $formmail->withcancel = 1;
// Tableau des substitutions // Tableau des substitutions
$formmail->substit ['__FACREF__'] = $object->ref; $formmail->substit['__FACREF__'] = $object->ref;
$formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit ['__REFCLIENT__'] = $object->ref_client; $formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit ['__CONTACTCIVNAME__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = '';
// Find the good contact adress // Find the good contact adress
$custcontact = ''; $custcontact = '';
@ -3873,7 +3872,7 @@ if ($action == 'create')
if (is_array($contactarr) && count($contactarr) > 0) { if (is_array($contactarr) && count($contactarr) > 0) {
foreach ($contactarr as $contact) { foreach ($contactarr as $contact) {
if ($contact ['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label if ($contact['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
@ -3884,15 +3883,15 @@ if ($action == 'create')
} }
if (! empty($custcontact)) { if (! empty($custcontact)) {
$formmail->substit ['__CONTACTCIVNAME__'] = $custcontact; $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
} }
} }
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param ['action'] = $action; $formmail->param['action'] = $action;
$formmail->param ['models'] = $modelmail; $formmail->param['models'] = $modelmail;
$formmail->param ['facid'] = $object->id; $formmail->param['facid'] = $object->id;
$formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
// Init list of files // Init list of files
if (GETPOST("mode") == 'init') { if (GETPOST("mode") == 'init') {

View File

@ -62,10 +62,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers")); $textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
llxHeader('',$langs->trans("BillsSetup")); llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup');
print '<br>'; print '<br>';
@ -74,44 +72,7 @@ $head = invoice_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice'); dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br><br>'."\n";
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();
@ -147,7 +108,7 @@ if ($action == 'create')
if ($action == 'edit' && ! empty($attrname)) if ($action == 'edit' && ! empty($attrname))
{ {
$langs->load("members"); $langs->load("members");
print "<br>"; print "<br>";
print_titre($langs->trans("FieldEdition", $attrname)); print_titre($langs->trans("FieldEdition", $attrname));

View File

@ -63,10 +63,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers")); $textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
llxHeader('',$langs->trans("BillsSetup")); llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("BillsSetup"),$linkback,'setup');
print '<br>'; print '<br>';
@ -75,44 +73,7 @@ $head = invoice_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("Invoices"), 0, 'invoice'); dol_fiche_head($head, 'attributeslines', $langs->trans("Invoices"), 0, 'invoice');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br><br>'."\n";
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -639,6 +639,8 @@ class Facture extends CommonInvoice
$error=0; $error=0;
$this->context['createfromclone'] = 'createfromclone';
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone // get extrafields so they will be clone
@ -725,6 +727,8 @@ class Facture extends CommonInvoice
// End call triggers // End call triggers
} }
unset($this->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {
@ -2030,12 +2034,12 @@ class Facture extends CommonInvoice
* @param int $fk_fournprice Supplier price id (to calculate margin) or '' * @param int $fk_fournprice Supplier price id (to calculate margin) or ''
* @param int $pa_ht Buying price of line (to calculate margin) or '' * @param int $pa_ht Buying price of line (to calculate margin) or ''
* @param string $label Label of the line (deprecated, do not use) * @param string $label Label of the line (deprecated, do not use)
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @param int $situation_percent Situation advance percentage * @param int $situation_percent Situation advance percentage
* @param int $fk_prev_id Previous situation line id reference * @param int $fk_prev_id Previous situation line id reference
* @return int <0 if KO, Id of line if OK * @return int <0 if KO, Id of line if OK
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_option=0, $situation_percent=100, $fk_prev_id='') function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_options=0, $situation_percent=100, $fk_prev_id='')
{ {
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
@ -2120,6 +2124,9 @@ class Facture extends CommonInvoice
// Insert line // Insert line
$this->line=new FactureLigne($this->db); $this->line=new FactureLigne($this->db);
$this->line->context = $this->context;
$this->line->fk_facture=$this->id; $this->line->fk_facture=$this->id;
$this->line->label=$label; // deprecated $this->line->label=$label; // deprecated
$this->line->desc=$desc; $this->line->desc=$desc;
@ -2155,8 +2162,8 @@ class Facture extends CommonInvoice
$this->line->fk_fournprice = $fk_fournprice; $this->line->fk_fournprice = $fk_fournprice;
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_option; $this->line->array_options=$array_options;
} }
$result=$this->line->insert(); $result=$this->line->insert();
@ -2210,11 +2217,11 @@ class Facture extends CommonInvoice
* @param int $pa_ht Price (without tax) of product when it was bought * @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label Label of the line (deprecated, do not use) * @param string $label Label of the line (deprecated, do not use)
* @param int $special_code Special code (also used by externals modules!) * @param int $special_code Special code (also used by externals modules!)
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @param int $situation_percent Situation advance percentage * @param int $situation_percent Situation advance percentage
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0, $situation_percent=0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0)
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -2263,7 +2270,9 @@ class Facture extends CommonInvoice
// Update line into database // Update line into database
$this->line=new FactureLigne($this->db); $this->line=new FactureLigne($this->db);
// Stock previous line records $this->line->context = $this->context;
// Stock previous line records
$staticline=new FactureLigne($this->db); $staticline=new FactureLigne($this->db);
$staticline->fetch($rowid); $staticline->fetch($rowid);
$this->line->oldline = $staticline; $this->line->oldline = $staticline;
@ -2313,8 +2322,8 @@ class Facture extends CommonInvoice
} }
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_options) && count($array_options)>0) {
$this->line->array_options=$array_option; $this->line->array_options=$array_options;
} }
$result=$this->line->update(); $result=$this->line->update();
@ -2403,6 +2412,8 @@ class Facture extends CommonInvoice
$line=new FactureLigne($this->db); $line=new FactureLigne($this->db);
$line->context = $this->context;
// For triggers // For triggers
$line->fetch($rowid); $line->fetch($rowid);

View File

@ -33,6 +33,7 @@ class PaymentTerm // extends CommonObject
var $errors=array(); //!< To return several error codes (or messages) var $errors=array(); //!< To return several error codes (or messages)
//public $element='c_payment_term'; //!< Id that identify managed objects //public $element='c_payment_term'; //!< Id that identify managed objects
//public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored //public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored
var $context =array();
var $id; var $id;
@ -409,6 +410,8 @@ class PaymentTerm // extends CommonObject
$object=new PaymentTerm($this->db); $object=new PaymentTerm($this->db);
$object->context['createfromclone'] = 'createfromclone';
$this->db->begin(); $this->db->begin();
// Load source object // Load source object
@ -436,6 +439,8 @@ class PaymentTerm // extends CommonObject
} }
unset($this->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {

View File

@ -2,6 +2,7 @@
/* 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-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@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
@ -31,7 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; if ($conf->deplacement->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
if ($conf->expensereport->enabled) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$langs->load('users'); $langs->load('users');
@ -69,6 +71,39 @@ print_fiche_titre($langs->trans("HRMArea"));
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
/*
* Search expenses
*/
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
{
$langs->load("trips");
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/deplacement/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td><label for=\"search_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td><label for=\"sall\">".$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
}
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
{
$langs->load("trips");
print '<form method="post" action="'.DOL_URL_ROOT.'/expensereport/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td><label for=\"search_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td><label for=\"sall\">".$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
}
if (! empty($conf->holiday->enabled)) if (! empty($conf->holiday->enabled))
{ {
@ -89,25 +124,6 @@ if (! empty($conf->holiday->enabled))
} }
/*
* Search expenses
*/
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
{
$langs->load("trips");
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/deplacement/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td><label for=\"search_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td><label for=\"sall\">".$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=10; $max=10;
@ -115,65 +131,131 @@ $max=10;
$langs->load("boxes"); $langs->load("boxes");
// Last trips // Last trips
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = d.fk_user";
$sql.= " AND d.entity = ".$conf->entity;
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
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 (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid;
$sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result)
{ {
$var=false; $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
$num = $db->num_rows($result); $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = d.fk_user";
$sql.= " AND d.entity = ".$conf->entity;
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')';
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 (!empty($socid)) $sql.= " AND d.fk_soc = ".$socid;
$sql.= $db->order("d.tms","DESC");
$sql.= $db->plimit($max, 0);
$i = 0; $result = $db->query($sql);
if ($result)
{
$var=false;
$num = $db->num_rows($result);
print '<table class="noborder" width="100%">'; $i = 0;
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).'</td>';
print '<td align="right">'.$langs->trans("FeesKilometersOrAmout").'</td>';
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
print '<td width="16">&nbsp;</td>';
print '</tr>';
if ($num)
{
$total_ttc = $totalam = $total = 0;
$deplacementstatic=new Deplacement($db); print '<table class="noborder" width="100%">';
$userstatic=new User($db); print '<tr class="liste_titre">';
while ($i < $num && $i < $max) print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).'</td>';
{ print '<td align="right">'.$langs->trans("FeesKilometersOrAmout").'</td>';
$obj = $db->fetch_object($result); print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
$deplacementstatic->ref=$obj->rowid; print '<td width="16">&nbsp;</td>';
$deplacementstatic->id=$obj->rowid; print '</tr>';
$userstatic->id=$obj->uid; if ($num)
$userstatic->lastname=$obj->lastname; {
$userstatic->firstname=$obj->firstname; $total_ttc = $totalam = $total = 0;
print '<tr '.$bc[$var].'>';
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(1).'</td>';
print '<td align="right">'.$obj->km.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut,3).'</td>';
print '</tr>';
$var=!$var;
$i++;
}
} $deplacementstatic=new Deplacement($db);
else $userstatic=new User($db);
{ while ($i < $num && $i < $max)
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>'; {
} $obj = $db->fetch_object($result);
print '</table><br>'; $deplacementstatic->ref=$obj->rowid;
$deplacementstatic->id=$obj->rowid;
$userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
print '<tr '.$bc[$var].'>';
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(1).'</td>';
print '<td align="right">'.$obj->km.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
print '<td>'.$deplacementstatic->LibStatut($obj->fk_statut,3).'</td>';
print '</tr>';
$var=!$var;
$i++;
}
}
else
{
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table><br>';
}
else dol_print_error($db);
}
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
{
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.date_debut as date, x.tms as dm, x.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = x.fk_user_author";
$sql.= " AND x.entity = ".$conf->entity;
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND x.fk_user_author IN ('.join(',',$childids).')';
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
//if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid;
$sql.= $db->order("x.tms","DESC");
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
if ($result)
{
$var=false;
$num = $db->num_rows($result);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).'</td>';
print '<td align="right">'.$langs->trans("FeesAmount").'</td>';
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
print '<td width="16">&nbsp;</td>';
print '</tr>';
if ($num)
{
$total_ttc = $totalam = $total = 0;
$expensereportstatic=new ExpenseReport($db);
$userstatic=new User($db);
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
$expensereportstatic->ref=$obj->rowid;
$expensereportstatic->id=$obj->rowid;
$userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
print '<tr '.$bc[$var].'>';
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(1).'</td>';
print '<td align="right">'.$obj->total_ttc.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
//print '<td>'.$expensereportstatic->LibStatut($obj->fk_statut,3).'</td>';
print '</tr>';
$var=!$var;
$i++;
}
}
else
{
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table><br>';
}
else dol_print_error($db);
} }
else dol_print_error($db);
print '</div></div></div>'; print '</div></div></div>';

View File

@ -1249,14 +1249,29 @@ class BonPrelevement extends CommonObject
$fileDebiteurSection = ''; $fileDebiteurSection = '';
$fileEmetteurSection = ''; $fileEmetteurSection = '';
$i = 0; $i = 0;
$j = 0;
$this->total = 0; $this->total = 0;
/* /*
* 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, c.code as country_code,";
$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 = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.iban_prefix as iban, rib.bic as bic, rib.datec, rib.rowid as drum"; $resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
while ($j < $num)
{
$objfac = $this->db->fetch_object($resql);
$ListOfFactures = $ListOfFactures . $objfac->fac . ",";
$j++;
}
}
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, p.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.= " 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,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,";
@ -1279,7 +1294,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->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); $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
$this->total = $this->total + $obj->somme; $this->total = $this->total + $obj->somme;
$i++; $i++;
} }
@ -1314,13 +1329,14 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf); fputs($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
fputs($this->file, ' <InitgPty>'.$CrLf); fputs($this->file, ' <InitgPty>'.$CrLf);
fputs($this->file, ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf); fputs($this->file, ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf);
/* fputs($this->file, ' <Id>'.$CrLf); fputs($this->file, ' <Id>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf); fputs($this->file, ' <PrvtId>'.$CrLf);
fputs($this->file, ' <Id>0533883248</Id>'.$CrLf);
fputs($this->file, ' <Issr>KBO-BCE</Issr>'.$CrLf);
fputs($this->file, ' <Othr>'.$CrLf); fputs($this->file, ' <Othr>'.$CrLf);
fputs($this->file, ' <Id>'.$conf->global->PRELEVEMENT_ICS.'</Id>'.$CrLf);
fputs($this->file, ' </Othr>'.$CrLf);
fputs($this->file, ' </PrvtId>'.$CrLf);
fputs($this->file, ' </Id>'.$CrLf); fputs($this->file, ' </Id>'.$CrLf);
*/ fputs($this->file, ' </InitgPty>'.$CrLf); fputs($this->file, ' </InitgPty>'.$CrLf);
fputs($this->file, ' </GrpHdr>'.$CrLf); fputs($this->file, ' </GrpHdr>'.$CrLf);
// SEPA File Emetteur // SEPA File Emetteur
if ($result != -2) if ($result != -2)
@ -1509,19 +1525,19 @@ class BonPrelevement extends CommonObject
// Define value for RUM // Define value for RUM
// Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId) // Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId)
$Date_Rum = strtotime($row_datec); $Date_Rum = strtotime($row_datec);
$pre = ($date_Rum > 1359673200) ? 'RUM' : '++R'; $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
$Rum = dol_trunc($pre.$row_code_client.'-'.$row_drum.'-0'.date('U', $Date_Rum), 35, 'right', 'UTF-8', 1); $pre = ($date_Rum > 1359673200) ? 'Rum' : '++R';
$Rum = $pre.$row_code_client.$row_drum.'-0'.date('U', $Date_Rum);
$XML_DEBITOR =''; $XML_DEBITOR ='';
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
$XML_DEBITOR .=' <PmtId>'.$CrLf; $XML_DEBITOR .=' <PmtId>'.$CrLf;
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.$row_facnumber.'-'.$Rowing).'</EndToEndId>'.$CrLf; $XML_DEBITOR .=' <EndToEndId>'.('AS-'.$row_facnumber.'-'.$Rowing).'</EndToEndId>'.$CrLf;
$XML_DEBITOR .=' </PmtId>'.$CrLf; $XML_DEBITOR .=' </PmtId>'.$CrLf;
$XML_DEBITOR .=' <InstdAmt Ccy.="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf; $XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
$XML_DEBITOR .=' <MndtRltdInf>'.$CrLf; $XML_DEBITOR .=' <MndtRltdInf>'.$CrLf;
$XML_DEBITOR .=' <MndtId>'.$Rum.'</MndtId>'.$CrLf; $XML_DEBITOR .=' <MndtId>'.$Rum.'</MndtId>'.$CrLf;
$XML_DEBITOR .=' <DtOfSgntr>'.$row_datec.'</DtOfSgntr>'.$CrLf; $XML_DEBITOR .=' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
$XML_DEBITOR .=' <AmdmntInd>false</AmdmntInd>'.$CrLf; $XML_DEBITOR .=' <AmdmntInd>false</AmdmntInd>'.$CrLf;
$XML_DEBITOR .=' </MndtRltdInf>'.$CrLf; $XML_DEBITOR .=' </MndtRltdInf>'.$CrLf;
$XML_DEBITOR .=' </DrctDbtTx>'.$CrLf; $XML_DEBITOR .=' </DrctDbtTx>'.$CrLf;
@ -1534,17 +1550,18 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf; $XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
$XML_DEBITOR .=' <PstlAdr>'.$CrLf; $XML_DEBITOR .=' <PstlAdr>'.$CrLf;
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf; $XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.strtr($row_adr, array(CHR(13) => ", ", CHR(10) => "")).'</AdrLine>'.$CrLf; $XML_DEBITOR .=' <AdrLine>'.strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf; $XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
$XML_DEBITOR .=' </PstlAdr>'.$CrLf; $XML_DEBITOR .=' </PstlAdr>'.$CrLf;
$XML_DEBITOR .=' </Dbtr>'.$CrLf; $XML_DEBITOR .=' </Dbtr>'.$CrLf;
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf; $XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
$XML_DEBITOR .=' <Id>'.$CrLf; $XML_DEBITOR .=' <Id>'.$CrLf;
$XML_DEBITOR .=' <IBAN>'.$row_iban.'</IBAN>'.$CrLf; $XML_DEBITOR .=' <IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
$XML_DEBITOR .=' </Id>'.$CrLf; $XML_DEBITOR .=' </Id>'.$CrLf;
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf; $XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
$XML_DEBITOR .=' <RmtInf>'.$CrLf; $XML_DEBITOR .=' <RmtInf>'.$CrLf;
$XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf; // $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
$XML_DEBITOR .=' <Ustrd>'.$row_facnumber.'</Ustrd>'.$CrLf;
$XML_DEBITOR .=' </RmtInf>'.$CrLf; $XML_DEBITOR .=' </RmtInf>'.$CrLf;
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf; $XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
return $XML_DEBITOR; return $XML_DEBITOR;

View File

@ -384,6 +384,8 @@ class PaymentSocialContribution extends CommonObject
$object=new PaymentSocialContribution($this->db); $object=new PaymentSocialContribution($this->db);
$object->context['createfromclone'] = 'createfromclone';
$this->db->begin(); $this->db->begin();
// Load source object // Load source object
@ -411,6 +413,8 @@ class PaymentSocialContribution extends CommonObject
} }
unset($this->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {

View File

@ -200,6 +200,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
if (! GETPOST("lastname")) if (! GETPOST("lastname"))
{ {
@ -303,6 +304,7 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;
$result = $object->update($contactid, $user); $result = $object->update($contactid, $user);

View File

@ -62,10 +62,10 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject = $langs->transnoentitiesnoconv('Contracts');
llxHeader(); llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
@ -74,46 +74,7 @@ $head=contract_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Contracts"), 0, 'contract'); dol_fiche_head($head, 'attributes', $langs->trans("Contracts"), 0, 'contract');
$textobject = $langs->transnoentitiesnoconv('Contracts'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -62,10 +62,10 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject = $langs->transnoentitiesnoconv('Contracts');
llxHeader(); llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
@ -74,46 +74,7 @@ $head=contract_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("Contracts"), 0, 'contract'); dol_fiche_head($head, 'attributeslines', $langs->trans("Contracts"), 0, 'contract');
$textobject = $langs->transnoentitiesnoconv('Contracts'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -84,7 +84,7 @@ if ($id > 0 || ! empty($ref)) {
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// fetch optionals attributes lines and labels // fetch optionals attributes lines and labels
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
@ -359,6 +359,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++;
$result = $object->create($user); $result = $object->create($user);
if ($result > 0) if ($result > 0)
@ -415,7 +416,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
// Unset extrafield // Unset extrafield
if (is_array($extralabelsline)) { if (is_array($extralabelsline)) {
// Get extra fields // Get extra fields
@ -537,7 +538,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$info_bits, $info_bits,
$fk_fournprice, $fk_fournprice,
$pa_ht, $pa_ht,
$array_option $array_options
); );
} }
@ -637,9 +638,9 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
$objectline->array_options=$array_option; $objectline->array_options=$array_options;
// TODO verifier price_min si fk_product et multiprix // TODO verifier price_min si fk_product et multiprix
$result=$objectline->update($user); $result=$objectline->update($user);
@ -725,19 +726,20 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) if ($ret < 0) $error++;
$error ++;
if (! $error) { if (! $error)
{
$result = $object->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
else if ($reshook < 0) $error++;
$result = $object->insertExtraFields(); if ($error)
if ($result < 0) { {
$error ++;
}
} else if ($reshook < 0)
$error ++;
if ($error) {
$action = 'edit_extras'; $action = 'edit_extras';
setEventMessage($object->error,'errors'); setEventMessage($object->error,'errors');
} }
@ -1414,8 +1416,8 @@ else
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
//Display lines extrafields //Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
@ -1481,7 +1483,7 @@ else
print '<br>'.$langs->trans("DateEndPlanned").' '; print '<br>'.$langs->trans("DateEndPlanned").' ';
$form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update"); $form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update");
print '</td>'; print '</td>';
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
$line = new ContratLigne($db); $line = new ContratLigne($db);
@ -1489,7 +1491,7 @@ else
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan)); print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan));
print '</tr>'; print '</tr>';
} }
print '</tr>'; print '</tr>';
} }

View File

@ -1239,10 +1239,10 @@ class Contrat extends CommonObject
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param int $fk_fournprice Fourn price id * @param int $fk_fournprice Fourn price id
* @param int $pa_ht Buying price HT * @param int $pa_ht Buying price HT
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @return int <0 si erreur, >0 si ok * @return int <0 si erreur, >0 si ok
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0)
{ {
global $user, $langs, $conf, $mysoc; global $user, $langs, $conf, $mysoc;
@ -1350,11 +1350,11 @@ class Contrat extends CommonObject
$result=$this->update_statut($user); $result=$this->update_statut($user);
if ($result > 0) if ($result > 0)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{ {
$contractline = new ContratLigne($this->db); $contractline = new ContratLigne($this->db);
$contractline->array_options=$array_option; $contractline->array_options=$array_options;
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element); $contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
$result=$contractline->insertExtraFields(); $result=$contractline->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -1363,7 +1363,7 @@ class Contrat extends CommonObject
$error++; $error++;
} }
} }
if (empty($error)) { if (empty($error)) {
// Call trigger // Call trigger
$result=$this->call_trigger('LINECONTRACT_CREATE',$user); $result=$this->call_trigger('LINECONTRACT_CREATE',$user);
@ -1373,7 +1373,7 @@ class Contrat extends CommonObject
return -1; return -1;
} }
// End call triggers // End call triggers
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@ -1417,10 +1417,10 @@ class Contrat extends CommonObject
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes
* @param int $fk_fournprice Fourn price id * @param int $fk_fournprice Fourn price id
* @param int $pa_ht Buying price HT * @param int $pa_ht Buying price HT
* @param array $array_option extrafields array * @param array $array_options extrafields array
* @return int < 0 si erreur, > 0 si ok * @return int < 0 si erreur, > 0 si ok
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0)
{ {
global $user, $conf, $langs, $mysoc; global $user, $conf, $langs, $mysoc;
@ -1520,8 +1520,8 @@ class Contrat extends CommonObject
$result=$this->update_statut($user); $result=$this->update_statut($user);
if ($result >= 0) if ($result >= 0)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{ {
$contractline = new ContratLigne($this->db); $contractline = new ContratLigne($this->db);
$contractline->array_options=$array_option; $contractline->array_options=$array_option;
@ -1533,7 +1533,7 @@ class Contrat extends CommonObject
$error++; $error++;
} }
} }
if (empty($error)) { if (empty($error)) {
// Call trigger // Call trigger
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user); $result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
@ -1543,7 +1543,7 @@ class Contrat extends CommonObject
return -3; return -3;
} }
// End call triggers // End call triggers
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@ -1597,7 +1597,7 @@ class Contrat extends CommonObject
$this->error="Error ".$this->db->lasterror(); $this->error="Error ".$this->db->lasterror();
$error++; $error++;
} }
if (empty($error)) { if (empty($error)) {
// Remove extrafields // Remove extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
@ -2522,10 +2522,10 @@ class ContratLigne extends CommonObject
$error++; $error++;
//return -1; //return -1;
} }
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
{ {

View File

@ -0,0 +1,73 @@
<?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/actions_lineupdown.inc.php
* \brief Code for actions on moving lines up or down onto object page
*/
// $action must be defined
// $permissiontoedit must be defined to permission to edit object
// $object must be defined
// $langs must be defined
// $hidedetails, $hidedesc, $hideref must de defined
if ($action == 'up' && $permissiontoedit)
{
$object->line_up(GETPOST('rowid'));
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
exit();
}
if ($action == 'down' && $permissiontoedit)
{
$object->line_down(GETPOST('rowid'));
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
exit();
}

View File

@ -23,7 +23,7 @@
// $action must be defined // $action must be defined
// $permission must be defined to permission to edit object // $permissionnote must be defined to permission to edit object
// $object must be defined (object is loaded in this file with fetch) // $object must be defined (object is loaded in this file with fetch)
// $id must be defined (object is loaded in this file with fetch) // $id must be defined (object is loaded in this file with fetch)

View File

@ -36,12 +36,12 @@
*/ */
class CMailFile class CMailFile
{ {
var $subject; // Topic: Subject of email var $subject; // Topic: Subject of email
var $addr_from; // From: Label of sender (name but can contains an email inside <>) var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@mydomain.com>' or 'John Doe <myemail@mydomain.com>' or '<myemail+trackingid@mydomain.com>')
// Sender: Who send the email ("Sender" has sent emails on behalf of "From"). // Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it with an email from a sending host from is a SPF protected domain and sending host is not this domain. // Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, use for Sender an email of the protected domain.
// Return-Path: Email where to send bounds. // Return-Path: Email where to send bounds.
var $errors_to; // Errors-To: Email where to send errors. var $errors_to; // Errors-To: Email where to send errors.
var $addr_to; var $addr_to;
var $addr_cc; var $addr_cc;
var $addr_bcc; var $addr_bcc;

View File

@ -49,6 +49,7 @@ abstract class CommonObject
public $errors; public $errors;
public $canvas; // Contains canvas name if it is public $canvas; // Contains canvas name if it is
public $context=array(); // Use to pass context information
public $name; public $name;
public $lastname; public $lastname;
@ -2136,7 +2137,7 @@ abstract class CommonObject
$fieldstatus="fk_statut"; $fieldstatus="fk_statut";
if ($elementTable == 'user') $fieldstatus="statut"; if ($elementTable == 'user') $fieldstatus="statut";
if ($elementTable == 'expensereport') $fieldstatus="fk_c_expensereport_statuts"; if ($elementTable == 'expensereport') $fieldstatus="fk_c_expensereport_statuts";
$sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable; $sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable;
$sql.= " SET ".$fieldstatus." = ".$status; $sql.= " SET ".$fieldstatus." = ".$status;
// If status = 1 = validated, update also fk_user_valid // If status = 1 = validated, update also fk_user_valid
@ -2567,38 +2568,43 @@ abstract class CommonObject
* @param string $buyer Object of buyer third party * @param string $buyer Object of buyer third party
* @param string $selected Object line selected * @param string $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @param int $permtoedit Permission to edit line
* @return void * @return void
*/ */
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0) function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $permtoedit=0)
{ {
global $conf, $hookmanager, $inputalsopricewithtax, $langs, $user; global $conf, $hookmanager, $inputalsopricewithtax, $usemargins, $langs, $user;
// Define usemargins
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element,array('facture','propal','commande'))) $usemargins=1;
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td align="center" width="5">&nbsp;</td>'; if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td align="center" width="5">&nbsp;</td>';
// Description // Description
print '<td><label for="">'.$langs->trans('Description').'</label></td>'; print '<td>'.$langs->trans('Description').'</td>';
// VAT // VAT
print '<td align="right" width="50"><label for="tva_tx">'.$langs->trans('VAT').'</label></td>'; print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
// Price HT // Price HT
print '<td align="right" width="80"><label for="price_ht">'.$langs->trans('PriceUHT').'</label></td>'; print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">&nbsp;</td>'; if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
// Qty // Qty
print '<td align="right" width="50"><label for="qty">'.$langs->trans('Qty').'</label></td>'; print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
// Reduction short // Reduction short
print '<td align="right" width="50"><label for="remise_percent">'.$langs->trans('ReductionShort').'</label></td>'; print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
if ($this->situation_cycle_ref) { if ($this->situation_cycle_ref) {
print '<td align="right" width="50"><label for="progress">' . $langs->trans('Progress') . '</label></td>'; print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
} }
if (! empty($conf->margin->enabled) && empty($user->societe_id)) if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{ {
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" class="margininfos" width="80">'.$langs->trans('BuyingPrice').'</td>'; print '<td align="right" class="margininfos" width="80">'.$langs->trans('BuyingPrice').'</td>';
@ -2653,7 +2659,7 @@ abstract class CommonObject
} }
else else
{ {
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline); $this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline,$permtoedit);
} }
$i++; $i++;
@ -2674,9 +2680,10 @@ abstract class CommonObject
* @param string $buyer Object of buyer third party * @param string $buyer Object of buyer third party
* @param string $selected Object line selected * @param string $selected Object line selected
* @param object $extrafieldsline Object of extrafield line attribute * @param object $extrafieldsline Object of extrafield line attribute
* @param int $permtoedit Permission to edit
* @return void * @return void
*/ */
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0) function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0,$permtoedit=0)
{ {
global $conf,$langs,$user,$object,$hookmanager; global $conf,$langs,$user,$object,$hookmanager;
global $form,$bc,$bcdd; global $form,$bc,$bcdd;
@ -3496,7 +3503,8 @@ abstract class CommonObject
/** /**
* Add/Update all extra fields values for the current object. * Add/Update all extra fields values for the current object.
* All data to describe values to insert are stored into $this->array_options=array('keyextrafield'=>'valueextrafieldtoadd') * Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* This function delte record with all extrafields and insert them again from the array $this->array_options.
* *
* @return int -1=error, O=did nothing, 1=OK * @return int -1=error, O=did nothing, 1=OK
*/ */

View File

@ -54,6 +54,10 @@ class Conf
public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array()); public $modules_parts = array('css'=>array(),'js'=>array(),'tabs'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'sms'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'societe'=>array(),'hooks'=>array(),'dir'=>array());
var $logbuffer = array(); var $logbuffer = array();
/**
* @var LogHandlerInterface[]
*/
var $loghandlers = array(); var $loghandlers = array();
//! To store properties of multi-company //! To store properties of multi-company

View File

@ -1264,7 +1264,7 @@ class ExtraFields
* @param array $extralabels $array of extrafields * @param array $extralabels $array of extrafields
* @param object $object Object * @param object $object Object
* @param string $onlykey Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset. * @param string $onlykey Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset.
* @return int 1 if array_options set / 0 if no value * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
*/ */
function setOptionalsFromPost($extralabels,&$object,$onlykey='') function setOptionalsFromPost($extralabels,&$object,$onlykey='')
{ {

View File

@ -4097,7 +4097,7 @@ class Form
* Function to show a form to select a duration on a page * Function to show a form to select a duration on a page
* *
* @param string $prefix Prefix for input fields * @param string $prefix Prefix for input fields
* @param int $iSecond Default preselected duration (number of seconds) * @param int $iSecond Default preselected duration (number of seconds or '')
* @param int $disabled Disable the combo box * @param int $disabled Disable the combo box
* @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo * @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo
* @param string $minunderhours If 1, show minutes selection under the hours * @param string $minunderhours If 1, show minutes selection under the hours
@ -4112,7 +4112,7 @@ class Form
$hourSelected=0; $minSelected=0; $hourSelected=0; $minSelected=0;
if ($iSecond) if ($iSecond != '')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';

View File

@ -670,10 +670,9 @@ class FormFile
if (! function_exists('dol_dir_list')) include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (! function_exists('dol_dir_list')) include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$out=''; $out='';
$this->numoffiles=0; $this->numoffiles=0;
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote($modulesubdir.'.pdf','/'), '\.meta$|\.png$'); $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir).'.pdf','/'), '\.meta$|\.png$');
// For ajax treatment // For ajax treatment
$out.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\n"; $out.= '<div id="gen_pdf_'.$modulesubdir.'" class="linkobject hideobject">'.img_picto('', 'refresh').'</div>'."\n";

View File

@ -330,7 +330,7 @@ class FormOther
} }
// Print a select with each of them // Print a select with each of them
$moreforfilter.='<select class="flat" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $moreforfilter.='<select class="flat minwidth100" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
$moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing $moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs)) if (is_array($tab_categs))

View File

@ -208,6 +208,8 @@ class DoliDBPgsql extends DoliDB
$line=preg_replace('/tinytext/i','text',$line); $line=preg_replace('/tinytext/i','text',$line);
$line=preg_replace('/mediumtext/i','text',$line); $line=preg_replace('/mediumtext/i','text',$line);
$line=preg_replace('/text\([0-9]+\)/i','text',$line);
// change not null datetime field to null valid ones // change not null datetime field to null valid ones
// (to support remapping of "zero time" to null // (to support remapping of "zero time" to null
$line=preg_replace('/datetime not null/i','datetime',$line); $line=preg_replace('/datetime not null/i','datetime',$line);

176
htdocs/core/js/timesheet.js Normal file
View File

@ -0,0 +1,176 @@
//FIXME total not working
/* Copyright (C) 2014 delcroip <delcroip@gmail.com>
* Laurent Destailleur 2015 <eldy@users.sourceforge.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Parse en input data for time entry into timesheet */
function regexEvent(objet,evt,type)
{
console.log('regexEvent type='+type);
switch(type)
{
case 'days':
var regex= /^[0-9]{1}([.,]{1}[0-9]{1})?$/;
if(regex.test(objet.value) )
{
var tmp=objet.value.replace(',','.');
if(tmp<=1.5){
var tmpint=parseInt(tmp);
if(tmp-tmpint>=0.5){
objet.value= tmpint+0.5;
}else{
objet.value= tmpint;
}
}else{
objet.value= '1.5';
}
}else{
objet.value= '0';
}
break;
case 'hours':
var regex= /^[0-9]{1,2}:[0-9]{2}$/;
var regex2=/^[0-9]{1,2}$/;
if(!regex.test(objet.value))
{
if(regex2.test(objet.value))
objet.value=objet.value+':00';
else
objet.value='';
}
/* alert(jQuery("#"+id).val()); */
break;
case 'timeChar':
//var regex= /^[0-9:]{1}$/;
//alert(event.charCode);
var charCode = (evt.which) ? evt.which : event.keyCode;
if(((charCode >= 48) && (charCode <= 57)) || //num
(charCode===46) || (charCode===8)||// comma & periode
(charCode === 58) || (charCode==44) )// : & all charcode
{
// ((charCode>=96) && (charCode<=105)) || //numpad
return true;
}else
{
return false;
}
break;
default:
break;
}
}
function pad(n) {
return (n < 10) ? ("0" + n) : n;
}
/* function from http://www.timlabonne.com/2013/07/parsing-a-time-string-with-javascript/ */
function parseTime(timeStr, dt)
{
if (!dt) {
dt = new Date();
}
var time = timeStr.match(/(\d+)(?::(\d\d))?\s*(p?)/i);
if (!time) {
return -1;
}
var hours = parseInt(time[1], 10);
if (hours == 12 && !time[3]) {
hours = 0;
}
else {
hours += (hours < 12 && time[3]) ? 12 : 0;
}
dt.setHours(hours);
dt.setMinutes(parseInt(time[2], 10) || 0);
dt.setSeconds(0, 0);
return 0;
}
/* Update total. days = column nb staring from 0 */
function updateTotal(days,mode)
{
console.log('updateTotal days='+days+' mode='+mode);
if(mode=="hours")
{
var total = new Date(0);
total.setHours(0);
total.setMinutes(0);
var nbline = document.getElementById('numberOfLines').value;
for (var i=0;i<nbline;i++)
{
var id='task['+i+']['+days+']';
var taskTime= new Date(0);
var element=document.getElementById(id);
if(element)
{
/* alert(element.value);*/
if (element.value)
{
result=parseTime(element.value,taskTime);
}
else
{
result=parseTime(element.innerHTML,taskTime);
}
if (result >= 0)
{
total.setHours(total.getHours()+taskTime.getHours());
total.setMinutes(total.getMinutes()+taskTime.getMinutes());
}
}
}
document.getElementById('totalDay['+days+']').innerHTML = pad(total.getHours())+':'+pad(total.getMinutes());
//addText(,total.getHours()+':'+total.getMinutes());
}
else
{
var total =0;
var nbline = document.getElementById('numberOfLines').value;
for (var i=0;i<nbline;i++)
{
var id='task['+i+']['+days+']';
var taskTime= new Date(0);
var element=document.getElementById(id);
if(element)
{
if (element.value)
{
total+=parseInt(element.value);
}
else
{
total+=parseInt(element.innerHTML);
}
}
}
document.getElementById('totalDay['+days+']').innerHTML = total;
}
}

View File

@ -71,9 +71,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if ($canedit) if ($canedit)
{ {
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("ActionsToDoBy").' &nbsp; '; print $langs->trans("ActionsToDoBy").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">'; print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("Group").' &nbsp; '; if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("Group").' &nbsp; ';
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
@ -83,16 +83,16 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
$formactions=new FormActions($db); $formactions=new FormActions($db);
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Type"); print $langs->trans("Type");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">'; print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0)); print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0));
print '</td></tr>'; print '</td></tr>';
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Status"); print $langs->trans("Status");
print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">'; print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
$formactions->form_select_status_action('formaction',$status,1,'status',1,2); $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
print '</td></tr>'; print '</td></tr>';
} }
@ -100,9 +100,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if (! empty($conf->societe->enabled) && $user->rights->societe->lire) if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
{ {
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("ThirdParty").' &nbsp; '; print $langs->trans("ThirdParty").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">'; print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
print $form->select_thirdparty($socid, 'socid'); print $form->select_thirdparty($socid, 'socid');
print '</td></tr>'; print '</td></tr>';
} }
@ -113,9 +113,9 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
$formproject=new FormProjets($db); $formproject=new FormProjets($db);
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Project").' &nbsp; '; print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap maxwidthonsmartphone">'; print '</td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px;">';
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0); $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0);
print '</td></tr>'; print '</td></tr>';
} }
@ -124,7 +124,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{ {
// Filter on hours // Filter on hours
print '<tr>'; print '<tr>';
print '<td class="nowrap">'.$langs->trans("WorkingTimeRange").'</td>'; print '<td class="nowrap" style="padding-bottom: 2px;">'.$langs->trans("WorkingTimeRange").'</td>';
print "<td class='nowrap maxwidthonsmartphone'>"; print "<td class='nowrap maxwidthonsmartphone'>";
print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">'; print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
if (empty($conf->dol_use_jmobile)) print ' - '; if (empty($conf->dol_use_jmobile)) print ' - ';
@ -140,10 +140,6 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if (empty($conf->dol_use_jmobile)) print ' - '; if (empty($conf->dol_use_jmobile)) print ' - ';
print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">'; print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("AgendaShowBirthdayEvents").' <input type="checkbox" id="check_birthday" name="check_birthday"></td></tr>';
print '</table>';
print '</td>';
} }
// Hooks // Hooks

View File

@ -166,7 +166,7 @@ function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
/** Return, in clear text, value of a number of seconds in days, hours and minutes /** Return, in clear text, value of a number of seconds in days, hours and minutes
* *
* @param int $iSecond Number of seconds * @param int $iSecond Number of seconds
* @param string $format Output format (all: total delay days hour:min like "2 days 12:30"", allhourmin: total delay hours:min like "60:30", allhour: total delay hours without min/sec like "60:30", fullhour: total delay hour decimal like "60.5" for 60:30, hour: only hours part "12", min: only minutes part "30", sec: only seconds part, month: only month part, year: only year part); * @param string $format Output format ('all': total delay days hour:min like "2 days 12:30"", 'allhourmin': total delay hours:min like "60:30", 'allhour': total delay hours without min/sec like "60:30", 'fullhour': total delay hour decimal like "60.5" for 60:30, 'hour': only hours part "12", 'min': only minutes part "30", 'sec': only seconds part, 'month': only month part, 'year': only year part);
* @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour) * @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour)
* @param int $lengthOfWeek Length of week (default 7) * @param int $lengthOfWeek Length of week (default 7)
* @return string Formated text of duration * @return string Formated text of duration

View File

@ -187,19 +187,19 @@ function supplierorder_admin_prepare_head()
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierorderdet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierorderdet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsSupplierOrdersLines");
$head[$h][2] = 'supplierorderdet'; $head[$h][2] = 'supplierorderdet';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices"); $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices");
$head[$h][2] = 'supplierinvoice'; $head[$h][2] = 'supplierinvoice';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLines");
$head[$h][2] = 'supplierinvoicedet'; $head[$h][2] = 'supplierinvoicedet';
$h++; $h++;

View File

@ -44,6 +44,7 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php';
* @param string $class Class name * @param string $class Class name
* @param string $member Name of property * @param string $member Name of property
* @return mixed Return value of static property * @return mixed Return value of static property
* @deprecated Dolibarr now requires 5.3.0+
*/ */
function getStaticMember($class, $member) function getStaticMember($class, $member)
{ {
@ -122,49 +123,85 @@ function getEntity($element=false, $shared=0)
/** /**
* Return information about user browser * Return information about user browser
* *
* @return array Array of information ('browsername'=>,'browseros'=>,'browserversion'=>,'layout'=>(classic|phone|tablet)) * Returns array with the following format:
* array(
* 'browsername' => Browser name (firefox|chrome|iceweasel|epiphany|safari|opera|ie|unknown)
* 'browserversion' => Browser version. Empty if unknown
* 'browseros' => Set with mobile OS (android|blackberry|ios|palm|symbian|webos|maemo|windows|unknown)
* 'layout' => (tablet|phone|classic)
* 'phone' => empty if not mobile, (android|blackberry|ios|palm|unknown) if mobile
* 'tablet' => true/false
* )
*
* @param string $user_agent Content of $_SERVER["HTTP_USER_AGENT"] variable
* @return array Check function documentation
*/ */
function getBrowserInfo() function getBrowserInfo($user_agent)
{ {
$name='unknown'; $version=''; $os='unknown'; $phone=''; $tablet=''; include_once DOL_DOCUMENT_ROOT.'/core/class/mobiledetect.class.php';
// If phone/smartphone, we set phone os name. $name='unknown';
if (preg_match('/android/i',$_SERVER["HTTP_USER_AGENT"])) { $os=$phone='android'; } $version='';
elseif (preg_match('/blackberry/i',$_SERVER["HTTP_USER_AGENT"])) { $os=$phone='blackberry'; } $os='unknown';
elseif (preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) { $os='ios'; $phone='iphone'; } $phone = '';
elseif (preg_match('/ipod/i',$_SERVER["HTTP_USER_AGENT"])) { $os='ios'; $phone='iphone'; }
elseif (preg_match('/palm/i',$_SERVER["HTTP_USER_AGENT"])) { $os=$phone='palm'; } $detectmobile = new MobileDetect(null, $user_agent);
elseif (preg_match('/symbian/i',$_SERVER["HTTP_USER_AGENT"])) { $os='symbian'; $phone='unknown'; } $tablet = $detectmobile->isTablet();
elseif (preg_match('/webos/i',$_SERVER["HTTP_USER_AGENT"])) { $os='webos'; $phone='unknown'; }
elseif (preg_match('/maemo/i',$_SERVER["HTTP_USER_AGENT"])) { $os='maemo'; $phone='unknown'; } if ($detectmobile->isMobile()) {
// MS products at end
elseif (preg_match('/iemobile/i',$_SERVER["HTTP_USER_AGENT"])) { $os='windows'; $phone='unkown'; } $phone = 'unknown';
elseif (preg_match('/windows ce/i',$_SERVER["HTTP_USER_AGENT"])) { $os='windows'; $phone='unkown'; }
// If phone/smartphone, we set phone os name.
if ($detectmobile->is('AndroidOS')) {
$os = $phone = 'android';
} elseif ($detectmobile->is('BlackBerryOS')) {
$os = $phone = 'blackberry';
} elseif ($detectmobile->is('iOS')) {
$os = 'ios';
$phone = 'iphone';
} elseif ($detectmobile->is('PalmOS')) {
$os = $phone = 'palm';
} elseif ($detectmobile->is('SymbianOS')) {
$os = 'symbian';
} elseif ($detectmobile->is('webOS')) {
$os = 'webos';
} elseif ($detectmobile->is('MaemoOS')) {
$os = 'maemo';
} elseif ($detectmobile->is('WindowsMobileOS') || $detectmobile->is('WindowsPhoneOS')) {
$os = 'windows';
}
}
// OS // OS
if (preg_match('/android/i',$_SERVER["HTTP_USER_AGENT"])) { $os='android'; } if (preg_match('/linux/i', $user_agent)) { $os='linux'; }
elseif (preg_match('/linux/i',$_SERVER["HTTP_USER_AGENT"])) { $os='linux'; }
// Name // Name
if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='firefox'; $version=$reg[2]; } if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='firefox'; $version=$reg[2]; }
elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='chrome'; $version=$reg[2]; } // we can have 'chrome (Mozilla...) chrome x.y' in one string elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { $name='chrome'; $version=$reg[2]; } // we can have 'chrome (Mozilla...) chrome x.y' in one string
elseif (preg_match('/chrome/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='chrome'; } elseif (preg_match('/chrome/i', $user_agent, $reg)) { $name='chrome'; }
elseif (preg_match('/iceweasel/i',$_SERVER["HTTP_USER_AGENT"])) { $name='iceweasel'; $version=$reg[2]; } elseif (preg_match('/iceweasel/i', $user_agent)) { $name='iceweasel'; $version=$reg[2]; }
elseif (preg_match('/epiphany/i',$_SERVER["HTTP_USER_AGENT"])) { $name='epiphany'; $version=$reg[2]; } elseif (preg_match('/epiphany/i', $user_agent)) { $name='epiphany'; $version=$reg[2]; }
elseif ((empty($phone) || preg_match('/iphone/i',$_SERVER["HTTP_USER_AGENT"])) && preg_match('/safari(\/|\s)([\d\.]*)/i',$_SERVER["HTTP_USER_AGENT"], $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not. elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not.
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='opera'; $version=$reg[2]; } elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; }
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $_SERVER["HTTP_USER_AGENT"], $reg)) { $name='ie'; $version= end($reg); } // MS products at end elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
// Other
$firefox=0;
if (in_array($name,array('firefox','iceweasel'))) $firefox=1;
include_once DOL_DOCUMENT_ROOT.'/core/class/mobiledetect.class.php'; if ($tablet) {
$detectmobile=new MobileDetect(); $layout = 'tablet';
$phone=$detectmobile->isMobile(); } elseif ($phone) {
$tablet=$detectmobile->isTablet(); $layout = 'phone';
unset($detectmobile); // free memory } else {
$layout = 'classic';
}
return array('browsername'=>$name, 'browserversion'=>$version, 'browseros'=>$os, 'browserfirefox'=>$firefox, 'layout'=> ($tablet?'tablet':($phone?'phone':'classic')), 'phone'=>$phone, 'tablet'=>$tablet); return array(
'browsername' => $name,
'browserversion' => $version,
'browseros' => $os,
'layout' => $layout,
'phone' => $phone,
'tablet' => $tablet
);
} }
/** /**
@ -382,7 +419,7 @@ function dol_size($size,$type='')
* *
* @param string $str String to clean * @param string $str String to clean
* @param string $newstr String to replace bad chars with * @param string $newstr String to replace bad chars with
* @param string $unaccent 1=Remove also accent (default), 0 do not remove them * @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @return string String cleaned (a-zA-Z_) * @return string String cleaned (a-zA-Z_)
* *
* @see dol_string_nospecial, dol_string_unaccent * @see dol_string_nospecial, dol_string_unaccent
@ -484,8 +521,8 @@ function dolEscapeXML($string)
* Returns text escaped for inclusion into javascript code * Returns text escaped for inclusion into javascript code
* *
* @param string $stringtoescape String to escape * @param string $stringtoescape String to escape
* @param string $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \ * @param int $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \
* @param string $noescapebackslashn 0=Escape also \n. 1=Do not escape \n. * @param int $noescapebackslashn 0=Escape also \n. 1=Do not escape \n.
* @return string Escaped string. Both ' and " are escaped into ' if they are escaped. * @return string Escaped string. Both ' and " are escaped into ' if they are escaped.
*/ */
function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0) function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
@ -569,7 +606,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
global $conf, $user; global $conf, $user;
// If syslog module enabled // If syslog module enabled
if (empty($conf->syslog->enabled)) return false; if (empty($conf->syslog->enabled)) return;
if (! empty($level)) if (! empty($level))
{ {
@ -579,7 +616,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
{ {
throw new Exception('Incorrect log level'); throw new Exception('Incorrect log level');
} }
if ($level > $conf->global->SYSLOG_LEVEL) return false; if ($level > $conf->global->SYSLOG_LEVEL) return;
// If adding log inside HTML page is required // If adding log inside HTML page is required
if (! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_LOGTOHTML)) if (! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_LOGTOHTML))
@ -587,6 +624,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message; $conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
} }
//TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a HTML handler
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments // If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"])) if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
{ {
@ -812,7 +850,7 @@ function dol_bc($var,$moreclass='')
* @param Object $object A company or contact object * @param Object $object A company or contact object
* @param int $withcountry 1=Add country into address string * @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string * @param string $sep Separator to use to build string
* @param Tranlsate $outputlangs Object lang that contains language for text translation. * @param Translate $outputlangs Object lang that contains language for text translation.
* @return string Formated string * @return string Formated string
*/ */
function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
@ -1393,7 +1431,7 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
* @param string $country Country code to use for formatting * @param string $country Country code to use for formatting
* @param int $cid Id of contact if known * @param int $cid Id of contact if known
* @param int $socid Id of third party if known * @param int $socid Id of third party if known
* @param int $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set) * @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set)
* @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx * @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @param string $withpicto Show picto * @param string $withpicto Show picto
* @return string Formated phone number * @return string Formated phone number
@ -1610,6 +1648,7 @@ function isValidEmail($address)
/** /**
* Return true if phone number syntax is ok * Return true if phone number syntax is ok
* *
* TODO: Decide what to do with this
* @param string $phone phone (Ex: "0601010101") * @param string $phone phone (Ex: "0601010101")
* @return boolean true if phone syntax is OK, false if KO or empty string * @return boolean true if phone syntax is OK, false if KO or empty string
*/ */
@ -2697,7 +2736,7 @@ function print_fiche_titre($title, $mesg='', $picto='title.png', $pictoisfullpat
* @param int $id To force an id on html objects * @param int $id To force an id on html objects
* @return string * @return string
*/ */
function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='') function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id=0)
{ {
global $conf; global $conf;
@ -3243,7 +3282,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
{ {
global $db; global $db;
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local." thirdparty id=".(is_object($thirdparty)?$thirdparty->id:'')); dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local);
// Search local taxes // Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
@ -3301,30 +3340,6 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
} }
} }
if(! isOnlyOneLocalTax(2))
{
if(! isOnlyOneLocalTax(1))
{
return array($obj->localtax2_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy);
}
else
{
return array($obj->localtax2_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
}
}
else
{
if(! isOnlyOneLocalTax(1))
{
return array($obj->localtax2_type, $obj->localtax2, $obj->localtax1_type,get_localtax($vatrate, 1, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
}
else
{
return array($obj->localtax2_type, $obj->localtax2, $obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
}
}
} }
} }
@ -3836,8 +3851,8 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
/** /**
* This function is called to encode a string into a HTML string but differs from htmlentities because * This function is called to encode a string into a HTML string but differs from htmlentities because
* all entities but &,<,> are converted. This permits to encode special chars to entities with no double * a detection is done before to see if text is already HTML or not. Also, all entities but &,<,> are converted.
* encoding for already encoded HTML strings. * This permits to encode special chars to entities with no double encoding for already encoded HTML strings.
* This function also remove last EOL or BR if $removelasteolbr=1 (default). * This function also remove last EOL or BR if $removelasteolbr=1 (default).
* For PDF usage, you can show text by 2 ways: * For PDF usage, you can show text by 2 ways:
* - writeHTMLCell -> param must be encoded into HTML. * - writeHTMLCell -> param must be encoded into HTML.
@ -3854,7 +3869,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8',$removelasteolbr=1) function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8',$removelasteolbr=1)
{ {
$newstring=$stringtoencode; $newstring=$stringtoencode;
if (dol_textishtml($stringtoencode)) if (dol_textishtml($stringtoencode)) // Check if text is already HTML or not
{ {
$newstring=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF. $newstring=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
if ($removelasteolbr) $newstring=preg_replace('/<br>$/i','',$newstring); // Remove last <br> (remove only last one) if ($removelasteolbr) $newstring=preg_replace('/<br>$/i','',$newstring); // Remove last <br> (remove only last one)
@ -3915,8 +3930,8 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
} }
/** /**
* Replace htmlentities functions to manage errors * Replace htmlentities functions to manage errors http://php.net/manual/en/function.htmlentities.php
* http://php.net/manual/en/function.htmlentities.php * Goal of this function is to be sure to have default values of htmlentities that match what we need.
* *
* @param string $string The input string. * @param string $string The input string.
* @param int $flags Flags(see PHP doc above) * @param int $flags Flags(see PHP doc above)
@ -4063,7 +4078,7 @@ function dol_textishtml($msg,$option=0)
* *
* @param string $text1 Text 1 * @param string $text1 Text 1
* @param string $text2 Text 2 * @param string $text2 Text 2
* @param string $forxml false=Use <br>, true=Use <br /> * @param bool $forxml false=Use <br>, true=Use <br />
* @return string Text 1 + new line + Text2 * @return string Text 1 + new line + Text2
* @see dol_textishtml * @see dol_textishtml
*/ */
@ -4105,7 +4120,7 @@ function make_substitutions($chaine,$substitutionarray)
* *
* @param array $substitutionarray Array substitution old value => new value value * @param array $substitutionarray Array substitution old value => new value value
* @param Translate $outputlangs If we want substitution from special constants, we provide a language * @param Translate $outputlangs If we want substitution from special constants, we provide a language
* @param Object $object If we want substitution from special constants, we provide data in a source object * @param object $object If we want substitution from special constants, we provide data in a source object
* @param Mixed $parameters Add more parameters (useful to pass product lines) * @param Mixed $parameters Add more parameters (useful to pass product lines)
* @param string $callfunc What is the name of the custom function that will be called? (default: completesubstitutionarray) * @param string $callfunc What is the name of the custom function that will be called? (default: completesubstitutionarray)
* @return void * @return void
@ -4148,8 +4163,8 @@ function complete_substitutions_array(&$substitutionarray,$outputlangs,$object='
/** /**
* Format output for start and end date * Format output for start and end date
* *
* @param timestamp $date_start Start date * @param int $date_start Start date
* @param timestamp $date_end End date * @param int $date_end End date
* @param string $format Output format * @param string $format Output format
* @param Translate $outputlangs Output language * @param Translate $outputlangs Output language
* @return void * @return void
@ -4162,8 +4177,8 @@ function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
/** /**
* Format output for start and end date * Format output for start and end date
* *
* @param timestamp $date_start Start date * @param int $date_start Start date
* @param timestamp $date_end End date * @param int $date_end End date
* @param string $format Output format * @param string $format Output format
* @param Translate $outputlangs Output language * @param Translate $outputlangs Output language
* @param string $withparenthesis 1=Add parenthesis, 0=non parenthesis * @param string $withparenthesis 1=Add parenthesis, 0=non parenthesis
@ -4708,6 +4723,7 @@ function picto_from_langcode($codelang)
* 'member' to add a tab in fundation member view * 'member' to add a tab in fundation member view
* 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member) * 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member)
* 'ecm' to add a tab for another ecm view * 'ecm' to add a tab for another ecm view
* 'stock' to add a tab for warehouse view
* @param string $mode 'add' to complete head, 'remove' to remove entries * @param string $mode 'add' to complete head, 'remove' to remove entries
* @return void * @return void
*/ */

View File

@ -371,6 +371,21 @@ function dol_print_object_info($object)
} }
} }
/**
* Return an email formatted to include a tracking id
* For example myemail@mydomain.com becom myemail+trackingid@mydomain.com
*
* @param string $email Email address (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
* @param string $trackingid Tracking id (Ex: thi123 for thirdparty with id 123)
* @return boolean True if domain email is OK, False if KO
*/
function dolAddEmailTrackId($email, $trackingid)
{
$tmp=explode('@',$email);
return $tmp[0].'+'.$trackingid.'@'.(isset($tmp[1])?$tmp[1]:'');
}
/** /**
* Return true if email has a domain name that can't be resolved * Return true if email has a domain name that can't be resolved
* *

View File

@ -125,8 +125,9 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
if (empty($conf->global->MAIN_USE_FPDF)) require_once TCPDF_PATH.'tcpdf.php'; if (empty($conf->global->MAIN_USE_FPDF)) require_once TCPDF_PATH.'tcpdf.php';
else require_once FPDF_PATH.'fpdf.php'; else require_once FPDF_PATH.'fpdf.php';
// We need to instantiate fpdi object (instead of tcpdf) to use merging features. But we can disable it. // We need to instantiate tcpdi or fpdi object (instead of tcpdf) to use merging features. But we can disable it (this will break all merge features).
if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once FPDI_PATH.'fpdi.php'; if (empty($conf->global->MAIN_DISABLE_TCPDI)) require_once TCPDI_PATH.'tcpdi.php';
else if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once FPDI_PATH.'fpdi.php';
//$arrayformat=pdf_getFormat(); //$arrayformat=pdf_getFormat();
//$format=array($arrayformat['width'],$arrayformat['height']); //$format=array($arrayformat['width'],$arrayformat['height']);
@ -146,7 +147,8 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality. - print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions. - owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
*/ */
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format); if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype,$metric,$format);
else if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
else $pdf = new TCPDF($pagetype,$metric,$format); else $pdf = new TCPDF($pagetype,$metric,$format);
// For TCPDF, we specify permission we want to block // For TCPDF, we specify permission we want to block
$pdfrights = array('modify','copy'); $pdfrights = array('modify','copy');
@ -157,7 +159,8 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
} }
else else
{ {
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format); if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype,$metric,$format);
else if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
else $pdf = new TCPDF($pagetype,$metric,$format); else $pdf = new TCPDF($pagetype,$metric,$format);
} }

View File

@ -163,6 +163,38 @@ function task_prepare_head($object)
return $head; return $head;
} }
/**
* Prepare array with list of tabs
*
* @param string $mode Mode
* @return array Array of tabs to show
*/
function project_timesheet_prepare_head($mode)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:'');
$head[$h][1] = $langs->trans("InputPerDay");
$head[$h][2] = 'inputperday';
$h++;
$head[$h][0] = DOL_URL_ROOT."/projet/activity/pertime.php".($mode?'?mode='.$mode:'');
$head[$h][1] = $langs->trans("InputPerTime");
$head[$h][2] = 'inputpertime';
$h++;
complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet');
complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet','remove');
return $head;
}
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs
* *
@ -352,11 +384,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print dol_print_date($lines[$i]->date_end,'dayhour'); print dol_print_date($lines[$i]->date_end,'dayhour');
print '</td>'; print '</td>';
$plannedworkloadoutputformat='allhourmin';
$timespentoutputformat='allhourmin';
if (! empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat=$conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
if (! empty($conf->global->PROJECT_TIMES_PENT_FORMAT)) $timespentoutputformat=$conf->global->PROJECT_TIME_SPENT_FORMAT;
// Planned Workload (in working hours) // Planned Workload (in working hours)
print '<td align="right">'; print '<td align="right">';
$fullhour=convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); $fullhour=convertSecondToTime($lines[$i]->planned_workload,$plannedworkloadoutputformat);
$workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks $workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
if ($lines[$i]->planned_workload) if ($lines[$i]->planned_workload != '')
{ {
print $fullhour; print $fullhour;
// TODO Add delay taking account of working hours per day and working day per week // TODO Add delay taking account of working hours per day and working day per week
@ -367,14 +404,17 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Progress declared // Progress declared
print '<td align="right">'; print '<td align="right">';
print $lines[$i]->progress.' %'; if ($lines[$i]->progress != '')
{
print $lines[$i]->progress.' %';
}
print '</td>'; print '</td>';
// Time spent // Time spent
print '<td align="right">'; print '<td align="right">';
if ($showlineingray) print '<i>'; if ($showlineingray) print '<i>';
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">'; else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">';
if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,'allhourmin'); if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration,$timespentoutputformat);
else print '--:--'; else print '--:--';
if ($showlineingray) print '</i>'; if ($showlineingray) print '</i>';
else print '</a>'; else print '</a>';
@ -440,7 +480,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
/** /**
* Output a task line * Output a task line into a pertime intput mode
* *
* @param string $inc ? * @param string $inc ?
* @param string $parent ? * @param string $parent ?
@ -452,7 +492,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc * @return $inc
*/ */
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
{ {
global $db, $user, $bc, $langs; global $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic; global $form, $formother, $projectstatic, $taskstatic;
@ -504,25 +544,15 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
// Label task // Label task
print "<td>"; print "<td>";
for ($k = 0 ; $k < $level ; $k++) for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
{
print "&nbsp;&nbsp;&nbsp;";
}
$taskstatic->id=$lines[$i]->id; $taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->label; $taskstatic->ref=$lines[$i]->label;
print $taskstatic->getNomUrl(0); print $taskstatic->getNomUrl(0);
print "<br>";
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n"; print "</td>\n";
// Date start
print '<td align="center">';
print dol_print_date($lines[$i]->date_start,'dayhour');
print '</td>';
// Date end
print '<td align="center">';
print dol_print_date($lines[$i]->date_end,'dayhour');
print '</td>';
// Planned Workload // Planned Workload
print '<td align="right">'; print '<td align="right">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin'); if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
@ -581,7 +611,158 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
$inc++; $inc++;
$level++; $level++;
if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); if ($lines[$i]->id) projectLinesPerTime($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
$level--;
}
else
{
//$level--;
}
}
return $inc;
}
/**
* Output a task line into a perday intput mode
*
* @param string $inc ?
* @param string $parent ?
* @param Task[] $lines ?
* @param int $level ?
* @param string $projectsrole ?
* @param string $tasksrole ?
* @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
* @return $inc
*/
function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
{
global $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic;
if (! is_object($formother))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($db);
}
$lastprojectid=0;
$var=true;
$numlines=count($lines);
for ($i = 0 ; $i < $numlines ; $i++)
{
if ($parent == 0) $level = 0;
if ($lines[$i]->fk_parent == $parent)
{
// Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{
$var = !$var;
$lastprojectid=$lines[$i]->fk_project;
$projectstatic->id = $lines[$i]->fk_project;
$projectstatic->loadTimeSpent($datestart, $lines[$i]->id, $fuser->id);
}
// If we want all or we have a role on task, we show it
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
{
print "<tr ".$bc[$var].">\n";
// Project
print '<td class="nowrap">';
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
print $projectstatic->getNomUrl(1);
print "</td>";
// Ref
print '<td class="nowrap">';
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
print $taskstatic->getNomUrl(1);
print '</td>';
// Label task
print "<td>";
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
$taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->label;
print $taskstatic->getNomUrl(0);
print "<br>";
for ($k = 0 ; $k < $level ; $k++) print "&nbsp;&nbsp;&nbsp;";
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
print "</td>\n";
// Planned Workload
print '<td align="right">';
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
else print '--:--';
print '</td>';
// Progress declared %
print '<td align="right">';
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
print '</td>';
// Time spent
/*
print '<td align="right">';
if ($lines[$i]->duration)
{
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
print convertSecondToTime($lines[$i]->duration,'allhourmin');
print '</a>';
}
else print '--:--';
print "</td>\n";
*/
$disabledproject=1;$disabledtask=1;
//print "x".$lines[$i]->fk_project;
//var_dump($lines[$i]);
//var_dump($projectsrole[$lines[$i]->fk_project]);
// If at least one role for project
if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
{
$disabledproject=0;
$disabledtask=0;
}
// If $restricteditformytask is on and I have no role on task, i disable edit
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
{
$disabledtask=1;
}
//var_dump($projectstatic->weekWorkLoad);
// Fields to show current time
$tableCell=''; $modeinput='hours';
for ($idw = 0; $idw < 7; $idw++)
{
$dayWorkLoad = 0;
$tableCell ='<td align="center">';
$tableCell.='<input type="text" class="center" size="2" disabled="disabled" value="'.convertSecondToTime($dayWorkLoad,'allhourmin').'">+';
$tableCell.='<input type="text" class="center" size="2" id="task['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
$tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\');updateTotal('.$idw.',\''.$modeinput.'\')" />';
$tableCell.='</td>';
print $tableCell;
}
print "</tr>\n";
}
$inc++;
$level++;
if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
$level--; $level--;
} }
else else
@ -653,8 +834,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta
$project_year_filter=0; $project_year_filter=0;
$title=$langs->trans("Project"); $title=$langs->trans("Project");
if ($statut == 0) $title=$langs->trans("ProjectDraft"); if ($statut != '' && $statut >= 0) $title=$langs->trans("Project").' ('.$langs->trans($projectstatic->statuts[$statut]).')';
if ($statut == 1) $title=$langs->trans("Project").' ('.$langs->trans("Validated").')';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -244,12 +244,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/list.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perday.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&amp;mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&amp;mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create&amp;mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&amp;action=create&amp;mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&amp;mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&amp;mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/list.php?leftmenu=projects&amp;mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/perday.php?leftmenu=projects&amp;mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
-- Tools -- Tools
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&amp;action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);

View File

@ -1148,13 +1148,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer); $newmenu->add("/projet/activity/perday.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
// All project i have permission on // All project i have permission on
$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
$newmenu->add("/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire); $newmenu->add("/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer); $newmenu->add("/projet/activity/perday.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
} }
} }
} }

View File

@ -718,19 +718,20 @@ class pdf_einstein extends ModelePDFCommandes
// If payment mode not forced or forced to VIR, show payment with BAN // If payment mode not forced or forced to VIR, show payment with BAN
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
{ {
if (! empty($conf->global->FACTURE_RIB_NUMBER)) if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
{ {
$account = new Account($this->db); $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank);
$account->fetch($conf->global->FACTURE_RIB_NUMBER); $account = new Account($this->db);
$account->fetch($bankid);
$curx=$this->marge_gauche; $curx=$this->marge_gauche;
$cury=$posy; $cury=$posy;
$posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size); $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size);
$posy+=2; $posy+=2;
} }
} }
return $posy; return $posy;
} }

View File

@ -354,6 +354,7 @@ class ImportCsv extends ModeleImports
} }
else else
{ {
$last_insert_id_array = array(); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id (eg: extrafields fk_object will be set with the last inserted object's id)
// For each table to insert, me make a separate insert // For each table to insert, me make a separate insert
foreach($objimport->array_import_tables[0] as $alias => $tablename) foreach($objimport->array_import_tables[0] as $alias => $tablename)
{ {
@ -590,7 +591,7 @@ class ImportCsv extends ModeleImports
elseif (preg_match('/^lastrowid-/',$val)) elseif (preg_match('/^lastrowid-/',$val))
{ {
$tmp=explode('-',$val); $tmp=explode('-',$val);
$lastinsertid=$this->db->last_insert_id($tmp[1]); $lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0;
$listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key); $listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key);
$listvalues.=$lastinsertid; $listvalues.=$lastinsertid;
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit; //print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
@ -632,6 +633,7 @@ class ImportCsv extends ModeleImports
if ($sql) if ($sql)
{ {
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
if ($resql) if ($resql)
{ {
//print '.'; //print '.';

View File

@ -255,40 +255,40 @@ class modFournisseur extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields // Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'"; $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{ {
$fieldname='extra.'.$obj->name; while ($obj=$this->db->fetch_object($resql))
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{ {
case 'int': $fieldname='extra.'.$obj->name;
case 'double': $fieldlabel=ucfirst($obj->label);
case 'price': $typeFilter="Text";
$typeFilter="Numeric"; switch($obj->type)
break; {
case 'date': case 'int':
case 'datetime': case 'double':
$typeFilter="Date"; case 'price':
break; $typeFilter="Numeric";
case 'boolean': break;
$typeFilter="Boolean"; case 'date':
break; case 'datetime':
case 'sellist': $typeFilter="Date";
$typeFilter="List:".$obj->param; break;
break; case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='invoice';
} }
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture_fourn';
} }
} // End add axtra fields
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
@ -309,40 +309,40 @@ class modFournisseur extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields // Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'"; $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{ {
$fieldname='extra.'.$obj->name; while ($obj=$this->db->fetch_object($resql))
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{ {
case 'int': $fieldname='extra.'.$obj->name;
case 'double': $fieldlabel=ucfirst($obj->label);
case 'price': $typeFilter="Text";
$typeFilter="Numeric"; switch($obj->type)
break; {
case 'date': case 'int':
case 'datetime': case 'double':
$typeFilter="Date"; case 'price':
break; $typeFilter="Numeric";
case 'boolean': break;
$typeFilter="Boolean"; case 'date':
break; case 'datetime':
case 'sellist': $typeFilter="Date";
$typeFilter="List:".$obj->param; break;
break; case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='invoice';
} }
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='facture_fourn';
} }
} // End add axtra fields
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
@ -353,20 +353,57 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')';
$r++; $r++;
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Commandes fournisseurs et lignes de commandes'; $this->export_label[$r]='Commandes fournisseurs et lignes de commandes';
$this->export_icon[$r]='order'; $this->export_icon[$r]='order';
$this->export_permission[$r]=array(array("fournisseur","commande","export")); $this->export_permission[$r]=array(array("fournisseur","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note_private'=>"NotePrivate",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note_private'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note_public'=>"order",'f.note_private'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='order';
}
}
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f, '.MAIN_DB_PREFIX.'commande_fournisseurdet as fd'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseurdet as fd';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande';
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_order',1).')'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_order',1).')';

View File

@ -1,44 +0,0 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>
<!-- BEGIN PHP TEMPLATE admin_extrafields.tpl.php -->
<script type="text/javascript">
jQuery(document).ready(function() {
function init_typeoffields(type)
{
var size = jQuery("#size");
var unique = jQuery("#unique");
var required = jQuery("#required");
if (type == 'date') { size.val('').attr('disabled','disabled'); }
else if (type == 'datetime') { size.val('').attr('disabled','disabled'); }
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); }
else if (type == 'int') { size.val('10').removeAttr('disabled'); }
else if (type == 'text') { size.val('2000').removeAttr('disabled'); }
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); }
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');}
else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');}
else size.val('').attr('disabled','disabled');
}
init_typeoffields();
jQuery("#type").change(function() {
init_typeoffields($(this).val());
});
});
</script>
<!-- END PHP TEMPLATE admin_extrafields.tpl.php -->

View File

@ -112,4 +112,4 @@
</form> </form>
<!-- END PHP TEMPLATE admin_extrafields.tpl.php --> <!-- END PHP TEMPLATE admin_extrafields_add.tpl.php -->

View File

@ -121,4 +121,4 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($typ
</form> </form>
<!-- END PHP TEMPLATE admin_extrafields.tpl.php --> <!-- END PHP TEMPLATE admin_extrafields_edit.tpl.php -->

View File

@ -0,0 +1,72 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* To call this template, you must define
* $textobject
* $langs
* $extrafield
* $elementtype
*/
?>
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->
<?php
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="left">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
?>
<!-- END PHP TEMPLATE admin_extrafields_view.tpl.php -->

View File

@ -263,7 +263,8 @@ else {
</td> </td>
<?php <?php
// Lines for extrafield // Lines for extrafield
if (!empty($extrafieldsline)) { if (!empty($extrafieldsline))
{
if ($this->table_element_line=='commandedet') { if ($this->table_element_line=='commandedet') {
$newline = new OrderLine($this->db); $newline = new OrderLine($this->db);
} }
@ -276,6 +277,12 @@ else {
elseif ($this->table_element_line=='contratdet') { elseif ($this->table_element_line=='contratdet') {
$newline = new ContratLigne($this->db); $newline = new ContratLigne($this->db);
} }
elseif ($this->table_element_line=='commande_fournisseurdet') {
$newline = new CommandeFournisseurLigne($this->db);
}
elseif ($this->table_element_line=='facture_fourn_det') {
$newline = new FactureFournisseurLigne($this->db);
}
if (is_object($newline)) { if (is_object($newline)) {
print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8)); print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8));
} }

View File

@ -43,7 +43,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
// Define colspan for button Add // Define colspan for button Add
$colspan = 3; // Col total ht + col edit + col delete $colspan = 3; // Col total ht + col edit + col delete
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
if (in_array($object->element,array('propal','facture','invoice','commande','order'))) $colspan++; // With this, there is a column move button if (in_array($object->element,array('propal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
?> ?>
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php --> <!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
@ -109,20 +109,18 @@ $coldisplay=-1; // We remove first td
} }
$coldisplay++; $coldisplay++;
print '<td align="right"><input type="text" class="flat" size="8" id="price_ht" name="price_ht" value="' . price($line->subprice,0,'',0) . '" '; print '<td align="right"><input type="text" class="flat" size="8" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"';
if ($this->situation_counter > 1) { if ($this->situation_counter > 1) print ' readonly="readonly"';
print 'readonly="readonly" ';
}
print '></td>'; print '></td>';
if ($inputalsopricewithtax) { if ($inputalsopricewithtax)
{
$coldisplay++; $coldisplay++;
print '<td align="right"><input type="text" class="flat" size="8" id="price_ttc" name="price_ttc" value="' . price($pu_ttc,0,'',0) . '"'; print '<td align="right"><input type="text" class="flat" size="8" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"';
if ($this->situation_counter > 1) { if ($this->situation_counter > 1) print ' readonly="readonly"';
print 'readonly="readonly" ';
}
print '></td>'; print '></td>';
} ?> }
?>
<td align="right"><?php $coldisplay++; ?> <td align="right"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) { <?php if (($line->info_bits & 2) != 2) {
@ -130,11 +128,9 @@ $coldisplay=-1; // We remove first td
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...) // must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print '<input size="3" type="text" class="flat" name="qty" id="qty" value="' . $line->qty . '" '; print '<input size="3" type="text" class="flat" name="qty" id="qty" value="' . $line->qty . '"';
if ($this->situation_counter > 1) { if ($this->situation_counter > 1) print ' readonly="readonly"';
print 'readonly="readonly" '; print '>';
}
print '/>';
} else { ?> } else { ?>
&nbsp; &nbsp;
<?php } ?> <?php } ?>
@ -142,11 +138,9 @@ $coldisplay=-1; // We remove first td
<td align="right" nowrap><?php $coldisplay++; ?> <td align="right" nowrap><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) { <?php if (($line->info_bits & 2) != 2) {
print '<input size="1" type="text" class="flat" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '" '; print '<input size="1" type="text" class="flat" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"';
if ($this->situation_counter > 1) { if ($this->situation_counter > 1) print ' readonly="readonly"';
print 'readonly="readonly" '; print '>%';
}
print '/>%';
} else { ?> } else { ?>
&nbsp; &nbsp;
<?php } ?> <?php } ?>
@ -189,7 +183,8 @@ $coldisplay=-1; // We remove first td
$coldisplay++; $coldisplay++;
} }
} }
} ?> }
?>
<!-- colspan=4 for this td because it replace total_ht+3 td for buttons --> <!-- colspan=4 for this td because it replace total_ht+3 td for buttons -->
<td align="center" colspan="<?php echo $colspan; ?>" valign="middle"><?php $coldisplay+=4; ?> <td align="center" colspan="<?php echo $colspan; ?>" valign="middle"><?php $coldisplay+=4; ?>
@ -199,7 +194,8 @@ $coldisplay=-1; // We remove first td
<?php <?php
//Line extrafield //Line extrafield
if (!empty($extrafieldsline)) { if (!empty($extrafieldsline))
{
print $line->showOptionals($extrafieldsline,'edit',array('style'=>$bc[$var],'colspan'=>$coldisplay)); print $line->showOptionals($extrafieldsline,'edit',array('style'=>$bc[$var],'colspan'=>$coldisplay));
} }
?> ?>

View File

@ -25,20 +25,21 @@
* $langs * $langs
* $dateSelector * $dateSelector
* $forceall (0 by default, 1 for supplier invoices/orders) * $forceall (0 by default, 1 for supplier invoices/orders)
* $element (used to test $user->rights->$element->creer)
* $permtoedit (used to replace test $user->rights->$element->creer)
* $senderissupplier (0 by default, 1 for supplier invoices/orders) * $senderissupplier (0 by default, 1 for supplier invoices/orders)
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
* $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
* *
* $type, $text, $description, $line * $type, $text, $description, $line
*/ */
$usemargins=0; global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
global $forceall, $senderissupplier, $inputalsopricewithtax;
if (empty($dateSelector)) $dateSelector=0; if (empty($dateSelector)) $dateSelector=0;
if (empty($forceall)) $forceall=0; if (empty($forceall)) $forceall=0;
if (empty($senderissupplier)) $senderissupplier=0; if (empty($senderissupplier)) $senderissupplier=0;
if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
if (empty($usemargins)) $usemargins=0;
?> ?>
<?php $coldisplay=0; ?> <?php $coldisplay=0; ?>
@ -83,7 +84,8 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
} }
else else
{ {
if ($line->fk_product > 0) { if ($line->fk_product > 0)
{
echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
@ -96,7 +98,9 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):''; print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
} }
} else { }
else
{
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
@ -118,10 +122,10 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ht)?price($line->pu_ht):price($line->subprice)); ?></td>
<?php if ($inputalsopricewithtax) { ?> <?php if ($inputalsopricewithtax) { ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?>&nbsp;</td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?></td>
<?php } ?> <?php } ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?> <td align="right" class="nowrap"><?php $coldisplay++; ?>
@ -135,7 +139,11 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
</td> </td>
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?> <?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>
<td align="right"><?php $coldisplay++; ?><?php echo dol_print_reduction($line->remise_percent,$langs); ?></td> <td align="right"><?php
$coldisplay++;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
echo dol_print_reduction($line->remise_percent,$langs);
?></td>
<?php } else { ?> <?php } else { ?>
<td><?php $coldisplay++; ?>&nbsp;</td> <td><?php $coldisplay++; ?>&nbsp;</td>
<?php } <?php }
@ -145,17 +153,19 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
print '<td align="right" nowrap="nowrap">' . $line->situation_percent . '%</td>'; print '<td align="right" nowrap="nowrap">' . $line->situation_percent . '%</td>';
} }
if (! empty($conf->margin->enabled) && empty($user->societe_id)) { if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); {
?> $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
?>
<td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td> <td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) {?> <?php if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?>
<td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td> <td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?></td>
<?php <?php }
} if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
<td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td> <td align="right" class="nowrap margininfos"><?php $coldisplay++; ?><?php echo price($line->marque_tx, null, null, null, null, $rounding).'%'; ?></td>
<?php } } ?> <?php }
}
?>
<?php if ($line->special_code == 3) { ?> <?php if ($line->special_code == 3) { ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
@ -163,7 +173,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td> <td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
<?php } ?> <?php } ?>
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?> <?php if ($this->statut == 0 && ($user->rights->$element->creer || $permtoedit)) { ?>
<td align="center"><?php $coldisplay++; ?> <td align="center"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) == 2) { ?> <?php if (($line->info_bits & 2) == 2) { ?>
<?php } else { ?> <?php } else { ?>

View File

@ -718,6 +718,8 @@ class Cronjob extends CommonObject
$object=new Cronjob($this->db); $object=new Cronjob($this->db);
$object->context['createfromclone'] = 'createfromclone';
$this->db->begin(); $this->db->begin();
// Load source object // Load source object
@ -744,6 +746,8 @@ class Cronjob extends CommonObject
} }
unset($this->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@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
@ -63,7 +64,7 @@ $html = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$expensereporttmp=new ExpenseReport($db); $expensereporttmp=new ExpenseReport($db);
llxHeader('', $langs->trans("ListOfExpenseReports")); llxHeader('', $langs->trans("ListOfTrips"));
$max_year = 5; $max_year = 5;
$min_year = 5; $min_year = 5;
@ -302,7 +303,7 @@ if ($resql)
print "</form>"; print "</form>";
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a href="'.dol_buildpath('/expensereport/card.php',1).'?action=create" class="butAction">Ajouter une note de frais</a>'; print '<a href="'.dol_buildpath('/expensereport/card.php',1).'?action=create" class="butAction">'.$langs->trans("NewTrip").'</a>';
print '</div>'; print '</div>';
$db->free($resql); $db->free($resql);

View File

@ -62,60 +62,18 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Interventions");
llxHeader(); llxHeader();
$textobject=$langs->transnoentitiesnoconv("Interventions");
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup');
$head=fichinter_admin_prepare_head(); $head=fichinter_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Interventions"), 0, 'intervention'); dol_fiche_head($head, 'attributes', $langs->trans("Interventions"), 0, 'intervention');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n"; // TODO This must be generalised into all page to admin extrafield. Mutualize code here is easy and will save a lot of code
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -62,11 +62,10 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Interventions");
llxHeader(); llxHeader();
$textobject=$langs->transnoentitiesnoconv("Interventions");
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup');
@ -75,45 +74,7 @@ $head=fichinter_admin_prepare_head();
dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), 0, 'intervention'); dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), 0, 'intervention');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end(); dol_fiche_end();

View File

@ -206,9 +206,9 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
// Extrafields // Extrafields
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$array_option = $extrafields->getOptionalsFromPost($extralabels); $array_options = $extrafields->getOptionalsFromPost($extralabels);
$object->array_options = $array_option; $object->array_options = $array_options;
$id = $object->create($user); $id = $object->create($user);
@ -288,7 +288,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
$result = $object->addline( $result = $object->addline(
@ -297,7 +297,7 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
$desc, $desc,
$date_intervention, $date_intervention,
$duration, $duration,
$array_option $array_options
); );
if ($result < 0) if ($result < 0)
@ -327,9 +327,9 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
// Extrafields // Extrafields
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$array_option = $extrafields->getOptionalsFromPost($extralabels); $array_options = $extrafields->getOptionalsFromPost($extralabels);
$object->array_options = $array_option; $object->array_options = $array_options;
$result = $object->create($user); $result = $object->create($user);
if ($result > 0) if ($result > 0)
@ -470,7 +470,7 @@ else if ($action == "addline" && $user->rights->ficheinter->creer)
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
$result=$object->addline( $result=$object->addline(
$user, $user,
@ -478,7 +478,7 @@ else if ($action == "addline" && $user->rights->ficheinter->creer)
$desc, $desc,
$date_intervention, $date_intervention,
$duration, $duration,
$array_option $array_options
); );
// Define output language // Define output language
@ -568,8 +568,8 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST(
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
$objectline->array_options = $array_option; $objectline->array_options = $array_options;
$result = $objectline->update($user); $result = $objectline->update($user);
if ($result < 0) if ($result < 0)

View File

@ -889,10 +889,10 @@ class Fichinter extends CommonObject
* @param string $desc Line description * @param string $desc Line description
* @param date $date_intervention Intervention date * @param date $date_intervention Intervention date
* @param int $duration Intervention duration * @param int $duration Intervention duration
* @param array $array_option Array option * @param array $array_options Array option
* @return int >0 if ok, <0 if ko * @return int >0 if ok, <0 if ko
*/ */
function addline($user,$fichinterid, $desc, $date_intervention, $duration, $array_option='') function addline($user,$fichinterid, $desc, $date_intervention, $duration, $array_options='')
{ {
dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration"); dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration");
@ -908,8 +908,8 @@ class Fichinter extends CommonObject
$line->datei = $date_intervention; $line->datei = $date_intervention;
$line->duration = $duration; $line->duration = $duration;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_options) && count($array_options)>0) {
$line->array_options=$array_option; $line->array_options=$array_options;
} }
$result=$line->insert($user); $result=$line->insert($user);

View File

@ -191,9 +191,10 @@ define('MAIN_DB_PREFIX',$dolibarr_main_db_prefix);
*/ */
// Path to root libraries // Path to root libraries
if (! defined('ADODB_PATH')) { define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH))?DOL_DOCUMENT_ROOT.'/includes/adodbtime/':(empty($dolibarr_lib_ADODB_PATH)?'':$dolibarr_lib_ADODB_PATH.'/')); } if (! defined('ADODB_PATH')) { define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH))?DOL_DOCUMENT_ROOT.'/includes/adodbtime/':(empty($dolibarr_lib_ADODB_PATH)?'':$dolibarr_lib_ADODB_PATH.'/')); }
if (! defined('TCPDF_PATH')) { define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH))?DOL_DOCUMENT_ROOT.'/includes/tcpdf/':$dolibarr_lib_TCPDF_PATH.'/'); }
if (! defined('FPDF_PATH')) { define('FPDF_PATH', (empty($dolibarr_lib_FPDF_PATH))?DOL_DOCUMENT_ROOT.'/includes/fpdf/':$dolibarr_lib_FPDF_PATH.'/'); } // Used only for package that can't include tcpdf if (! defined('FPDF_PATH')) { define('FPDF_PATH', (empty($dolibarr_lib_FPDF_PATH))?DOL_DOCUMENT_ROOT.'/includes/fpdf/':$dolibarr_lib_FPDF_PATH.'/'); } // Used only for package that can't include tcpdf
if (! defined('TCPDF_PATH')) { define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH))?DOL_DOCUMENT_ROOT.'/includes/tcpdf/':$dolibarr_lib_TCPDF_PATH.'/'); }
if (! defined('FPDI_PATH')) { define('FPDI_PATH', (empty($dolibarr_lib_FPDI_PATH))?DOL_DOCUMENT_ROOT.'/includes/fpdfi/':$dolibarr_lib_FPDI_PATH.'/'); } if (! defined('FPDI_PATH')) { define('FPDI_PATH', (empty($dolibarr_lib_FPDI_PATH))?DOL_DOCUMENT_ROOT.'/includes/fpdfi/':$dolibarr_lib_FPDI_PATH.'/'); }
if (! defined('TCPDI_PATH')) { define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH))?DOL_DOCUMENT_ROOT.'/includes/tcpdi/':$dolibarr_lib_TCPDI_PATH.'/'); }
if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH))?DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/':(empty($dolibarr_lib_NUSOAP_PATH)?'':$dolibarr_lib_NUSOAP_PATH.'/')); } if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH))?DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/':(empty($dolibarr_lib_NUSOAP_PATH)?'':$dolibarr_lib_NUSOAP_PATH.'/')); }
if (! defined('PHPEXCEL_PATH')) { define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH))?DOL_DOCUMENT_ROOT.'/includes/phpexcel/':(empty($dolibarr_lib_PHPEXCEL_PATH)?'':$dolibarr_lib_PHPEXCEL_PATH.'/')); } if (! defined('PHPEXCEL_PATH')) { define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH))?DOL_DOCUMENT_ROOT.'/includes/phpexcel/':(empty($dolibarr_lib_PHPEXCEL_PATH)?'':$dolibarr_lib_PHPEXCEL_PATH.'/')); }
if (! defined('GEOIP_PATH')) { define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH))?DOL_DOCUMENT_ROOT.'/includes/geoip/':(empty($dolibarr_lib_GEOIP_PATH)?'':$dolibarr_lib_GEOIP_PATH.'/')); } if (! defined('GEOIP_PATH')) { define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH))?DOL_DOCUMENT_ROOT.'/includes/geoip/':(empty($dolibarr_lib_GEOIP_PATH)?'':$dolibarr_lib_GEOIP_PATH.'/')); }

View File

@ -214,13 +214,13 @@ class CommandeFournisseur extends CommonOrder
$sql.= " l.qty,"; $sql.= " l.qty,";
$sql.= " l.tva_tx, l.remise_percent, l.subprice,"; $sql.= " l.tva_tx, l.remise_percent, l.subprice,";
$sql.= " l.localtax1_tx, l. localtax2_tx, l.total_localtax1, l.total_localtax2,"; $sql.= " l.localtax1_tx, l. localtax2_tx, l.total_localtax1, l.total_localtax2,";
$sql.= " l.total_ht, l.total_tva, l.total_ttc,"; $sql.= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc,";
$sql.= " l.date_start, l.date_end"; $sql.= " l.date_start, l.date_end";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= " WHERE l.fk_commande = ".$this->id; $sql.= " WHERE l.fk_commande = ".$this->id;
$sql.= " ORDER BY l.rowid"; $sql.= " ORDER BY l.rang, l.rowid";
//print $sql; //print $sql;
dol_syslog(get_class($this)."::fetch get lines", LOG_DEBUG); dol_syslog(get_class($this)."::fetch get lines", LOG_DEBUG);
@ -267,6 +267,11 @@ class CommandeFournisseur extends CommonOrder
$line->date_start = $this->db->jdate($objp->date_start); $line->date_start = $this->db->jdate($objp->date_start);
$line->date_end = $this->db->jdate($objp->date_end); $line->date_end = $this->db->jdate($objp->date_end);
$this->special_line = $objp->special_line;
$this->fk_parent_line = $objp->fk_parent_line;
$this->rang = $objp->rang;
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
@ -662,7 +667,7 @@ class CommandeFournisseur extends CommonOrder
if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT)) if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT))
{ {
$result=$this->add_contact($user->id, 'SALESREPFOLL', 'internal', 1); $result=$this->add_contact($user->id, 'SALESREPFOLL', 'internal', 1);
if ($result < 0) if ($result < 0 && $result != -2) // -2 means already exists
{ {
$error++; $error++;
} }
@ -1044,7 +1049,9 @@ class CommandeFournisseur extends CommonOrder
$error=0; $error=0;
$this->db->begin(); $this->context['createfromclone'] = 'createfromclone';
$this->db->begin();
// Load source object // Load source object
$objFrom = dol_clone($this); $objFrom = dol_clone($this);
@ -1080,7 +1087,9 @@ class CommandeFournisseur extends CommonOrder
// End call triggers // End call triggers
} }
// End unset($this->context['createfromclone']);
// End
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
@ -1113,9 +1122,10 @@ class CommandeFournisseur extends CommonOrder
* @param bool $notrigger Disable triggers * @param bool $notrigger Disable triggers
* @param int $date_start Date start of service * @param int $date_start Date start of service
* @param int $date_end Date end of service * @param int $date_end Date end of service
* @param array $array_options extrafields array
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0)
{ {
global $langs,$mysoc; global $langs,$mysoc;
@ -1250,7 +1260,19 @@ class CommandeFournisseur extends CommonOrder
{ {
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande_fournisseurdet'); $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'commande_fournisseurdet');
if (! $notrigger) if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$linetmp = new CommandeFournisseurLigne($this->db);
$linetmp->id=$this->rowid;
$linetmp->array_options = $array_options;
$result=$linetmp->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $error && ! $notrigger)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
// Call trigger // Call trigger
@ -1389,51 +1411,53 @@ class CommandeFournisseur extends CommonOrder
* *
* @param int $idline Id of line to delete * @param int $idline Id of line to delete
* @param int $notrigger 1=Disable call to triggers * @param int $notrigger 1=Disable call to triggers
* @return >=0 if OK, <0 if KO * @return <0 if KO, >0 if OK
*/ */
function deleteline($idline, $notrigger=0) function deleteline($idline, $notrigger=0)
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
if ($this->statut == 0)
if ($this->statut != 0)
{ {
$this->db->begin(); return -1;
}
if (! $notrigger) $this->db->begin();
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
}
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idline;
$resql=$this->db->query($sql);
dol_syslog(get_class($this)."::deleteline sql=".$sql);
if (! $resql)
{ {
// Call trigger $this->error=$this->db->lasterror();
$result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user); $error++;
if ($result < 0) $error++;
// End call triggers
} }
}
if (! $error) if (! $error)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idline; $result=$this->update_price();
$resql=$this->db->query($sql); }
dol_syslog(get_class($this)."::deleteline sql=".$sql); if (! $error)
if (! $resql) {
{ $this->db->commit();
$this->error=$this->db->lasterror(); return 1;
$error++;
}
}
if (! $error)
{
$result=$this->update_price();
$this->db->commit();
return 0;
}
else
{
$this->db->rollback();
return -1;
}
} }
else else
{ {
$this->db->rollback();
return -1; return -1;
} }
} }
@ -1755,23 +1779,24 @@ class CommandeFournisseur extends CommonOrder
/** /**
* Update line * Update line
* *
* @param int $rowid Id de la ligne de facture * @param int $rowid Id de la ligne de facture
* @param string $desc Description de la ligne * @param string $desc Description de la ligne
* @param double $pu Prix unitaire * @param double $pu Prix unitaire
* @param double $qty Quantity * @param double $qty Quantity
* @param double $remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @param double $txtva Taux TVA * @param double $txtva Taux TVA
* @param double $txlocaltax1 Localtax1 tax * @param double $txlocaltax1 Localtax1 tax
* @param double $txlocaltax2 Localtax2 tax * @param double $txlocaltax2 Localtax2 tax
* @param double $price_base_type Type of price base * @param double $price_base_type Type of price base
* @param int $info_bits Miscellaneous informations * @param int $info_bits Miscellaneous informations
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @param timestamp $date_start Date start of service * @param timestamp $date_start Date start of service
* @param timestamp $date_end Date end of service * @param timestamp $date_end Date end of service
* @return int < 0 if error, > 0 if ok * @param array $array_options extrafields array
* @return int < 0 if error, > 0 if ok
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='') function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_options=0)
{ {
global $mysoc; global $mysoc;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type"); dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
@ -1848,8 +1873,19 @@ class CommandeFournisseur extends CommonOrder
if ($result > 0) if ($result > 0)
{ {
$this->rowid = $rowid; $this->rowid = $rowid;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$tmpline = new CommandeFournisseurLigne($this->db);
$tmpline->id=$this->rowid;
$tmpline->array_options = $array_options;
$result=$tmpline->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $notrigger) if (! $error && ! $notrigger)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
// Call trigger // Call trigger
@ -1863,14 +1899,25 @@ class CommandeFournisseur extends CommonOrder
} }
// Mise a jour info denormalisees au niveau facture // Mise a jour info denormalisees au niveau facture
$this->update_price('','auto'); if (! $error)
{
$this->update_price('','auto');
}
$this->db->commit(); if (! $error)
return $result; {
$this->db->commit();
return $result;
}
else
{
$this->db->rollback();
return -1;
}
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -2138,17 +2185,22 @@ class CommandeFournisseur extends CommonOrder
*/ */
function getMaxDeliveryTimeDay($langs) function getMaxDeliveryTimeDay($langs)
{ {
if (empty($this->lines)) return $langs->trans('Undefined'); if (empty($this->lines)) return '';
$obj = new ProductFournisseur($this->db);
$nb = 0; $nb = 0;
foreach ($this->lines as $line) { foreach ($this->lines as $line)
$obj = new ProductFournisseur($this->db); {
$idp = $obj->find_min_price_product_fournisseur($line->fk_product, $line->qty); if ($line->fk_product > 0)
if ($idp) { {
$obj->fetch($idp); $idp = $obj->find_min_price_product_fournisseur($line->fk_product, $line->qty);
if ($obj->delivery_time_days > $nb) $nb = $obj->delivery_time_days; if ($idp)
{
$obj->fetch($idp);
if ($obj->delivery_time_days > $nb) $nb = $obj->delivery_time_days;
}
} }
} }
if ($nb === 0) return $langs->trans('Undefined'); if ($nb === 0) return $langs->trans('Undefined');
@ -2163,6 +2215,14 @@ class CommandeFournisseur extends CommonOrder
*/ */
class CommandeFournisseurLigne extends CommonOrderLine class CommandeFournisseurLigne extends CommonOrderLine
{ {
var $db;
var $error;
public $element='commande_fournisseurdet';
public $table_element='commande_fournisseurdet';
var $oldline;
// From llx_commandedet // From llx_commandedet
var $qty; var $qty;
var $tva_tx; var $tva_tx;

View File

@ -450,7 +450,7 @@ class FactureFournisseur extends CommonInvoice
$result=$this->fetch_lines(); $result=$this->fetch_lines();
if ($result < 0) if ($result < 0)
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
return -3; return -3;
} }
@ -482,11 +482,12 @@ class FactureFournisseur extends CommonInvoice
{ {
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva'; $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits'; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
$sql.= ' WHERE fk_facture_fourn='.$this->id; $sql.= ' WHERE fk_facture_fourn='.$this->id;
$sql.= ' ORDER BY f.rang, f.rowid';
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
$resql_rows = $this->db->query($sql); $resql_rows = $this->db->query($sql);
@ -500,7 +501,9 @@ class FactureFournisseur extends CommonInvoice
{ {
$obj = $this->db->fetch_object($resql_rows); $obj = $this->db->fetch_object($resql_rows);
$this->lines[$i] = new stdClass(); $this->lines[$i] = new FactureFournisseurLigne($this->db);
$this->lines[$i]->id = $obj->rowid;
$this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->description = $obj->description; $this->lines[$i]->description = $obj->description;
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference $this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
@ -523,7 +526,10 @@ class FactureFournisseur extends CommonInvoice
$this->lines[$i]->total_ttc = $obj->total_ttc; $this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->product_type = $obj->product_type; $this->lines[$i]->product_type = $obj->product_type;
$this->lines[$i]->info_bits = $obj->info_bits; $this->lines[$i]->info_bits = $obj->info_bits;
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->rang = $obj->rang;
$i++; $i++;
} }
@ -1109,11 +1115,12 @@ class FactureFournisseur extends CommonInvoice
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param int $rang Position of line * @param int $rang Position of line
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @param array $array_options extrafields array
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* *
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
*/ */
function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false) function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0)
{ {
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG); dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -1150,7 +1157,7 @@ class FactureFournisseur extends CommonInvoice
{ {
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
$result=$this->updateline($idligne, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product, $price_base_type, $info_bits, $type, $remise_percent, true); $result=$this->updateline($idligne, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product, $price_base_type, $info_bits, $type, $remise_percent, true, '', '', $array_options);
if ($result > 0) if ($result > 0)
{ {
$this->rowid = $idligne; $this->rowid = $idligne;
@ -1189,22 +1196,25 @@ class FactureFournisseur extends CommonInvoice
/** /**
* Update a line detail into database * Update a line detail into database
* *
* @param int $id Id of line invoice * @param int $id Id of line invoice
* @param string $desc Description of line * @param string $desc Description of line
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type) * @param double $pu Prix unitaire (HT ou TTC selon price_base_type)
* @param double $vatrate VAT Rate * @param double $vatrate VAT Rate
* @param double $txlocaltax1 LocalTax1 Rate * @param double $txlocaltax1 LocalTax1 Rate
* @param double $txlocaltax2 LocalTax2 Rate * @param double $txlocaltax2 LocalTax2 Rate
* @param double $qty Quantity * @param double $qty Quantity
* @param int $idproduct Id produit * @param int $idproduct Id produit
* @param double $price_base_type HT or TTC * @param double $price_base_type HT or TTC
* @param int $info_bits Miscellaneous informations of line * @param int $info_bits Miscellaneous informations of line
* @param int $type Type of line (0=product, 1=service) * @param int $type Type of line (0=product, 1=service)
* @param double $remise_percent Pourcentage de remise de la ligne * @param double $remise_percent Pourcentage de remise de la ligne
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @param timestamp $date_start Date start of service
* @param timestamp $date_end Date end of service
* @param array $array_options extrafields array
* @return int <0 if KO, >0 if OK
*/ */
function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false) function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false, $date_start='', $date_end='', $array_options=0)
{ {
global $mysoc; global $mysoc;
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG); dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
@ -1285,7 +1295,19 @@ class FactureFournisseur extends CommonInvoice
{ {
$this->rowid = $id; $this->rowid = $id;
if (! $notrigger) if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$linetmp = new FactureFournisseurLigne($this->db);
$linetmp->id=$this->rowid;
$linetmp->array_options = $array_options;
$result=$linetmp->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $error && ! $notrigger)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
// Call trigger // Call trigger
@ -1301,9 +1323,16 @@ class FactureFournisseur extends CommonInvoice
// Update total price into invoice record // Update total price into invoice record
$result=$this->update_price('','auto'); $result=$this->update_price('','auto');
$this->db->commit(); if (! $error)
{
return $result; $this->db->commit();
return $result;
}
else
{
$this->db->rollback();
return -1;
}
} }
else else
{ {
@ -1318,7 +1347,7 @@ class FactureFournisseur extends CommonInvoice
* *
* @param int $rowid Id of line to delete * @param int $rowid Id of line to delete
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return void * @return int <0 if KO, >0 if OK
*/ */
function deleteline($rowid, $notrigger=0) function deleteline($rowid, $notrigger=0)
{ {
@ -1356,7 +1385,7 @@ class FactureFournisseur extends CommonInvoice
if (! $error) if (! $error)
{ {
// Mise a jour prix facture // Mise a jour prix facture
$this->update_price(); $result=$this->update_price();
} }
if (! $error) if (! $error)
@ -1716,7 +1745,9 @@ class FactureFournisseur extends CommonInvoice
$object=new FactureFournisseur($this->db); $object=new FactureFournisseur($this->db);
$this->db->begin(); $object->context['createfromclone'] = 'createfromclone';
$this->db->begin();
// Load source object // Load source object
$object->fetch($fromid); $object->fetch($fromid);
@ -1762,6 +1793,8 @@ class FactureFournisseur extends CommonInvoice
} }
unset($object->context['createfromclone']);
// End // End
if (! $error) if (! $error)
{ {
@ -1810,3 +1843,35 @@ class FactureFournisseur extends CommonInvoice
} }
} }
/**
* Class to manage line invoices
*/
class FactureFournisseurLigne extends CommonInvoice
{
var $db;
var $error;
var $pu_ht;
var $pu_ttc;
public $element='facture_fourn_det';
public $table_element='facture_fourn_det';
var $oldline;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db= $db;
}
}

View File

@ -485,14 +485,20 @@ class ProductFournisseur extends Product
/** /**
* Load properties for minimum price * Load properties for minimum price
* *
* @param int $prodid Product id * @param int $prodid Product id
* @param int $qty Minimum quantity * @param int $qty Minimum quantity
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0=Not found of no product id provided, >0 if OK
*/ */
function find_min_price_product_fournisseur($prodid, $qty=0) function find_min_price_product_fournisseur($prodid, $qty=0)
{ {
global $conf; global $conf;
if (empty($prodid))
{
dol_syslog("Warning function find_min_price_product_fournisseur were called with prodid empty. May be a bug.", LOG_WARNING);
return 0;
}
$this->product_fourn_price_id = ''; $this->product_fourn_price_id = '';
$this->product_fourn_id = ''; $this->product_fourn_id = '';
$this->fourn_ref = ''; $this->fourn_ref = '';
@ -582,7 +588,7 @@ class ProductFournisseur extends Product
return 1; return 1;
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }

File diff suppressed because it is too large Load Diff

View File

@ -457,11 +457,11 @@ if ($id > 0 || ! empty($ref))
print '<td align="right">'; print '<td align="right">';
if (count($listwarehouses)>1) if (count($listwarehouses)>1)
{ {
print $form->selectarray("entrepot".$suffix, $listwarehouses, '', 1, 0, 0, '', 0, 0, $disabled); print $form->selectarray("entrepot".$suffix, $listwarehouses, GETPOST("entrepot".$suffix), 1, 0, 0, '', 0, 0, $disabled);
} }
elseif (count($listwarehouses)==1) elseif (count($listwarehouses)==1)
{ {
print $form->selectarray("entrepot".$suffix, $listwarehouses, '', 0, 0, 0, '', 0, 0, $disabled); print $form->selectarray("entrepot".$suffix, $listwarehouses, GETPOST("entrepot".$suffix), 0, 0, 0, '', 0, 0, $disabled);
} }
else else
{ {

File diff suppressed because it is too large Load Diff

View File

@ -199,7 +199,14 @@ class pdf_parser
// Read xref-Data // Read xref-Data
$this->_xref = array(); $this->_xref = array();
$this->_readXref($this->_xref, $this->_findXref()); try {
$this->_readXref($this->_xref, $this->_findXref());
}
catch(Exception $e)
{
print $e->getMessage();
exit;
}
// Check for Encryption // Check for Encryption
$this->getEncryption(); $this->getEncryption();

View File

@ -1,6 +1,68 @@
6.2.6 (2015-01-28)
- Bug #1008 "UTC offset sing breaks PDF/A-1b compliance" was fixed.
6.2.5 (2015-01-24)
- Bug #1019 "$this in static context" was fixed.
- Bug #1015 "Infinite loop in getIndirectObject method of parser" was fixed.
6.2.4 (2015-01-08)
- fix warning related to empty K_PATH_URL.
- fix error when a $table_colwidths key is not set.
6.2.3 (2014-12-18)
- New comment.
- Moved the K_PATH_IMAGES definition in tcpdf_autoconfig.
6.2.2 (2014-12-18)
- Fixed mispelled words.
- Fixed version number.
6.2.1 (2014-12-18)
- The constant K_TCPDF_THROW_EXCEPTION_ERROR is now set to false in the default configuration file.
- An issue with the _destroy() method was fixed.
6.2.0 (2014-12-10)
- Bug #1005 "Security Report, LFI posting internal files externally abusing default parameter" was fixed.
- Static methods serializeTCPDFtagParameters() and unserializeTCPDFtagParameters() were moved as non static to the main TCPDF class (see changes in example n. 49).
- Deprecated methods were removed, please use the equivalents defined in other classes (i.e. TCPDF_STATIC and TCPDF_FONTS).
- The constant K_TCPDF_CALLS_IN_HTML is now set by default to FALSE.
- DLE, DLX and DLP page format was added.
- Page format are now defined as a public property in TCPDF_STATIC.
6.1.1 (2014-12-09)
- Fixed bug with the register_shutdown_function().
6.1.0 (2014-12-07)
- The method TCPDF_STATIC::getRandomSeed() was improved.
- The disk caching feature was removed.
- Bug #1003 "Backslashes become duplicated in table, using WriteHTML" was fixed.
- Bug #1002 "SVG radialGradient within non-square Rect" was fixed.
6.0.099 (2014-11-15)
- Added basic support for nested SVG images (adapted PR from SamMousa).
- A bug related to setGDImageTransparency() was fixed (thanks to Maarten Boerema).
6.0.098 (2014-11-08)
- Bug item #996 "getCharBBox($char) returns incorrect results for TTF glyphs without outlines" was fixed.
- Bug item #991 "Text problem with SVG" was fixed (only the font style part).
6.0.097 (2014-10-20)
- Bug item #988 "hyphenateText - charmin parameter not work" was fixed.
- New 1D barcode method to print pre-formatted IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200.
6.0.096 (2014-10-06)
- Bug item #982 "Display style is not inherited in SVG" was fixed.
- Bug item #984 "Double quote url in CSS" was fixed.
6.0.095 (2014-10-02)
- Bug item #979 "New Timezone option overwriting current timezone" was fixed.
6.0.094 (2014-09-30)
- Bug item #978 "Variable Undefined: $cborder" was fixed.
6.0.093 (2014-09-02) 6.0.093 (2014-09-02)
- Security fix: some serialize/unserialize methods were replaced with json_encode/json_decode to avoid a potential object injection with user supplied content. Thanks to ownCloud Inc. for reporting this issue. - Security fix: some serialize/unserialize methods were replaced with json_encode/json_decode to avoid a potential object injection with user supplied content. Thanks to ownCloud Inc. for reporting this issue.
- K_TIMEZONE constant was added to the default configuration to supress date-time warnings. - K_TIMEZONE constant was added to the default configuration to suppress date-time warnings.
6.0.092 (2014-09-01) 6.0.092 (2014-09-01)
- Bug item #956 "Monospaced fonts are not alignd at the baseline" was fixed. - Bug item #956 "Monospaced fonts are not alignd at the baseline" was fixed.
@ -355,7 +417,7 @@
- Image method was improved. - Image method was improved.
5.9.208 (2013-03-15) 5.9.208 (2013-03-15)
- objclone fuction was patched to support old imagick extensions. - objclone function was patched to support old imagick extensions.
- tcpdf_parser was improved to support Cross-Reference Streams and large streams. - tcpdf_parser was improved to support Cross-Reference Streams and large streams.
5.9.207 (2013-03-04) 5.9.207 (2013-03-04)
@ -432,7 +494,7 @@
- barcodes.php file was resynced. - barcodes.php file was resynced.
- Methods SetAbsX, SetAbsY, SetAbsXY where added to set the absolute pointer coordinates. - Methods SetAbsX, SetAbsY, SetAbsXY where added to set the absolute pointer coordinates.
- Method getCharBBox were added to get single character bounding box. - Method getCharBBox were added to get single character bounding box.
- Signature of addTTFfont method was changed ($addcbbox paramter was added). - Signature of addTTFfont method was changed ($addcbbox parameter was added).
5.9.185 (2012-09-12) 5.9.185 (2012-09-12)
- Method _putfontwidths() was fixed. - Method _putfontwidths() was fixed.
@ -834,7 +896,7 @@
5.9.080 (2011-05-17) 5.9.080 (2011-05-17)
- A problem related to file path calculation for images was fixed. - A problem related to file path calculation for images was fixed.
- A problem related to unsupressed getimagesize() error was fixed. - A problem related to unsuppressed getimagesize() error was fixed.
5.9.079 (2011-05-16) 5.9.079 (2011-05-16)
- Footer() method was changed to use C128 barcode as default (instead of the previous C128B). - Footer() method was changed to use C128 barcode as default (instead of the previous C128B).
@ -1188,7 +1250,7 @@
- Alignment problem on write2DBarcode was fixed. - Alignment problem on write2DBarcode was fixed.
5.8.015 (2010-08-24) 5.8.015 (2010-08-24)
- A problem arised with the latest bugfix was fixed. - A problem arose with the latest bugfix was fixed.
5.8.014 (2010-08-23) 5.8.014 (2010-08-23)
- Method _getxobjectdict() was added for better compatibility with external extensions. - Method _getxobjectdict() was added for better compatibility with external extensions.
@ -1650,7 +1712,7 @@
- Bug item #2938412 "Table related problems - thead, nobr, table width" was fixed. - Bug item #2938412 "Table related problems - thead, nobr, table width" was fixed.
4.8.026 (2010-01-19) 4.8.026 (2010-01-19)
- The misspelled word "lenght" was replaced with "length" in some variables and comments. - The misspelled word "length" was replaced with "length" in some variables and comments.
4.8.025 (2010-01-18) 4.8.025 (2010-01-18)
- addExtGState() method was improved to reuse existing ExtGState objects. - addExtGState() method was improved to reuse existing ExtGState objects.
@ -1732,7 +1794,7 @@
4.8.006 (2009-09-23) 4.8.006 (2009-09-23)
- Bug item #2864522 "No images if DOCUMENT_ROOT=='/'" was fixed. - Bug item #2864522 "No images if DOCUMENT_ROOT=='/'" was fixed.
- Support for text-indent CSS attribute was added. - Support for text-indent CSS attribute was added.
- Method rollbackTransaction() was changed to support self-reassigment of previous object (check source code documentation). - Method rollbackTransaction() was changed to support self-reassignment of previous object (check source code documentation).
- Support for the HTML "nobr" attribute was added to avoid splitting a table or a table row on two pages (i.e.: <tr nobr="true">...</tr>). - Support for the HTML "nobr" attribute was added to avoid splitting a table or a table row on two pages (i.e.: <tr nobr="true">...</tr>).
4.8.005 (2009-09-17) 4.8.005 (2009-09-17)
@ -1903,7 +1965,7 @@
- WARNING: THIS VERSION CHANGES THE BEHAVIOUR OF $x and $y parameters for several TCPDF methods: - WARNING: THIS VERSION CHANGES THE BEHAVIOUR OF $x and $y parameters for several TCPDF methods:
zero coordinates for $x and $y are now valid coordinates; zero coordinates for $x and $y are now valid coordinates;
set $x and $y as empty strings to get the current value. set $x and $y as empty strings to get the current value.
- Some error caused by 'empty' funtion were fixed. - Some error caused by 'empty' function were fixed.
- Default color for convertHTMLColorToDec() method was changed to white and the return value for invalid color is false. - Default color for convertHTMLColorToDec() method was changed to white and the return value for invalid color is false.
- HTML on footer bug was fixed. - HTML on footer bug was fixed.
- The following examples were fixed: 5,7,10,17,19,20,21,33,42,43. - The following examples were fixed: 5,7,10,17,19,20,21,33,42,43.
@ -1922,8 +1984,8 @@
C128A : CODE 128 A C128A : CODE 128 A
C128B : CODE 128 B C128B : CODE 128 B
C128C : CODE 128 C C128C : CODE 128 C
EAN2 : 2-Digits UPC-Based Extention EAN2 : 2-Digits UPC-Based Extension
EAN5 : 5-Digits UPC-Based Extention EAN5 : 5-Digits UPC-Based Extension
EAN8 : EAN 8 EAN8 : EAN 8
EAN13 : EAN 13 EAN13 : EAN 13
UPCA : UPC-A UPCA : UPC-A

View File

@ -8,11 +8,11 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 6.0.093 Version: 6.2.6
Release date: 2014-09-02 Release date: 2015-01-28
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2014: Copyright (c) 2002-2015:
Nicola Asuni Nicola Asuni
Tecnick.com LTD Tecnick.com LTD
www.tecnick.com www.tecnick.com
@ -35,7 +35,7 @@ Main Features:
* methods to publish some XHTML + CSS code, Javascript and Forms; * methods to publish some XHTML + CSS code, Javascript and Forms;
* images, graphic (geometric figures) and transformation methods; * images, graphic (geometric figures) and transformation methods;
* supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http: www.imagemagick.org/www/formats.html) * supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http: www.imagemagick.org/www/formats.html)
* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417; * 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417;
* JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies; * JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies;
* automatic page header and footer management; * automatic page header and footer management;
* document encryption up to 256 bit and digital signature certifications; * document encryption up to 256 bit and digital signature certifications;

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