Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop6
This commit is contained in:
commit
e26cb0f238
21
ChangeLog
21
ChangeLog
@ -2,15 +2,6 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
WARNING:
|
||||
|
||||
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
|
||||
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
|
||||
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection" during
|
||||
migration.
|
||||
Upgrading to any other version or any other database system is abolutely required BEFORE trying
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 5.0.0 compared to 4.0.* *****
|
||||
@ -258,12 +249,12 @@ NEW: Add the admin info on combo of type of contact
|
||||
NEW: Add the event BILL_PAYED to the list of supported events for module notification.
|
||||
NEW: Add total weight and volume on PDF.
|
||||
NEW: Add hidden option to hide column qty ordered on shipments.
|
||||
NEW: Add view of virtual stock into product list (when appropriate).
|
||||
NEW: Add warning on tasks when they are late (add also the warning tolerance parameter).
|
||||
NEW: Add weight/volume for one product into shipment export.
|
||||
NEW: Add width and height on product card
|
||||
NEW: allow a document to be linked to project of another customer by config setup.
|
||||
NEW: allow project to be shared across entities (for multicompany module).
|
||||
NEW: Add view of virtual stock into product list (when appropriate)
|
||||
NEW: Add warning on tasks when they are late (add also the warning tolerance parameter)
|
||||
NEW: Add weight/volume for one product into shipment export
|
||||
NEW: Add width and height on product table
|
||||
NEW: allow a document to be linked to project from another customer on config
|
||||
NEW: allow project to be shared across entities (for multicompany module)
|
||||
NEW: All variant of ckeditor config can be tested into the setup page of module.
|
||||
NEW: Can change dynamically number of records visible into lists.
|
||||
NEW: Can change type of extrafields (for some combinations only).
|
||||
|
||||
8737
dev/initdemo/mysqldump_dolibarr_5.0.0.sql
Normal file
8737
dev/initdemo/mysqldump_dolibarr_5.0.0.sql
Normal file
File diff suppressed because one or more lines are too long
@ -192,7 +192,7 @@ else {
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">';
|
||||
print '<td class="liste_titre center" colspan="2">';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||
print '<br>';
|
||||
@ -200,14 +200,13 @@ else {
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
|
||||
print '</td>';
|
||||
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -386,7 +386,7 @@ print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" al
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
|
||||
print '<td class="liste_titre center"><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
@ -394,15 +394,15 @@ print '<br>';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td>';
|
||||
print '<td class="liste_titre center"><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print '<br>';
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print '<br>';
|
||||
@ -412,10 +412,10 @@ print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
print '<td class="liste_titre center"> </td>';
|
||||
print '<td class="liste_titre center" align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td class="liste_titre center" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
@ -190,14 +190,14 @@ class BookKeeping extends CommonObject
|
||||
|
||||
if ($resql) {
|
||||
$row = $this->db->fetch_object($resql);
|
||||
if ($row->nb == 0) {
|
||||
|
||||
if ($row->nb == 0)
|
||||
{
|
||||
// Determine piece_num
|
||||
$sqlnum = "SELECT piece_num";
|
||||
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'";
|
||||
$sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'";
|
||||
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'"; // For example doc_type = 'bank'
|
||||
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'"; // fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ...
|
||||
$sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'"; // ref of source object
|
||||
$sqlnum .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
||||
@ -276,13 +276,13 @@ class BookKeeping extends CommonObject
|
||||
$this->id = $id;
|
||||
$result = 0;
|
||||
} else {
|
||||
$result = - 2;
|
||||
$result = -2;
|
||||
$error ++;
|
||||
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
$result = - 1;
|
||||
$result = -1;
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
@ -290,11 +290,11 @@ class BookKeeping extends CommonObject
|
||||
} else { // Already exists
|
||||
$result = -3;
|
||||
$error++;
|
||||
$this->errors[] = 'Error Transaction for ('.$this->doc_type.', '.$this->doc_ref.', '.$this->fk_docdet.') were already recorded';
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_WARNING);
|
||||
$this->error='BookkeepingRecordAlreadyExists';
|
||||
dol_syslog(__METHOD__ . ' ' . $this->error, LOG_WARNING);
|
||||
}
|
||||
} else {
|
||||
$result = - 5;
|
||||
$result = -5;
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
@ -316,11 +316,9 @@ class BookKeeping extends CommonObject
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,10 +30,10 @@
|
||||
*/
|
||||
class FormVentilation extends Form
|
||||
{
|
||||
|
||||
|
||||
private $options_cache = array();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return select filter with date of transaction
|
||||
*
|
||||
@ -87,21 +87,22 @@ class FormVentilation extends Form
|
||||
if ($usecache && ! empty($this->options_cache[$usecache]))
|
||||
{
|
||||
$options = $this->options_cache[$usecache];
|
||||
$selected=$selectid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " ORDER BY aa.account_number";
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
@ -109,16 +110,16 @@ class FormVentilation extends Form
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
|
||||
$selected = 0;
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
|
||||
// Try to guess if we have found default value
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
@ -132,19 +133,19 @@ class FormVentilation extends Form
|
||||
//var_dump("Found ".$selectid." ".$select_value_in);
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
if ($usecache)
|
||||
{
|
||||
$this->options_cache[$usecache] = $options;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -303,7 +304,7 @@ class FormVentilation extends Form
|
||||
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$out_array = array();
|
||||
|
||||
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
|
||||
@ -342,7 +343,7 @@ class FormVentilation extends Form
|
||||
function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
$out_array = array();
|
||||
|
||||
$sql = "SELECT DISTINCT code_journal";
|
||||
|
||||
@ -153,7 +153,8 @@ if ($result) {
|
||||
// one line for bank jounral = tabbq
|
||||
// one line for thirdparty journal = tabtp
|
||||
$i = 0;
|
||||
while ( $i < $num ) {
|
||||
while ( $i < $num )
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Set accountancy code (for bank and thirdparty)
|
||||
@ -314,7 +315,8 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
if (! $errorforline)
|
||||
{
|
||||
// Line into bank account
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
foreach ( $tabbq[$key] as $k => $mt )
|
||||
{
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -363,9 +365,18 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->doc_ref.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -463,16 +474,6 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
// Export
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
@ -633,6 +634,15 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
$invoicestatic = new Facture($db);
|
||||
$invoicesupplierstatic = new FactureFournisseur($db);
|
||||
@ -689,7 +699,8 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||
print "<td>" . $langs->trans("Type") . "</td>";
|
||||
print "<td>" . $langs->trans("PaymentMode") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
|
||||
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$var = true;
|
||||
@ -697,7 +708,7 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
foreach ( $tabpay as $key => $val ) { // $key is rowid in llx_bank
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
|
||||
$reflabel = $val["ref"];
|
||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Supplier');
|
||||
@ -721,7 +732,7 @@ if (empty($action) || $action == 'view') {
|
||||
$sqlmid = 'SELECT payfac.fk_facture as id';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac";
|
||||
$sqlmid .= " WHERE payfac.fk_paiement=" . $val["paymentid"];
|
||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid) {
|
||||
$objmid = $db->fetch_object($resultmid);
|
||||
@ -735,7 +746,7 @@ if (empty($action) || $action == 'view') {
|
||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id';
|
||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac";
|
||||
$sqlmid .= " WHERE payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid) {
|
||||
$objmid = $db->fetch_object($resultmid);
|
||||
@ -744,14 +755,14 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];*/
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
|
||||
foreach ( $tabbq[$key] as $k => $mt )
|
||||
{
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td><!-- Bank bank.rowid=".$key."--></td>";
|
||||
print "<td>" . $date . "</td>";
|
||||
@ -809,7 +820,7 @@ if (empty($action) || $action == 'view') {
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
||||
}
|
||||
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) .
|
||||
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
|
||||
print "</td>";
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td> </td>";
|
||||
|
||||
@ -187,11 +187,11 @@ if ($action == 'writebookkeeping') {
|
||||
// Fees
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
if ($accountingaccount->fetch(null, $k)) {
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -355,7 +355,7 @@ if ($action == 'export_csv') {
|
||||
// Fees
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
@ -464,7 +464,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Fees
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . " >";
|
||||
|
||||
@ -219,11 +219,11 @@ if ($action == 'writebookkeeping') {
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
if ($accountingaccount->fetch(null, $k)) {
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -398,7 +398,7 @@ if ($action == 'export_csv') {
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
@ -518,7 +518,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . " >";
|
||||
|
||||
@ -243,7 +243,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
if ($accountingaccount->fetch(null, $k)) {
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -375,7 +375,7 @@ if ($action == 'export_csv') {
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount_static = new AccountingAccount($db);
|
||||
if ($accountingaccount_static->fetch(null, $k)) {
|
||||
if ($accountingaccount_static->fetch(null, $k, true)) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
@ -429,7 +429,7 @@ if ($action == 'export_csv') {
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
@ -559,7 +559,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
|
||||
@ -83,6 +83,9 @@ class Adherent extends CommonObject
|
||||
var $datevalid;
|
||||
var $birth;
|
||||
|
||||
var $note_public;
|
||||
var $note_private;
|
||||
|
||||
var $typeid; // Id type adherent
|
||||
var $type; // Libelle type adherent
|
||||
var $need_subscription;
|
||||
@ -410,7 +413,9 @@ class Adherent extends CommonObject
|
||||
$this->country_id=($this->country_id > 0?$this->country_id:$this->country_id);
|
||||
$this->state_id=($this->state_id > 0?$this->state_id:$this->state_id);
|
||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords(trim($this->lastname));
|
||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname));
|
||||
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname));
|
||||
$this->note_public=($this->note_public?$this->note_public:$this->note_public);
|
||||
$this->note_private=($this->note_private?$this->note_private:$this->note_private);
|
||||
|
||||
// Check parameters
|
||||
if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email))
|
||||
@ -440,7 +445,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", note_public=" .($this->note_private?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||
$sql.= ", public='".$this->public."'";
|
||||
$sql.= ", statut=" .$this->statut;
|
||||
@ -1146,11 +1151,11 @@ class Adherent extends CommonObject
|
||||
$this->birth = $this->db->jdate($obj->birthday);
|
||||
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->morphy = $obj->morphy;
|
||||
|
||||
$this->typeid = $obj->fk_adherent_type;
|
||||
$this->type = $obj->type;
|
||||
$this->type = $obj->type;
|
||||
$this->need_subscription = $obj->subscription;
|
||||
|
||||
$this->user_id = $obj->user_id;
|
||||
|
||||
@ -35,9 +35,10 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
public $table_element = 'adherent_type';
|
||||
public $element = 'adherent_type';
|
||||
|
||||
public $picto = 'group';
|
||||
|
||||
/** @var string Label */
|
||||
public $libelle;
|
||||
public $label;
|
||||
/**
|
||||
* @var bool
|
||||
* @deprecated Use subscription
|
||||
@ -199,7 +200,7 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.libelle, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".$rowid;
|
||||
|
||||
@ -214,7 +215,8 @@ class AdherentType extends CommonObject
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->label = $obj->label;
|
||||
$this->libelle = $obj->label; // For backward compatibility
|
||||
$this->statut = $obj->statut;
|
||||
$this->subscription = $obj->subscription;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
@ -296,6 +298,16 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getLibStatut
|
||||
*
|
||||
* @return string Return status of a type of member
|
||||
*/
|
||||
function getLibStatut()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* getMailOnValid
|
||||
*
|
||||
|
||||
@ -395,8 +395,8 @@ if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titr
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
@ -434,32 +434,32 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
if (! empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_firstname" value="'.$search_firstname.'" size="6"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="6"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_company" value="'.$search_company.'" size="6"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="6"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.morphy']['checked']))
|
||||
@ -479,24 +479,24 @@ if (! empty($arrayfields['t.libelle']['checked']))
|
||||
if (! empty($arrayfields['d.address']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_address" value="'.$search_address.'" size="5"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_address" value="'.$search_address.'"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_zip" value="'.$search_zip.'" size="5"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['d.town']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_town" value="'.$search_town.'" size="5"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_town" value="'.$search_town.'"></td>';
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '<input class="flat searchstring maxwidth50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
@ -510,25 +510,25 @@ if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
if (! empty($arrayfields['d.phone']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_phone" value="'.$search_phone.'" size="5"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_phone" value="'.$search_phone.'"></td>';
|
||||
}
|
||||
// Phone perso
|
||||
if (! empty($arrayfields['d.phone_perso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_phone_perso" value="'.$search_phone_perso.'" size="5"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_phone_perso" value="'.$search_phone_perso.'"></td>';
|
||||
}
|
||||
// Phone mobile
|
||||
if (! empty($arrayfields['d.phone_mobile']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'" size="5"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'"></td>';
|
||||
}
|
||||
// Email
|
||||
if (! empty($arrayfields['d.email']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="5"></td>';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_email" value="'.$search_email.'"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.datefin']['checked']))
|
||||
@ -597,7 +597,7 @@ print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
$i = 0;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
@ -298,20 +298,15 @@ if ($rowid > 0)
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>';
|
||||
print $form->showrefnav($object, 'rowid', $linkback);
|
||||
print '</td></tr>';
|
||||
dol_banner_tab($object, 'rowid', $linkback);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.dol_escape_htmltag($object->libelle).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print yn($object->subscription);
|
||||
print '</tr>';
|
||||
|
||||
@ -378,9 +373,7 @@ if ($rowid > 0)
|
||||
$sql.= " AND t.rowid = ".$object->id;
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (d.firstname LIKE '%".$sall."%' OR d.lastname LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'";
|
||||
$sql.= " OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.address LIKE '%".$sall."%'";
|
||||
$sql.= " OR d.town LIKE '%".$sall."%' OR d.note_public LIKE '%".$sall."%' OR d.note_private LIKE '%".$sall."%')";
|
||||
$sql.=natural_search(array("f.firstname","d.lastname","d.societe","d.email","d.login","d.address","d.town","d.note_public","d.note_private"), $sall);
|
||||
}
|
||||
if ($status != '')
|
||||
{
|
||||
@ -388,22 +381,22 @@ if ($rowid > 0)
|
||||
}
|
||||
if ($action == 'search')
|
||||
{
|
||||
if (isset($_POST['search']) && $_POST['search'] != '')
|
||||
{
|
||||
$sql.= " AND (d.firstname LIKE '%".$_POST['search']."%' OR d.lastname LIKE '%".$_POST['search']."%')";
|
||||
}
|
||||
if (GETPOST('search'))
|
||||
{
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search'));
|
||||
}
|
||||
}
|
||||
if (! empty($search_lastname))
|
||||
{
|
||||
$sql.= " AND (d.firstname LIKE '%".$search_lastname."%' OR d.lastname LIKE '%".$search_lastname."%')";
|
||||
$sql.= natural_search(array("d.firstname","d.lastname"), $search_lastname);
|
||||
}
|
||||
if (! empty($search_login))
|
||||
{
|
||||
$sql.= " AND d.login LIKE '%".$search_login."%'";
|
||||
$sql.= natural_search("d.login", $search_login);
|
||||
}
|
||||
if (! empty($search_email))
|
||||
{
|
||||
$sql.= " AND d.email LIKE '%".$search_email."%'";
|
||||
$sql.= natural_search("d.email", $search_email);
|
||||
}
|
||||
if ($filter == 'uptodate')
|
||||
{
|
||||
|
||||
@ -675,8 +675,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
if (! empty($_POST["localtax1_type"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (! empty($_POST["localtax2_type"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
if ((! empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if ((! empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||
@ -1064,7 +1064,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
||||
|
||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; }
|
||||
|
||||
@ -500,8 +500,10 @@ if ($mode != 'marketplace')
|
||||
else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
|
||||
|
||||
$textexternal='';
|
||||
$imginfo="info";
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
$imginfo="info_black";
|
||||
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
|
||||
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
|
||||
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> '.$objMod->editor_url;
|
||||
@ -645,7 +647,7 @@ if ($mode != 'marketplace')
|
||||
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||
$text.=$langs->trans("DetectionNotPossible");
|
||||
|
||||
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
|
||||
print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20');
|
||||
|
||||
print '</td>';
|
||||
|
||||
@ -659,8 +661,6 @@ if ($mode != 'marketplace')
|
||||
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"');
|
||||
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"');
|
||||
|
||||
// Picto external
|
||||
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"');
|
||||
|
||||
print $versiontrans;
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
|
||||
|
||||
// Translations
|
||||
$langs->load("admin");
|
||||
$langs->load("multicurrency");
|
||||
|
||||
// Access control
|
||||
@ -323,8 +324,17 @@ print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></form></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$conf->currency.$form->textwithpicto(' ', $langs->trans("BaseCurrency")).'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="300">1';
|
||||
print '</td></form></tr>';
|
||||
|
||||
foreach ($TCurrency as &$currency)
|
||||
{
|
||||
if($currency->code == $conf->currency) continue;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
|
||||
@ -334,10 +344,12 @@ foreach ($TCurrency as &$currency)
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update_currency">';
|
||||
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
||||
print '<input type="text" name="rate" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13" /> ';
|
||||
print '1 '.$conf->currency.' = ';
|
||||
print '<input type="text" name="rate" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13" /> '.$currency->code.' ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '</form>';
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -368,7 +368,7 @@ if ($resql)
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
|
||||
@ -189,6 +189,10 @@ if ($action == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($array_query['type_of_target'] == 2 || $array_query['type_of_target'] == 4) {
|
||||
$user_contact_query = true;
|
||||
}
|
||||
|
||||
if (preg_match("/^type_of_target/", $key)) {
|
||||
$array_query[$key] = GETPOST($key);
|
||||
}
|
||||
@ -203,8 +207,8 @@ if ($action == 'add') {
|
||||
$advTarget->thirdparty_lines = array ();
|
||||
}*/
|
||||
|
||||
if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2)) {
|
||||
$result = $advTarget->query_contact($array_query);
|
||||
if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2 || $array_query['type_of_target'] == 4)) {
|
||||
$result = $advTarget->query_contact($array_query, 1);
|
||||
if ($result < 0) {
|
||||
setEventMessage($advTarget->error, 'errors');
|
||||
}
|
||||
@ -889,6 +893,11 @@ if ($object->fetch($id) >= 0) {
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('socpeople');
|
||||
foreach($extrafields->attribute_type as $key=>&$value) {
|
||||
if($value == 'radio')$value = 'select';
|
||||
}
|
||||
|
||||
|
||||
foreach ( $extralabels as $key => $val ) {
|
||||
|
||||
print '<tr><td>' . $extrafields->attribute_label[$key];
|
||||
@ -900,8 +909,8 @@ if ($object->fetch($id) >= 0) {
|
||||
print '<input type="text" name="options_' . $key . '_cnct"/></td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
|
||||
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options' . $key . '_min_cnct"/>';
|
||||
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options' . $key . '_max_cnct"/>';
|
||||
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options_' . $key . '_min_cnct"/>';
|
||||
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options_' . $key . '_max_cnct"/>';
|
||||
print '</td><td>' . "\n";
|
||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
|
||||
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
@ -967,12 +976,6 @@ if ($object->fetch($id) >= 0) {
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3))
|
||||
{
|
||||
// List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content)
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -64,16 +64,19 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->select_target_type = array('2'=>$langs->trans('Contacts'),'1'=>$langs->trans('Contacts').'+'.$langs->trans('ThirdParty'),
|
||||
'3'=>$langs->trans('ThirdParty'),
|
||||
);
|
||||
$this->type_statuscommprospect=array(
|
||||
-1=>$langs->trans("StatusProspect-1"),
|
||||
0=>$langs->trans("StatusProspect0"),
|
||||
1=>$langs->trans("StatusProspect1"),
|
||||
2=>$langs->trans("StatusProspect2"),
|
||||
3=>$langs->trans("StatusProspect3"));
|
||||
|
||||
$this->select_target_type = array(
|
||||
'2' => $langs->trans('Contacts'),
|
||||
'1' => $langs->trans('Contacts') . '+' . $langs->trans('ThirdParty'),
|
||||
'3' => $langs->trans('ThirdParty'),
|
||||
'4' => $langs->trans('ContactsWithThirdpartyFilter')
|
||||
);
|
||||
$this->type_statuscommprospect = array(
|
||||
- 1 => $langs->trans("StatusProspect-1"),
|
||||
0 => $langs->trans("StatusProspect0"),
|
||||
1 => $langs->trans("StatusProspect1"),
|
||||
2 => $langs->trans("StatusProspect2"),
|
||||
3 => $langs->trans("StatusProspect3")
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -492,7 +495,7 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
}
|
||||
if (!empty($arrayquery['cust_mothercompany'])) {
|
||||
$str=$this->transformToSQL('nom',$arrayquery['cust_mothercompany']);
|
||||
$sqlwhere[]= " (t.parent IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "societe WHERE ('.$str.')))";
|
||||
$sqlwhere[]= " (t.parent IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "societe WHERE (".$str.")))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_status']) && count($arrayquery['cust_status'])>0) {
|
||||
$sqlwhere[]= " (t.status IN (".implode(',',$arrayquery['cust_status'])."))";
|
||||
@ -603,9 +606,10 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param array $arrayquery All element to Query
|
||||
* @param int $withThirdpartyFilter add contact with tridparty filter
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function query_contact($arrayquery)
|
||||
function query_contact($arrayquery, $withThirdpartyFilter = 0)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
@ -614,6 +618,11 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t";
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as te ON te.fk_object=t.rowid ";
|
||||
|
||||
if (! empty($withThirdpartyFilter)) {
|
||||
$sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe as ts ON ts.rowid=t.fk_soc";
|
||||
$sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_extrafields as tse ON tse.fk_object=ts.rowid ";
|
||||
}
|
||||
|
||||
$sqlwhere=array();
|
||||
|
||||
$sqlwhere[]= 't.entity IN ('.getEntity('socpeople',1).')';
|
||||
@ -694,14 +703,107 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
if (! empty($withThirdpartyFilter)) {
|
||||
if (array_key_exists('cust_saleman', $arrayquery)) {
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=ts.rowid ";
|
||||
}
|
||||
if (array_key_exists('cust_categ', $arrayquery)) {
|
||||
$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_soc=ts.rowid ";
|
||||
}
|
||||
|
||||
if (!empty($arrayquery['cust_name'])) {
|
||||
|
||||
$sqlwhere[]= $this->transformToSQL('ts.nom',$arrayquery['cust_name']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_code'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('ts.code_client',$arrayquery['cust_code']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_adress'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('ts.address',$arrayquery['cust_adress']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_zip'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('ts.zip',$arrayquery['cust_zip']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_city'])) {
|
||||
$sqlwhere[]= $this->transformToSQL('ts.town',$arrayquery['cust_city']);
|
||||
}
|
||||
if (!empty($arrayquery['cust_mothercompany'])) {
|
||||
$str=$this->transformToSQL('nom',$arrayquery['cust_mothercompany']);
|
||||
$sqlwhere[]= " (ts.parent IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "societe WHERE (".$str.")))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_status']) && count($arrayquery['cust_status'])>0) {
|
||||
$sqlwhere[]= " (ts.status IN (".implode(',',$arrayquery['cust_status'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_typecust']) && count($arrayquery['cust_typecust'])>0) {
|
||||
$sqlwhere[]= " (ts.client IN (".implode(',',$arrayquery['cust_typecust'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_comm_status']) && count($arrayquery['cust_comm_status']>0)) {
|
||||
$sqlwhere[]= " (ts.fk_stcomm IN (".implode(',',$arrayquery['cust_comm_status'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_prospect_status']) && count($arrayquery['cust_prospect_status'])>0) {
|
||||
$sqlwhere[]= " (ts.fk_prospectlevel IN ('".implode("','",$arrayquery['cust_prospect_status'])."'))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_typeent']) && count($arrayquery['cust_typeent'])>0) {
|
||||
$sqlwhere[]= " (ts.fk_typent IN (".implode(',',$arrayquery['cust_typeent'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_saleman']) && count($arrayquery['cust_saleman'])>0) {
|
||||
$sqlwhere[]= " (saleman.fk_user IN (".implode(',',$arrayquery['cust_saleman'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_country']) && count($arrayquery['cust_country'])>0) {
|
||||
$sqlwhere[]= " (ts.fk_pays IN (".implode(',',$arrayquery['cust_country'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_effectif_id']) && count($arrayquery['cust_effectif_id'])>0) {
|
||||
$sqlwhere[]= " (ts.fk_effectif IN (".implode(',',$arrayquery['cust_effectif_id'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_categ']) && count($arrayquery['cust_categ'])>0) {
|
||||
$sqlwhere[]= " (custcateg.fk_categorie IN (".implode(',',$arrayquery['cust_categ'])."))";
|
||||
}
|
||||
if (!empty($arrayquery['cust_language']) && count($arrayquery['cust_language'])>0) {
|
||||
$sqlwhere[]= " (ts.default_lang IN ('".implode("','",$arrayquery['cust_language'])."'))";
|
||||
}
|
||||
|
||||
//Standard Extrafield feature
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('societe');
|
||||
|
||||
foreach($extralabels as $key=>$val) {
|
||||
|
||||
if (($extrafields->attribute_type[$key] == 'varchar') ||
|
||||
($extrafields->attribute_type[$key] == 'text')) {
|
||||
if (!empty($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')";
|
||||
}
|
||||
} elseif (($extrafields->attribute_type[$key] == 'int') ||
|
||||
($extrafields->attribute_type[$key] == 'double')) {
|
||||
if (!empty($arrayquery['options_'.$key.'_max'])) {
|
||||
$sqlwhere[]= " (tse.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND tse.".$key." <= ".$arrayquery['options_'.$key.'_min'].")";
|
||||
}
|
||||
} else if (($extrafields->attribute_type[$key] == 'date') ||
|
||||
($extrafields->attribute_type[$key] == 'datetime')) {
|
||||
if (!empty($arrayquery['options_'.$key.'_end_dt'])){
|
||||
$sqlwhere[]= " (tse.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND tse.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')";
|
||||
}
|
||||
}else if ($extrafields->attribute_type[$key] == 'boolean') {
|
||||
if ($arrayquery['options_'.$key]!=''){
|
||||
$sqlwhere[]= " (tse.".$key." = ".$arrayquery['options_'.$key].")";
|
||||
}
|
||||
}else{
|
||||
if (is_array($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[]= " (tse.".$key." IN ('".implode("','",$arrayquery['options_'.$key])."'))";
|
||||
} elseif (!empty($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[]= " (tse.".$key." LIKE '".$arrayquery['options_'.$key]."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($sqlwhere)>0) $sql.= " WHERE ".implode(" AND ",$sqlwhere);
|
||||
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::query_contact sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -681,6 +681,7 @@ if (empty($reshook))
|
||||
$predef='';
|
||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
if (GETPOST('prod_entry_mode') == 'free')
|
||||
{
|
||||
$idprod=0;
|
||||
@ -712,7 +713,7 @@ if (empty($reshook))
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && $price_ht == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
$error ++;
|
||||
@ -858,6 +859,7 @@ if (empty($reshook))
|
||||
$type = GETPOST('type');
|
||||
|
||||
$fk_unit = GETPOST('units', 'alpha');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
}
|
||||
|
||||
// Margin
|
||||
@ -880,7 +882,7 @@ if (empty($reshook))
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// 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_options, $fk_unit);
|
||||
$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, $fk_unit, '', 0, $pu_ht_devise);
|
||||
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
@ -959,6 +961,8 @@ if (empty($reshook))
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
@ -1011,7 +1015,7 @@ if (empty($reshook))
|
||||
if (! $error) {
|
||||
$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_options, $_POST["units"]);
|
||||
$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, $_POST["units"], $pu_ht_devise);
|
||||
|
||||
if ($result >= 0) {
|
||||
$db->commit();
|
||||
@ -1070,17 +1074,17 @@ if (empty($reshook))
|
||||
|
||||
// Set project
|
||||
else if ($action == 'classin' && $user->rights->propal->creer) {
|
||||
$object->setProject($_POST['projectid']);
|
||||
$object->setProject(GETPOST('projectid','int'));
|
||||
}
|
||||
|
||||
// Delai de livraison
|
||||
else if ($action == 'setavailability' && $user->rights->propal->creer) {
|
||||
$result = $object->availability($_POST['availability_id']);
|
||||
$result = $object->set_availability($user, GETPOST('availability_id','int'));
|
||||
}
|
||||
|
||||
// Origine de la propale
|
||||
else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
|
||||
$result = $object->demand_reason($_POST['demand_reason_id']);
|
||||
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id','int'));
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
@ -1701,10 +1705,10 @@ if ($action == 'create')
|
||||
|
||||
|
||||
// Proposal card
|
||||
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
|
||||
@ -1744,17 +1748,17 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Ref
|
||||
/*
|
||||
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
|
||||
@ -1784,7 +1788,7 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
|
||||
// Company
|
||||
/*
|
||||
print '<tr><td>' . $langs->trans('Company') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>';
|
||||
@ -2002,10 +2006,18 @@ if ($action == 'create')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == 0) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2107,42 +2119,42 @@ if ($action == 'create')
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Amount VAT
|
||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
@ -2156,27 +2168,27 @@ if ($action == 'create')
|
||||
print '<td class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Amount TTC
|
||||
print '<tr><td>' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Statut
|
||||
//print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled))
|
||||
{
|
||||
$formmargin->displayMarginInfos($object);
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||
@ -2232,7 +2244,7 @@ if ($action == 'create')
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
@ -2391,7 +2403,7 @@ if ($action == 'create')
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class Propal extends CommonObject
|
||||
public $fk_element='fk_propal';
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
public $picto='propal';
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -392,10 +392,10 @@ class Propal extends CommonObject
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @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_options=0, $fk_unit=null, $origin='', $origin_id=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, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise = 0)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
@ -463,18 +463,22 @@ class Propal extends CommonObject
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
$pu_tva = $tabprice[4];
|
||||
$pu_ttc = $tabprice[5];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Rang to use
|
||||
$rangtouse = $rang;
|
||||
@ -503,7 +507,7 @@ class Propal extends CommonObject
|
||||
$this->line->label=$label;
|
||||
$this->line->desc=$desc;
|
||||
$this->line->qty=$qty;
|
||||
|
||||
|
||||
$this->line->vat_src_code=$vat_src_code;
|
||||
$this->line->tva_tx=$txtva;
|
||||
$this->line->localtax1_tx=$txlocaltax1;
|
||||
@ -537,7 +541,7 @@ class Propal extends CommonObject
|
||||
// Multicurrency
|
||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||
$this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
@ -607,9 +611,10 @@ class Propal extends CommonObject
|
||||
* @param int $date_end End date of the line
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @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_options=0, $fk_unit=null)
|
||||
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, $fk_unit=null, $pu_ht_devise = 0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
@ -638,7 +643,7 @@ class Propal extends CommonObject
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
|
||||
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code='';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
@ -647,17 +652,21 @@ class Propal extends CommonObject
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
$pu_tva = $tabprice[4];
|
||||
$pu_ttc = $tabprice[5];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||
$price = $pu;
|
||||
@ -696,7 +705,7 @@ class Propal extends CommonObject
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
$this->line->remise_percent = $remise_percent;
|
||||
$this->line->subprice = $pu;
|
||||
$this->line->subprice = $pu_ht;
|
||||
$this->line->info_bits = $info_bits;
|
||||
|
||||
$this->line->vat_src_code = $vat_src_code;
|
||||
@ -725,7 +734,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
// Multicurrency
|
||||
$this->line->multicurrency_subprice = price2num($pu * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
@ -1180,7 +1189,7 @@ class Propal extends CommonObject
|
||||
$clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj);
|
||||
|
||||
// Create clone
|
||||
|
||||
|
||||
$result=$clonedObj->create($user);
|
||||
if ($result < 0) $error++;
|
||||
else
|
||||
@ -1541,7 +1550,7 @@ class Propal extends CommonObject
|
||||
dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate))))
|
||||
{
|
||||
@ -1551,7 +1560,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Numbering module definition
|
||||
@ -1839,7 +1848,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_availability($user, $id, $notrigger=0)
|
||||
{
|
||||
if (! empty($user->rights->propal->creer))
|
||||
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
@ -1849,7 +1858,7 @@ class Propal extends CommonObject
|
||||
$sql.= " SET fk_availability = '".$id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
@ -1861,6 +1870,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->fk_availability = $id;
|
||||
$this->availability_id = $availability_id;
|
||||
}
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
@ -1887,6 +1897,14 @@ class Propal extends CommonObject
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error_str='Propal status do not meet requirement '.$this->statut;
|
||||
dol_syslog(__METHOD__.$error_str, LOG_ERR);
|
||||
$this->error=$error_str;
|
||||
$this->errors[]= $this->error;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1899,14 +1917,14 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_demand_reason($user, $id, $notrigger=0)
|
||||
{
|
||||
if (! empty($user->rights->propal->creer))
|
||||
if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
||||
$sql.= " SET fk_input_reason = '".$id."'";
|
||||
$sql.= " SET fk_input_reason = ".$id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -1922,6 +1940,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
$this->fk_input_reason = $id;
|
||||
$this->demand_reason_id = $id;
|
||||
}
|
||||
|
||||
|
||||
@ -1949,6 +1968,14 @@ class Propal extends CommonObject
|
||||
return -1*$error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error_str='Propal status do not meet requirement '.$this->statut;
|
||||
dol_syslog(__METHOD__.$error_str, LOG_ERR);
|
||||
$this->error=$error_str;
|
||||
$this->errors[]= $this->error;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2406,7 +2433,7 @@ class Propal extends CommonObject
|
||||
$this->statut = self::STATUS_DRAFT;
|
||||
$this->brouillon = 1;
|
||||
}
|
||||
|
||||
|
||||
if (! $notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
@ -2733,6 +2760,7 @@ class Propal extends CommonObject
|
||||
* @param int $availability_id Id of new delivery time
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @deprecated use set_availability
|
||||
*/
|
||||
function availability($availability_id, $notrigger=0)
|
||||
{
|
||||
@ -2753,7 +2781,7 @@ class Propal extends CommonObject
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
@ -2800,6 +2828,7 @@ class Propal extends CommonObject
|
||||
* @param int $demand_reason_id Id of new source demand
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int >0 si ok, <0 si ko
|
||||
* @deprecated use set_demand_reason
|
||||
*/
|
||||
function demand_reason($demand_reason_id, $notrigger=0)
|
||||
{
|
||||
@ -2820,7 +2849,7 @@ class Propal extends CommonObject
|
||||
$this->errors[]=$this->db->error();
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
@ -3241,7 +3270,7 @@ class Propal extends CommonObject
|
||||
global $langs, $conf, $user;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
|
||||
$result='';
|
||||
$label='';
|
||||
$url='';
|
||||
@ -3272,7 +3301,7 @@ class Propal extends CommonObject
|
||||
$url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$linkclose='';
|
||||
if (empty($notooltip) && $user->rights->propal->lire)
|
||||
{
|
||||
@ -3284,9 +3313,9 @@ class Propal extends CommonObject
|
||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip"';
|
||||
}
|
||||
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto)
|
||||
@ -3350,7 +3379,7 @@ class Propal extends CommonObject
|
||||
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except;
|
||||
$this->lines[$i]->remise_percent = $obj->remise_percent;
|
||||
|
||||
$this->lines[$i]->vat_src_code = $obj->vat_src_code;
|
||||
$this->lines[$i]->vat_src_code = $obj->vat_src_code;
|
||||
$this->lines[$i]->tva_tx = $obj->tva_tx;
|
||||
$this->lines[$i]->info_bits = $obj->info_bits;
|
||||
$this->lines[$i]->total_ht = $obj->total_ht;
|
||||
@ -3684,7 +3713,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0;
|
||||
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
|
||||
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
|
||||
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
|
||||
@ -111,13 +111,16 @@ if (empty($reshook))
|
||||
{
|
||||
if ($cancel)
|
||||
{
|
||||
if ($action != 'addlink')
|
||||
if ($action != 'addlink' && $action != 'updateline')
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/commande/list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref);
|
||||
}
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$ret = $object->fetch($id,$ref);
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
@ -636,6 +639,7 @@ if (empty($reshook))
|
||||
$predef='';
|
||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
if (GETPOST('prod_entry_mode') == 'free')
|
||||
{
|
||||
$idprod=0;
|
||||
@ -670,7 +674,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && (! ($price_ht_devise >= 0) || $price_ht_devise == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
$error++;
|
||||
@ -810,6 +814,7 @@ if (empty($reshook))
|
||||
$desc = $product_desc;
|
||||
$type = GETPOST('type');
|
||||
$fk_unit=GETPOST('units', 'alpha');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
}
|
||||
|
||||
// Margin
|
||||
@ -831,7 +836,7 @@ if (empty($reshook))
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// 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_options, $fk_unit);
|
||||
$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, $fk_unit, '', 0, $pu_ht_devise);
|
||||
|
||||
if ($result > 0) {
|
||||
$ret = $object->fetch($object->id); // Reload to get new records
|
||||
@ -902,6 +907,7 @@ if (empty($reshook))
|
||||
$description=dol_htmlcleanlastbr(GETPOST('product_desc'));
|
||||
$pu_ht=GETPOST('price_ht');
|
||||
$vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
|
||||
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
@ -962,7 +968,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
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, $special_code, $array_options, GETPOST('units'));
|
||||
$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, $special_code, $array_options, GETPOST('units'),$pu_ht_devise);
|
||||
|
||||
if ($result >= 0) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
@ -2193,10 +2199,18 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == 0) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1225,6 +1225,7 @@ class Commande extends CommonOrder
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @see add_product
|
||||
@ -1234,7 +1235,7 @@ class Commande extends CommonOrder
|
||||
* 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)
|
||||
*/
|
||||
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, $fk_unit=null, $origin='', $origin_id=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, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise = 0)
|
||||
{
|
||||
global $mysoc, $conf, $langs, $user;
|
||||
|
||||
@ -1310,18 +1311,20 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Rang to use
|
||||
$rangtouse = $rang;
|
||||
@ -1385,7 +1388,7 @@ class Commande extends CommonOrder
|
||||
// Multicurrency
|
||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||
$this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
@ -2745,17 +2748,17 @@ class Commande extends CommonOrder
|
||||
* Update a line in database
|
||||
*
|
||||
* @param int $rowid Id of line to update
|
||||
* @param string $desc Description de la ligne
|
||||
* @param float $pu Prix unitaire
|
||||
* @param string $desc Description of line
|
||||
* @param float $pu Unit price
|
||||
* @param float $qty Quantity
|
||||
* @param float $remise_percent Pourcentage de remise de la ligne
|
||||
* @param float $remise_percent Percent of discount
|
||||
* @param float $txtva Taux TVA
|
||||
* @param float $txlocaltax1 Local tax 1 rate
|
||||
* @param float $txlocaltax2 Local tax 2 rate
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $info_bits Miscellaneous informations on line
|
||||
* @param int $date_start Start date of the line
|
||||
* @param int $date_end End date of the line
|
||||
* @param int $date_start Start date of the line
|
||||
* @param int $date_end End date of the line
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $fk_parent_line Id of parent line (0 in most cases, used by modules adding sublevels into lines).
|
||||
* @param int $skip_update_total Keep fields total_xxx to 0 (used for special lines by some modules)
|
||||
@ -2765,9 +2768,10 @@ class Commande extends CommonOrder
|
||||
* @param int $special_code Special code (also used by externals modules!)
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @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_options=0, $fk_unit=null)
|
||||
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, $fk_unit=null, $pu_ht_devise = 0)
|
||||
{
|
||||
global $conf, $mysoc, $langs, $user;
|
||||
|
||||
@ -2811,28 +2815,32 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
$pu_tva = $tabprice[4];
|
||||
$pu_ttc = $tabprice[5];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Anciens indicateurs: $price, $subprice, $remise (a ne plus utiliser)
|
||||
$price = $pu;
|
||||
$price = $pu_ht;
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$subprice = $tabprice[5];
|
||||
$subprice = $pu_ttc;
|
||||
}
|
||||
else
|
||||
{
|
||||
$subprice = $pu;
|
||||
$subprice = $pu_ht;
|
||||
}
|
||||
$remise = 0;
|
||||
if ($remise_percent > 0)
|
||||
@ -2910,7 +2918,7 @@ class Commande extends CommonOrder
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// Multicurrency
|
||||
$this->line->multicurrency_subprice = price2num($subprice * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
|
||||
@ -142,10 +142,6 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order');
|
||||
|
||||
@ -160,7 +156,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
@ -196,10 +192,6 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
// Order card
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
dol_fiche_end();
|
||||
@ -216,7 +208,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
// Contrat non trouve
|
||||
// Contact not found
|
||||
print "ErrorRecordNotFound";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
@ -159,7 +159,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@ -832,7 +832,7 @@ if ($resql)
|
||||
}
|
||||
if (! empty($arrayfields['ba.ref']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$form->select_comptes($account,'account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
|
||||
print '</td>';
|
||||
}
|
||||
@ -850,7 +850,7 @@ if ($resql)
|
||||
}
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
||||
print $form->textwithpicto('', $htmltext, 1);
|
||||
print '</td>';
|
||||
|
||||
@ -1931,7 +1931,7 @@ class AccountLine extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT b.rowid, b.datec,';
|
||||
$sql = 'SELECT b.rowid, b.datec, b.tms as datem,';
|
||||
$sql.= ' b.fk_user_author, b.fk_user_rappro';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'bank as b';
|
||||
$sql.= ' WHERE b.rowid = '.$id;
|
||||
@ -1958,6 +1958,7 @@ class AccountLine extends CommonObject
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
//$this->date_rappro = $obj->daterappro; // Not yet managed
|
||||
}
|
||||
$this->db->free($result);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@ -237,6 +237,12 @@ if ($user->rights->banque->supprimer) $arrayofmassactions['delete']=$langs->tran
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
$newcardbutton.='<a class="butAction" href="card.php?action=create">'.$langs->trans("NewFinancialAccount").'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Lines of title fields
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -248,7 +254,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,'','',$limit, 1);
|
||||
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_bank.png',0,$newcardbutton,'',$limit, 1);
|
||||
|
||||
|
||||
if ($sall)
|
||||
@ -404,7 +410,7 @@ if (! empty($arrayfields['b.clos']['checked']))
|
||||
// Balance
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
@ -415,10 +421,12 @@ print '</tr>';
|
||||
|
||||
|
||||
|
||||
$total = array(); $found = 0; $i=0;
|
||||
$total = array(); $found = 0; $i=0; $lastcurrencycode='';
|
||||
$var=true;
|
||||
foreach ($accounts as $key=>$type)
|
||||
{
|
||||
if ($i >= $limit) break;
|
||||
|
||||
$found++;
|
||||
|
||||
$acc = new Account($db);
|
||||
@ -427,6 +435,15 @@ foreach ($accounts as $key=>$type)
|
||||
$var = !$var;
|
||||
$solde = $acc->solde(1);
|
||||
|
||||
if (! empty($lastcurrencycode) && $lastcurrencycode != $acc->currency_code)
|
||||
{
|
||||
$lastcurrencycode='various'; // We found several different currencies
|
||||
}
|
||||
if ($lastcurrencycode != 'various')
|
||||
{
|
||||
$lastcurrencycode=$acc->currency_code;
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
@ -486,7 +503,6 @@ foreach ($accounts as $key=>$type)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -565,7 +581,7 @@ foreach ($accounts as $key=>$type)
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="'.$totalarray['nbfield'].'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalbalancefield']))
|
||||
if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
@ -577,7 +593,7 @@ if (isset($totalarray['totalbalancefield']))
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalbalancefield'] == $i) print '<td align="right">'.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $key).'</td>';
|
||||
elseif ($totalarray['totalbalancefield'] == $i) print '<td align="right">'.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
@ -589,18 +605,6 @@ print "</div>";
|
||||
print "</form>";
|
||||
|
||||
|
||||
/*
|
||||
* Buttons actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">'."\n";
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
print '<a class="butAction" href="card.php?action=create">'.$langs->trans("NewFinancialAccount").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
@ -274,8 +274,8 @@ if ($result)
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref")."</td>";
|
||||
print '<td colspan="4">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref")."</td>";
|
||||
print '<td>';
|
||||
print $form->showrefnav($bankline, 'rowid', $linkback, 1, 'rowid', 'rowid');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -285,7 +285,7 @@ if ($result)
|
||||
|
||||
// Bank account
|
||||
print "<tr><td>".$langs->trans("Account")."</td>";
|
||||
print '<td colspan="4">';
|
||||
print '<td>';
|
||||
print $acct->getNomUrl(1,'transactions');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -294,7 +294,7 @@ if ($result)
|
||||
if (count($links))
|
||||
{
|
||||
print "<tr><td>".$langs->trans("Links")."</td>";
|
||||
print '<td colspan="4">';
|
||||
print '<td>';
|
||||
foreach($links as $key=>$val)
|
||||
{
|
||||
if ($key) print '<br>';
|
||||
@ -389,8 +389,6 @@ if ($result)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$rowspan=0;
|
||||
|
||||
//$user->rights->banque->modifier=false;
|
||||
//$user->rights->banque->consolidate=true;
|
||||
|
||||
@ -399,7 +397,7 @@ if ($result)
|
||||
print "</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
$form->select_types_paiements($objp->fk_type,"value",'',2);
|
||||
print '<input type="text" class="flat" name="num_chq" value="'.(empty($objp->num_chq) ? '' : $objp->num_chq).'">';
|
||||
if ($objp->receiptid)
|
||||
@ -411,13 +409,10 @@ if ($result)
|
||||
|
||||
}
|
||||
print '</td>';
|
||||
$rowspan=7;
|
||||
print '<td align="center" rowspan="'.$rowspan.'" width="20%"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="4">'.$objp->fk_type.' '.$objp->num_chq.'</td>';
|
||||
print '<td>'.$objp->fk_type.' '.$objp->num_chq.'</td>';
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
@ -425,13 +420,13 @@ if ($result)
|
||||
print "<tr><td>".$langs->trans("Bank")."</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="40" name="banque" value="'.(empty($objp->banque) ? '' : $objp->banque).'">';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="'.($rowspan?'3':'4').'">'.$objp->banque.'</td>';
|
||||
print '<td>'.$objp->banque.'</td>';
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
@ -439,13 +434,13 @@ if ($result)
|
||||
print "<tr><td>".$langs->trans("CheckTransmitter")."</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="40" name="emetteur" value="'.(empty($objp->emetteur) ? '' : stripslashes($objp->emetteur)).'">';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="'.($rowspan?'3':'4').'">'.$objp->emetteur.'</td>';
|
||||
print '<td>'.$objp->emetteur.'</td>';
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
@ -453,13 +448,13 @@ if ($result)
|
||||
print '<tr><td>'.$langs->trans("DateOperation").'</td>';
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print $form->select_date($db->jdate($objp->do),'dateo','','','','update',1,0,1,$objp->rappro);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
||||
print '<td>';
|
||||
print dol_print_date($db->jdate($objp->do),"day");
|
||||
print '</td>';
|
||||
}
|
||||
@ -469,7 +464,7 @@ if ($result)
|
||||
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print $form->select_date($db->jdate($objp->dv),'datev','','','','update',1,0,1,$objp->rappro);
|
||||
if (! $objp->rappro)
|
||||
{
|
||||
@ -483,7 +478,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
||||
print '<td>';
|
||||
print dol_print_date($db->jdate($objp->dv),"day");
|
||||
print '</td>';
|
||||
}
|
||||
@ -493,7 +488,7 @@ if ($result)
|
||||
print "<tr><td>".$langs->trans("Label")."</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print '<input name="label" class="flat" '.($objp->rappro?' disabled':'').' value="';
|
||||
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
|
||||
{
|
||||
@ -509,7 +504,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
||||
print '<td>';
|
||||
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
|
||||
{
|
||||
// Label generique car entre parentheses. On l'affiche en le traduisant
|
||||
@ -527,19 +522,22 @@ if ($result)
|
||||
print "<tr><td>".$langs->trans("Amount")."</td>";
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print '<input name="amount" class="flat" size="10" '.($objp->rappro?' disabled':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
||||
print '<td>';
|
||||
print price($objp->amount);
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
// Releve rappro
|
||||
@ -554,10 +552,10 @@ if ($result)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("Conciliation")."</td>";
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Conciliation")."</td>";
|
||||
if ($user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
if ($objp->rappro)
|
||||
{
|
||||
print $langs->trans("AccountStatement").' <input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro?' disabled':'').'>';
|
||||
@ -568,28 +566,31 @@ if ($result)
|
||||
print $langs->trans("AccountStatement").' <input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro?' disabled':'').'>';
|
||||
}
|
||||
if ($objp->num_releve) print ' (<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?num='.$objp->num_releve.'&account='.$acct->id.'">'.$langs->trans("AccountStatement").' '.$objp->num_releve.')</a>';
|
||||
print '</td><td align="center" rowspan="2" width="20%"><input type="submit" class="button" value="'.$langs->trans("Update").'"></td>';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="4">'.$objp->num_releve.' </td>';
|
||||
print '<td>'.$objp->num_releve.' </td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
|
||||
if ($user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked="checked"':''):($objp->rappro?' checked="checked"':'')).'">';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="4">'.yn($objp->rappro).'</td>';
|
||||
print '<td>'.yn($objp->rappro).'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</table></form>';
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ if (empty($reshook))
|
||||
|
||||
// Multicurrency rate
|
||||
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int'));
|
||||
}
|
||||
|
||||
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
||||
@ -1314,6 +1314,7 @@ if (empty($reshook))
|
||||
$predef='';
|
||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
if (GETPOST('prod_entry_mode') == 'free')
|
||||
{
|
||||
$idprod=0;
|
||||
@ -1348,7 +1349,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||
$error ++;
|
||||
@ -1505,6 +1506,7 @@ if (empty($reshook))
|
||||
$desc = $product_desc;
|
||||
$type = GETPOST('type');
|
||||
$fk_unit= GETPOST('units', 'alpha');
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
}
|
||||
|
||||
// Margin
|
||||
@ -1524,7 +1526,7 @@ if (empty($reshook))
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// 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_options, $_POST['progress'], '', $fk_unit);
|
||||
$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'], '', $fk_unit, $pu_ht_devise);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -1604,6 +1606,7 @@ if (empty($reshook))
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$qty = GETPOST('qty');
|
||||
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
@ -1688,7 +1691,7 @@ if (empty($reshook))
|
||||
$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, $special_code, $array_options, GETPOST('progress'),
|
||||
$_POST['units']);
|
||||
$_POST['units'],$pu_ht_devise);
|
||||
|
||||
if ($result >= 0) {
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
@ -2974,7 +2977,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
@ -3234,10 +3237,18 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == 0) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
//}
|
||||
@ -3419,7 +3430,8 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</table>';
|
||||
|
||||
// List of payments
|
||||
|
||||
// List of previous situation invoices
|
||||
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1;
|
||||
@ -3530,9 +3542,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
// List of payments already done
|
||||
|
||||
print '<table class="noborder paymenttable" width="100%">';
|
||||
|
||||
// List of payments already done
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>';
|
||||
print '<td class="liste_titre">' . $langs->trans('Date') . '</td>';
|
||||
|
||||
@ -2411,9 +2411,10 @@ class Facture extends CommonInvoice
|
||||
* @param int $situation_percent Situation advance percentage
|
||||
* @param int $fk_prev_id Previous situation line id reference
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @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_options=0, $situation_percent=100, $fk_prev_id='', $fk_unit = null)
|
||||
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='', $fk_unit = null, $pu_ht_devise = 0)
|
||||
{
|
||||
// Deprecation warning
|
||||
if ($label) {
|
||||
@ -2493,7 +2494,7 @@ class Facture extends CommonInvoice
|
||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx);
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
@ -2506,6 +2507,7 @@ class Facture extends CommonInvoice
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Rank to use
|
||||
$rangtouse = $rang;
|
||||
@ -2565,7 +2567,7 @@ class Facture extends CommonInvoice
|
||||
// Multicurrency
|
||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||
$this->line->multicurrency_subprice = price2num($this->line->subprice * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
@ -2628,9 +2630,10 @@ class Facture extends CommonInvoice
|
||||
* @param array $array_options extrafields array
|
||||
* @param int $situation_percent Situation advance percentage
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @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_options=0, $situation_percent=0, $fk_unit = null)
|
||||
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, $fk_unit = null, $pu_ht_devise = 0)
|
||||
{
|
||||
global $conf,$user;
|
||||
// Deprecation warning
|
||||
@ -2688,7 +2691,7 @@ class Facture extends CommonInvoice
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx);
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
@ -2703,6 +2706,7 @@ class Facture extends CommonInvoice
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Old properties: $price, $remise (deprecated)
|
||||
$price = $pu;
|
||||
@ -2778,7 +2782,7 @@ class Facture extends CommonInvoice
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
// Multicurrency
|
||||
$this->line->multicurrency_subprice = price2num($this->line->subprice * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
|
||||
@ -138,45 +138,59 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$head = facture_prepare_head($object);
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
dol_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), 0, 'bill');
|
||||
|
||||
/*
|
||||
* Summary invoice for reminder
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
$morehtmlref='';
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$result=$discount->fetch(0,$object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error('',$discount->error);
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
|
||||
print '</td></tr>';
|
||||
|
||||
// Invoice content
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
print '<tr><td >';
|
||||
print $langs->trans('RefCustomer');
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td></tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'compta').'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
@ -99,7 +99,8 @@ if ($id > 0 || ! empty($ref))
|
||||
$head = facture_prepare_head($object);
|
||||
dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), 0, 'bill');
|
||||
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
@ -108,51 +109,74 @@ if ($id > 0 || ! empty($ref))
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
// Invoice content
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
$morehtmlref='';
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$result=$discount->fetch(0,$object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error('',$discount->error);
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>';
|
||||
print $langs->trans('RefCustomer');
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td></tr>';
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'facture';
|
||||
$permission = $user->rights->facture->creer;
|
||||
$permtoedit = $user->rights->facture->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
$id = GETPOST("facid","int");
|
||||
$ref=GETPOST("ref",'alpha');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -40,22 +43,78 @@ $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$fac = new Facture($db);
|
||||
$fac->fetch($_GET["facid"]);
|
||||
$fac->info($_GET["facid"]);
|
||||
$object = new Facture($db);
|
||||
$object->fetch($id, $ref);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($fac->socid);
|
||||
$object->info($object->id);
|
||||
|
||||
$head = facture_prepare_head($fac);
|
||||
$head = facture_prepare_head($object);
|
||||
dol_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
// Invoice content
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($fac);
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -71,51 +71,69 @@ if ($id > 0 || ! empty($ref))
|
||||
$object = new Facture($db);
|
||||
$object->fetch($id,$ref);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = facture_prepare_head($object);
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
dol_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
||||
|
||||
// Invoice content
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
$morehtmlref='';
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$result=$discount->fetch(0,$object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error('',$discount->error);
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
|
||||
print '</td></tr>';
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>';
|
||||
print $langs->trans('RefCustomer');
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td></tr>';
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
$cssclass="titlefield";
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
@ -149,48 +149,63 @@ if ($object->id > 0)
|
||||
|
||||
dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill');
|
||||
|
||||
/*
|
||||
* Facture
|
||||
*/
|
||||
// Invoice content
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
$morehtmlref='';
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$result=$discount->fetch(0,$object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error('',$discount->error);
|
||||
}
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
|
||||
print "</td></tr>";
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RefCustomer');
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'compta');
|
||||
print ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="3">';
|
||||
print $object->getLibType();
|
||||
if ($object->type == Facture::TYPE_REPLACEMENT)
|
||||
{
|
||||
@ -407,50 +422,101 @@ if ($object->id > 0)
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Montants
|
||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td align="right" colspan="2" class="nowrap">'.price($object->total_ht).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" class="nowrap">'.price($object->total_tva).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj=="1") //Localtax1
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" class="nowrap">'.price($object->total_localtax1).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj=="1") //Localtax2
|
||||
{
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
|
||||
print '<td align="right" colspan="2" class="nowrap">'.price($object->total_localtax2).'</td>';
|
||||
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" class="nowrap">'.price($object->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// We can also use bcadd to avoid pb with floating points
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
//$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
||||
|
||||
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td align="right" colspan="2" class="nowrap">'.price($resteapayer).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="3">';
|
||||
print $object->thirdparty->display_rib();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="titlefield">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td class="nowrap">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
// Vat
|
||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td colspan="3" class="nowrap">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
|
||||
{
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
if ($selleruserevenustamp) // Test company use revenue stamp
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RevenueStamp');
|
||||
print '</td>';
|
||||
if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
{
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editrevenuestamp&facid=' . $object->id . '">' . img_edit($langs->trans('SetRevenuStamp'), 1) . '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editrevenuestamp') {
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="setrevenuestamp">';
|
||||
print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code);
|
||||
// print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
|
||||
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
print '</form>';
|
||||
} else {
|
||||
print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Total with tax
|
||||
print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td class="nowrap">' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
|
||||
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
||||
|
||||
// TODO Replace this by an include with same code to show already done payment visible in invoice card
|
||||
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td class="nowrap">'.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ if (empty($reshook))
|
||||
if (! empty($multicurrency_amounts[$cursorfacid])) $atleastonepaymentnotnull++;
|
||||
$result=$tmpinvoice->fetch($cursorfacid);
|
||||
if ($result <= 0) dol_print_error($db);
|
||||
$multicurrency_amountsresttopay[$cursorfacid]=price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement(1));
|
||||
$multicurrency_amountsresttopay[$cursorfacid]=price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
|
||||
if ($multicurrency_amounts[$cursorfacid])
|
||||
{
|
||||
// Check amount
|
||||
|
||||
@ -94,9 +94,9 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid";
|
||||
$sql.= " AND bc.entity = ".$conf->entity;
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.=" AND bc.ref=".$search_ref;
|
||||
if ($search_ref) $sql.=natural_search("bc.ref",$search_ref);
|
||||
if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account;
|
||||
if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'";
|
||||
if ($search_amount) $sql.=natural_search("bc.amount", price2num($search_amount));
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
@ -166,14 +166,14 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_amount" value="'.$search_amount.'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
|
||||
@ -248,30 +248,30 @@ if ($resql)
|
||||
|
||||
// Lines for filters fields
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.$search_payment_num.'">';
|
||||
print '</td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
@ -280,7 +280,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -118,7 +118,7 @@ if ($result)
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("Line").'</td>';
|
||||
print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]);
|
||||
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref");
|
||||
print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom");
|
||||
@ -130,10 +130,10 @@ if ($result)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="8"></td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'. dol_escape_htmltag($search_company).'" size="12"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="8"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="6"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'. dol_escape_htmltag($search_company).'" size="6"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="6"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
|
||||
@ -185,7 +185,7 @@ if ($result)
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
}
|
||||
@ -196,6 +196,7 @@ if ($result)
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
|
||||
@ -426,7 +426,7 @@ if ($id > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
/*
|
||||
/*
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object,'id',$linkback);
|
||||
@ -446,7 +446,7 @@ if ($id > 0)
|
||||
}*/
|
||||
|
||||
// Type
|
||||
print "<tr><td>".$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type")."</td><td>".$object->type_libelle."</td>";
|
||||
print "</tr>";
|
||||
|
||||
// Period end date
|
||||
|
||||
@ -153,6 +153,8 @@ class ChargeSociales extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Nettoyage parametres
|
||||
$newamount=price2num($this->amount,'MT');
|
||||
|
||||
@ -162,17 +164,18 @@ class ChargeSociales extends CommonObject
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity)";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity, fk_user_author, date_creation)";
|
||||
$sql.= " VALUES (".$this->type;
|
||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
||||
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL");
|
||||
$sql.= ", '".$this->db->escape($this->lib)."',";
|
||||
$sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',";
|
||||
$sql.= " '".price2num($newamount)."',";
|
||||
$sql.= " ".$conf->entity;
|
||||
$sql.= ", '".$this->db->escape($this->lib)."'";
|
||||
$sql.= ", '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."'";
|
||||
$sql.= ", '".price2num($newamount)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -276,10 +279,11 @@ class ChargeSociales extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
||||
$sql.= " SET libelle='".$this->db->escape($this->lib)."',";
|
||||
$sql.= " date_ech='".$this->db->idate($this->date_ech)."',";
|
||||
$sql.= " periode='".$this->db->idate($this->periode)."',";
|
||||
$sql.= " amount='".price2num($this->amount,'MT')."'";
|
||||
$sql.= " SET libelle='".$this->db->escape($this->lib)."'";
|
||||
$sql.= ", date_ech='".$this->db->idate($this->date_ech)."'";
|
||||
$sql.= ", periode='".$this->db->idate($this->periode)."'";
|
||||
$sql.= ", amount='".price2num($this->amount,'MT')."'";
|
||||
$sql.= ", fk_user_modif=".$user->id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
@ -505,8 +509,9 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
||||
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
|
||||
$sql.= " fk_user_author, fk_user_modif, fk_user_valid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
||||
$sql.= " WHERE e.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
@ -522,7 +527,13 @@ class ChargeSociales extends CommonObject
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
@ -532,7 +543,7 @@ class ChargeSociales extends CommonObject
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
if (! empty($obj->fk_user_modif)) $this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
$this->import_key = $obj->import_key;
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("banks");
|
||||
@ -38,7 +39,7 @@ $refund=GETPOST("refund","int");
|
||||
if (empty($refund)) $refund=0;
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
@ -179,8 +180,9 @@ if ($action == 'delete')
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$title=$langs->trans("VAT") . " - " . $langs->trans("Card");
|
||||
$help_url='';
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@ -236,13 +238,13 @@ if ($action == 'create')
|
||||
print '</label>';
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
|
||||
print $form->select_date($datep,"datep",'','','','add',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -263,7 +265,7 @@ if ($action == 'create')
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccount").'</td><td>';
|
||||
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -273,12 +275,12 @@ if ($action == 'create')
|
||||
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
|
||||
print "</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -296,20 +298,10 @@ if ($action == 'create')
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
// View mode
|
||||
if ($id)
|
||||
{
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Card');
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
$head=vat_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
|
||||
|
||||
@ -317,7 +309,7 @@ if ($id)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr>";
|
||||
print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $object->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
@ -325,19 +317,19 @@ if ($id)
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">';
|
||||
print '<td>'.$langs->trans("DatePayment").'</td><td>';
|
||||
print dol_print_date($object->datep,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("DateValue", 'datev', $object->datev, $object, $user->rights->tax->charges->creer, 'day');
|
||||
print '</td><td colspan="3">';
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("DateValue", 'datev', $object->datev, $object, $user->rights->tax->charges->creer, 'day');
|
||||
//print dol_print_date($object->datev,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($object->amount).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
@ -348,7 +340,7 @@ if ($id)
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print $bankline->getNomUrl(1,0,'showall');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -356,14 +348,12 @@ if ($id)
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Action buttons
|
||||
*/
|
||||
|
||||
@ -671,4 +671,52 @@ class Tva extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Informations of vat payment object
|
||||
*
|
||||
* @param int $id Id of vat payment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.tms as datec, t.fk_user_creat";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
if ($obj->fk_user_creat) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_creat);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datec);
|
||||
$this->import_key = $obj->import_key;
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
64
htdocs/compta/tva/info.php
Normal file
64
htdocs/compta/tva/info.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/tva/info.php
|
||||
* \ingroup tax
|
||||
* \brief Page with info about vat
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$action=GETPOST("action");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$title=$langs->trans("VAT") . " - " . $langs->trans("Info");
|
||||
$help_url='';
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
$object = new Tva($db);
|
||||
$object->fetch($id);
|
||||
$object->info($id);
|
||||
|
||||
$head = vat_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("VATPayment"), 0, 'payment');
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -185,7 +185,7 @@ if ($result)
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -991,6 +991,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -1381,7 +1382,6 @@ else
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
@ -1395,7 +1395,7 @@ else
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
//echo '<br>';
|
||||
echo '<br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
@ -1990,8 +1990,8 @@ else
|
||||
|
||||
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
$langs->load("orders");
|
||||
if ($user->rights->commande->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -46,9 +46,7 @@ $result=restrictedArea($user,'contrat',$id);
|
||||
$object = new Contrat($db);
|
||||
|
||||
|
||||
/*
|
||||
* Ajout d'un nouveau contact
|
||||
*/
|
||||
// Add new contact
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
@ -91,7 +89,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer)
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
// Delete contact
|
||||
if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@ -134,37 +132,100 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Contract"), 0, 'contract');
|
||||
|
||||
/*
|
||||
* Contrat
|
||||
*/
|
||||
// Contract card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='';
|
||||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref.=$object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Ref supplier
|
||||
$morehtmlref.='<br>';
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
// Reference du contrat
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
print "</td></tr>";
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Customer")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
// Date
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">';
|
||||
print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,0);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,0,'datehourpicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
|
||||
@ -105,23 +105,81 @@ if ($object->id)
|
||||
}
|
||||
|
||||
|
||||
// Contract card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='';
|
||||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref.=$object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Ref supplier
|
||||
$morehtmlref.='<br>';
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Reference
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">'.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'</td></tr>';
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'contract';
|
||||
$permission = $user->rights->contrat->creer;
|
||||
$permtoedit = $user->rights->contrat->creer;
|
||||
|
||||
@ -40,20 +40,91 @@ $result = restrictedArea($user, 'contrat',$contratid,'');
|
||||
|
||||
llxHeader('',$langs->trans("Contract"),"");
|
||||
|
||||
$contrat = new Contrat($db);
|
||||
$contrat->fetch($contratid);
|
||||
$contrat->info($contratid);
|
||||
$object = new Contrat($db);
|
||||
$object->fetch($contratid);
|
||||
$object->fetch_thirdparty();
|
||||
$object->info($contratid);
|
||||
|
||||
$head = contract_prepare_head($contrat);
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Contract"), 0, 'contract');
|
||||
|
||||
|
||||
// Contract card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='';
|
||||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref.=$object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Ref supplier
|
||||
$morehtmlref.='<br>';
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($contrat);
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -488,7 +488,7 @@ if ($resql)
|
||||
}
|
||||
if (! empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -72,31 +72,98 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
dol_fiche_head($head, 'note', $langs->trans("Contract"), 0, 'contract');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Contract card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Reference
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="5">'.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'</td></tr>';
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
$morehtmlref='';
|
||||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref.=$object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Ref supplier
|
||||
$morehtmlref.='<br>';
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Ligne info remises tiers
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
||||
print '. ';
|
||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
|
||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||
print '.';
|
||||
print '</td></tr>';
|
||||
|
||||
// Date
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">';
|
||||
print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,0);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,0,'datehourpicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
@ -103,6 +103,7 @@ class box_comptes extends ModeleBoxes
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$account_static->id = $objp->rowid;
|
||||
$account_static->ref = $objp->ref;
|
||||
$account_static->label = $objp->label;
|
||||
$account_static->number = $objp->number;
|
||||
$solde=$account_static->solde(0);
|
||||
|
||||
@ -366,13 +366,13 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
|
||||
|
||||
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
|
||||
$array_key.'_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
|
||||
$array_key.'_total_vat_locale'=>(! empty($object->total_vat)?price($object->total_vat, 0, $outputlangs):price($object->total_tva, 0, $outputlangs)),
|
||||
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
|
||||
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||
$array_key.'_total_ht'=>price2num($object->total_ht),
|
||||
$array_key.'_total_vat'=>price2num($object->total_tva),
|
||||
$array_key.'_total_vat'=>(! empty($object->total_vat)?price2num($object->total_vat):price2num($object->total_tva)),
|
||||
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
|
||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||
|
||||
@ -1491,9 +1491,10 @@ abstract class CommonObject
|
||||
* Change the multicurrency rate
|
||||
*
|
||||
* @param double $rate multicurrency rate
|
||||
* @param int $mode mode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setMulticurrencyRate($rate)
|
||||
function setMulticurrencyRate($rate, $mode=1)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setMulticurrencyRate('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
@ -1513,21 +1514,28 @@ abstract class CommonObject
|
||||
{
|
||||
foreach ($this->lines as &$line)
|
||||
{
|
||||
if($mode == 1) {
|
||||
$line->subprice = 0;
|
||||
}
|
||||
|
||||
switch ($this->element) {
|
||||
case 'propal':
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit);
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'commande':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit);
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'facture':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'supplier_proposal':
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn);
|
||||
$this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->ref_fourn, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'order_supplier':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit);
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
case 'invoice_supplier':
|
||||
$this->updateline($line->id, $line->desc, $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
|
||||
break;
|
||||
default:
|
||||
dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG);
|
||||
@ -3307,7 +3315,7 @@ abstract class CommonObject
|
||||
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency').'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
|
||||
|
||||
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
|
||||
|
||||
@ -3343,7 +3351,7 @@ abstract class CommonObject
|
||||
print '<td class="linecolht" align="right">'.$langs->trans('TotalHTShort').'</td>';
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency').'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
|
||||
|
||||
if ($outputalsopricetotalwithtax) print '<td align="right" width="80">'.$langs->trans('TotalTTCShort').'</td>';
|
||||
|
||||
|
||||
@ -3956,7 +3956,11 @@ class Form
|
||||
print '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setmulticurrencyrate">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="text" name="'.$htmlname.'" value="'.(!empty($rate) ? price($rate) : 1).'" size="10" />';
|
||||
print '<input type="text" name="'.$htmlname.'" value="'.(!empty($rate) ? price($rate) : 1).'" size="10" /> ';
|
||||
print '<select name="calculation_mode">';
|
||||
print '<option value="1">'.$currency.' > '.$conf->currency.'</option>';
|
||||
print '<option value="2">'.$conf->currency.' > '.$currency.'</option>';
|
||||
print '</select> ';
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
}
|
||||
@ -4231,6 +4235,10 @@ class Form
|
||||
}
|
||||
|
||||
$out.= '</select>';
|
||||
// Make select dynamic
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($htmlname);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -5188,7 +5196,7 @@ class Form
|
||||
</a>
|
||||
<input type="hidden" class="'.$htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
|
||||
</dt>
|
||||
<dd>
|
||||
<dd class="dropowndd">
|
||||
<div class="multiselectcheckbox'.$htmlname.'">
|
||||
<ul class="ul'.$htmlname.'">
|
||||
'.$lis.'
|
||||
@ -5997,9 +6005,10 @@ class Form
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$out='';
|
||||
$out='<div class="nowrap">';
|
||||
$out.='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
$out.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
$out.='</div>';
|
||||
if ($addcheckuncheckall)
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax)) $out.='<input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions">';
|
||||
|
||||
@ -805,7 +805,7 @@ class FormFile
|
||||
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight').'</a></dt>
|
||||
<dd><div class="multichoicedoc"><ul class="ulselectedfields" style="display: none;">';
|
||||
$tmpout='';
|
||||
|
||||
|
||||
// Loop on each file found
|
||||
foreach($file_list as $file)
|
||||
{
|
||||
@ -828,7 +828,7 @@ class FormFile
|
||||
$ext=pathinfo($file["name"], PATHINFO_EXTENSION);
|
||||
if (empty($this->infofiles[$ext])) $this->infofiles['extensions'][$ext]=1;
|
||||
else $this->infofiles['extensions'][$ext]++;
|
||||
|
||||
|
||||
// Preview
|
||||
$urladvanced = getAdvancedPreviewUrl($modulepart, $relativepath);
|
||||
if ($urladvanced) $tmpout.= '<li><a data-ajax="false" href="'.$urladvanced.'">'.img_picto('','detail').' '.$langs->trans("Preview").' '.$ext.'</a></li>';
|
||||
@ -838,9 +838,8 @@ class FormFile
|
||||
if (preg_match('/text/',$mime)) $tmpout.= ' target="_blank"';
|
||||
$tmpout.= '>';
|
||||
$tmpout.=img_mime($relativepath, $file["name"]).' ';
|
||||
$tmpout.= $langs->trans("Download ".$ext);
|
||||
$tmpout.= $langs->trans("Download").' '.$ext;
|
||||
$tmpout.= '</a></li>'."\n";
|
||||
|
||||
}
|
||||
$out.=$tmpout;
|
||||
$out.='</ul></div></dd>
|
||||
|
||||
@ -42,9 +42,11 @@ if ($resql) // This can fail when class is used on old database (during migra
|
||||
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
|
||||
break;
|
||||
}
|
||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
||||
$this->export_entities_array[$r][$fieldname]=$keyforelement;
|
||||
if ($obj->type!='separate') {
|
||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
||||
$this->export_entities_array[$r][$fieldname]=$keyforelement;
|
||||
}
|
||||
}
|
||||
}
|
||||
// End add axtra fields
|
||||
|
||||
@ -135,6 +135,8 @@ function societe_prepare_head(Societe $object)
|
||||
// Bank accounrs
|
||||
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
|
||||
{
|
||||
$langs->load("banks");
|
||||
|
||||
$nbBankAccount=0;
|
||||
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("BankAccounts");
|
||||
|
||||
@ -45,16 +45,16 @@ function emailing_prepare_head(Mailing $object)
|
||||
$head[$h][1] = $langs->trans("MailRecipients");
|
||||
if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
|
||||
$head[$h][2] = 'targets';
|
||||
|
||||
$h++;
|
||||
|
||||
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
||||
$head[$h][2] = 'advtargets';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
||||
$head[$h][2] = 'advtargets';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
|
||||
|
||||
@ -72,8 +72,25 @@ function fichinter_prepare_head($object)
|
||||
// Tab to link resources
|
||||
if ($conf->resource->enabled)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
|
||||
$nbResource = 0;
|
||||
$objectres=new Dolresource($db);
|
||||
if (is_array($objectres->available_resources))
|
||||
{
|
||||
foreach ($objectres->available_resources as $modresources => $resources)
|
||||
{
|
||||
$resources=(array) $resources; // To be sure $resources is an array
|
||||
foreach($resources as $resource_obj)
|
||||
{
|
||||
$linked_resources = $object->getElementResources('fichinter',$object->id,$resource_obj);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Resources");
|
||||
if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>';
|
||||
$head[$h][2] = 'resource';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
@ -1788,7 +1788,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les produits et services
|
||||
else if ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service')
|
||||
else if ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service')
|
||||
{
|
||||
if (($fuser->rights->produit->lire || $fuser->rights->service->lire) || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
|
||||
@ -228,14 +228,14 @@ function dol_print_object_info($object, $usetable=0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_creation))
|
||||
{
|
||||
if ($object->user_creation->id) print $object->user_creation->getNomUrl(1);
|
||||
if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@ -264,14 +264,14 @@ function dol_print_object_info($object, $usetable=0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_modification))
|
||||
{
|
||||
if ($object->user_modification->id) print $object->user_modification->getNomUrl(1);
|
||||
if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@ -300,14 +300,14 @@ function dol_print_object_info($object, $usetable=0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_validation))
|
||||
{
|
||||
if ($object->user_validation->id) print $object->user_validation->getNomUrl(1);
|
||||
if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@ -336,14 +336,14 @@ function dol_print_object_info($object, $usetable=0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_approve))
|
||||
{
|
||||
if ($object->user_approve->id) print $object->user_approve->getNomUrl(1);
|
||||
if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@ -372,7 +372,7 @@ function dol_print_object_info($object, $usetable=0)
|
||||
else print ': ';
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_approve_id2);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
if ($usetable) print '</td></tr>';
|
||||
else print '<br>';
|
||||
@ -400,14 +400,14 @@ function dol_print_object_info($object, $usetable=0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_cloture))
|
||||
{
|
||||
if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1);
|
||||
if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_cloture);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
@ -436,14 +436,14 @@ function dol_print_object_info($object, $usetable=0)
|
||||
else print ': ';
|
||||
if (is_object($object->user_rappro))
|
||||
{
|
||||
if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1);
|
||||
if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$userstatic->fetch($object->user_rappro);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0);
|
||||
else print $langs->trans("Unknown");
|
||||
}
|
||||
if ($usetable) print '</td></tr>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -41,16 +41,6 @@ function loan_prepare_head($object)
|
||||
$head[$tab][2] = 'card';
|
||||
$tab++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1);
|
||||
$head[$tab][0] = DOL_URL_ROOT."/loan/note.php?id=".$object->id;
|
||||
$head[$tab][1] = $langs->trans("Notes");
|
||||
if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$tab][2] = 'note';
|
||||
$tab++;
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
@ -68,6 +58,16 @@ function loan_prepare_head($object)
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1);
|
||||
$head[$tab][0] = DOL_URL_ROOT."/loan/note.php?id=".$object->id;
|
||||
$head[$tab][1] = $langs->trans("Notes");
|
||||
if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||
$head[$tab][2] = 'note';
|
||||
$tab++;
|
||||
}
|
||||
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Info");
|
||||
$head[$tab][2] = 'info';
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
* @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
|
||||
* @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
|
||||
* @param double $multicurrency_tx Currency rate (1 by default)
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @return array [
|
||||
* 0=total_ht,
|
||||
* 1=total_vat, (main vat only)
|
||||
@ -70,8 +71,9 @@
|
||||
* 16=multicurrency_total_ht
|
||||
* 17=multicurrency_total_tva
|
||||
* 18=multicurrency_total_ttc
|
||||
* 19=multicurrency_pu_ht
|
||||
*/
|
||||
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1)
|
||||
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array='', $progress=100, $multicurrency_tx=1, $pu_ht_devise=0)
|
||||
{
|
||||
global $conf,$mysoc,$db;
|
||||
|
||||
@ -140,6 +142,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
|
||||
// pu calculation from pu_devise if pu empty
|
||||
if(empty($pu) && !empty($pu_ht_devise)) {
|
||||
$pu = $pu_ht_devise / $multicurrency_tx;
|
||||
} else {
|
||||
$pu_ht_devise = $pu * $multicurrency_tx;
|
||||
}
|
||||
|
||||
// initialize total (may be HT or TTC depending on price_base_type)
|
||||
$tot_sans_remise = $pu * $qty * $progress / 100;
|
||||
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100));
|
||||
@ -332,6 +342,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$result[16] = price2num($result[0] * $multicurrency_tx, 'MT');
|
||||
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT');
|
||||
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT');
|
||||
$result[19] = price2num($pu_ht_devise, 'MU');
|
||||
|
||||
// initialize result array
|
||||
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
|
||||
|
||||
@ -35,7 +35,7 @@ function stock_prepare_head($object)
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("WarehouseCard");
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
|
||||
57
htdocs/core/lib/vat.lib.php
Normal file
57
htdocs/core/lib/vat.lib.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.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/core/lib/vat.lib.php
|
||||
* \ingroup tax
|
||||
* \brief Library for tax module (VAT)
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function vat_prepare_head($object)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$tab = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans('Card');
|
||||
$head[$tab][2] = 'card';
|
||||
$tab++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab,'vat');
|
||||
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/info.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Info");
|
||||
$head[$tab][2] = 'info';
|
||||
$tab++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$tab,'vat','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@ -100,7 +100,7 @@ class modExpenseReport extends DolibarrModules
|
||||
$this->rights[1][0] = 771;
|
||||
$this->rights[1][1] = 'Read expense reports (yours and your subordinates)';
|
||||
$this->rights[1][2] = 'r';
|
||||
$this->rights[1][3] = 1;
|
||||
$this->rights[1][3] = 0;
|
||||
$this->rights[1][4] = 'lire';
|
||||
|
||||
$this->rights[3][0] = 772;
|
||||
|
||||
@ -113,7 +113,7 @@ class modHoliday extends DolibarrModules
|
||||
// 'group' to add a tab in group view
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
$this->tabs = array('user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=holiday&id=__ID__');
|
||||
$this->tabs = array('user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=hrm&id=__ID__');
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(); // List of boxes
|
||||
|
||||
@ -85,7 +85,7 @@ class modStock extends DolibarrModules
|
||||
$this->rights[0][0] = 1001;
|
||||
$this->rights[0][1] = 'Lire les stocks';
|
||||
$this->rights[0][2] = 'r';
|
||||
$this->rights[0][3] = 1;
|
||||
$this->rights[0][3] = 0;
|
||||
$this->rights[0][4] = 'lire';
|
||||
$this->rights[0][5] = '';
|
||||
|
||||
@ -106,7 +106,7 @@ class modStock extends DolibarrModules
|
||||
$this->rights[3][0] = 1004;
|
||||
$this->rights[3][1] = 'Lire mouvements de stocks';
|
||||
$this->rights[3][2] = 'r';
|
||||
$this->rights[3][3] = 1;
|
||||
$this->rights[3][3] = 0;
|
||||
$this->rights[3][4] = 'mouvement';
|
||||
$this->rights[3][5] = 'lire';
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Meos
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -105,7 +106,7 @@ elseif ($modulepart == 'holiday')
|
||||
|
||||
if (empty($backtourl))
|
||||
{
|
||||
if (in_array($modulepart, array('product','produit','service'))) $backtourl=DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
if (in_array($modulepart, array('product','produit','service','produit|service'))) $backtourl=DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
|
||||
}
|
||||
|
||||
@ -698,6 +698,7 @@ function setforfree() {
|
||||
jQuery("#prod_entry_mode_free").prop('checked',true);
|
||||
jQuery("#prod_entry_mode_predef").prop('checked',false);
|
||||
jQuery("#price_ht").show();
|
||||
jQuery("#multicurrency_price_ht").show();
|
||||
jQuery("#price_ttc").show(); // May no exists
|
||||
jQuery("#tva_tx").show();
|
||||
jQuery("#buying_price").val('').show();
|
||||
@ -717,6 +718,7 @@ function setforpredef() {
|
||||
jQuery("#prod_entry_mode_free").prop('checked',false);
|
||||
jQuery("#prod_entry_mode_predef").prop('checked',true);
|
||||
jQuery("#price_ht").hide();
|
||||
jQuery("#multicurrency_price_ht").hide();
|
||||
jQuery("#price_ttc").hide(); // May no exists
|
||||
jQuery("#tva_tx").hide();
|
||||
jQuery("#buying_price").show();
|
||||
|
||||
@ -122,6 +122,7 @@ $coldisplay=-1; // We remove first td
|
||||
print '></td>';
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$colspan++;
|
||||
print '<td align="right"><input rel="'.$object->multicurrency_tx.'" type="text" class="flat" size="8" id="multicurrency_subprice" name="multicurrency_subprice" value="'.price($line->multicurrency_subprice).'" /></td>';
|
||||
}
|
||||
|
||||
@ -259,12 +260,25 @@ jQuery(document).ready(function()
|
||||
{
|
||||
jQuery("#price_ht").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') jQuery("#price_ttc").val('');
|
||||
});
|
||||
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
|
||||
jQuery("#price_ttc").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
});
|
||||
jQuery("#price_ttc").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') jQuery("#price_ht").val('');
|
||||
});
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#multicurrency_subprice").val('');
|
||||
}
|
||||
});
|
||||
jQuery("#multicurrency_subprice").keyup(function(event) {
|
||||
// console.log(event.which); // discard event tag and arrows
|
||||
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
|
||||
jQuery("#price_ht").val('');
|
||||
jQuery("#price_ttc").val('');
|
||||
}
|
||||
});
|
||||
|
||||
<?php
|
||||
if (! empty($conf->margin->enabled))
|
||||
|
||||
@ -313,20 +313,20 @@ print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_label" value="'.$search_label.'" size="10">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectarray('status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Enabled"), '-2'=>$langs->trans("EnabledAndDisabled"), '2'=>$langs->trans("Archived")), $status, 1);
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
|
||||
@ -494,12 +494,13 @@ if ($action == 'delete_section')
|
||||
|
||||
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
|
||||
{
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<table width="100%" class="nobordernopadding">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left" colspan="6">';
|
||||
print '<!-- Title for manual directories -->'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<th class="liste_titre" align="left" colspan="6">';
|
||||
print ' '.$langs->trans("ECMSections");
|
||||
print '</td></tr>';
|
||||
print '</th></tr>';
|
||||
|
||||
$showonrightsize='';
|
||||
|
||||
|
||||
@ -480,12 +480,13 @@ if ($action == 'delete_section')
|
||||
|
||||
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
|
||||
{
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<table width="100%" class="nobordernopadding">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left" colspan="6">';
|
||||
print '<!-- Title for auto directories -->'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<th class="liste_titre" align="left" colspan="6">';
|
||||
print ' '.$langs->trans("ECMSections");
|
||||
print '</td></tr>';
|
||||
print '</th></tr>';
|
||||
|
||||
$showonrightsize='';
|
||||
// Auto section
|
||||
|
||||
@ -1427,26 +1427,6 @@ else
|
||||
// Other attributes
|
||||
//$cols = 3;
|
||||
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td valign="top">';
|
||||
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->societe_id)) {
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
|
||||
print '<td valign="top">';
|
||||
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -1624,14 +1604,6 @@ else
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td>'.$object->note_public.'</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td>'.$object->note_private.'</td>';
|
||||
print '</tr>';
|
||||
// Amount
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountHT").'</td>';
|
||||
@ -2280,7 +2252,7 @@ print '<div class="fichehalfleft">';
|
||||
* Generate documents
|
||||
*/
|
||||
|
||||
if($user->rights->expensereport->export && $action != 'edit')
|
||||
if($user->rights->expensereport->export && $action != 'create' && $action != 'edit')
|
||||
{
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
|
||||
@ -1194,16 +1194,16 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->load("interventions");
|
||||
$langs->load("sendings");
|
||||
@ -105,6 +107,7 @@ $form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
$userstatic=new User($db);
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
llxHeader('',$langs->trans("Intervention"));
|
||||
|
||||
@ -112,43 +115,74 @@ llxHeader('',$langs->trans("Intervention"));
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = fichinter_prepare_head($object);
|
||||
dol_fiche_head($head, 'contact', $langs->trans("InterventionCard"), 0, 'intervention');
|
||||
|
||||
|
||||
/*
|
||||
* Fiche intervention synthese pour rappel
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Intervention card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print "</td></tr>";
|
||||
|
||||
// Customer
|
||||
if ( is_null($object->thirdparty) )
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, 0, 0, '', '', 1);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_USER)) $hideaddcontactforuser=1;
|
||||
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_THIPARTY)) $hideaddcontactforthirdparty=1;
|
||||
|
||||
// Contacts lines
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
|
||||
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
{
|
||||
$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
|
||||
if ($res) break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -101,24 +101,66 @@ if ($object->id)
|
||||
}
|
||||
|
||||
|
||||
// Intervention card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Societe
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$object->thirdparty->getNomUrl(1)."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'ficheinter';
|
||||
$permission = $user->rights->ficheinter->creer;
|
||||
$permtoedit = $user->rights->ficheinter->creer;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -31,7 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
|
||||
$langs->load('companies');
|
||||
$langs->load("interventions");
|
||||
|
||||
$socid=0;
|
||||
$id = GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
@ -39,9 +41,10 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
|
||||
|
||||
$object = new Fichinter($db);
|
||||
|
||||
if ($id > 0)
|
||||
if (! $object->fetch($id, $ref) > 0)
|
||||
{
|
||||
$object->fetch($id);
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -51,13 +54,63 @@ if ($id > 0)
|
||||
|
||||
llxHeader('',$langs->trans("Intervention"));
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($object->socid);
|
||||
$object->fetch_thirdparty();
|
||||
$object->info($object->id);
|
||||
|
||||
$head = fichinter_prepare_head($object);
|
||||
dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), 0, 'intervention');
|
||||
|
||||
$object->info($object->id);
|
||||
// Intervention card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
@ -65,5 +118,7 @@ print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -60,31 +60,67 @@ $form = new Form($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
if ($societe->fetch($object->socid))
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = fichinter_prepare_head($object);
|
||||
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
|
||||
|
||||
// Intervention card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$head = fichinter_prepare_head($object);
|
||||
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td>';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans('Company').'</td><td>'.$societe->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
$cssclass="titlefield";
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -28,20 +28,24 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("interventions");
|
||||
|
||||
$ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
$ilink++;
|
||||
$var=!$var;
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $langs->trans("Intervention"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->datev,'day'); ?></td>
|
||||
<td></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Intervention"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->datev,'day'); ?></td>
|
||||
<td></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
@ -1333,9 +1333,10 @@ class CommandeFournisseur extends CommonOrder
|
||||
* @param int $date_end Date end of service
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $pu_ht_devise Amount in currency
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
public 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, $fk_unit=null)
|
||||
public 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, $fk_unit=null, $pu_ht_devise=0)
|
||||
{
|
||||
global $langs,$mysoc,$conf;
|
||||
|
||||
@ -1441,17 +1442,19 @@ class CommandeFournisseur extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx,$pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
$localtax1_type=$localtaxes_type[0];
|
||||
$localtax2_type=$localtaxes_type[2];
|
||||
@ -1498,12 +1501,12 @@ class CommandeFournisseur extends CommonOrder
|
||||
// Multicurrency
|
||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||
$this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
|
||||
$this->line->subprice=$pu;
|
||||
$this->line->subprice=$pu_ht;
|
||||
$this->line->price=$this->line->subprice;
|
||||
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
@ -2247,9 +2250,10 @@ class CommandeFournisseur extends CommonOrder
|
||||
* @param timestamp $date_end Date end of service
|
||||
* @param array $array_options Extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @return int < 0 if error, > 0 if ok
|
||||
*/
|
||||
public 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, $fk_unit=null)
|
||||
public 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, $fk_unit=null, $pu_ht_devise = 0)
|
||||
{
|
||||
global $mysoc, $conf;
|
||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");
|
||||
@ -2296,22 +2300,26 @@ class CommandeFournisseur extends CommonOrder
|
||||
$vatrate = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
$pu_tva = $tabprice[4];
|
||||
$pu_ttc = $tabprice[5];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
$localtax1_type=$localtaxes_type[0];
|
||||
$localtax2_type=$localtaxes_type[2];
|
||||
|
||||
$subprice = price2num($pu,'MU');
|
||||
$subprice = price2num($pu_ht,'MU');
|
||||
|
||||
$this->line=new CommandeFournisseurLigne($this->db);
|
||||
$this->line->fetch($rowid);
|
||||
@ -2330,7 +2338,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
$this->line->remise_percent = $remise_percent;
|
||||
$this->line->subprice = $pu;
|
||||
$this->line->subprice = $pu_ht;
|
||||
$this->line->rang = $this->rang;
|
||||
$this->line->info_bits = $info_bits;
|
||||
$this->line->total_ht = $total_ht;
|
||||
@ -2349,12 +2357,12 @@ class CommandeFournisseur extends CommonOrder
|
||||
// Multicurrency
|
||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||
$this->line->multicurrency_subprice = price2num($pu_ht * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
|
||||
$this->line->subprice=$pu;
|
||||
$this->line->subprice=$pu_ht;
|
||||
$this->line->price=$this->line->subprice;
|
||||
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
@ -2367,9 +2375,11 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
|
||||
// Mise a jour info denormalisees au niveau facture
|
||||
if (! $error)
|
||||
if ($result >= 0)
|
||||
{
|
||||
$this->update_price('','auto');
|
||||
$this->db->commit();
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3087,10 +3097,10 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$sql.= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'":"null");
|
||||
$sql.= ", ".($this->fk_multicurrency ? $this->fk_multicurrency : "null");
|
||||
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||
$sql.= ", ".price2num($this->pu_ht * $this->multicurrency_tx);
|
||||
$sql.= ", ".$this->multicurrency_total_ht;
|
||||
$sql.= ", ".$this->multicurrency_total_tva;
|
||||
$sql.= ", ".$this->multicurrency_total_ttc;
|
||||
$sql.= ", ".price2num($this->multicurrency_subprice);
|
||||
$sql.= ", ".price2num($this->multicurrency_total_ht);
|
||||
$sql.= ", ".price2num($this->multicurrency_total_tva);
|
||||
$sql.= ", ".price2num($this->multicurrency_total_ttc);
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
@ -3176,7 +3186,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$sql.= ($this->fk_unit ? ", fk_unit='".$this->db->escape($this->fk_unit)."'":", fk_unit=null");
|
||||
|
||||
// Multicurrency
|
||||
$sql.= ", multicurrency_subprice=".price2num($this->subprice * $this->multicurrency_tx)."";
|
||||
$sql.= ", multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
|
||||
$sql.= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
|
||||
$sql.= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
|
||||
$sql.= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
|
||||
|
||||
@ -1310,11 +1310,12 @@ class FactureFournisseur extends CommonInvoice
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param int $origin_id id origin document
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @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.
|
||||
*/
|
||||
public 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, $fk_unit=null, $origin_id=0)
|
||||
public 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, $fk_unit=null, $origin_id=0, $pu_ht_devise=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,$fk_unit", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
@ -1347,17 +1348,19 @@ class FactureFournisseur extends CommonInvoice
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
$total_localtax1 = $tabprice[9];
|
||||
$total_localtax2 = $tabprice[10];
|
||||
$pu_ht = $tabprice[3];
|
||||
|
||||
// MultiCurrency
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
@ -1379,7 +1382,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->line->fk_product=$fk_product;
|
||||
$this->line->product_type=$type;
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu):$pu); // For credit note, unit price always negative, always positive otherwise
|
||||
$this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
|
||||
$this->line->date_start=$date_start;
|
||||
$this->line->date_end=$date_end;
|
||||
$this->line->ventil=$ventil;
|
||||
@ -1401,7 +1404,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
// Multicurrency
|
||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
||||
$this->line->multicurrency_subprice = price2num($this->line->subprice * $this->multicurrency_tx);
|
||||
$this->line->multicurrency_subprice = $pu_ht_devise;
|
||||
$this->line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
@ -1458,9 +1461,10 @@ class FactureFournisseur extends CommonInvoice
|
||||
* @param timestamp $date_end Date end of service
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param double $pu_ht_devise Amount in currency
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public 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, $fk_unit = null)
|
||||
public 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, $fk_unit = null, $pu_ht_devise=0)
|
||||
{
|
||||
global $mysoc;
|
||||
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$fk_unit", LOG_DEBUG);
|
||||
@ -1469,9 +1473,10 @@ class FactureFournisseur extends CommonInvoice
|
||||
$pu = price2num($pu);
|
||||
$qty = price2num($qty);
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
|
||||
// Check parameters
|
||||
if (! is_numeric($pu) || ! is_numeric($qty)) return -1;
|
||||
//if (! is_numeric($pu) || ! is_numeric($qty)) return -1;
|
||||
if ($type < 0) return -1;
|
||||
|
||||
// Clean parameters
|
||||
@ -1499,7 +1504,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -1513,6 +1518,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$multicurrency_total_ht = $tabprice[16];
|
||||
$multicurrency_total_tva = $tabprice[17];
|
||||
$multicurrency_total_ttc = $tabprice[18];
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
|
||||
@ -1558,7 +1564,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$line->array_options = $array_options;
|
||||
|
||||
// Multicurrency
|
||||
$line->multicurrency_subprice = price2num($line->subprice * $this->multicurrency_tx);
|
||||
$line->multicurrency_subprice = $pu_ht_devise;
|
||||
$line->multicurrency_total_ht = $multicurrency_total_ht;
|
||||
$line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||
$line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||
@ -2493,9 +2499,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
$qty = price2num($this->qty);
|
||||
|
||||
// Check parameters
|
||||
if (! is_numeric($pu) || ! is_numeric($qty)) {
|
||||
return -1;
|
||||
}
|
||||
if (empty($this->qty)) $this->qty=0;
|
||||
|
||||
if ($this->product_type < 0) {
|
||||
return -1;
|
||||
|
||||
@ -299,6 +299,7 @@ if (empty($reshook))
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$remise_percent=GETPOST('remise_percent'.$predef);
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
@ -322,7 +323,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='') // Unit price can be 0 but not ''
|
||||
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise === '') // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors');
|
||||
$error++;
|
||||
@ -410,7 +411,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors');
|
||||
}
|
||||
}
|
||||
else if ((GETPOST('price_ht')!=='' || GETPOST('price_ttc')!=='') && empty($error))
|
||||
else if (empty($error))
|
||||
{
|
||||
$pu_ht = price2num($price_ht, 'MU');
|
||||
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
||||
@ -440,8 +441,10 @@ if (empty($reshook))
|
||||
$ht = $ttc / (1 + ($tva_tx / 100));
|
||||
$price_base_type = 'HT';
|
||||
}
|
||||
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
|
||||
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit);
|
||||
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise);
|
||||
}
|
||||
|
||||
//print "xx".$tva_tx; exit;
|
||||
@ -540,6 +543,8 @@ if (empty($reshook))
|
||||
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$mysoc,$object->thirdparty);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$mysoc,$object->thirdparty);
|
||||
|
||||
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||
|
||||
// Extrafields Lines
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
@ -568,7 +573,8 @@ if (empty($reshook))
|
||||
$date_start,
|
||||
$date_end,
|
||||
$array_options,
|
||||
$_POST['units']
|
||||
$_POST['units'],
|
||||
$pu_ht_devise
|
||||
);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['type']);
|
||||
@ -1401,7 +1407,7 @@ if ($action=='create')
|
||||
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
||||
$mode_reglement_id = $societe->mode_reglement_supplier_id;
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code;
|
||||
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private');
|
||||
$note_public = $object->getDefaultCreateValueFor('note_public');
|
||||
@ -1594,6 +1600,8 @@ if ($action=='create')
|
||||
}
|
||||
elseif (! empty($object->id))
|
||||
{
|
||||
$result = $object->fetch($id, $ref);
|
||||
|
||||
$societe = new Fournisseur($db);
|
||||
$result=$societe->fetch($object->socid);
|
||||
if ($result < 0) dol_print_error($db);
|
||||
@ -1813,7 +1821,7 @@ elseif (! empty($object->id))
|
||||
|
||||
// Author
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AuthorRequest").'</td>';
|
||||
print '<td>'.$author->getNomUrl(1).'</td>';
|
||||
print '<td>'.$author->getNomUrl(1, '', 0, 0, 0).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Conditions de reglement par defaut
|
||||
@ -1885,10 +1893,18 @@ elseif (! empty($object->id))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == 0) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2672,15 +2688,13 @@ elseif (! empty($object->id))
|
||||
|
||||
if ($user->rights->fournisseur->commande->commander && $object->statut == 2)
|
||||
{
|
||||
/*
|
||||
* Commander (action=commande)
|
||||
*/
|
||||
// Set status to ordered (action=commande)
|
||||
print '<!-- form to record supplier order -->'."\n";
|
||||
print '<form name="commande" action="card.php?id='.$object->id.'&action=commande" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="commande">';
|
||||
print load_fiche_titre($langs->trans("ToOrder"),'','');
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ToOrder").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
|
||||
$date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
@ -2700,15 +2714,14 @@ elseif (! empty($object->id))
|
||||
|
||||
if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4))
|
||||
{
|
||||
/*
|
||||
* Receptionner (action=livraison)
|
||||
*/
|
||||
// Set status to received (action=livraison)
|
||||
print '<!-- form to record supplier order received -->'."\n";
|
||||
print '<form action="card.php?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="livraison">';
|
||||
print load_fiche_titre($langs->trans("Receive"),'','');
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
||||
print $form->select_date('','',1,1,'',"commande",1,0,1);
|
||||
|
||||
@ -133,39 +133,61 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($object->fetch($id, $ref) > 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = ordersupplier_prepare_head($object);
|
||||
dol_fiche_head($head, 'contact', $langs->trans("SupplierOrder"), 0, 'order');
|
||||
|
||||
|
||||
/*
|
||||
* Facture synthese pour rappel
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Supplier order card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Supplier
|
||||
print '<tr><td>'.$langs->trans("Supplier")."</td>";
|
||||
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// Contacts lines
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -65,16 +65,16 @@ $projectid = 0;
|
||||
if ($_GET["projectid"])
|
||||
$projectid = GETPOST("projectid", 'int');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$object = new CommandeFournisseur($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$result = $commande->fetch($id, $ref);
|
||||
$result = $object->fetch($id, $ref);
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$result = $commande->fetch_thirdparty();
|
||||
$result = $object->fetch_thirdparty();
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,9 +94,9 @@ if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED
|
||||
$error ++;
|
||||
$action = '';
|
||||
} else {
|
||||
$result = $commande->calcAndSetStatusDispatch($user);
|
||||
$result = $object->calcAndSetStatusDispatch($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
$action = '';
|
||||
}
|
||||
@ -114,9 +114,9 @@ if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANC
|
||||
$error ++;
|
||||
$action = '';
|
||||
} else {
|
||||
$result = $commande->calcAndSetStatusDispatch($user);
|
||||
$result = $object->calcAndSetStatusDispatch($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
$action = '';
|
||||
}
|
||||
@ -134,9 +134,9 @@ if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_
|
||||
$error ++;
|
||||
$action = '';
|
||||
} else {
|
||||
$result = $commande->calcAndSetStatusDispatch($user);
|
||||
$result = $object->calcAndSetStatusDispatch($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
$action = '';
|
||||
}
|
||||
@ -174,9 +174,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$result = $commande->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger);
|
||||
$result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger);
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -218,9 +218,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$result = $commande->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger);
|
||||
$result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger);
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -229,9 +229,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$result = $commande->calcAndSetStatusDispatch($user, GETPOST('closeopenorder')?1:0);
|
||||
$result = $object->calcAndSetStatusDispatch($user, GETPOST('closeopenorder')?1:0);
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -240,11 +240,11 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
||||
global $conf, $langs, $user;
|
||||
// Call trigger
|
||||
|
||||
$result = $commande->call_trigger('ORDER_SUPPLIER_DISPATCH', $user);
|
||||
$result = $object->call_trigger('ORDER_SUPPLIER_DISPATCH', $user);
|
||||
// End call triggers
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
@ -275,25 +275,75 @@ llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_
|
||||
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->socid);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($commande->user_author_id);
|
||||
$author->fetch($object->user_author_id);
|
||||
|
||||
$head = ordersupplier_prepare_head($commande);
|
||||
$head = ordersupplier_prepare_head($object);
|
||||
|
||||
$title = $langs->trans("SupplierOrder");
|
||||
dol_fiche_head($head, 'dispatch', $title, 0, 'order');
|
||||
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Supplier order card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
/*
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($commande, 'ref', '', 1, 'ref', 'ref');
|
||||
print $form->showrefnav($object, 'ref', '', 1, 'ref', 'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -306,29 +356,31 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Status") . '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $commande->getLibStatut(4);
|
||||
print $object->getLibStatut(4);
|
||||
print "</td></tr>";
|
||||
|
||||
*/
|
||||
// Date
|
||||
if ($commande->methode_commande_id > 0) {
|
||||
print '<tr><td>' . $langs->trans("Date") . '</td><td colspan="2">';
|
||||
if ($commande->date_commande) {
|
||||
print dol_print_date($commande->date_commande, "dayhourtext") . "\n";
|
||||
if ($object->methode_commande_id > 0) {
|
||||
print '<tr><td class="titlefield">' . $langs->trans("Date") . '</td><td>';
|
||||
if ($object->date_commande) {
|
||||
print dol_print_date($object->date_commande, "dayhourtext") . "\n";
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
if ($commande->methode_commande) {
|
||||
print '<tr><td>' . $langs->trans("Method") . '</td><td colspan="2">' . $commande->methode_commande . '</td></tr>';
|
||||
if ($object->methode_commande) {
|
||||
print '<tr><td>' . $langs->trans("Method") . '</td><td>' . $object->methode_commande . '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Auteur
|
||||
print '<tr><td>' . $langs->trans("AuthorRequest") . '</td>';
|
||||
print '<td colspan="2">' . $author->getNomUrl(1) . '</td>';
|
||||
print '<td>' . $author->getNomUrl(1, '', 0, 0, 0) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
// if ($mesg) print $mesg;
|
||||
print '<br>';
|
||||
|
||||
@ -336,20 +388,20 @@ if ($id > 0 || ! empty($ref)) {
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
|
||||
$disabled = 0;
|
||||
|
||||
/*
|
||||
* Lignes de commandes
|
||||
*/
|
||||
if ($commande->statut <= 2 || $commande->statut >= 6) {
|
||||
// Line of orders
|
||||
if ($object->statut <= 2 || $object->statut >= 6) {
|
||||
print $langs->trans("OrderStatusNotReadyToDispatch");
|
||||
}
|
||||
|
||||
if ($commande->statut == 3 || $commande->statut == 4 || $commande->statut == 5) {
|
||||
if ($object->statut == 3 || $object->statut == 4 || $object->statut == 5) {
|
||||
$entrepot = new Entrepot($db);
|
||||
$listwarehouses = $entrepot->list_array(1);
|
||||
|
||||
print '<form method="POST" action="dispatch.php?id=' . $commande->id . '">';
|
||||
print '<form method="POST" action="dispatch.php?id=' . $object->id . '">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="dispatch">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Set $products_dispatched with qty dispatched for each product id
|
||||
@ -357,7 +409,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet";
|
||||
$sql .= " WHERE cfd.fk_commande = " . $commande->id;
|
||||
$sql .= " WHERE cfd.fk_commande = " . $object->id;
|
||||
$sql .= " GROUP BY l.rowid, cfd.fk_product";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -369,7 +421,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
while ( $i < $num ) {
|
||||
$objd = $db->fetch_object($resql);
|
||||
$products_dispatched[$objd->rowid] = price2num($objd->qty, 5);
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
@ -379,7 +431,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$sql .= " p.ref, p.label, p.tobatch";
|
||||
$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 .= " WHERE l.fk_commande = " . $commande->id;
|
||||
$sql .= " WHERE l.fk_commande = " . $object->id;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
$sql .= " AND l.product_type = 0";
|
||||
$sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
|
||||
@ -414,8 +466,9 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
}
|
||||
|
||||
$nbfreeproduct = 0;
|
||||
$nbproduct = 0;
|
||||
$nbfreeproduct = 0; // Nb of lins of free products/services
|
||||
$nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default)
|
||||
// or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on.
|
||||
|
||||
$var = false;
|
||||
while ( $i < $num ) {
|
||||
@ -423,14 +476,14 @@ if ($id > 0 || ! empty($ref)) {
|
||||
|
||||
// On n'affiche pas les produits personnalises
|
||||
if (! $objp->fk_product > 0) {
|
||||
$nbfreeproduct ++;
|
||||
$nbfreeproduct++;
|
||||
} else {
|
||||
$remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched
|
||||
if ($remaintodispatch < 0)
|
||||
$remaintodispatch = 0;
|
||||
|
||||
if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) {
|
||||
$nbproduct ++;
|
||||
$nbproduct++;
|
||||
|
||||
$var = ! $var;
|
||||
|
||||
@ -470,7 +523,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP))
|
||||
$up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
|
||||
|
||||
// Qty ordered
|
||||
// Qty ordered
|
||||
print '<td align="right">' . $objp->qty . '</td>';
|
||||
|
||||
// Already dispatched
|
||||
@ -538,7 +591,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
@ -546,30 +599,35 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "<br/>\n";
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
|
||||
if ($nbproduct)
|
||||
{
|
||||
$checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($commande->statuts[5]));
|
||||
$checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5]));
|
||||
|
||||
print '<br><div class="center">';
|
||||
print $langs->trans("Comment") . ' : ';
|
||||
print '<input type="text" size="60" maxlength="128" name="comment" value="';
|
||||
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $commande->ref);
|
||||
// print ' / '.$commande->ref_supplier; // Not yet available
|
||||
print '<input type="text" class="minwidth200" maxlength="128" name="comment" value="';
|
||||
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
|
||||
// print ' / '.$object->ref_supplier; // Not yet available
|
||||
print '" class="flat"><br>';
|
||||
|
||||
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
|
||||
|
||||
// print '<div class="center">';
|
||||
print '<br><input type="submit" class="button" value="' . $langs->trans("DispatchVerb") . '"';
|
||||
if (count($listwarehouses) <= 0)
|
||||
print ' disabled';
|
||||
print '>';
|
||||
// print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
if (! $nbproduct && $nbfreeproduct) {
|
||||
print $langs->trans("NoPredefinedProductToDispatch");
|
||||
|
||||
// Message if nothing to dispatch
|
||||
if (! $nbproduct) {
|
||||
if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED))
|
||||
print $langs->trans("NoPredefinedProductToDispatch"); // No predefined line at all
|
||||
else
|
||||
print $langs->trans("NoMorePredefinedProductToDispatch"); // No predefined line that remain to be dispatched.
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
@ -577,6 +635,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// List of lines already dispatched
|
||||
$sql = "SELECT p.ref, p.label,";
|
||||
$sql .= " e.rowid as warehouse_id, e.label as entrepot,";
|
||||
@ -584,7 +643,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p,";
|
||||
$sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e ON cfd.fk_entrepot = e.rowid";
|
||||
$sql .= " WHERE cfd.fk_commande = " . $commande->id;
|
||||
$sql .= " WHERE cfd.fk_commande = " . $object->id;
|
||||
$sql .= " AND cfd.fk_product = p.rowid";
|
||||
$sql .= " ORDER BY cfd.rowid ASC";
|
||||
|
||||
@ -594,10 +653,11 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$i = 0;
|
||||
|
||||
if ($num > 0) {
|
||||
print "<br/>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("ReceivingForSameOrder"));
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -666,7 +726,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
} else {
|
||||
$disabled = '';
|
||||
if ($commande->statut == 5)
|
||||
if ($object->statut == 5)
|
||||
$disabled = 1;
|
||||
if (empty($objp->status)) {
|
||||
print '<a class="button' . ($disabled ? ' buttonRefused' : '') . '" href="' . $_SERVER["PHP_SELF"] . "?id=" . $id . "&action=checkdispatchline&lineid=" . $objp->dispatchlineid . '">' . $langs->trans("Approve") . '</a>';
|
||||
@ -692,6 +752,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$db->free($resql);
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
@ -74,6 +74,7 @@ if ($object->fetch($id,$ref) < 0)
|
||||
$upload_dir = $conf->fournisseur->dir_output.'/commande/'.dol_sanitizeFileName($object->ref);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -92,6 +93,8 @@ if ($object->id > 0)
|
||||
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
|
||||
llxHeader('',$langs->trans("Order"),$help_url);
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author_id);
|
||||
|
||||
@ -108,57 +111,67 @@ if ($object->id > 0)
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Supplier order card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Fournisseur
|
||||
print '<tr><td>'.$langs->trans("Supplier")."</td>";
|
||||
print '<td colspan="2">'.$object->thirdparty->getNomUrl(1,'supplier').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $object->getLibStatut(4);
|
||||
print "</td></tr>";
|
||||
|
||||
// Date
|
||||
if ($object->methode_commande_id > 0)
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
||||
if ($object->date_commande)
|
||||
{
|
||||
print dol_print_date($object->date_commande,"dayhourtext")."\n";
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
if ($object->methode_commande)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
|
||||
}
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
// Auteur
|
||||
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
|
||||
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
$modulepart = 'commande_fournisseur';
|
||||
$permission = $user->rights->fournisseur->commande->creer;
|
||||
$permtoedit = $user->rights->fournisseur->commande->creer;
|
||||
@ -169,6 +182,7 @@ if ($object->id > 0)
|
||||
else
|
||||
{
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
@ -130,7 +130,7 @@ if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate";
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'cf.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplier"), 'checked'=>1, 'enabled'=>1),
|
||||
'cf.ref_supplier'=>array('label'=>$langs->trans("RefOrderSupplierShort"), 'checked'=>1, 'enabled'=>1),
|
||||
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1),
|
||||
'u.login'=>array('label'=>$langs->trans("AuthorRequest"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
@ -300,7 +300,7 @@ if ($search_ref) $sql .= natural_search('cf.ref', $search_ref);
|
||||
if ($search_refsupp) $sql.= natural_search("cf.ref_supplier", $search_refsupp);
|
||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_request_author) $sql.= " AND u.login LIKE '%".$db->escape($search_request_author)."%'";
|
||||
if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname','u.login'), $search_request_author) ;
|
||||
if ($billed != '' && $billed >= 0) $sql .= " AND cf.billed = ".$billed;
|
||||
|
||||
//Required triple check because statut=0 means draft filter
|
||||
@ -379,7 +379,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -503,7 +502,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cf.fk_author']['checked'])) print_liste_field_titre($arrayfields['cf.fk_author']['label'],$_SERVER["PHP_SELF"],"u.login","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cf.fk_author']['checked'])) print_liste_field_titre($arrayfields['cf.fk_author']['label'],$_SERVER["PHP_SELF"],"cf.fk_author","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cf.date_commande']['checked'])) print_liste_field_titre($arrayfields['cf.date_commande']['label'],$_SERVER["PHP_SELF"],"cf.date_commande","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'],$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['cf.total_ht']['checked'])) print_liste_field_titre($arrayfields['cf.total_ht']['label'],$_SERVER["PHP_SELF"],"cf.total_ht","",$param,'align="right"',$sortfield,$sortorder);
|
||||
@ -673,7 +672,7 @@ if ($resql)
|
||||
// Status billed
|
||||
if (! empty($arrayfields['cf.billed']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectyesno('billed', $billed, 1, 0, 1);
|
||||
print '</td>';
|
||||
}
|
||||
@ -757,7 +756,7 @@ if ($resql)
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->photo = $obj->photo;
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
@ -74,9 +74,8 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($result >= 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author_id);
|
||||
|
||||
@ -85,61 +84,63 @@ if ($id > 0 || ! empty($ref))
|
||||
$title=$langs->trans("SupplierOrder");
|
||||
dol_fiche_head($head, 'note', $title, 0, 'order');
|
||||
|
||||
// Supplier order card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Fournisseur
|
||||
print '<tr><td>'.$langs->trans("Supplier")."</td>";
|
||||
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $object->getLibStatut(4);
|
||||
print "</td></tr>";
|
||||
|
||||
// Date
|
||||
if ($object->methode_commande_id > 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
||||
if ($object->date_commande)
|
||||
{
|
||||
print dol_print_date($object->date_commande,"dayhourtext")."\n";
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
if ($object->methode_commande)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Author
|
||||
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
|
||||
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
$colwidth=20;
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
$cssclass="titlefield";
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
else
|
||||
|
||||
@ -804,6 +804,7 @@ if (empty($reshook))
|
||||
$localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
|
||||
$localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
|
||||
$remise_percent=GETPOST('remise_percent');
|
||||
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||
|
||||
// Extrafields Lines
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
@ -816,7 +817,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, 0, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units']);
|
||||
$result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, 0, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise);
|
||||
if ($result >= 0)
|
||||
{
|
||||
unset($_POST['label']);
|
||||
@ -875,6 +876,7 @@ if (empty($reshook))
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$remise_percent=GETPOST('remise_percent'.$predef);
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
|
||||
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
@ -901,7 +903,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='') // Unit price can be 0 but not ''
|
||||
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise==='') // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors');
|
||||
$error++;
|
||||
@ -917,7 +919,7 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (GETPOST('prod_entry_mode') != 'free') // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
||||
if (GETPOST('prod_entry_mode') != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
|
||||
{
|
||||
$idprod=0;
|
||||
$productsupplier=new ProductFournisseur($db);
|
||||
@ -966,7 +968,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors');
|
||||
}
|
||||
}
|
||||
else if ($price_ht !== '' || GETPOST('price_ttc') !== '') // $price_ht is already set
|
||||
else if (empty($error)) // $price_ht is already set
|
||||
{
|
||||
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
||||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
@ -992,8 +994,9 @@ if (empty($reshook))
|
||||
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
|
||||
}
|
||||
$price_base_type = 'HT';
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||
|
||||
$result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit);
|
||||
$result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise);
|
||||
}
|
||||
|
||||
//print "xx".$tva_tx; exit;
|
||||
@ -2142,10 +2145,18 @@ else
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == 0) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
@ -717,23 +717,23 @@ if (empty($action))
|
||||
|
||||
// Lines for filters fields
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="left">';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
|
||||
@ -849,25 +849,49 @@ class Holiday extends CommonObject
|
||||
* Return value of a conf parameterfor leave module
|
||||
* TODO Move this into llx_const table
|
||||
*
|
||||
* @param string $name name of parameter
|
||||
* @return string value of parameter
|
||||
* @param string $name Name of parameter
|
||||
* @param string $createifnotfound 'stringvalue'=Create entry with string value if not found. For example 'YYYYMMDDHHMMSS'.
|
||||
* @return string Value of parameter. Example: 'YYYYMMDDHHMMSS' or < 0 if error
|
||||
*/
|
||||
function getConfCP($name)
|
||||
function getConfCP($name, $createifnotfound='')
|
||||
{
|
||||
$sql = "SELECT value";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_config";
|
||||
$sql.= " WHERE name = '".$name."'";
|
||||
|
||||
dol_syslog(get_class($this).'::getConfCP name='.$name.'', LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::getConfCP name='.$name.' createifnotfound='.$createifnotfound, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
// Si pas d'erreur
|
||||
if($result) {
|
||||
|
||||
$objet = $this->db->fetch_object($result);
|
||||
// Retourne la valeur
|
||||
return $objet->value;
|
||||
|
||||
$obj = $this->db->fetch_object($result);
|
||||
// Return value
|
||||
if (empty($obj))
|
||||
{
|
||||
if ($createifnotfound)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_config(name, value)";
|
||||
$sql.= " VALUES('".$name."', '".$createifnotfound."')";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
return $createifnotfound;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $obj->value;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Erreur SQL
|
||||
@ -896,11 +920,12 @@ class Holiday extends CommonObject
|
||||
$now=dol_now();
|
||||
|
||||
$month = date('m',$now);
|
||||
|
||||
$newdateforlastupdate = dol_print_date($now, '%Y%m%d%H%M%S');
|
||||
|
||||
// Get month of last update
|
||||
$lastUpdate = $this->getConfCP('lastUpdate');
|
||||
$lastUpdate = $this->getConfCP('lastUpdate', $newdateforlastupdate);
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;exit;
|
||||
//print 'month: '.$month.' lastUpdate:'.$lastUpdate.' monthLastUpdate:'.$monthLastUpdate;exit;
|
||||
|
||||
// Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
|
||||
if ($month != $monthLastUpdate)
|
||||
@ -911,9 +936,8 @@ class Holiday extends CommonObject
|
||||
$nbUser = count($users);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
|
||||
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
|
||||
$sql.= " value = '".$newdateforlastupdate."'";
|
||||
$sql.= " WHERE name = 'lastUpdate'";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$typeleaves=$this->getTypes(1,1);
|
||||
|
||||
@ -364,7 +364,7 @@ print $form->selectarray('type', $arraytypeleaves, (GETPOST('type')?GETPOST('typ
|
||||
print '</td>';
|
||||
|
||||
// DUREE
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
// DATE DEBUT
|
||||
print '<td class="liste_titre" align="center">';
|
||||
|
||||
@ -62,6 +62,12 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
$holiday = new Holiday($db);
|
||||
$holidaystatic=new Holiday($db);
|
||||
|
||||
// Update sold
|
||||
if (! empty($conf->holiday->enabled))
|
||||
{
|
||||
$result = $holiday->updateBalance();
|
||||
}
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user